From: reinej@bray1a.its.rpi.edu (John Theodore Reine)
Subject: RE: Infrared Remote Controls
Reply-To: reinej@rpi.edu
Organization: Rensselaer Polytechnic Institute, Troy, NY.
Date: Thu, 17 Dec 1992 22:54:10 GMT


                                          
  Here what I found out about Infrared Remote Controls
  during a high school science fair project:
  I plan to answer the following questions here:

    -What kind of signal comes out of the remote control?
    -How does the component know what button was pressed?
    -What happens when you keep a button pressed down?
    -Some possible computer interfacing- what i did (and tried to do).

The remote control emits a series of on and off pulses of Infrared light
when a button is pressed. It is the pattern of these signals that lets
the component decipher which button was pressed.  There are two kinds
of on pulses that it emits, a short one and a long one.  These are in
a pattern from 7 to 15 pulses long, depending on the remote, that is 
different for each button pressed.
Here is a sample of a pattern from a Sony CD remote control.  The short
pulses are represented by a S and the long pulses are represented by a B.
The timing space between each pulse, long or short, is the same. 
The button #'s are the actual 1,2,3.. on the remote.
This is button #1

   S S S S S S S B S S S B

here it is plotted out:

ON  - - - - - - - -- - - - --
off- - - - - - - -  - - - -  --

This pattern is repeated over and over again on sony remotes as
long as you hold down the button.  What this pattern contains
is a pattern that tells the component what button is being pressed,
and another pattern that is the same for all buttons.  After 
looking at a few patterns, you will see.


Button #2

       B S S S S S S B S S S B

plotted:              (as you can see, the big pulses are twice the little
			ones.  I am not sure of the timing, and do not
                         trust the timing that I got since I was learning
                           how to use an oscilloscope)
on     __ _ _ _ _ _ _ __ _ _ _ __
off____  _ _ _ _ _ _ _  _ _ _ _  ______

Now, for the pattern for Button #3, I will put a marker where the 
two patterns are divided.  The pattern for the particular button 
will be on the left, the other on the right.  The one on the right
is slightly different for different components made by sony so
they will not get confused.  The pattern for, say yamaha, is about
15 pulses long and completely different than Sony's, exept for one
aspect that will be discussed.

Button #3
               |             
    S B S S S S S B S S S B
   
BUTTON #4
               |
    B B S S S S S B S S S B

As you can see, the pattern on the right is changing while the 
one on the left is not.  Now I will replace all the B's with 1's 
and all the S's with 0's and repeat the pattern for button #4.

BUTTON #4
              |
   1 1 0 0 0 0 0 1 0 0 0 1
Now i will isolate the first pattern:
   1 1 0 0 0 0            and rotate it
   

   0 0 0 0 1 1 
 And now we have what looks to be a binary code...
  This binary number, for button #4, is 3
  hmmmm...

  now let us look at the two previouse buttons, 1 and two

Button #1
              |
   S S S S S S S B S S S B 
   0 0 0 0 0 0 0 1 0 0 0 1     
  
    rotate:
 
   0 0 0 0 0 0     and we have the binary equivalent of Button #1 = to 0

Button #2
              |  
   B S S S S S S B S S S B
   1 0 0 0 0 0 0 1 0 0 0 1
     rotate:

   0 0 0 0 0 1    and we have the binary equivalent on Button #2 = to 1

Lets skip right to button #9
              |
   S S S B S S S B S S S B
   0 0 0 1 0 0 0 1 0 0 0 1

   rotate:
   0 0 1 0 0 0   and we have the binary equivalent of Button #9 = to 8

By now, you see the pattern.  That for every numbered button on a 
remote control, the reversed binary equivalent of the code is one 
less than the number of the button that was pressed.  The trick is, 
it is not like this on only sony remotes.  While the rest of the 
pattern is longer or shorter, for every remote that I tested, this 
pattern was true.
Now, as long as the button was pressed down on the sony remote, it 
is the complete above patterns that are sent again and again.  But 
on some remotes, this pattern is sent only once, and then as long 
as the button was pressed, a small trailing pattern is sent to tell 
the component that the button was pressed. These kinds of remotes 
are not good for practical purposes because if you aim it wrong 
when you press the button, you have to repress it instead of waving 
it around with the button held down to get the light to the component 
as you can do with the sony.  You can tell if you have a one shot 
or continuous remote by pressing a button with you hand over the 
emitter, then keeping it pressed and remove your hand.  If the 
component reacts then it is a continuous.
    The way that I looked at the signal was to attach an infrared 
detector to an oscilloscope.  With good triggering, you can get 
it so that the signal appears beutifully.  The little metal box 
with a detector and a chip that makes the signal constant and 
perfect and wipes out all the noise from Radio Shack is better 
than a plain detector.
    Recap:

There is a signal coming out of the remote, say in this case a 
continuous, that as long as you press the button, will repeat 
over and over again
remote        button #17                             _____
| ________              signal                      |     |
 |________|               |                         |      \
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  | tv    |
       enlarged    /~\                              |_____ / 
      ____________/   \_______
      S S S S B S S B S S S B 
      0 0 0 0 1 0 0 1 0 0 0 1
rotated

      0 1 0 0 0 0   and we get binary number of 16, one less than 17, the 
                    button pressed!


If that were a one shot remote, only one ~ would be sent, with 
trailing stuff. but one shot remotes are not that imortant for 
hacking, but are good to know  about.  here is a list of brands.

		One Shot              Continuous
		Onkyo			pioneer
		carver			sony
		aiwa			JVC
		yamaha			mitstubishi
		denon			rca
		toshiba			proscan
		sanyo			vcr2
		zamzung			goldstar
		hitachi			panasonic
		nakamichi
Maybe someone could tell me why there are two formats, and why use oneshot
when continuous is obviously better?  Just curious.


Interfacing with computers:

	Pure speculation on my part, but couldn't one use any kind 
of digital interface, connect an IR detector, and write a simple 
program to time the intervals between pulses, and the length of 
pulses?  Then for output, simply have the program blink an emitter 
at the same times.  I made a 24 input/output digital interface 
card a while ago, and when i have time will try the above experiment.
One thing that might slow me down is that currently i only have 
an XT for interfacing purposes (mom and dad won't let me go inside 
the at's] This could also be done thru the parallel port, too.  
I have tried to do some timing on a 286, but couldn't get results
that were correct because I was using an interface that was
connected through a communications port and was set at the max, 9600 
baud.

For analysis of the signal, an oscilloscope is the bast way.  To look at
the code of one-shot remotes, you need storage.  I have an old techtronix
that happens to have it.  You can also "listen" to the light by connecting
an IR detector to an amplifier.    
	
	 I have only read about the miniboard, so the following is 
only what I have thought up.  In article 2083 of comp.robotics, 
Fred Martin talks about the high speed bus option on the miniboard, 
with a master out slave in line, and a master in slave out line. 
By looking at the schematic, there are 4 lines thatare connected 
to other 6811's.  The SCK line, the master clock, SS line,that 
selects slaves, which is always true in the case of the miniboard, 
and the MOSIand MISO lines.  Is there a way to have a master and 
a slave talk over IR light? How would the clock be transmitted?  
Could one binary light connection do all three lines?    
		
Any comments or suggestions are appreciated.
						


				John Reine
				email  reinej@rpi.edu
				rpi:518 217 7741
				home:617 235 6489

Keywords: