Programmers

All on one SLOW page
Serial Port
Parallel Port
Smart Programmers
Serial Loaders

Projects

ATmega8 Serial LCD
ATtiny2313 Serial LCD
ATtiny4313 Serial LCD
ATmega328 SIRC
ATtiny2313 SIRC
40-pin Dev Board
28-pin Dev Board
AVR PS/2 Keyboard
AVR MAX232 RTS/CTS
AVR Dual RS232 Ports

Minimal Circuits

ATmega16
ATmega32
ATmega644
ATmega1284
ATmega8515
ATmega8535
ATmega8
ATmega48
ATmega88
ATmega168
ATmega328
ATmega162
ATmega128
ATtiny13
ATtiny2313
ATtiny4313
ATtiny24
ATtiny84
ATtiny25
ATtiny45
ATtiny85

Other Stuff

ATtiny13 vs ATtiny85
ATmega8 vs ATmega88
ATmega16 vs ATmega164
ISP and SPI
MAX232 Arduino
A small FAQ
Hardware Info

SIRC using an ATmega328

Page: 1 2 3 4 5

Key Mapping

The first step in in deciding which keys can be used is determining what, if anything, each key sends. Although this information appears early in the project, it is about the last thing you find out. The decoder has to be functioning before you can tell what is being sent. To get all of the codes, I put a Serial.print() in the timerISR() routine to print the address and command every time a button was pressed. It gets messy, because there are misreads - more on some keys than on others. I think the cheap remote may have contributed something to that problem. Some keys read correctly 100% of the time, while others misfire every third time. I didn't have that problem with the Cox cable remote, but it would polute the signal by echoing in a different protocol. Actually, the decision to change was ultimately made because the volume up/down signals would go three or four times, then the protocol would change to the cable box protocol for three or four echoes, then back. I couldn't get a smooth fade. Eventually, it would signal an error on the Aux, and switch from Aux to TV. Hopefully a bug in the controller.

There must be a list of Sony remote codes somewhere, but I haven't been able to find one. With this little project, you will be able to make one easily enough. You just have to do the above trick for every Sony code number on a couple of universal remotes to get most of them. Luckily I needed to do that only twice for this SIRC project.

One Sony TV code
Addr Cmd Function
137Input
196Menu
118Vol+
119Vol-
120Mute
158Info
159Last
1116Up
1117Down
151Right
152Left
101
112
123
134
145
156
167
178
189
190
117Ch -
116Ch +
1101Ok
114Guide
120Mute

An interesting thing about the address. Don't count on it always being the same. Any given button always sends the same address, but different buttons may send different addresses. There appear to be 5 different addresses in use on the Cox remote, and they seem to be grouped more-or-less by function. Other multi-function remotes seemed to do that also, but I didn't find a manufacturer's remote that behaved that way. To simplify things, though, I spent $10 on a GE universal remote. I set it up as a Sony TV, and all of the keys send the same address.

The Design

We should decide exactly what we want to do with the codes received. In the real world the codes would be mapped to functionality - some would pulse a line, some would set or reset a line, or some would change an analog voltage, or the code sent to an I2C potentiometer. Because the ATmega328 can pulse width modulate the voltage on an LED, I have chosen to simulate the volume control up/down function in that way. Other buttons, specifically 1 and 2, will turn LED's on while 4 and 5 will turn them off.

Not all remote control transmitters work the same. Some will resend the code up to three times in a short period of time for a single button push. Some will send the code once. All will repeat the code if the button is held down. The Sony protocol expects the message to be repeated every 45 mS. To prevent that from affecting the system, a command should be allowed to lock out further input until it has completed, if it so chooses.

The remote control runs entirely in the background. Commands will be presented to the main loop ("userville") and a flag indicates the arrival. The main loop will look for this flag and when set, will read the command. The address, and extra data are available as well, but the address will always be the address we set it to look for. It may be changed programmatically.

The code will be presented in the form of an Arduino library. An Arduino is not required, but the environment is, along with an ATmega88,-168, or -328. The code doesn't care which. You also don't need the Arduino bootloader in your chip, if you have an ISP, but I'll leave that to you to figure out.

Page: 1 2 3 4 5