Interface single and Dual IR Infrared sensor with PIC18F4550 and LCD

Summary of Interface single and Dual IR Infrared sensor with PIC18F4550 and LCD


This tutorial shows how to interface single and dual infrared (IR) proximity sensor modules with an Arduino Uno, first using an LED indicator and then displaying both sensors’ statuses on a JHD162A 4x16 LCD. It reuses a low-cost IR sensor module with three pins (VCC, GND, control) and explains wiring, pin assignments (example: sensor to Arduino pin 9, LED on pin 13), and that Arduino can be USB-powered during testing.

Parts used in the Infrared IR Sensor with Arduino Tutorial:

  • Arduino Uno development board
  • Infrared IR sensor module (3-pin: VCC, GND, control)
  • JHD162A 4X16 LCD
  • LED (external indicator, optional)
  • Resistors
  • USB cable (for Arduino power and connection)
  • Wires/jumper cables
  • Two identical IR sensor modules (for dual-sensor chapters)

In this another tutorial on sensors  for beginners, we are going to interface single and multiple Infrared IR sensors with Arduino Uno development board, working simultaneously and have the status displayed either on an ( 4X16 LCD ) LCD module (jhd162a) or an LED. We are going to cover three chapters in single tutorial in simple step by step fashion. The purpose of this tutorial is to serve the basics for beginners with Sensor interface on Arduino for being able to use these concepts and to develop various other sensor based applications (robotics, Automation Projects etc.). We will use the same Object Detection Proximity IR Sensor Module that we made in our precedent tutorial. In our previous Proximity Sensor tutorials we have learned how to interface IR sensor with various other microcontrollers such as PIC18F4550 and 18F2550; However, today we are going to learn how to interface the same infrared sensor with the famous Arduino Uno board.Interface single and Dual IR Infrared sensor with Arduino and LCD

To begin easy, first we are going to interface a Single IR sensor for sensing the distance and read the value of the sensor using an Arduino board and have status displayed on a LED. On the next level we are going to do same with two IR sensors working simultaneously. At last we will interface (add) an LCD (Liquid Crystal Display) and have the status of both the Infrared sensors displayed on a 4X16 LCD Display unit. The Concepts for Reading the IR sensor is still same as explained in previous lessons, the only difference is the Arduino board.

Tutorials

Requirements

– PIC18F4550
– Infrared IR sensor Module
– JHD162a 4X16 LCD
– Resistors
– LEDS

Infrared IR Sensor Module

We will use the IR Infrared Sensor Circuit module that we made in our previous project, which is an inexpensive (Low Cost)  sensor circuit module. You can find the schematic and PCB design in my previous post. There are three pins in the Schematic – Two pins for providing the input voltage and GND, and the third pin from the IR module is the IR control pin. This Control Pin from the IR sensor Module will be interfaced to the Arduino for reading the value from sensor. We will use two identical copies of the sensor for our tutorial.

Single Infrared IR Sensor Interface to PIC18F4550Microcontroller

Chapter1

As mentioned before we are going to start easy,hence here we going to interface just one infrared sensor circuit with Arduino, the source code is pretty much self-explanatory. Like every microcontroller, we need to define pins either as input or output. We have configured Pin 13 as output, and pin 9 as input for taking input from sensor. The Result of sensor will reflect on the LED connected on pin13 which is configured as output. The source code can be tweaked easily to display the result on serial monitor too.

We are going to leave pin 0 to Pin 7 on Arduino Uno untouched for using it with LCD operation in future. Make the Circuit ready according to the schematics below to proceed further. Arduino will draw power from USB hence there is no need to interface external power supply as long as the board is connected with USB cable.Interface single and Dual IR Infrared sensor with Arduino and LCD schematich

Schematic (Single Sensor Interface)

USE and GND and +5V pins on the arduino to power the IR sensors. Make the necessary wiring acording to the schamatic given below.

NOTE: The operation is quiet similar to that of interfacing a simple switch to Arduino or any microcontroller, But here you don’t need to ground the input pin (pull-down) with a resister. In Arduino pin13 by default is interfaced with an Onboard led for displaying status. We can use that one onboard led or you can interface an Extra led on Pin 13 to have the Status displayed.

 

 

 

For more detail: Interface single and Dual IR Infrared sensor with PIC18F4550 and LCD

Quick Solutions to Questions related to Infrared IR Sensor with Arduino Tutorial:

  • How do I power the IR sensor module?
    Use the Arduino 5V and GND pins; Arduino can be powered via USB so no external supply is needed while connected to USB.
  • Which Arduino pins are used in the single sensor example?
    Pin 9 is used as input from the IR sensor and pin 13 is configured as output for the LED status.
  • Do I need a pull-down resistor for the sensor input pin?
    No, the tutorial notes you do not need to ground the input pin with a pull-down resistor for this IR module.
  • Can I use the onboard LED instead of an external LED?
    Yes, pin 13 is connected to an onboard LED you can use to display status instead of adding an extra LED.
  • How many pins does the IR sensor module have and what are they?
    The IR module has three pins: VCC (power), GND, and a control output pin to interface to the Arduino.
  • Will connecting the LCD affect initial sensor pins 0 to 7?
    The tutorial leaves Arduino pins 0 to 7 untouched for future LCD operation, so plan wiring accordingly.
  • Can I read sensor values on the serial monitor?
    Yes, the source code can be tweaked to display results on the serial monitor.
  • How do I expand from single to dual sensor setup?
    Use two identical IR modules and wire each control pin to separate Arduino input pins so both work simultaneously.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter