Friday, February 15, 2013

How to: Build an SN76489 USB MIDI Module

Overview: 
With a pre-programmed Teensy, it is very easy to make a simple SN76489 USB MIDI module.

The SN76489 USB MIDI maps to the SN76489 in the following way:
MIDI Channel 1 --> SN76489 Square Wave 1
MIDI Channel 2 --> SN76489 Square Wave 2
MIDI Channel 3 --> SN76489 Square Wave 3
MIDI Channel 4 --> SN76489 Noise Channel

Actually, the mapping is pretty much identical to the SMSM mapping for the SN76489 - see this text document for more information. 

The source code for this project can be found here, and should be uploaded to the Teensy using the Teensyduino and Arduino software. 



Pinouts: 





The Quick Version: 

From: To:
Teensy Digital Pin 0 SN76489 Pin 10
Teensy Digital Pin 1 SN76489 Pin 11
Teensy Digital Pin 2 SN76489 Pin 12
Teensy Digital Pin 3 SN76489 Pin 13
Teensy Digital Pin 4 SN76489 Pin 5
Teensy Digital Pin 5 SN76489 Pin 15
Teensy Digital Pin 6 SN76489 Pin 1
Teensy Digital Pin 7 SN76489 Pin 2
Teensy Digital Pin 8 SN76489 Pin 3
Teensy Ground SN76489 Pin 8, Pin 6, Crystal Ground
Teensy 5V SN76489 Pin 16, Crystal 5V
Crystal Clock Signal SN76489 Pin 14
SN76489 Pin 7 Audio Output Signal





The Step By Step Version:

Let's start with an empty breadboard! It has rows separated by a central column, and two pairs of vertical buses (marked + and -). Each row of five points is electrically connected. Each vertical bus is a continuous connection. Easy!


Put the pre-programmed Teensy on the breadboard.


Put the SN76489 on the breadboard, with pin 1 and 16 closest to the Teensy (refer to pinout diagram above). 


Put the crystal on the breadboard, with the 5V pin closest to the SN76489 (refer to pinout diagram above).


Connect the ground of the Teensy to a vertical bus on the breadboard. In this image, I've chosen to do so on the negative (-) blue bus. 


Connect the 5V VCC of the Teensy to a vertical bus on the breadboard. In this image, I've chosen to do so on the positive (+) red bus.  


Connect pin 8 of the SN76489 to the vertical ground bus.


Connect pin 6 of the SN76489 to the vertical ground bus. 


Connect pin 16 of the SN76489 to the vertical 5V bus. 


Connect the ground pin of the crystal to the vertical ground bus.


Connect the 5V pin of the crystal to the vertical 5V bus.


Connect the output pin of the crystal to pin 14 of the SN76489.


Connect digital pin 0 (marked B0) of the Teensy to pin 10 of the SN76489.


Connect digital pin 1 (marked B1) of the Teensy to pin 11 of the SN76489. 


Connect digital pin 2 (marked B2) of the Teensy to pin 12 of the SN76489. 


Connect digital pin 3 (marked B3) of the Teensy to pin 13 of the SN76489. 


 Connect digital pin 5 (marked D0) of the Teensy to pin 15 of the SN76489.

Connect digital pin 6 (marked D1) of the Teensy to pin 1 of the SN76489. 


Connect digital pin 7 (marked D2) of the Teensy to pin 2 of the SN76489.  


Connect digital pin 8 (marked D3) of the Teensy to pin 3 of the SN76489.  


Connect digital pin 4 (marked B7) of the Teensy to pin 5 of the SN76489.  


Take an audio jack. Connect the tip (signal) of the jack to an alligator lead. Connect the ring (ground) of the jack to an alligator lead.


Connect the signal alligator lead to pin 7 of the SN76489, using a small breadboard jumper to connect to the pin. Connect the ground alligator lead to the vertical ground bus.

1 comments:

Anonymous said...

Check out http://harizanov.com/2013/04/crazy-high-frequency-pwm-with-atmega32u4/. This will let you have the teensy generate the clock signal for the sn76489. Make sure to change pin13 to pin10 in his script. Clock output will be on physical pin c7.