Adding IR Sensor Module to Raspberry Pi Robot – Part1

IR-Sensor-Module

We are in part 2 of tutorial series of Building Raspberry Pi Line Follower Robot! If you want to jump back and forth or missed any of my previous tutorials – here is the consolidated list.

All Tutorials to build line follower Pi Robot:

  1. Build Line follower using Raspberry Pi
  2. Adding IR Sensor Module to Raspberry Pi Robot
  3. Programming Line Follower Raspberry Pi Robot with Python
  4. Final Line Follower Raspberry Pi robot in Action

If you want to see all my Raspberry Pi Robotics tutorials do visit this page – http://www.vishalavalani.com/robotics-tutorials/

IR Line Tracker Module basics

In this tutorial we are using module LINE TRACKER MODULE BASED ON TCRT5000L It Adopts TCRT5000 photoelectric sensor and comparator which is easy to use with good stability and anti-interference ability. Perfect for black & white line detection for smart car. Black line for low level output and white line for high level output. The Operating Voltage is 5V. Tested range of 2cms-9cms.

Pinouts

There are 4 pins but we are going to use just 3 pins here. Two are very easy to understand – 5 V and Gnd. 3rd one is for the Output named DO by Robokits. It might be different name by other vendor.

Connecting IR modules to Raspberry Pi

  • First thing is that 5V output pins are already used up by Pi for other sensors and purpose. Hence, we are going to power sensor directly from Adata powerbank that we are using. We are going to create a line in breadboard so that we can use it for powering multiple sensors and don’t need any further converters. It will be used for powering both the IR Modules.
  • Other issue that we have is that the output of the sensor is going to be 5V. But, as we know Raspberry Pi is just capable of handling 3.3V input. Hence, we have to step down the voltage. We are going to use voltage divider circuit which we created in this tutorial
  • Voltage divider circuit will look like this – I use breadboard for connections:
  • We will use the output generated from the voltage divider circuit to Raspberry Pi Pins – 31 and 32.

Entire circuit diagram of above explanation is shown below:

Calibration

This IR sensor is affected by ambient light. There is a variable resistor present on top of the module to calibrate the sensor as per light. We have to test by creating a black line and rotating the screw using screw driver till black line gets detected meaning – output will be 5 V. When normal surface is detected output will be 0V. As shown in below figure, rotate the screw and check output using multimeter or hooking up LED light for testing. We also have output light in module so we can use it for testing.

Once, we have above setup ready – we are all set for programming line follower robot 🙂

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *