Secondary Menu

Make a Pocket-Size Theremin With ESP32

Theremin are those unique instruments use to make those alien show theme songs or sound effect. You may have also heard it in Star Trek, Big Bang Theory, or even a haunted house. They produced a unique sound from the electromagnetic effects between wires.

Here we will duplicate a similar sound digitally using a buzzer controlled by Pulse Width Modulations and an Light Dependent Resistor (LDR) for the input of reading values as the hand moves over it.

Step 1: BoM

* ESP32

* Light Dependent Resistor (LDR)

* Buzzer

* Jumper Wires

* Breadboard

Step 2: Soldering

We will solder a voltage divider onto the LDR to make the wiring simpler.

* Take a 10kΩ resistor and solder it to one of the pins of the LDR.

* Then take two different coloured wires and solder it to each pin of the LDR.

That's it! Now you have a voltage divider!

Step 3: Wiring

Follow the following table when wiring the LDR and Buzzer to the ESP32:

I/O

Pin #

ESP32 Pin #

Buzzer*

1

D4

Buzzer*

2

GND

LDR

Resistor

D5

LDR

Grey

3.3V

LDR

Red

GND

* Order is arbitrary

Step 4: Code

int photopin = 5; // 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