Black/White Infrared tracking sensor can sense black/white and send the color as 1/0 digital data to computer. This kind of tracking sensor plays a key role in may robot car line tracking project.

In this lesson, we will teach you how to use tracking sensor to send black/white signal to Raspberry Pi and display the result in raspberry Pi terminal.

Circuit Graph:

connection table

Tracking SensorRaspberry Pi

VCC 3v
GND GND
D0 GPIO5

Testing:
Step 1: Run following command download and install python code:

wget http://osoyoo.com/driver/testsensor.py

python testsensor.py

Result:

After running the code, put the sensor above a white background, the color LED will ON and the terminal screen will show “white detected!”.
Now put the sensor onto black ground or simply put it far away from white background, LED will OFF and terminal screen will show “Black detected!”.