How do I send signals from a 38 kHz Vishay's TSOP series IR receivers to an Arduino and make the Arduino act accordingly(eg. move a motor)?
-
Do you want to receive/decode remote control commands or is this on/off as in obstacle detection? – stevenvh Nov 28 '10 at 08:26
-
It's on/off as in obstacle detection. – gomek Nov 29 '10 at 03:27
-
I just realized that you also asked this question: http://electronics.stackexchange.com/questions/7208/using-38-khz-ir-receivers-to-measure-distance I guess my answer doesn't really help here. Apologies. – mjcarroll Nov 29 '10 at 06:47
2 Answers
The IR receiver will output a high or low level depending on the presence/absence of the 38kHz carrier in the received IR signal. The scope screenshot shows what that looks like in a typical remote control signal. The top trace shows the signal as seen by the IR-photodiode, the first component in the receiver chain. You can see intermittent bursts of the 38kHz carrier. After this signal is demodulated the pulses of the RC command (in this example RC5) show up, see bottom trace.
Now this is when you send data pulses like a remote control would. You will send the 38kHz signal continuously, so the receiver will see the carrier continuously, or not at all. In the former case the output of the receiver will be high, otherwise low. You just connect this signal to an input pin of the Arduino and test the level. A high level would mean an obstacle reflects the transmitted signal to the receiver, a low level means the way is clear.
(The scope screenshot was taken from my webpage on RC5)

- 145,145
- 21
- 455
- 667
While there isn't an Arduino library available for this type of sensor, there are a few resources that you may find useful.
You can buy the sensor from SparkFun along with a breakout board. Keep in mind that these are very small, and you'll have to be careful when hand-soldering them.
As far as the software aspect, there is a project on tinkerish.com that has some AVR code (the chip that the Arduino is based on) for using the interrupt pin when receiving data from the IR receiver. In the example, he is using the INT1 external interrupt on the Arduino to receive the data, and processing the data in an interrupt included in his main.c file.
You should be able to duplicate this functionality using the Arduino software.
There is also a second project in pure Arduino, here. This example is using the hardware serial port on the Arduino to grab data off of the IR signal, and is unpacking the data in the getRC5Key function.

- 1,974
- 10
- 16