Lesson 34 Tracking Sensor

Share for us
Share on facebook
Share on twitter
Share on pinterest
Share on whatsapp

Lesson 34 Tracking Sensor

Introduction

The infrared tracking sensor uses a TRT5000 sensor. The blue LED of TRT5000 is the emission tube and after electrified it emits infrared light invisible to human eye. The black part of the sensor is for receiving; the resistance of the resistor inside changes with the infrared light received.

Required Components

 1 * Raspberry Pi

– 1 * Breadboard

– 1 * Tracking sensor module

– 1 * 3-Pin anti-reverse cable

Experimental Principle

When the infrared transmitter emits rays to a piece of paper, if the rays shine on a white surface, they will be reflected and received by the receiver, and pin SIG will output low level; If the rays encounter black lines, they will be absorbed, thus the receiver gets nothing, and pin SIG will output high level. The schematic diagram of the module is as shown below:

Experimental Procedures

Step 1: Build the circuit.

Raspberry PiGPIO Extension BoardTracking Sensor Module
GPIO0GPIO17SIG
3.3V3V3VCC
GNDGNDGND

For C Users:

Step 2: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/C/34_tracking/

Step 3: Compile.

    gcc tracking.c -lwiringPi

Step 4: Run.

    sudo ./a.out

For Python Users:

Step 2: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/Python/

Step 3: Run.

    sudo python3 34_tracking.py

When the tracking sensor encounters black lines, a string “Black Line is detected” will be printed on the screen.