All The Good Ones Were Taken

Controlling a Sony Hifi with a BASIC Stamp 2 (1999)

Way back in the mists of the late 20th century, I owned a Sony DHC-MD515. This was a mini hi-fi component system, including a cassette deck, 3-disc CD changer, and 3-disc MiniDisc changer.

It could copy CDs to MiniDiscs, which was useful back in those days. It could also write disc and track names to MiniDiscs, but entering these with the controls provided was a prohibitively cumbersome process, so I set out to find a way for my PC to control it.

The MD515 had a detachable remote control unit. When plugged in, it communicated over a wired connection via three spring-loaded pins. When detached, it transmitted infra-red signals. The wired connections on the base unit were, from left to right: 1. +5v (not enough current for power supply, it probably just signalled to the remote control that it was plugged in) 2. 0v ground 3. Signal

The communication protocol used was Sony's Control-S. This is a unidirectional protocol, with codes of 12, 15 or 20 bits sent as a series of TTL-level pulses through a wired connection, or over a 40 kHz infra-red carrier as SIRCS (Serial Infrared Remote Control System). The former is of primary interest here.

The closest thing to a microcontroller that I had to hand at the time was a Parallax BASIC Stamp 2, a postage-stamp sized device programmable in a dialect of BASIC.

Wiring was simple enough. The BS2 is connected to a PC serial port for programming, debugging, and runtime communication.

One of the BS2's output pins is connected to the Control-S input pin with a plain old croc lead. I used P8, purely because it's on a corner, making it easy to attach a croc clip.

I started out with a groupd connection too, but when it accidentally fell off, it turned out that the hifi and PC had enough of a common ground for it to be unnecessary. Nor did I bother with limiting resistors, optocouplers, or other such cautionary components. Professionals, please feel free to express your astonishment and disgust now.

The BS2 could probably have been made to drive an infra-red diode with the addition of a 555 or similar to generate the 40 kHz carrier, but I didn't try that.

After a certain amount of experimentation with a Poor Man's Oscilloscope (ie, I plugged the signal into a Sound Blaster's Line In hole), it turned out that the BS2 was just about capable of producing the 600μs and 1200μs pulses required for Control-S. The program receives data from the BS2's serial connection in the format Scommand address repeat, where command is a decimal number in the range 0-127 representing the lowest seven bits of the Control-S code, address is a decimal number representing the higher bits of the Control-S code, and repeat is the number of times to repeat the code (the real remote control sent codes three times, except for the jog and volume dials which sent the code once per tweak).

The BASIC program doesn't adhere precisely to the Control-S protocol (for example, the 45ms frame size has been gleefully defenestrated), but it worked for me. I threw together a Visual BASIC program (not reproduced here) to emulate the MD515 remote control, plus a couple of extra buttons and a disc and track titling facility.

Sony DHC-MD515 Control Codes

With the Poor Man's Oscilloscope mentioned above, a few web pages, and a certain amount of experimentation, I put together a non-exhaustive list of codes the MD515 accepts via the remote control docking port. Some of these are generated by the real remote control, others are not.

Numbers are in hex. Codes are 12-bit or 20-bit. For each code, the 7 low bits are command codes, the higher bits are a device ID.

Amp:
661 DBFB toggle (not on the remote!)
662 Preset
669 Function
812 Volume Up (send once)
813 Volume Down (send once)
815 Power On/Off
823 Tape
825 CD
82E On
82F Off
860 Sleep Auto
862 Select
84B Display
865 Set
869 MiniDisc

Tuner:
680 1
681 2
682 3
683 4
684 5
685 6
686 7
687 8
688 9
689 0
68F Tuner
691 Station Down
690 Station Up
692 Tune Up
693 Tune Down
6A1 Mono/Stereo
6A6 Prompt for two-digit station number

MiniDisc:
780 1
781 2
782 3
783 4
784 5
785 6
786 7
787 8
788 9
789 10 / 0
78A Prompt for two-digit track number
798 Display
799 Show Title
7A0 Previous Track
7A1 Next Track
7A2 Rec-It
7A8 Stop
7A9 Pause/Play
7AB <<
7AC >>
7BB Accept Title
7BC Edit Title
7BD Delete Character
7DA Edit: Erase? (when playing) / Edit: AllErase? (when stopped)
7DB Edit: Divide?
7DC Edit: Combine?
7DD Edit: Move?

CD:
880 1
881 2
882 3
883 4
884 5
885 6
886 7
887 8
888 9
8A0 10 / 0
8A7 Prompt for two-digit track number
8B0 Previous Track
8B1 Next Track
8B3 <<
8B4 >>
8B8 Stop
8B9 Pause/Play
8F8 Loop

MD515:
39D29 Continue
39D2A Shuffle
39D2B Program
39D2D Repeat
39D30 Jog Left (send once)
39D31 Jog Right (send once)
39D33 << Left
39D34 >> Right
39D38 Stop
39D3A Play/Pause
39D3E Skip
39D3F Rec/CD-MD Sync
39D40 Disc 1
39D41 Disc 2
39D42 Disc 3
39D58 Edit
39D59 Enter

61Dxx ASCII characters for titling
      (subset of characters as listed in MD515 instruction manual)

Note

Just because I figured this stuff out, doesn't mean I'm some kind of remote control guru. Chances are that I have no idea how to make your XK7-4430 work with a Tamagotchi GM-6000. Sorry.