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.
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):
-
A leading pulse
-
A pause
-
The 8-bit address for the receiving device
-
The 8-bit logical inverse of that address
-
The 8-bit command
-
The 8-bit logical inverse of the command
-
An end burst
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.
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:
-
Raspberry Pi
-
Yamaha MRX-70 Learning capable remote
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.