IR-Receiver.txt The Serial IR decoder sub-system accepts IR signals from standard IR remotes. It decodes the IR data and outputs an RS232 type signal at 9600 baud with the button pressed information. The decoder will sense and respond to 8 different IR signals. Operation ========= Program Mode ------------ Before use, the Decoder must be taught to the signals to respond to. To enter programming mode momentarily short the two header-pins 'Prog' by the IR receiver. The yellow LED should now light and stay lit. The next nine button presses on the remote will be given, in order, the codes x,1,2,3,4,5,6,7,8. Some remotes seem to waver on first start-up so we intentionally discard the first full reading. Always wait for the LED to extinguish before releasing the button. If you keep the button pressed the LED will light again and programing will be unsuccessful. Turn off the power, turn on again and short the two header-pins again. Decide which eight buttons you wish to use. Once in programming mode (LED lit) press the first button on your remote. The LED will extinguish after ½ second or so indicating the signal has been successfully decoded, it will not be stored. Release the button. Press again the first button on your remote. The LED will light and extinguish after ½ second or so indicating the signal has been successfully stored. Release the button. Press the second button to store the second signal. The LED will light and extinguish after ½ second or so indicating the signal has been successfully stored. Release the button. Proceed to record the remaining 6 buttons. If you require less than 8 buttons, you will have to load dummy buttons- the Decoder will not exit programming mode until 9 (8 buttons + 1 discarded) signals have been recorded. Avoid overloading the IR detector by maintaining a minimum of 1-2 m between the IR decoder and your remote. Operating Mode -------------- The Decoder enters operating mode either immediately after IR data signals have been recorded or 2 seconds after power on- the LED will light and then extinguish. Press one of the previously recorded buttons- the LED will light to indicate the Decoder is reading the IR signal and extinguishes when an IR signal has been successfully received. Only release the button when the LED is extinguished otherwise you risk spurious results. The button code is only transmitted on cessation of the IR signal. (If you keep your finger on the button the module will never transmitt the button code!) At power on, the Decoder sends the signal "0" on the serial line- this code is repeated every 10 msecs. Once a valid IR signal has been received, the code changes to the corresponding button number- ie from 1 to 8. This code continues until another button is pressed or a period of 2.5 seconds elapses after which the code reverts to 0. The format of the transmitted serial byte is as follows: MSB XXXXYYYY LSB YYYY contains the button pressed code from 0 to 15 (1 to 8 only implemented) XXXX contains timing data to indicate how long ago the button was pressed in units of approximately 0.16 seconds: YYYY= 0100 would imply the button was pressed 4 x 0.16 seconds ago. When YYYY rolls up to 1111 (after approximately 2.5 seconds), the timing counter stops, the button pressed code automatically reverts to 0000 and it stays at this value until another valid key press is received. If a non-recognised command is received, the button data nibble stays at 0000 but the timing counter restarts. If you do not require the timing data- simply AND the received byte with %00001111 in your application to remove it. Problem Areas ============= Decoder appears to programme but will not respond as expected. Check you are not operating under strong fluorescent lights- they can confuse the IR detector both during programming and normal operation. Increase the distance between the Remote and Decoder- the IR signal may be overloading the detector. Decoder operates only every other time a button is pressed. Some remotes generate two, alternating codes for the same button. The Decoder has stored one value but not the second code. This can be overcome by recording the same button twice but limits the number of different buttons to 4. Button 1 is not recognised- all the others are fine! Button 1 must be recorded twice- the first reading is discarded.