Arduino Theremin/Synth Final Walkthrough

Part I: DemonstrationPart II: The HardwarePart III: The Software

enclosure

The Enclosure and Parts Sourcing: I think this is a sign for stores to put out if their restrooms are somewhat difficult to locate.  It was $8, which is kind of a lot for broken down Goodwill electronics, but as soon as I saw it I had to have it.  I also purchased an old clock radio for $2 for the power supply and speaker, and some kind of broken weather clock thingy for the blue LEDs for $0.50.

Just after midnight, forever

Just after midnight, forever

speaker-grille

Handy Tip: to drill out the speaker grille, I just taped the top part of the radio case, and drilled through the existing holes.

A lot of the parts were salvage from obsolete electronics that I’ve kept for that reason.  Total cost for the project was about $100, but a lot of that was ‘research’, AKA ‘buying things that I think will solve my problem, but don’t.’  I think the total cost if I just bought everything I needed the first time would be around $60, not including the enclosure.  The Arduino Pro ($23) and Parallax Ping ($30) were the big-ticket items.

I really need to own another color of hookup wire besides gray

I really need to own another color of hookup wire besides gray

This is an Unholy Mess. Let’s just get that out of the way.  I designed/built it part-by-part, on breadboard, then added each component onto the protoboard as I finished it, then crammed everything into the enclosure at the very end.  So the schematics I’m showing you were done after the fact, ymmv, the impermanence of memory, etc.  But it works, which is more than I can say for my fucking oscilloscope.

P1000471DNGPower Supply and Case Lighting: I just cut out the part of the radio chassis that had the transformer, and used that to mout it on the enclosure.  It’s a center-tap, 12:1 transformer, pretty standard.  I don’t like using line voltage in my projects, but I added a fuse and made sure the case was grounded, so it’s reasonably safe, I think.  The diodes, fuse holder, and smoothing capacitor were also salvage, from something else I had laying around.  The blue LEDs came from some kind of broken weather clock thingy that I bought at Surplus Gizmos for $0.50.  Here’s the schematic:

Schematic-PSU

The power supply and case lighting

The 9V powers the Arduino, which can take from 5-12V, and the sensor LEDs and ICs (not shown above).  Then I took the 5V output provided by the onboard voltage regulator on the Arduino and used it to power the things that had to have 5V, such as the Ping and photoresistor sensors.

Audio Output: The audio signal is generated from a PWM pin, as outlined here.  From there it passes through two low-pass filters that get rid of the noise from the pin banging on and off.  These can be omitted as the speaker will mostly filter anything that high out, but it sounds better with them.  Here’s some pictures of the audio circuit while it was still on breadboard:

Next it’s amplified by the ubiquitous and much-maligned LM386 audio amplifier.  I’m using the example circuit from the datasheet with the 6dB bass boost.  On the advice of the nice people from DIY audio forums, I increased the zobel capacitor from .05uF to .1uF, which got rid of a nasty high pitched tone when I connected the speaker.

Finally, it passes to the speaker and headphone jack, mounted in the bottom corner of the case:

headphone-jack

There’s a switch that allows you to disconnect the speaker (again from the clock radio, which gave so much to this project), and a headphone jack I pulled out of my old CD player, with a 10K pot sitting in front of it to control the output level to the headphones/external amplifier.  From the sample you can hear that the volume decreases significantly in the lower frequency range, because the cheap 4″ speaker that I had starts to drop out at around 500Hz.  But when I connected it up to my Macintosh 1700 amplifier, it’s a whole different animal :]   Here’s the schematic for that section:

schematic-AudioThe Sensors: As I covered in a prior post, these are wall anchor hardware with a photocell mounted inside.  I discovered that if I moved an LED nearer or farther from the sensor it gave a very linear, stable response.

push-button-2
top-view-with-sensor
I really like the way the sensors came out aesthetically– I used coaxial cable to do the LED runs, and it has a nice steampunk organ-stop look.  Also, with enough fussing I was able to get a very smooth, precise action out of the spring movement.  Here’s the schematic:

schematic-SensorThere’s one other trick I should talk about here, which is the use of the LM358 op-amp to provide the supply voltage for the sensors.  Originally, my schematic looked like this:

sensor-supply-original

Simple, right? You have the four photoresistors acting as a voltage divider with their respective 4.7Kohm resistors, so as they change in resistance it varies the voltage that the analog input on the Arduino sees.  Then, you have a pot feeding all of them, which you can adjust to get the right range selection.  The problem was that as I would vary one sensor, it would affect all the others.  After a lot of thinking, here’s why: each photoresistor is a voltage divider (#1), but there is also a composite voltage divider made up of the equivalent resistance of all four sensors, and the 10Kohm pot, which would cause the supply voltage to vary feeding into #1.  Using an op-amp as a unity-gain buffer amplifier solved this problem.  A heartfelt shout out to Ran Talbott on the Arduino forums who suggested the buffer amp.

Also: I also ran an LED from PWM pin 11 on the arduino to just behind the center of the torso, where the sensor LED wires enter the enclosure.  I set the value to increment every time the software runs through the main loop, so the heart pulses slower or faster depending on processor load.

heartbeat

The complete schematic is available as a pdf and an Eagle sch file.  As I mentioned, the schematic was done from memory, after the fact, so I would breadboard it before you build a custom pcb.  If you do design a custom circuit board for it, or improve the hardware, drop me a line, I’d love to hear about it.

incrementalism

"Why Incrementalism is Bad Design," A photo-essay by Max Pierson

Go to Section:

  1. Part I: Demonstration
  2. Part II: The Hardware
  3. Part III: The Software
  4. View All

Pages: 1 2 3


Leave a Reply