Played with a TCRT5000 sensor today. When I last tried these cheap little sensors I found out that they are very sensitive to ambient light. I always test my electronics on a breadboard, about a meter above it hangs a 40W halogen lamp. I got very different results when I turned of the lamp. So I decided to have a closer look into this and try do an analogread on the sensor. That way I have a better idea on how the sensor behaves. I hooked up the TCRT5000 sensor like in the drawing above. You only need 2 resistors, a 100 Ohm and a 4K7 Ohm.
I wrote a sketch see what’s going. In this sketch I divide the analogread from the sensor and use that to pwm a led. When the sensor detects nothing the led lights up. When there is an object very close to the sensor the led dims. I can also read the analog reading of the serial monitor. This sensor is ideal to use for a line following robot. I originally thought about using it as an object detection sensor. But it is not suitable for this. It only detects object that are really close to the sensor.
Here is the sketch:
/* http://www.bajdi.com Analog reading of TCRT5000 sensor connected to Arduino Uno TCRT5000 pins: (see datasheet http://www.vishay.com/docs/83760/tcrt5000.pdf ) C = Arduino analog pin A0 and to one end of 4K7 resistor, other end of resistor to 5V E = GND A = 100 ohm resistor, other end of resistor to 5V C = GND */ const int led = 11; // the number of the LED pin int tcrt; void setup() { Serial.begin(9600); pinMode(led, OUTPUT); } void loop(){ tcrt = analogRead(A0); Serial.println(tcrt); analogWrite(led, tcrt/4); }
I would suggest connecting the sensor’s LED to an output pin. Then the program should toggle the LED and measure the difference in the value of the light when on and off, thus eliminating some of the environment effect.
That’s not a bad idea 🙂
You could also increase the detection range by pulsing the IR LED at a higher current using a transistor.
Do you have your code posted anywhere? Interested to know if you’ve made some improvements. I just bought one of these and want to do some cool stuff with it.
I made a line following robot with TCRT5000 sensors. http://www.bajdi.com/category/line-following-robot/
[…] http://www.bajdi.com/analogread-from-a-tcrt5000-sensor/ […]
[…] measurable parameter. I dremelled out a hole for the sensor and hooked it up the arduino using the analog read example. Disappointingly, it worked but not quite as […]
Is it possible to use the TCRT5000 sensor to read IR-TV-Remote codes (HEX)?-Like a Universal Remote kind of application. Would it be able to read IR codes?
Buy an IR receiver like the TSOP series for that purpose.
There is a module that contains tcrt5000
does it work the same as this schematic?
can it read analog too?
I have no idea what you are trying to do. Best you read the datasheet of the sensors. Big difference between a TCRT5000 and a TSOP IR receiver. The TSOP can only receive IR signals. The TCRT has an IR led + IR receiver. But I don’t think the IR receiver in the TCRT is capable of receiving IR signals from a remote (different IR light spectrum).
[…] inventorArtist Related Hacker.instanet.net • View topic – TCRT5000 IR Sensor Analogread from a TCRT5000 sensor | Bajdi.com موفق باشید […]