Introduction: Arduino Photocell Theremin Synth (glitchamin)

Picture of Arduino Photocell Theremin Synth (glitchamin)

You know theremins, right?  Those cool-looking boxes with antennae that produce noise without being touched?  They are played by the likes of Jimmy Page of Led Zeppelin, and present in the soundtracks of countless films.  Well, with this instructable, I will show you how to build an approximation of a theremin (in principle, at least) using some basic electronics built on top of an Arduino, which I call a glitchamin.  This circuit features adjustable parameters and an optional kill switch, and information on hooking it up to an amplifier for the full-on concert glitchamin experience.

[Sorry for the blur in the photo below]

Step 1: Part List

Picture of Part List

Before you can get started on any project, you need to make sure you have all the parts.  Here's a rundown of what's necessary for this build.

Parts:
1x Arduino (I used a Duemilanove with a 328, but the circuit and code are light enough that any Arduino board should work)
1x half breadboard (the circuit could easily be replicated on perfboard)
1x momentary pushbutton (optional, for kill switch)
2x potentiometer (I used 1kOhm and 10kOhm, but similar values should be acceptable)
1x CdS Photocell resistor (the heart of the glitchamin)
2x 10kOhm resistors (brown-black-orange-gold, 1 is optional, for the kill switch)
1x piezo buzzer
1x 1/4" mono audio jack (optional, for attaching to amplifier)
Wire

Everything you need, with the exception of the piezo buzzer and the mono jack, is in the kit "Arduino Budget Pack" from Adafruit Industries.  I used Radio Shack to get the piezo and the mono jack.

Step 2: Attach the Potentiometers

Picture of Attach the Potentiometers

Take the two potentiometers, and insert them into the breadboard in some convenient location.  Then, take some wire, attaching the left lead on each to 5v, the right to gnd, and the middle (wiper) pin to Analog inputs 1 and 2.  The pot attached to a1 controls to some extent the pitch by trimming the sample time.  The pot attached to a2 controls the decay of the sample by mapping the number of cycles the sample lasts.

Step 3: Wire in the CdS Photoresistor

Picture of Wire in the CdS Photoresistor

Next comes the CdS photoresistor.  This cool part has a higher resistance when it's in a dark environment, and a lower resistance when there is light.  CdS photoresistors are not polarized, so you can't put them in wrong, however, they do need an additional resistor to complete the voltage divider.
So, take your CdS cell, and insert it into your breadboard, connecting one lead to 5v, and one to a 10kOhm resistor, connected to gnd.  Then connect the middle pin (where the CdS cell and the resistor meet) to Analog input 0 on the Arduino.

Step 4: Insert the Kill Switch (optional)

Picture of Insert the Kill Switch (optional)

This step is optional.  Only follow this step if you want to have a kill switch in your circuit, which cuts off the sound output to the piezo (or mono jack) while it's pressed.  I like to include these in all of my instruments and synths, because I like to do sudden changes and the stutter effect that having a kill switch allows.
If you wish to install a kill switch, insert your push button into your breadboard, minding orientation to ensure that you don't short the kill pin.  You want to attach it so that attached leads are in the same rail, and unattached leads are in separate rails.  Attach one lead to Digital pin 10, and the attached lead to gnd through a 10kOhm resistor.  Attach one of the other leads to 5v.  This button will read LOW while open, and HIGH while pressed.

Step 5: Insert the Piezo (or Mono Jack)

Picture of Insert the Piezo (or Mono Jack)

You have another option this step.  You can either install a piezo buzzer for a standalone system, or a 1/4" mono jack to allow for amplification.  The process for either is simple, though.  For a piezo setup simply insert the positive (red, on most buzzers) lead into Digital pin 9 on the Arduino, and the other lead to gnd.  For the mono jack setup, you need to solder some leads onto the jack, and then connect the tip to d9, and the barrel to gnd.  Regardless of either setup, you are now done with the building of the circuit.

Step 6: Program the ATMEGA

The last step is to program the ATMEGA chip using the Arduino software.  Download the attached sketch (glitchamin.pde) and upload it to your Arduino.  If you're not using the kill switch, comment out the line "#define KILLSWITCH".  This will prevent any killswitch related code from being generated.  If you would like to tweak some things, or debug your setup, uncomment the line "#define DEBUG".  This enables the Serial monitor (running at 115200 baudrate), which spits out the current values of the CdS, both pots, and the kill switch, every time it goes through the loop().  However, doing so slows down the loop quite a bit, causing some sound distortion, so be sure to disable it when you move to your finished circuit.

Step 7: Finished!

Picture of Finished!

To use this away from a computer, you'll need to find a power source.  I use a 9v battery connected to a barrel plug, and it works perfectly for this circuit.

Now the only thing you have to do with it is have fun!  Feel free to hack it, modify it, etc, etc.  If you used this for something, or found a cool way to modify it, please drop me a link, I'd love to see it.

Comments

nsanedrac (author)2015-07-25

Hey awesome man! Works great! thank you very much! Would love some lights on how to modify the code concerning the sound or how to move forward!

Tookkyyoo (author)2015-02-17

Anyone have a link to the code?

betadata1 (author)2014-09-13

Hi, great project! It was fun! Attached is my build of your theremin. Works great! I'm gonna hack it in a bit to get the sound I want. Will upload mod soon. Thank you for the great design, Gatesphere.

ICDab (author)2014-02-19

Hey man great project just finished! and thank you again :) i had one question is there any way to change the code to make the signal sound different?

faziefazie (author)2013-04-13

can i using this mono jack instead of yours?

leeseibert (author)2013-03-11

I did a project similar to this one. Then I shrunk it down to an ATTiny85 chip. Check it out here: https://www.youtube.com/watch?v=BsKRtUCCle4

sokbok (author)2013-03-06

awesome. Id like to try some other CdS photoresistors. Any recommendations? What about using a full solar panel through some kind of transistor? An audio way to fine tune the solar gain of a panel

NolagTheOrc (author)2013-01-09

will two 5kohm potents work?

fatboy106 (author)2011-05-07

You have successfully helped me annoy my family.

gatesphere (author)fatboy1062011-05-07

Nice. :)

arduino man (author)2011-01-11

I can't get the code

gatesphere (author)arduino man2011-01-11

I just clicked the link... it works for me. Anyways, here's an alternative link: http://suspended-chord.info/downloads/glitchamin/glitchamin.pde

arduino man (author)gatesphere2011-01-12

thanks

About This Instructable

24,632views

57favorites

License:

Add instructable to: