TinyDecoder – Cool IR Receiver and NEC Decoder with Arduino

TinyDecoder – Cool IR Receiver and NEC Decoder with Arduino


Infrared has been around for a long while. It has proven to be reliable enough so that basically almost everything remote and short range, that came before home automation was cool enough to be considered a thing, and battled its place fairly with RF technologies, so it deserves some love and affection from us. Besides that, it still has its own place, because our remotes and (specially) the old devices we like to hack still use it as a means for communication. Hence, understanding its internals is very useful, even to this day, and can be a good gateway for you into the IR world. Today, we will take a small glance at one of the most popular IR communication protocols and a device that will help you hack the IR devices all around you, the TinyDecoder!

Starting with the NEC, it is a standard protocol for sending and receiving data, used in IR remotes. It consists of 32-bit messages, with the address, its complement, the command and its complement, with each occupying 8 bits. Each message sent has the following sequence: 13.5 ms pulse, a 4.5 ms space and the message, with a 562.5 us pulse in the end of the transmission. The logical ‘0’ is represented by a 562.5 us pulse and another 562.5 us space, and the logical ‘1’ by a 562.5 us pulse and a 1.6875 ms space. Lastly, there are already tabulated values for the usual remote functions (changing channels, play, pause, numbers, etc).

NEC protocol message format
NEC protocol message format

Now that you know how it works, let us have a look at the star of the show, the TinyDecoder. It consists of an IR remote receiver and decoder for the NEC protocol, using the ATtiny13A. On Wagiminator’s project (hosted on GitHub), which receives an IR signal via the TSOP4838 IR sensor, decodes the NEC protocol (including its extended version) and displays its address and command in an SSD1306 OLED display. It is powered by a small coin cell battery and everything about it is open-source, so you have access to the PCB files and the Arduino code. It can be a very useful tool if you intend to hack some devices.

The TinyDecoder in action
The TinyDecoder in action

Lastly, there is a small limitation: NEC is not the only IR protocol you may want to tap into. There are other major protocols, such as the SIRC (Sony Infrared Remote Control) and RC-5, that you should learn about, and the 1 kB of Flash is deemed too small for that experience. So, you can switch to another ATtiny in the same package (such as the ATtiny85) and tap into them too, and there is already software support for it. So, why not give it all a try?

TinyDecoder GitHub link: https://github.com/wagiminator/ATtiny13-TinyDecoder

Notify of

Inline Feedbacks
View all comments

Join 97,897 other subscribers