I purchased an IR receiver (Vishay part #TSOP38238) and am having a hard time using it. I’ve studied the datasheet and can’t figure out how to integrate with an Arduino. I want the Arduino to act as the “Emitter.” I can’t figure out Pulse Code Modulation. I don’t know how to generate a 38kHz carrier, and integrate a pulse train that the receiver can react to. I don’t want to “hack” an existing OEM remote control. I want to make my own. Thus, I don’t need or want to copy an existing “protocol.” Is there an easy way to make the receiver react to 4 different presses of a button?
Thanks for any and all help…
I’ve done this, as have many others. On Avrfreaks.net, project section, lookup this topic, and RC5 projects.
The code “TWIRP” is there, years old, as are other codes.
Essentially, I used a timer in the AVR chip which can toggle an I/O bit each time the counter overflows. This bit becomes a 38KHz square wave. Now the firmware code simply turns the timer on and off for x milliseconds to create serial bits prefixed by a long start bit, as does RC5. A bit time is about 1mSec. During this time, there is a presence or absence of 38KHz according to the bit coding. Commonly, the serial bit stream is Manchester coded to keep the ratio of 1’s and 0’s constant. Sounds complex, but the code is simple. You don’t need the AVR doing the carrier itself at 38KHz, just the bit stream which is about 1Kbps. The I/O bit for the carrier goes to a transistor buffer then to an IR diode.
Thank-you for sharing! The information is outstanding, and exactly what I was looking for…
Joe
There’s a really nice library on the site below for IR remotes. He makes it possible to receive messages using a normal IR LED. I think it’s even possible to transmit using the same LED. I plan on using this lib to make my universal remote someday when I have time. I just want to pool all three of my remotes into one remote by recording the signals that I need from each of the three remotes.
http://www.arcfn.com/2009/08/multi-prot … brary.html
Denis.
@brainwav-there isn’t an LED as an receiver on that site.
…"How to receive
IRrecv uses an infrared detector connected to any digital input pin. "…
receiving IR with a bare IR rather than an IR receiver module (cheap), is the hard way, and will have these disadvantages vs. use of a receiver module:
-
very short range, like 10 ft. due to absence of bandpass filter
-
more complex software/firmware due to lack of modulated carrier
-
quite vulnerable to noise from sunlight and other IR sources
another-dave: Oops, sorry, my bad. I thought they did.
After what seemed like endless research, I found 2 great application notes at Atmel’s website for using the microcontroller as a transmitter and receiver for IR applications. You have to wade through what seems like almost 100 datasheets/app notes, but here is a link:
http://www.atmel.com/dyn/products/produ … rt_id=3303
The 2 app notes are titled “RC5 IR Remote Control Receiver on tinyAVR and megaAVR devices” and “RC5 IR Remote Control Transmitter on tinyAVR and megaAVR devices.”
They are located almost 2/3 down the page.
I hope this info helps people as much as it helped me…