Infrared Arduino

From Hack Manhattan Wiki


Several months ago, Justin brought in a nice Panasonic SA-DM3 DVD Home Theater system with a Tuner, to provide excellent sound for the space. However, it was a 'found' item, and did not have a remote. Since the radio could only be retuned using the remote on this model, we were stuck with the few heavy R&B stations that it was tuned to.

The universal remotes that we had to hand did not work either, so Dave went on a quest to learn how to reprogram the stereo using an Arduino (of course).

The hardware was obtained by scavenging the IR LED and IR sensor from a defunct COBY DVD player (Thanks for the desoldering tips, Robert!). The components were wired up as suggested by Ken Shiriff who has a very nice IRemote Arduino library to run it all.

One DSO Nano oscilloscope and a couple of hours later, we were able to see output from the detector in the correct pattern for Panasonic IR (48 bits!) using the universal remote. However, none of the codes worked on the stereo.

It was time to try sending some IR codes. As the first two bytes of each Panasonic code are constant, 1, and the Power Off code appears to be identical for all devices, that leaves only one byte to find, which describes the device class. Irritatingly, the binary signal has to be sent Least Significant Byte first, so initial searches were slowed, until I found a fantastically useful Binary/Hex Converter. Unfortunately, this still did not make any connection with the stereo.

No codes were available for the remote online, but a similar remote was found, posted as .mxd file. Some Googling yielded a way to pull the raw binary IR codes from this file using a hex editor - but this was slow going as the lookup table was well hidden, and the binary is coded using strings of V or U(0) and T(1). This eventually enabled the missing identifier byte to be found (A0/05 depending on whether you are human or Panasonic) and the stereo was successfully switched off via the Arduino! Other functions soon followed, including the elusive Auto Program Mode. Borrowing a bit of code from Guan's Brain Pong test sketch, a simple CLI sketch was made to control the stereo:

File:IRsendSADM3.ino.zip (Open a serial terminal at 9600 baud and send 'h' for help!)

IR Codes really vary widely in format between manufacturers, so if you want to do this yourself, be prepared to stare at hex and binary digits for a while. Or just use the stereo ;)