I had an infrared 38khz sensor that I used to read my TV remote control commands. It worked fine but I burned it. I had not another 38khz IR sensor so I tried to use my infrared reflective optic sensor like the one below:

enter image description here

I press my TV remote control button and when I try to read the HIGHs and LOWs it does not work. The sensor shows in my Serial that it received the infrared light but it does not sense the lows/high.

As far as I know, this sensor is not 38khz, it listens in all frequencies that are infrared. So why it does not work? It should work cause it listens in all frequencies. Why it can detect the HIGHs/LOWs that the remote control sends?

  • Just get one out of an old VCR or other electronic device. Manually detecting the 38kHz carrying frequency and filtering out ambient noise is a pain.
    – Gerben
    Dec 3, 2014 at 16:47

1 Answer 1


You didn't post the code that used to work with the standard 38Khz IR sensor, but I believe you used digitalRead to determine a HIGH or LOW value, by thus determine if there is an IR emitting in place.

The reflective optic sensor works differently, the output is analog, and changes according to the amount of IR light it sens. In addition, it has a built-in IR led next to the IR sensor, so if you want to use this as the IR detection sensor you had, first you need to disable the IR led to prevent interference.

The second step would be to use analogRead, and compare the result to a pre-defined threshold. For example, since analogRead returns result in the range of 0...1023, you can treat everything from, say, 512 and above as logic 'HIGH'. If you are working with libraries that detects the IR signal, you will need to alter them accordingly.

  • digitalRead works perfectly. I use it with TCRT1000, but external light like sun or luminescent lamp can interfere.
    – Martynas
    Dec 3, 2014 at 15:19
  • Good to know. I always used it along with analogRead. It kind of make sense when I think about it, since the MCU might interpret top half values as digital HIGH.
    – Omer
    Dec 3, 2014 at 17:42
  • I didnt use digitalRead cause people say it's slow. I used -->> while (irSensor_PIN & (1 << pino_sensor_infravermelho)) { <<--. I think my TCRT1000 is with problem. I will buy another one cause Martynas said it is gonna work. NOTE: I disabled the infrared LED emitter from the component, of course :)
    – Samul
    Dec 3, 2014 at 18:16
  • Samul :)))) You made my day. Because i said it won't work perfectly. As i said, the sun and other light will interfere. The voltage may rise that MCU will think its 1. You would probable easier get simple IR sensor :) and it would be more reliable. Something like this adafruit.com/product/157
    – Martynas
    Dec 3, 2014 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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