Optical Theremin With Arduino Uno




Introduction: Optical Theremin With Arduino Uno

About: MakeCrate provides coding and engineering kits and online curriculum to get kids excited about making!

A theremin is an electronic instrument in which two high-frequency oscillators control tone while the musicians hand movements control the pitch.

In this Instructable, we'll build a similar instrument, in which hand movements control the amount of light that the instrument's sensors receive, and that light measurement is converted into a resulting pitch from a buzzer.

Parts you'll need:

Arduino microcontroller


10 K Ohm resistor

Jumper wires

1 Piezo Buzzer


Step 1: Connect to Power

Start by connecting your breadboard's positive row to the 5V pin on the Arduino Uno.

Step 2: Connect to Ground

Then connect one of the GND pins to the negative line on your Arduino.

Step 3: The Buzzer

Insert your buzzer. It likely has a longer leg, or a small "+" sign on the top. Keep track of which side the longer leg or "+" sign are on.

Step 4: Ground the Buzzer

Connect the shorter leg of the buzzer to ground by inserting a wire in the same row as the shorter leg of the buzzer, and in the negative line on the breadboard.

Step 5: Power the Buzzer

Complete the buzzer circuit by connecting it to pin 12 on the Arduino.

Step 6: The Photoresistor

Start building the photoresistor circuit by inserting the photoresister so that it has one leg on each side of the channel down the middle of the breadboard.

Step 7: Connect the Photoresistor to Power

Use a wire to connect one leg of the photoresistor to the positive line on your breadboard that you connected to 5V earlier.

Step 8: Ground the Photoresistor

Connect the photoresistor's other leg to ground, connecting the 10K Ohm resistor to the negative line on your breadboard.

Step 9: Step 9: Connect the Photoresistor to the Arduino

We'll read the change in current through the resistor by connecting a wire between the photoresistor and its ground wire, back to pin A0 on the Arduino.

Step 10: Step 10: Write Your Code

int analogPin = A0;

int noteToPlay;

int sound; int speaker = 7;

void setup() {


pinMode(analogPin, INPUT);


void loop() {

sound= analogRead(analogPin);


int notes[21] = {65, 73, 82, 87, 98, 110, 123, 131, 147, 165, 175, 196, 220, 247,262, 294, 330, 349, 392, 440, 494};

noteToPlay= map(sound, 0,1023, 0, 21);

tone(speaker, notes[noteToPlay]); delay(10);


Step 11: Want More Projects Like This?

Check out MakeCrate!

1 Person Made This Project!


  • New Year, New Skill Student Design Challenge

    New Year, New Skill Student Design Challenge
  • Raspberry Pi Contest

    Raspberry Pi Contest
  • Photography Challenge

    Photography Challenge



1 year ago

Hi there,

I just made this and found out that there is a mistake in the code which I copy pasted from this Instructable.
It says to connect the speaker to pin 12, but when I did this, nothing happened... I checked the code and saw that it says: int sound; int speaker = 7;
So when I connected the speaker to pin 7, it worked perfectly :)

Besides from that, this is a really fun and easy project with which I intend to play around a bit more.
Thanks for sharing!


3 years ago

This looks like a really fun project! Thanks for sharing!