Thursday, February 13, 2014

Build the SoftSysSynth

For Software Systems, we're going to build an Arduino-based synthesizer called the SoftSysSynth.  Hopefully, it will be easier to build than to say.

Things you will need:

Super glue (if you want to mount the breadboard on the Arduino)
22 gauge insulated wire, ideally in different colors
Wire cutters
Wire strippers
Safety glasses (please don't cut wires and component leads without them!)
Pliers can help

Things that should be in the kit:

4 nylon spacers
a plastic sheet the size of the breadboard
mini breadboard
R2R SIP resistor array
op-amp
transistor
speaker
33K resistor
102 capacitor
LED
1K resistor
mini buttons or keypad

Software

In the GitHub repo in hw04, you should find Arduino sketches named wave, wave2 and wave3.

Here's the Fritzing diagram:


Speaker, LED and optional filters not shown.

Credits: Special thanks to Evan Dorsky and Prof. Brad Minch for their help designing and testing this project.

1) For my build, I glued a platform to the Arduino and then stuck a mini breadboard to the platform.  If you don't want to glue anything to your Arduino, you don't have to.  If you do, you'll need 4 spacers and a sheet of plastic the size of the breadboard.  I used super glue.


2) Position the R2R resistor array as shown (pin 1, marked with a dot, is on the left), and run wires to the Arduino headers.  The black wire goes to Ground.  The blue wires go to digital pins 6-13. The orange jumper takes the output of the R2R over to analog input A0.  Now you can run wave.ino to compare the input (0-255) to the output, which should be analog 0-5V.


3) Next, position the op-amp as shown (in this picture pin 1 is in the upper right).  Notice that pins 1, 2 and 3 are bent so they don't interfere with the R2R, but pin 4 is connected to the same ground as the R2R (also see the reverse photo below).  Run the output from the R2R to pin 5 of the op-amp (but unlike in the picture, you should just use one wire and run it diagonally, for reasons you will see soon).  The red wire connects pin 8 to 5V from the Arduino.


Add a short wire that connects pins 6 and 7 of the op-amp (that's the feedback).  Use the orange jumper to connect the output of the op-amp (pin 6 or 7) to analog pin A0.  You should be able to run wave.ino again and get the same results.


4) Position the transistor as shown.  The green wire connects the output from the op-amp to the base (middle wire) of the transistor.


Notice that the collector of the transistor also gets 5V from the Arduino.


5) Now the emitter of the transistor outputs the signal, but if you try to measure the voltage at the emitter, it doesn't work unless you add a resistor to simulate the speaker.  Position a resistor as shown (pretty much any resistor will do).  Also run the black wire to ground.  You should be able to run wave.ino again, but this time everything below 0.7 V gets clipped, which means output = input - 36, because 0.7 V / 5 V * 255 = 36.


6) Now mark the location of the speaker and run a wire from the emitter of the transistor to the speaker input.  Also, install the buttons as shown (you might have to straighten the pins to get them into the breadboard).  Check the orientation of the switches.  And run ground wires to the buttons.  For the wires that go under the speaker, I stripped the insulation so the speaker pins make a solid mechanical connection.


7) Connect an LED between digital pin 5 and the board, with the long leg in the Arduino header and the short leg in the breadboard.  Run a 1K resistor to ground (shown above).  Leave space between the op-amp pins and the resistor wire (or trim off the op-amp pins).    The green wires (shown below) connect the buttons to digital pins 2 and 3.



 8) OPTIONAL: we might want a low pass filter to attenuate sampling artifacts.  Replace the green wire with a 33K resistor, and run a 102 capacitor from the base of the transistor to ground.  I ran it over the top of the IC, which is not the prettiest choice.


 Here's a reverse view of the low pass filter elements.


9) OPTIONAL: we might want a high-pass filter to decouple the speaker from the DC part of the signal.  According to my calculations, we should replace the wire to the speaker with a 100 uF capacitor.  But when I tried it, it didn't work, so let's skip that for now.

 Reverse angle.

10) Place the speaker in the holes I marked black.  Run wave2.ino.  When you press the button connected to pin 2, you should hear a sawtooth tone.