We have looked at IR signals sent out by IR remote controls in a previous blog. So what happens when you keep the button pressed for a longer time? It depends on the remote control. Each one is slightly different but they fall into a few broad categories. I have access to a handful of remote controls and I used the IR Receive program mentioned before to analyse the repeat patterns. They fell into to two main categories - except for the damn Foxtel remote.
To understand the repeat patterns, let us start with the normal format for an IR signal
The signal starts with a Header pulse that is usually wider (~12,000µs) than the subsequent pulses. Then comes a series of Data pulses (~1200µs each). This holds the data being sent in the IR signal. For some remotes that is it. But a few have a longish Pause (~20,000µs) followed by a Stop pulse with timings similar to the header. Then comes an End pulse. If the remote uses Space Encoding, an End pulse is always needed to indicate the end of the last data space. After that is a long Gap (~100,000µs) before the next set of signals.
Sony - simple repeat
The screenshot is from part of a web page displayed by the latest version of the ESP8266 IR Receiver. The top waveform is the complete signal train. Each burst of activity is shown in subsequent waveforms.
This is what a long press on a Sony remote looks like. There are several signal bursts. They are all identical. It may not be visible but the rest of the signal is more of the same. There is no special terminating signal. Incidentally, a single press sends three sets of signals.
I found this pattern on the Onkyo and Benq remotes as well. The Harmony PS3 adapter takes IR signals and converts it to the Bluetooth signals the PS3 needs. The Harmony PS3 adapter also uses the same repeat pattern.
Laser DVD - repeat end signal
The normal signal from this remote has the usual pulse train with a pause, stop and end. In case of a long press, only the pause, stop and end pulses are repeated.
I found this pattern on the Optus iFetch remote and the Apple TV remote.
Foxtel - good grief!
I have played with a lot of IR remotes. There are IR remotes and there is bloody Foxtel. Back when I was analysing the signal formats for remotes, I found out that the Foxtel remote was nothing like the others. it used an encoding that I had not encountered before. Just when I thought it was safe to go back into the ether, I find out that the repeat pattern is different too.
The signal stream is retransmitted several times. But after the penultimate one, the gap is a lot shorter (19,250 µs instead of the usual 90,000 µs). The last signal is slightly different to the previous ones. The data is the same except that one of the bits is flipping flipped - bit 18, it looks like.
I found this pattern on the Foxtel remote, only the Foxtel remote and nothing but the Foxtel remote.
Update: Further experimentation on the Foxtel remote showed that the short gap varies. It may be tied to the instant the button is released. This means the signal receive will be weirder than before with variable gaps but the send logic can ignore this and have a simpler standard gap every time. The toggling of a bit is used with other remotes and is no longer a Foxtel specific feature. The original experimentation was done with a Harmony universal remote and the signal was quite inconsistent and weak. With the original Foxtel remote, the signal was much cleaner and reliable.
Implementing Repeat Patterns
Now that we have a few repeat patterns, we can look at extending the IR Transmit to handle repeats and simulate long presses of remote buttons.
To start with, the IR signal definition has a few extra elements added. This is what the previous definition looked like.
C=S,12;H=2200,1100;T=550,1100,550,,;P=455;S=50,50;E=550;G=22000;
The repeat format is tagged on to the end and it handles the three known variations. In addition to a long press, even a normal press may involve a few repeats. This default repeat count also forms part of the format.
C=S,12;H=2200,1100;T=550,1100,550,,;P=455;S=50,50;E=550;G=22000;R=R,3 R=R,3 - repeat the signal, default is 3 copies R=E - repeat only the pause/stop/end pulse, no default specified, default is 1 copy R=M,3,131072 - repeat with last signal with a toggle mask default is 3 copies apply XOR mask of 131072 (or toggle 18th bit)
When sending the signal using the IR transmitter, the URL specifies the format (s=), the data to be sent (d=) and the number of repeats (r=). Note that the format uses URL safe characters instead of the usual delimiters.
http://192.168.0.10/cgi/Send?s=C~M_12-H~415_242-T~200_300_400__-P~-S~_-E~-G~89471-R~R_3_&d=222&r=10
The send routine will implement all parts of the signal including long presses. It is too much work to modify the receive to handle all the cases. This may probably be done over time. Meanwhile, the waveform display will help in manually determining the format rather than have it automatically determined. I may look at a process where you put the device in learn mode first. Then do a single press, a pause of at least 2 seconds and then a long press. This should provide the receive signal analysis logic enough data on both a single press and repeats.
Also the implementation will follow from my limited collection of remotes rather than trying to handle every known remote.
No comments:
Post a Comment