I’ve spent a fair bit of time playing with the Control_Echo_Theremin example and finally committed it to stripboard.
I was originally aiming for a fully self-contained module, speaker and all, but after a day or so trying to find a simple amplifier that works well with a PWM output, I’ve put that on hold for the time being (more on that another time).
Warning! I strongly recommend using an old or second hand keyboard for your experiments. I am not responsible for any damage to expensive instruments or amplifiers!
Tutorials used in this project:
If you are new to Arduino, see the Getting Started pages.
Parts list
- Arduino Pro Mini (5V/16MHz)
- 1x 270Ω resistor
- 1x 75Ω resistor
- 1x 10k resistor
- 1x 100nF capacitor
- 1x 10uF non-polar capacitor
- 1x Light Dependent Resistor (LDR)
- 3.5mm Jack Socket
- PCB mounted switch
- Header pins
- Strip or proto board
The Circuit
This circuit is designed to go back-to-back with the Pro Mini, not as a “shield”. If the above diagram is a little confusing, here is the schematic.
It is basically the LDR circuit attached to A2 and the Mozzi Output Circuit – Part 2 on D9 powered via a switch into the RAW input for the Pro Micro. The eventual aim will be to power it all from a 9V battery.
The 10uF capacitor (C2) is actually a non-polar type in my circuit, so ignore the polarity indications as it isn’t relevant in this case.
The whole thing was build on a 12×7 piece of proto board as shown below.
And the final thing, showing the “back to back” orientation of the Pro Mini is shown below. I didn’t bother with headers for the Pro Mini, preferring the “slimmer” result of soldering the two together. Although note that I didn’t solder every pin to the Pro Mini – just the ones I needed and a couple of extras for support.
The Code
This is still using the provided Mozzi example “Echo_Control_Theremin” as described previously. There is one small change – in order to have a slightly simpler connection to the LDR, it was connected to A2 instead of A0, so the following line was changed in the example:
#define INPUT_PIN 2 // analog control input
Closing Thoughts
I wanted to include a simple amplifier and build in a speaker, but it turns out that amplifying a PWM output signal isn’t as straight forward as using a cheap, off-the-shelf “class D” amplifier, which was my first idea so I’m investigating alternatives.
For now though, I like how this has turned out.
Kevin