Introduction: Digital Light Theremin

You may not be aware of what a theremin sounds like, but I assure you that most people are familiar with it. It is the common sound in horror shows and alien soundtracks!

The theremin is an electronic musical instrument that can make create unique sounds without any physical contact, separating it from all the other traditional instruments. The theremin is capable of controlling the frequency (oscillation) and amplitude (volume) produced.

This project replaces the two metal antennas with a light dependent resistor or a photoresistor to determine the frequency and volume produced by a piezo buzzer. Thus, resulting in a digital light-controlled theremin

Step 1: Tools and Materials

  • Arduino 101 or Arduino Uno
  • Buzzer
  • Light Dependent Resistor
  • 10K Ω resistor
  • Jumper Cables

Step 2: Circuitry

Wiring the Arduino Power to the Breadboard
  • Connect the 3.3V pin from the Arduino to the breadboard's red power rail.
  • Connect the GND pin from the Arduino to the breadboard's black power rail.

Connecting the Buzzer to the Arduino

  • Connect one of the pins of the buzzer to the digital pin 9 on the Arduino.
  • Connect the remaining pin to the black power rail int he breadboard.

Connecting the Light-dependent resistor (LDR) to the Arduino using a voltage divider

  • Connect one of the pins in the LDR to the 3.3V power rail in the breadboard.
  • Then connect the 10k Ω resistor to the other pin of the LDR in series to ground, the black power rail in the breadboard.
  • Lastly, connect the LDR pin connected to the 10k resistor to the analog pin 0 of the Arduino.

Step 3: Code

int photopin = 0; // Pin where the photo resistor is connected to
int photValue; // The analog reading from the photoresistor
int buzzerPin = 4; // Connect Buzzer to Pin 4
long buzzerFreq; // The frequency to buzz the buzzer
// You can experiment with these values:
long buzzMAX = 2500; // Maximum frequency for the buzzer
long photoMAX = 1023; // Maximum value for the photoresistor
void setup() {
    pinMode(buzzerPin, OUTPUT); // set a pin for buzzer output
}
void loop() {
    // read the values of the potentiometer
    photValue = analogRead(photopin); // Values 0-1023
    // normalize the readings of a photoresistor to thatof the buzzer and photoresistor
    buzzerFreq = (photValue * buzzMAX) / photoMAX;
    buzz(buzzerPin, buzzerFreq, 10);
}
void buzz(int targetPin, long frequency, long length) {
    long delayValue = 1000000/frequency/2;
    long numCycles = frequency * length/ 1000;
    for (long i=0; i < numCycles; i++){
        digitalWrite(targetPin,HIGH);
        delayMicroseconds(delayValue);
        digitalWrite(targetPin,LOW);
        delayMicroseconds(delayValue);
    }

}

Step 4: Demo

Moving the positioning of my hand, I can control the amount of light that the LDR detect, therefore changing the analog input being read by the Arduino, which then changes the amplitude and frequency produced by the buzzer. This completes the Digital Light Theremin!

Enjoy making your own music!

Makerspace Contest 2017

Participated in the
Makerspace Contest 2017

Invention Challenge 2017

Participated in the
Invention Challenge 2017