This is the Line Tracking Sensor designed for line following robots. The board has two main components IR Transmitter and IR Receiver in one package named TCRT5000. The TCRT5000 are reflective sensors which include an infrared emitter and photo-transistor in a leaded package which blocks visible light. The package included two mounting clips. As you look at the board you can see a Potentiometer or Trimmer which used to adjust the sensitivity of the sensor.
Required Components
- UNO / MEGA / NANO / PRO / DUE / RPI / ESP8266 / STM
- TCRT5000 Line Following Sensor Module Board
- LED 5mm or 3mm
- 220 Ohms Resistor
- Solder Less Bread Board
- Jumper Wires / DuPont Wires
Wiring Guide
Sketch Code for Digital Output
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
/* 14CORE Test Code for: Line following sensor .:+osysso++:` `+yhs/-` `-+s+` `:/+++++++++` .:/++ooo++/-` .ooooooooooo+: :///////////- `odh/` `:y+` /ddhsooooooo+ /hddhsooooydddh sdddoooooosdddy` `////////////` -hds` `sy. +ddy` .ddd: sddy.dddo +ddd- .-----------` `hds :sssss/ -ossssso-yy` `hdd: oddy `ddd/oddd:......+dddo .++++++++++++ +dd` :sdddh` :ydddddddo +y/ .ddd+........ `hddy:.....:yddy.hdddddddddddy+. ```````````` ydy .hddd/+hdddhydddh/.+yo /hdddddddddd. :shddddddddhs/`+ddd:````-yddy- :ooooooooooo+ odh` sdddooyyyyyhddddyy.sy+ ` `......... ``.... ....` ```...` ` `` `` ` -dd+`::::` .:::- /yy. -oos+:-oos+--oos+: /o `+y o/: o:+/ h:`yos /+-`/+/+ s:y/y. /dd/ `+yy: +//+ +/:+ +/:+ -. `/ -:o.:/:`//+- + +:- :`-+:`://: +`o`+. -yds. `/yys- .`-.. .``` ```` .`` ` ` ``` ``-..` ` :ydy/.`````.-/oyhs: `+++oo+oo+:.+-++/-/ooo+o +:o/oo///:+/ .:oyhhhhhhhso:` `. ``` */ int LedOutput = 12;// Define as LED Output Pin 12 you can change this to 13 if you dont what pin 12 as output indictor int SensorPin = 2; // Define as Sensor Pin Input int Value;// Define as variable void setup() { pinMode(LedOutput,OUTPUT);//Set as LED output pinMode(SensorPin,INPUT);//Set as photo interrupter sensor output interface } void loop() { Value=digitalRead(SensorPin);// Set as sensor read SensorPin if(Value==HIGH) //If value is equal to HIGH estate then turn LED output = high { digitalWrite(LedOutput,HIGH); // Set ledoutput to HIGH or ON } else { digitalWrite(LedOutput,LOW); // Set landoutput to LOW or OFF } } |
Sketch Code for Analog Output
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
/* 14CORE Test Code for: Line Following Sensor .:+osysso++:` `+yhs/-` `-+s+` `:/+++++++++` .:/++ooo++/-` .ooooooooooo+: :///////////- `odh/` `:y+` /ddhsooooooo+ /hddhsooooydddh sdddoooooosdddy` `////////////` -hds` `sy. +ddy` .ddd: sddy.dddo +ddd- .-----------` `hds :sssss/ -ossssso-yy` `hdd: oddy `ddd/oddd:......+dddo .++++++++++++ +dd` :sdddh` :ydddddddo +y/ .ddd+........ `hddy:.....:yddy.hdddddddddddy+. ```````````` ydy .hddd/+hdddhydddh/.+yo /hdddddddddd. :shddddddddhs/`+ddd:````-yddy- :ooooooooooo+ odh` sdddooyyyyyhddddyy.sy+ ` `......... ``.... ....` ```...` ` `` `` ` -dd+`::::` .:::- /yy. -oos+:-oos+--oos+: /o `+y o/: o:+/ h:`yos /+-`/+/+ s:y/y. /dd/ `+yy: +//+ +/:+ +/:+ -. `/ -:o.:/:`//+- + +:- :`-+:`://: +`o`+. -yds. `/yys- .`-.. .``` ```` .`` ` ` ``` ``-..` ` :ydy/.`````.-/oyhs: `+++oo+oo+:.+-++/-/ooo+o +:o/oo///:+/ .:oyhhhhhhhso:` `. ``` */ int AnalogSensorPin = A0; // Define as Analog Input Signal from the Sensor int LedOutIndicator = 12; // Define as Output indicator (Optional) int Value = 0; // variable to store the value from the sensor void setup () { pinMode (LedOutIndicator, OUTPUT); Serial.begin (9600); // Start Serial Communication } void loop () { Value = analogRead (AnalogSensorPin); digitalWrite (LedOutIndicator, HIGH); delay (Value); digitalWrite (LedOutIndicator, LOW); delay (Value); Serial.println (Value, DEC); } |
Downloads
Download the TCRT5000 Datasheet Here | PDF
Wiring the TCRT5000 Reflective Optical Sensor Module