I have done a lot of stuff over the years, and the "old" tech, like barcodes, and modems, faxes, and all sorts have not passed me by, even old school "light pen" on a BBC micro.
But somehow one "old" tech passed me by somehow, and I am not sure how - the IR Remote.
They are a lot like barcodes, but without the variable timings. They are simple, and why the hell, in the last 50 years, have I never played with IR remotes? Mad.
So I have started.
This is my environmental board, and apart from light, sound, pressure, temp, humidity and CO₂ sensors, it has an IR receiver. So I had a play.The ESP32 has built in IR receiver (RMT) hardware that logs timings for the on/off from the IR receiver modules (which handles the 38kHz modulation for me).
It is a doddle to decode - actually way easier than barcodes. So I have decoded the very common NEC format, and the remote for the Daikin air-con.
NEC
The NEC coding is simple - a long/short header, and then pulse distance coding of 32 bits. It is 4 bytes (and annoyingly low bit first) which are address, and inverted address, and code, and inverted code, making a checked 16 bit sequence of fixed time duration.
This seems to cover a variety of bog standards remotes, like TV remotes. Interestingly my LG TV remote only does IR when the TV is off. Once on, it uses something else (not sure if bluetooth or what). It uses address 04.
I also have a very generic IR remote from Amazon, which is address code 00, and several (very illogically mapped) codes.
A single bit code 0, with a different timing header burst, is repeated whilst the button is pressed. Easy to decode press, hold, release.
Daikin
The Daikin remote is more complex, some 8 byte sequences, and a 19 bytes sequence, sent every time, using a simple byte checksum code at the end. Again, pulse distance coding. But again not hard to decode.
More
I have some more IR remotes coming to play with. So we'll see how they work.
The ESP32 can also decode the 2 common IR remote standards automatically as well so you don't have to do your own decode beyond mapping the values to the marking on the remote.
ReplyDeleteTo be honest I had not looked that far,I saw encoding stuff but the decode is so noddy to do anyway.
Delete