Making an IR-remote controller for your portable SONY MD-player - By Terje Lassen

I have built a little circuitboard that can receive and decode an IR signal from a SONY remote and control a portable SONY MD-player. I have a MZR-50, but I think the circuit will function on all SONY equipment that uses the same remote control. I have had the idea for some time but haven't finished it until recently. Upon browsing the internet I found someone selling similar equipment. You can check out their equipment here OR read on to make one on your own!

The key issue is to have the opportunity to control your MD player with your existing IR-remote control. In this project I have used a SONY remote, but with a little effort the program can be rewritten to tackle other protocols as well.

I spent some time on the net to find out how the remote control on the cord functioned. It's a rather simple design. When pressing a button on your remote you set up a resistor between two of the pins on the four pin connector beside the earphone plug. The idea was then to use a little CMOS switch controlled by a microcontroller to set up the desired resistor between the pins. This is a quite simple task, and after some trial I managed to control the player by a little assemblyprogram. Resistor values for the different operations and a more thorough description of the control can be found in:

MZ-R30 Remote Control Signals by Andy James

Now the difficult part of the project was to get and decode the IR-signal correctly. Again I consulted the Internet for information. I found several pages on the subject and saved a lot of research work!! I will give a description of both the protocol and the method I used to receive and decode the signal. Some other places you might want to look for more detailed information

Another project on SONY remote control

The SONY remote control protocol works as follows:

Data codes and other facts:

- The data codes are sent using pulse coding.

- The basic time period T = 600 micro secs

- Each packet has 12 bits and a header.

- The header or startsignal is a pulse of length = 4T

- Then the bitstream follows. It is made up of 12 bits sent with the least significant bit first.a 5-bit device ID code followed by a 7-bit button code. The 5 first bits are to specify the object for which the signal is meant (i.e. TV, stereo, VCR ...). The next 7 bits are to specify which function to accomplish.

- A zero = space of length T followed by pulse with length T

- A one = space of length T followed by pulse with length 2T

- This means that signals are of different length. A signal of only 1's is longer than one with only 0's

- The packet is transmitted every 25 milliseconds while a button is pressed.

Receiving and decoding the signal

To receive the signal I used a little packet with a photodiode and some electronics to give a nice signal when receiving an IR-signal. It's a packet with three legs, Vcc, GND and signal. The signal is normally high, but when receiving IR-light it's set low. This means that the signal will be inverted compared to that from the remote-control. First of all I connected the receiver (by this I mean the packet) to an oscilloscope to find all the binary codes on my remote.

To view a list of all the codes, please click here...

Next I had to write an assembly routine to decode the signal. I have used an ATMEL AVR 2313 during the developement of the circuit, but I think that any microcontroller with at least one timer and one interrupt pin will do. Because of the very slow datarate on the IR-signal I decided to make an interrupt driven routine. The concept is quite simple and I will go through it in brief here.

For the full assembly sourcecode, please click here...

I will go through the program in brief here.

- The first thing I do after starting the program is to set up the input pin to trigger on a falling edge.

- The signal from the receiver is normally high but when an IR signal is received the pin goes low. This causes an interrupt.

- In the interrupt routine I just start a timer and set the input pin to trigger on a rising edge. This because I want to have an interrupt when the first databit comes from the remote.

- When the startsignal is finished the signal goes high and produce an interrupt. In the interrupt routine I stop the timer. The timer will now contain the length of the start pulse. By comparing this to the expected value I find out wheter or not this is a legal startpulse. If it is I reset and start the counter and return from the interrupt still triggering on a positive edge.

- On the next positive edge I will have received the first bit in the signal. By comparing the timer to some expected values I can decide wheter it's a zero or a one.

- Since the botstream is sent least significant bit first I shift them to the right into a register. Using a counter to keep track of number of bits received I get the full code from the remote in a register in the microcontroller. By comparing this number to the known numbers sent from the remote I can find which button is pressed.

- Knowing which button is pressed the microcontroller closes the appropriate switch. The switch is actually a little relay that sets up the desired resistor value between the pins on the MD.

- To make the program easier to comprehend I have made a little drawing with an example waveform:

{example IR waveform}

-I have made a nice(??) drawing of the hardware in .pdf format. You can watch it by clicking here

Any questions or comments? Feel free to send me an electrical message: lassen@invalid.ed.ntnu.no

Or you can write a note in my
guestbook

NOTICE: All actions and ideas taken from this page is at own risk. I take no responibility for any problems or damaged equipment carrying out experiments with the equipment.