View Full Version : IR data recording

05-23-2005, 12:41 AM
Hello all.
Just starteed the whole Stamp thing, so please bear with me!
I am trying to determine whether it is possible to get my BS2p40 to recieve and store television infrared controller commands.
I have a IR receiver connected to pin 0, giving me logic 1 when receiving. That seems to work well.
However, I don't completely understand the IR communication method.
My first 'attempt' used the PULSIN command and had limited success with a Sony controller. It was basically a first PULSIN command to detect the first long start signal, then a·list of 11 further sequential PULSIN commands storing the 'low' time periods.
However, it did not work to know with any other make of remote.
It think the problem lies in that various controls, use various methods of sending their information over various lengths of time.
My other thought was just to record using sequential alternate high and low PULSIN values.·
My thinking·was that it would store the whole sequence and the timing exactly as it arrived, and who cared if it repeated.
To transmit the signal, I was going to work out the timings and send it back out using FREQOUT and a IR led.
I can see this needs to get far more involved!
Anyone else tried this ?


Chris Savage
05-23-2005, 12:47 AM

··· The link below is to a book about IR Remote control.· It might give you some insight as to how to best go about what you're trying to do.· It's available as a free PDF download.


Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

05-23-2005, 03:49 AM
Thanks Chris

The code in the downloaded text you mention is basically exactly what I have written already.· Their code is designed for a Sony controller, and mine only seems to work with a Sony controller.

I was just wondering if it was possible to get it to understand·other makes·of IR controller. The theory is they must all work along similar lines.

I'll keep on looking

05-23-2005, 04:50 AM
Yes, all IR remotes do work along similar lines.

The IR signal is a quick on-off-on-off blinking at 36 Khz to 38 Khz. The IR-Detector is looking for an IR signal blinking at that frequency. When it sees it, it pulls its output low. When it does not see it, it lets its output float high.

So, now each IR vendor must define what makes a '1' bit and a '0' bit. I believe the Sony standard uses an 800 uSec on, 800 uSec off pulse for a '0' bit, and a 1600 uSec on, 800 uSec off for a '1' bit. (I don't really know the Sony protocol, obviously). Other vendors can use different timings to define 1 and 0.

Then, each vendor defines how to put these bits together. Some protocols use a '1' bit to start the pattern, then send 16 data bits indicating the button pressed, then send a '0' stop bit. The protocols vary widely.

Common protocols are the Phillips RC-5, and the Sony protocol. Vendors don't always publish their protocols, so it can be hard for a hobbyist to find them. There do exist universal remotes, so apparently the vendors give some manufacturers access to what the protocols are.

Andy Lindsay (Parallax)
05-23-2005, 11:14 PM
Here is a link to a site that has IR protocol information for most remotes that Sid Weaver sent me·last year·(thanks Sid!):
· http://www.xs4all.nl/~sbp/knowledge/ir/ir.htm (http://www.xs4all.nl/~sbp/knowledge/ir/ir.htm)
In many cases, this information makes it possible for to either receive or transmit a given protocol with the BASIC Stamp.· Here is a thread with a post that made use if this information to get the BASIC Stamp to transmit with the JVC protocol:
· http://forums.parallax.com/showthread.php?p=536500 (http://forums.parallax.com/showthread.php?p=536500)

Post Edited (Andy Lindsay (Parallax)) : 5/23/2005 4:21:09 PM GMT

05-24-2005, 04:55 AM
Sorry for butting in (and being·off topic), but don't learning remotes just digitize and save the incoming signal without regards to how it's been modulated? I was trying to do this last year but gave up. I concluded that my processor (the BS2E, I beleive) was just too slow.


05-24-2005, 05:19 AM
Well, first of all, true "Learning Remotes" are becoming rare. Most of the "Universal Remotes" merely let you select the vendor when you set them up.

Secondly, yes, a true "Learning Remote" probably only has a single modulation frequency. Then they play back the 'bit' times that they memorized.

And it depends on the protocol if a BS2 can do it. I believe a BS2sx has the right 'PULSOUT' 'tick' size to support most protocols, once you've determined what the bit timings are.

Recording is more difficult, and Recording for Playback is even harder.

05-24-2005, 06:27 AM
I wanted to get my code to learn the codes, otherwise I would have to have a huge database of all the various codes to enable use with all the different controller makes.
My thinking was to basically record the incoming high and lows IR signals at my own speed.
Who really cared about the length and correct modulation. As long as you got the correct·timings of the high and low data, and your recording captures at least one complete run of data.
I will keep tinkering.