3
\$\begingroup\$

I am working on a project that uses a TCRT5000 reflective optical sensor.

Sensor datasheet is here

test circuit

I tested this sensor in a room, the voltage at the output pin is high it is above 2.5V. While showing my hands, this voltage is reduces to below 1V.

When I tested this sensor in daylight, without any obstacles the voltage is below 500mV.

  • Is there an error in testing?
  • Does the daylight affect the sensor reading?
  • How can I use this sensor in both indoor and outdoor applications?
\$\endgroup\$
  • \$\begingroup\$ This sensor characteristic is very nonlinear and therefore hard to calibrate. In case you just want a digital High/Low reading, get a module with an op-amp ADC: "TCRT500 IR Reflection Module - US$1": nl.aliexpress.com/item/…. Or read my answer below. \$\endgroup\$ – tlfong01 Aug 7 at 10:01
4
\$\begingroup\$

"Daylight" is full of various wavelengths of light, including infrared.

In daylight, your sensor will "see" infrared from the mishmash that is sunlight, and react the same as if it were seeing the reflected infrared from its emitter.

To make things worse, the detector can also "see" normal light as well as infrared. It has a filter (the lenses of detector and emitter are dark colored, that's the filter) to reduce the amount of visible light that the detector sees. Daylight is bright, though, so enough daylight can get in to make the situation worse.

The sensor can't tell daylight from the emitted infrared.

You have to make the emitted infrared "look" different from daylight.

The usual way to do this is to power the emitter in pulses, then look for the pulses in the detector.

There are infrared detectors that look for the typical 38kHz pulses used in infrared remote controls (like TVs have.) These detectors output a digital low when they see a 38kHz infrared signal, and a high when no 38kHz is visible.

The simplest thing to do would be to get a module that includes a pulsed emitter and a 38kHz detector. Pololu makes such a module, or you can build your own.

To build your own,the easiest path would be to generate the 38kHz pulse signal from the microcontroller that's probably already part of your project already. Use that (through a transistor) to drive the infrared LED.

If you don't have a microcontroller in your project, then you can use a simple oscillator like the Polulu module does. A 555 or other oscillator at 38kHz and a transistor is all it takes to drive the emitter.

Use something like the Vishay TSSP58038 IR to detect reflections.

There are many parts available for both the emitter and detector. The ones I've named arw just the first examples that Google coughed up.


There's nothing that says you can't select your own pulse frequency and design an emitter and demodulator that will work with your current sensor. It is just much easier to latch on to existing components.

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ Yes, toggling the LED on/off is the proper approach in daylight. Even so, phototransistor must be biased in its linear region (higher than 500mV, which is likely in saturation region). In daylight, the R2 10k resistor should be made smaller. \$\endgroup\$ – glen_geek Aug 7 at 11:50
1
\$\begingroup\$

Question

How come it is so hard to calibrate the TCRT5000 IR reflective sensor?


Answer

Part A - Using an 1-bit ADC op-amp comparator to do the calibration

TCRT5000 is hard to calibrate unless:

(1) You read the datasheet very carefully, or

(2) You cheat by getting a module with an analog to digital op-amp.

You might find References 7 ~ 10 of my answer to the following question helpful.

What are the two sensors doing in the automatic bread production line? [closed]

Note - The above question is now closed and I am not sure if it might also be deleted later. In case you cannot read my answer, please let me know and I can move over my answer here.


Part B - Using MCP3008 10-bit ADC to calibrate the distance of the reflected object

ProtoSupplies's TCRT5000 evaluation report says the following:

initial detection can occur at up to about 6” with a fairly reflective surface with the signal rising to near 5V (full detection) at around 1”

So if you wish to also measure the distance of the reflected object, you can use the Arduino's analog input pin to get reflected signal and calculate the distance. If you are using Raspberry Pi (without any analog pins), I would recommend the common MCP3008 to do the ADC.

MCP3008 is a bit tricky for newbies to use. You can read my answer to the following question for some setting up and troubleshooting tips. If case you are new to Rpi python, I am happy to provide a fully debugged program and design notes on calibrating MCP3008.

MCP3008 ADC Troubleshooting Notes - tlfong01, EE SE, 2020aug07

/ to continue, ...


References

(1) TCRT5000 IR Reflective Sensor Module - AliExpress US$1

(2) Op-am Comparator - Electronics Tutorials

(3) TCRT5000 IR Reflective Optical Sensor Module (approx 1″ detection range) - ProtoSupplies, US$1

(4) LM324 Single Supply Quad Op-amp Datasheet - Fairchild

/ to continue, ...


Appendices

Appendix A - TCRT5000 Module Schemetic

tcrt5000 schematic


Appendix B - Op-amp Comparator

op amp comparator


LM324 Single Supply Quad Op-amp Datasheet - Fairchild

lm324 comparator


Appendix C ProtoSupplies's TCRT500 Evaluation Results

TCRT5000 IR Reflective Optical Sensor (approx 1″ detection range) - ProtoSupplies, US$1

To use the sensor in a minimum configuration requires two current limiting resistors, one for the IR emitter and one for the IR receiver.TCRT5000 Refective IR Sensor Schematic

The maximum constant current through the IR emitter LED is 60mA and it has a forward voltage drop of 1.2V to 1.4V across it. In the example here, a 150 ohm resistor is used to limit current to 25mA through the emitter with an operating voltage of 5V.

The maximum current through the receiver phototransistor is 100mA. We are using a 4.7K resistor to limit the current to about 1mA since we are just looking for a logic output.

With the sensor wired up as shown here, the output will normally sit near ground due to the pull-down resistor. When a reflective surface is brought near to the sensor in order to reflect the IR light back toward the phototransistor, it will start to conduct and the voltage output will begin to rise towards 5V.

Typical circuit with an adjustable gain control

The output can be treated as an analog output and monitored with an analog input on the MCU.

In this case, the output voltage gives some indication of the distance of the object from the sensor. Depending on the reflectivity of the surface, initial detection can occur at up to about 6” with a fairly reflective surface with the signal rising to near 5V (full detection) at around 1”.

When the output is treated as a digital signal, the detection range is generally kept under 1”.

The housing has two snap in ears for mounting in a circuit board. These can be easily cut-off if desired for use in breadboards.

/ to continue, ...


| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ What's an analog to digital op-amp? \$\endgroup\$ – Andy aka Aug 7 at 12:14
  • \$\begingroup\$ @Andy aka, Ah, just a short name for op-amp comparator, which is an 1 bit ADC. (Thank you for reminding me of those of my old happy days in Fairchild Semi, testing uA723, an op-amp comparator, beside 709, 741, ...) \$\endgroup\$ – tlfong01 Aug 7 at 14:20
  • 1
    \$\begingroup\$ By my count, "analog to digital op-amp" is a longer phrase than "comparator," which kind of mangles the idea of a "short name for." \$\endgroup\$ – JRE Oct 1 at 13:43
  • \$\begingroup\$ JRE, Ah, let me, see if I can remember why I said that. (1) I agree with you that "analog to digital op-amp" is 4 words, and "op-amp comparator" three words". So I was wrong to say that 4 words is longer than 3 words.I confess that I made an obvious careless counting mistake. My apologies to all those confused by my mistake. (2) I do remember the naming of the op amp circuit, because it is a special case of ADC. Usually ADC is usually at least 8 bits, so it is laughable to say that I have an ADC with one bit resolution. / to continue, ... \$\endgroup\$ – tlfong01 Oct 1 at 14:30
  • \$\begingroup\$ I remember I did find it funny which I read the reference saying this, when explaining the cct. Just now I read my answer, and I surprisingly found that you also gave an answer. I confess that I did not read carefully your answer, and if your answer is different from mine, or indicates that my answer is wrong or misleading. \$\endgroup\$ – tlfong01 Oct 1 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.