0

I am somewhat experienced with Raspberry Pi, but I just got a set of IR receivers and emitters that I can't find a good tutorial for. The receiver I'm having troubles with is the VS 1838B receiver, I figured out the emitter well enough. I want to use this on a pair of rc tanks that can interact with each other, but I can't find a good tutorial for receiving my own frequency. The only frequency I really need to receive is the 'you got shot' frequency, so is there a way just to get yes or no from the emitter, and have the code say something like;

if ir_detected == yes:
  take damage

or maybe, if I can't get Yes/No

if ir not == 0:
  take damage

But I would still need a way to get data from the sensor back into the python script, and all I could find list the data in the terminal, which doesn't help much. Let me know if you find anything on this or have any solutions.

1

1 Answer 1

1

IR receivers have quite bad selectivity w.r.t modulation frequency. For instance, VS1838B may receive anything within the range of 38±5 kHz, and even signals outside of this range if they are strong enough.

You may get away with some sort of optical filter which will make the sensor only react on direct IR light and ignore reflections. Perhaps a few layers of semi-translucent sticky tape will do. Then you put a shield between the receiver and the IR LED to make a unit ignore its own signal.

Reading the sensor in Python is no different to reading a switch via a GPIO pin. A 20K pullup resistor is recommended.

Your Answer

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