Willy Nolan

Infrared Communication

At some point in time (probably in the 1980s) my parents acquired a complete Yamaha soundsystem. Although I loved the music, ever since I can remember, my favorite part was the tower of devices was the Yamaha MRX-70 learning capable remote (pictured in the first image of this post).

It is massive, about six inches long, and one of the rare remotes designed to be held in "landscape" orientation.

When single disc CDs players the size of car tires began to dissapear my parents decided to get rid of the system but I kept the remote wondering if one day I would be able to use it for something else.

This project focused on using a Raspberry Pi to allow the MRX-70 remote to control modern electronic devices.

Yamaha MRX-70 Remote Control

Yamaha MRX-70 Remote Control

The Raspberry Pi microcomputer has built-in support for IR communication in the form of LIRC which stands for Linux Infrared Remote Control.

However, for anybody that wants to interact with infrared communication directly (e.g. by using a computer program), there are not many options. LIRC has a specific, targeted focus and is not ideal for general IR control of electronics.

This research set out to make direct IR communication using a Raspberry Pi and Python easier.

There are a variety of infrared protocols in existence. A commonly used one is the NEC Infrared Transmission Protocol.

This protocol is robust and a good place to start for anybody interested in learning how IR communication works.

A complete message (sent when a button is pressed) in the NEC protocol consists of the following (in order):

NEC IR frame

This image shows the command 16 sent to the address 59 (both in hex). The message is sent in binary with the least significant bit first.

The logical inverse of the address and command is sent with each frame for error correction purposes.

There are also messages that are transmitted for repeat presses or if the controller is operating with the "extended" NEC protocol (which doesn't use the logical inverse of the address).

As an IR remote only flashes light, a logical question would be: "how are the flashes of light interpreted as numbers?"

IR communication uses 38khz modulation and the duration of a burst determines which binary digit is being sent.

IR modulation

This image visualizes the modulation. The longer spaces between pulses indicate a 1, the shorter spaces indicate a 0.

Since the command and address inverses are sent with each frame, each message takes the same amount of time to transmit.

The protocol itself is very straightforward. The most challenging aspect in this project was dealing with the timing tolerances from both the remotes and the Raspberry Pi.

My research explored creating an easy way to use IR communication directly from Python on a Raspberry Pi, specifically so old remotes could control new electronics.

During development the following equipment was used:

The end result of this exploration was the irreceiver Python library which is available on PyPi.

It is fully tested and well commented and a good place to start for someone interested in using IR communication with a Raspberry Pi or just interested in exploring IR in general.

Non-remote images and video in this post are courtesy of: