Optical Theremin With Arduino Uno

by MakeCrate in Circuits > Arduino

4155 Views, 13 Favorites, 0 Comments

Optical Theremin With Arduino Uno

Optical Theremin Intro
theremin.jpg

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

Breadboard

10 K Ohm resistor

Jumper wires

1 Piezo Buzzer

Photoresistor

Connect to Power

Speaker set up directions5.png

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

Connect to Ground

Speaker set up directions7.png

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

The Buzzer

Speaker set up directions9.png

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.

Ground the Buzzer

Speaker set up directions11.png

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.

Power the Buzzer

Speaker set up directions13.png

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

The Photoresistor

MusicCrate Optical Theremin7.png

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.

Connect the Photoresistor to Power

MusicCrate Optical Theremin9.png

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

Ground the Photoresistor

MusicCrate Optical Theremin11.png

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

Step 9: Connect the Photoresistor to the Arduino

MusicCrate Optical Theremin13.png

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: Write Your Code

int analogPin = A0;

int noteToPlay;

int sound; int speaker = 7;

void setup() {

Serial.begin(9600);

pinMode(analogPin, INPUT);

}

void loop() {

sound= analogRead(analogPin);

delay(200);

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);

}

Want More Projects Like This?

makecrate_logo_final.jpg

Check out MakeCrate!