hatestheinternet

MIDI SID Arduino

Let's see how you do coming up with a title to describe a MIDI-speaking, SID-controlling Arduino. Yah, you pretty much just come back here, dontcha? Well, whatever we want to call it, it's the first and most important stop on this crazy train's journey. Without something to actually control the SID chip, this thing's going to be doing a whole lot less nothing than intended. The only things needed for this part are an Arduino Uno, a 6581 SID chip, and a bunch of jumper wires. You're also going to need some kind of powered speakers as the SID outputs a line level signal.

The chip itself might be hard to find but, as a collector of aged technological curio, sometimes you just happen to run across things that are flat out beyond repair. A while ago, I'd picked up a Commodore 64 that'd found itself on the wrong end of a can of soda, the end result being a machine that just enough left in 'er to verify its infamous SID6581 had escaped unscathed.

Carefully, I pried the chip out of the socket it'd called home for the last 30 years, dug up a data sheet on the internet (and verified the data sheet, and again, because yah), and connected it to an Arduino Uno in the least efficient way possible:

Original SIDI BreadbaordCurrent SIDI Breadboard

The image on the left is the first iteration of the SIDI hardware, the image on the right the most recent. Note that the LEDs (5 green represent the address lines, the 8 red are fed by the data) serve no real purpose outside of whetting my appetite for das blinkenlights, although they were almost useful making sure the SysEx messages did the right thing.

Connection Notes

The reason I say this is the least efficient way of doing this is that it uses pretty much pin every the Arduino has to offer. A better way would be to whip something up with SPI or shiftOut() and a couple 74595s so you're only using 3 or 4 pins, but for my purposes this is fine.

You'll also notice I'm feeding the Arduino 12 volts. This is perfectly fine and actually needed because, as a mixed signal device, the SID requires both a Vcc (+5 volts) and a Vdd (+12 volts). The Uno's onboard regulator handles the 5 volts while we retain access to the source 12 through the Vin pin. If you're playing along at home using the later revision of the SID chip, the 8581 from the Commodore 64C, you should feed the Arduino 9 volts as the analog circuitry on the chip has slightly different voltage requirements than its predecessor.

Also included in the diagrams are a couple capacitors connected to pins 1-2 and 3-4. These capacitors are used by the chip to manage its filter so it's imperative that they be the right type and value listed in the data sheets, otherwise the SID chip's filters won't behave as expected.

In the circuit above, the green wires run from the Arduino's digital pins (and in one case A5) and are used to set the 8 bit values we'll use to control the various aspects of the SID's operation. The red wires on A0-A4 set the register, or what the 8-bit value we're sending represents.

In addition to the address and data lines, the SID requires a few other things be present:

Clock Signal

Both the 6581 and 8581 require a external clock. If you're shooting for fidelity with PAL-based C64s, this will need to be an 0.93MHz clock as it was fed from the same source as the computer's 6502. Since the frequency of this timer  is very important to the chip's oscillators, rather than build a clock circuit, I used one of the Atmel's timers exposed by the Arduino on pin D9.

Chip Select

This informs the SID chip that, in the event we have multiple sharing the same address and data lines, it's actually the one we're trying to control.

Chip Reset

In the very likely event you need to reset the SID chip, this is how you do it. Just to be safe, the SIDI firmware will do a proper reset after the Arduino bootloader's finished and the sketch is running.

Read/Write

This tells the chip whether we want to read or write data. Although we can read the data from the SID's various registers, we store the state of the chip in the Arduino's memory so this line is mostly used for writing.

Now that everything's theoretically hooked up properly, it's time to crack open the Arduino development environment and get started on what I called SIDI.

TL;DR

  • Arduino pins D13, A5, and D2-D8 drive the D0-D7 lines
  • Pins A0-A4 are used to drive the chip's address (A0-A4) lines
  • Pins 8, 10, and 11 are Reset, Read/Write and Chip Select (respectively)
  • Pin D9 is used as the SID's clock source
  • The SID chip's output pin goes to a male RCA plug connected to computer speakers