Introduction To Arduino TCRT5000 (IR Sensor)
Introduction To Arduino TCRT5000 (IR Sensor)
COM/)
THE MIND IS A TERIBLE THING TO WASTE
was talking about a way to get people a bit more involved with the Arduino community in Ottawa. After Bolt Reference Chart for Makers
a few beers, the Ottawa Arduino Challenge (http://inventorartist.com/oac/) was born. The idea was (http://blog.huntgang.com/2017/02/28/bolt-reference-
simple. Give participants a small surprise sensor or component which they must use in their project chart-makers/)
submission within 4 weeks. In order to win, it would be vote by public so you really needed to be able Fusion 360 31 Day Challenge
to share your project with the world. (http://blog.huntgang.com/2016/12/05/fusion-360-31-
day-challenge/)
C ATEGORIES
3D Design (http://blog.huntgang.com/category/3d-
design/) (2)
3D Printing (http://blog.huntgang.com/category/3d-
printing/) (8)
Arduino (http://blog.huntgang.com/category/arduino/)
(7)
What is a TCRT5000 IR Sensor?
Christmas Lights
Well, I can tell you what it isnt! And despite its looks, it unfortunately is not a Star Wars Walker!!!
(http://blog.huntgang.com/category/christmas-lights/)
However, it is an IR Emitter and an IR PhotoTransistor packaged together. The Ardiuno TCRT5000 is (3)
designed to sense the distance to an object using Infra Red light waves. It can also identify the
FPV Racing (http://blog.huntgang.com/category/fpv-
difference between white and black based on the contrast of an object and its reflective properties. racing/) (1)
Fusion 360
(http://blog.huntgang.com/category/fusion-360/) (2)
Home Theater
(http://blog.huntgang.com/category/home-theater/) (2)
Laser Cutter
(http://blog.huntgang.com/category/laser-cutter/) (10)
NL6621 (http://blog.huntgang.com/category/nl6621/)
(1)
Reference Material
(http://blog.huntgang.com/category/reference-
material/) (1)
Vixen Lights
(http://blog.huntgang.com/category/vixen-lights/) (2)
ARCHIVES
May 2017 (http://blog.huntgang.com/2017/05/) (1)
February 2017
(http://blog.huntgang.com/2017/02/) (1)
December 2016
(http://blog.huntgang.com/2016/12/) (1)
December 2014
How To Use the Arduino TCRT5000 (http://blog.huntgang.com/2014/12/) (1)
November 2014
Wiring up the TCRT5000 to an Arduino is relatively straight forward. Simply connect the Anode (A) of
(http://blog.huntgang.com/2014/11/) (2)
the IR emitter to a 100 ohm resistor which has 5V applied, then connect the Cathode (C) of the IR
Emitter to Ground (GND) on the arduino. Next you need to connect the Emitter (E) of the Photo October 2014 (http://blog.huntgang.com/2014/10/) (1)
Transistor to ground, then apply 5V to a 10,000 ohm resistor which connects to the Collector (C). July 2014 (http://blog.huntgang.com/2014/07/) (1)
Finally to measure the voltage drop produced by the transistor all we need to do is connect an analog
June 2014 (http://blog.huntgang.com/2014/06/) (2)
pin from the Arduino to the Collector (C) of the Transistor.
April 2014 (http://blog.huntgang.com/2014/04/) (2)
December 2013
(http://blog.huntgang.com/2013/12/) (1)
February 2013
(http://blog.huntgang.com/2013/02/) (1)
(http://blog.huntgang.com/wp-content/uploads/2014/06/Breadboard-Layout-TCRT50002.jpg)
1 /*
2 AnalogReadSerial
3 Reads an analog input on pin 0, prints the result to the serial monitor.
4 Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
5
6 This example code is in the public domain.
7 */
8
9 // the setup routine runs once when you press reset:
10 void setup() {
11 // initialize serial communication at 9600 bits per second:
12 Serial.begin(9600);
13 }
14
15 // the loop routine runs over and over again forever:
16 void loop() {
17 // read the input on analog pin 0:
18 int sensorValue = analogRead(A0);
19 // print out the value you read:
20 Serial.println(sensorValue);
21 delay(1);// delay in between reads for stability
22 }
DAVE
M O R E P O S T S ( H T T P : // B L O G . H U N T G A N G . C O M /A U T H O R / D A V E / )
17 COMMENTS
Pingback: Arduino TCRT5000 Distance Sensor - blog.huntgang.com
(http://blog.huntgang.com/2014/06/17/arduino-tcrt5000-distance-sensor/)
Pingback: Electronic 1 | www.snellathomas.wordpress.com
(http://snellathomas.wordpress.com/2014/09/27/electronic-1/)
Hi! Great post! Could you tell me how to increase measure distance?
Hello,
Do you know how this TCRT5000 would compare with a H21B1 Photodarlington Optical Interrupter
Switch (cut in the middle with the two parts glued side by side) ?
regards.
REPLY (HTTP://BLOG.HUNTGANG.COM/2014/06/17/ARDUINO-TCRT5000-BUILD-IR-SENSOR/?REPLYTOCOM=3165#RESPOND)
February 22, 2016 (http://blog.huntgang.com/2014/06/17/arduino-tcrt5000-build-ir-
sensor/#comment-3165)
DAVE
Certainly, Darcy worked on this at one point and shared some of his work here
http://inventorartist.com/blink-detector/ (http://inventorartist.com/blink-detector/)
Can you explain why should you use 10k and 100 ohms resistors?
Cheers for this used it to build the sensor into a Lego brick. :o)
@IDUL The 100 ohm resistor lets the LED run at 50 mA which is 10 mA under the maximum, so it
running bright but within safe limits. Look up V=IR. The 10k ohm resistor is chosen to be in a useful
range for the transistor to be in active mode. Look up NPN transistor and phototransistor. From the
datasheet for this device, a 0.5 mA collector current (switch closed) corresponds to 5V collector-
emitter voltage when LED is running at 50 mA and a reflecting surface is right up close. Vcc (5V) with a
10k resistor yields a 0.5 mA max current through the phototransistor. The intensity of reflected light will
then produce values of between 5V (no light) and 0.2V (full light) for the voltage between collector and
emitter (and your Arduino analog pin is connected to measure this). It will yield digital values of to 1023.
My understanding is that you cant get true zero Vce due to current coming from the base (in this case
generated by the photo thingy) but I cant elaborate further as its beyond the scope of my knowledge.
The previous post needs an edit. If the moderator (hello dave?) can simply delete it, that would be
appreciated.
February REPLY (HTTP://BLOG.HUNTGANG.COM/2014/06/17/ARDUINO-TCRT5000-BUILD-IR-SENSOR/?REPLYTOCOM=5363#RESPOND)
18, 2017 (http://blog.huntgang.com/2014/06/17/arduino-tcrt5000-build-ir-sensor/#comment-5363)
JOSEPH
I would like to ask if we can use tcrt5000 to detect a fluid drop. Thanks.
REPLY (HTTP://BLOG.HUNTGANG.COM/2014/06/17/ARDUINO-TCRT5000-BUILD-IR-SENSOR/?REPLYTOCOM=5388#RESPOND)
February 21, 2017 (http://blog.huntgang.com/2014/06/17/arduino-tcrt5000-build-ir-
sensor/#comment-5388)
DAVE
How do the TCRT5000 and CNY70 sensors compare when used for rotary encoder wheels?
What would change in the code for the TCRT5000 to detect lines and avoid them
Can i use this code and connection , and how? , so when the TRCT5000 detects something a little
engine starts working ?
LEAVE A REPLY
Your email address will not be published. Required fields are marked *
COMMENT
NAME *
EMAIL *
WEBSITE
POST COMMENT