Interface single and Dual IR Infrared sensor with PIC18F4550 and LCD

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

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