[last updated: 2025-01-16]
IR Remote Control Codes
TV antenna - rotating
-----
This page is in process ...
- Goal:
------------------------------------------------------------------
- Broad Overview:
- IR remote controls ("clickers") have an IR-emitting LED. They emit light (hence "IR senders"), but IR wavelengths are invisible to our eyes.
The light emitted by the IR sender is encoded as a pattern of pulses to identify the button that was pressed on the remote.
The encoding algorithm is complicated.
- The encoded IR light pulses get received by an IR Receiver. The receiver may be located on your TV, or DVD player, or on a light bulb,
or on any number of other devices that have receiver circuitry.
- The IR receiver "decodes" the IR pulses and determines which button was pressed,
then it does whatever it's programmed to do, eg. turn up the volume, start playing a DVD, change a light bulb color,
or, if the receiver is just on a computer or micro-controller (eg. Arduino), it may just display the decoded data for manual analysis.
------------------------------------------------------------------
- Encoding Algorithm:
------------------------------------------------------------------
- IR Receiver:
------------------------------------------------------------------
------------------------------------------------------------------
------------------------------------------------------------------
------------------------------------------------------------------
- The first such "meaning" to be extracted is the start code, which not only delineates the start of the data,
but also correlates to the manufacturer/protocol according to the specific start code that is used.
- Next is the actual data. As mentioned above, the length of the bursts in a data stream will vary in length, but will cluster around two values
(sometimes three, but at this moment I don't have an explanation for that. Stay tuned...)
One of those values will be decoded as a binary-1, and the other as a binary-0.
Note that the lengths of the spaces are almost always relatively constant, and in fact are ignored,
since the data that is needed is encoded in the lengths of the pulse bursts, and is not affected by the length of the spaces.
---------------------------------------------------------------
- Another way to decode the signals, instead of using Adafruit's brute-force method, is to use a contributed library that has done all the heavy lifting for you,
and will just spit out a single code to identify a given button press.
At this time I have only investigated two such libraries:
- The IRremote library:
- The IRLib2 library:
- This is shown in "...using-an-infrared-library.pdf" (link below):
- Installation of the library must follow the steps in the pdf. The library-master.zip that you download from github
actually contains 5 separate libraries,
so trying to install it using the IDE - sketch - include library - add zip library will fail for "ERROR 13 ... library not valid"
---------------------------------------------------------------
moved to my custom folder:
.../tech/Arduino/programsLibrariesUser/librariesOrigMasters
- Back to pdf to follow its more involved procedure:
- In my librariesOrigMasters folder, double-click on IRLib.zip, extract, extract
IRLib2-master folder was created, with the extracted files in it.
moved the IRLib.zip into it for archive
- Indeed the un-zipping created the 5 individual library folders that the pdf mentioned:
IRLib2, IRLibFreq, IRLibProtocols, IRLibRecv, and IRLibRecvPCI
- Copied all 5 folders into my sketchbook library folder: .../tech/Arduino/programsLibrariesUser/libraries
restarted IDE
Successful
- Testing IRLib2 Example programs:
- The dump.ino example program reads IR pulse streams sent from a remote,
and decodes it. It gives you several pieces of information:
First, it tells you the protocol being used:
These data are for pressing the LEFT button on Vizio remote
eg. "Decoded NEC(1): ... "
Next it gives the hex value of the decoded command:
eg. " ... Value: 20DFE21D ... "
The pdf says this data value "uniquely encodes" the button press.
Then it gives some other stuff, and finally the actual data:
eg. "0:m554 s606
1:m522 s578
2:m550 s1702
3:m542 s586
4:m550 s586
5:m542 s582
6:m546 s610 ... "
and continuing for 32 chunks.
At this point in time I have no idea how to interpret these data...
however I see this: repeated presses of a given key will always show the same decoded hex command,
though the raw timing data (the m... and s...) vary slightly.
The hex value of the VIZIO DOWN-VOL command: 20DFC03F
-
---------------------------------------------------------------
---------------------------------------------------------------
Third Step: build circuit and program to send IR pulses:
---------------------------------------------------------------
Links:
.
.
.
eof