Introduction: Theremin

Picture of Theremin

Actually, I wasn't planing on making a theremin, I was exploring the arduino sound capability and kinda drift into it...
This is an easy Saturday project.


You will need :
Arduino - I used the pro mini
220 ohm resistor
A speaker
an Infrared proximity sensor

Step 1: Explanation

Picture of Explanation

The arduino sens the proximity of the hand and divide it to 15 notes according to the 4th and 5th octave ending with the 6th C to realize what note to play
Then according to where the output Hertz are at the moment it will decrease or increase to match that note.

Step 2: The Code

Picture of The Code
int oct [15] = {262, 294, 330, 349, 392, 440, 494, 523, 587, 659, 698, 784, 880, 988, 1047};
int Play = oct [0];
void setup (){
    pinMode (5, OUTPUT);
    pinMode (A1, INPUT);
    Serial.begin (9600);
void loop (){
  int Hz = constrain (map (analogRead (A1), 100, 500,0, 14), 1, 14);
  Serial.println (Play);
  if (Play > oct [Hz]) {Play = Play - 6;}
  if (Play < oct [Hz]) {Play = Play+6;}
  tone (5,Play );
   // delay (100);


udubinsky (author)2015-02-25


The code will not work as is with hc-sr04. the hc-sr04 communicate differently with the arduino.
The transistor is not included in the partlist by mistake, it is a regular NPN 2222 transistor.
The code might work as is in another sketch if you keep the pins setting on the arduino and also depend on your surcuits.

terrible tinkerer (author)2015-02-25

Hi udubinsky, very nice ible. Your theremin is achieved using the smallest number of parts that I've seen, which is cool. Would this code work if I used an hc-sr04 as proximity sensor? & as I'm not very code savvy can I just cut & paste the pieces of your code into an arduino sketch to make it work? I see a transistor that's not included in your parts list. Any particular one?

You obviously know your stuff cuz I have no idea what your saying with your dividing notes & octaves!

Kiteman (author)2015-01-31

If you lowered the tone a bit, this would make a brilliant booby-trap, squawking as folk walked past or reached over it.

About This Instructable




More by udubinsky:ENC28J60 Using Ethernet With ArduinoElectro Double Pie Face Showdown Never Forget It on - Energy Saver
Add instructable to: