# Theremin Box

335

7

1

In this instructable you will learn how to make a small theremin fastened inside a box. This project revolves around use of the Arduino (Uno) and a small list of other materials. Above is a video that depicts the use of the circuit. I used a complete second set of materials and another buzzer to increase the range of sound being emitted.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Tools and Materials

You will need:

-1 CDS Photoresistor

-2 220k resistors

-1 Piezo Buzzer

-Arduino (I used the Arduino Uno)

-A soldering iron

-Wires to connect pins to breadboard from Arduino

-Solder

## Step 2: Arduino Code

The following code was put together by a man named António Lopes. I edited the code to adjust for my project and how I had everything wired. The code I used:

int prPin = A1
; // Pin where the photo resistor is connected to

int buzzerPin = 7; // Connect Buzzer to Pin 4

long buzzerFreq; // The frequency to buzz the buzzer

// You can experiment with these values: long BUZZ_FREQ_MAX = 2500; // Maximum frequency for the buzzer

long PR_MAX = 1023; // Maximum value for the photoresistor

void setup() { pinMode(buzzerPin, OUTPUT); // set a pin for buzzer output Serial.begin(115200);

}

void loop() {

buzzerFreq = (prReading * BUZZ_FREQ_MAX) / PR_MAX;

buzz(buzzerPin, buzzerFreq, 100);

}

void buzz(int targetPin, long frequency, long length) {

long delayValue = 1000000/frequency/2;

long numCycles = frequency * length/ 1500;

for (long i=0; i < numCycles; i++){

digitalWrite(targetPin,HIGH);

delayMicroseconds(delayValue);

digitalWrite(targetPin,LOW);

delayMicroseconds(delayValue);

}

}

The schematic that I followed was also generously posted by António Lopes. Above is a the picture I found on his website www.antoniolopes.info. I changed a couple of pins and the buzzer's frequency around but for the most part it's pretty similar. If all of the pins are matching between the code and Arduino, the buzzers frequency should respond to how much light is around the sensor. (Or sensors in my case)

## Recommendations

• ### Internet of Things Class

22,844 Enrolled

## Discussions

I've always loved the theremin! Thanks for sharing and welcome to the community!