Light theremin
Two LDRs control pitch and note rate as you move your hands over them, like a theremin played with shadows.
Build it step by step
0 of 6 doneWire the sensors
Build the two LDR dividers and read them on A0 and A1.
Print the readings
Add Serial prints temporarily to see the range for light and shadow.
Calibrate
Reset and wave your hands over both sensors for four seconds.
Play
Move one hand to change pitch and the other to change how often notes sound.
Smooth it
Change the 0.8 and 0.2 values until the notes stop jittering.
Mark the sensors
Stick labels on them so players know which does pitch and which does speed.
How do you build a light theremin?
Two LDRs control pitch and note rate as you move your hands over them, like a theremin played with shadows. You need Arduino Uno R3, LDR Photoresistor × 2, Resistor 10 kΩ × 2, Passive buzzer, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 6 steps and about 45 minutes.
- Level
- Beginner
- Time
- About 45 min
- Parts
- 6
Parts list
- Development BoardsBuyArduino Uno R3 × 1
- SensorsBuy
- PassivesBuyResistor 10 kΩ × 2
- Motors & ActuatorsBuyPassive buzzer × 1
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| 5V | LDR 1 and LDR 2, one leg each | Top of the dividers |
| LDR 1 other leg | Uno A0 and 10 kΩ resistor to GND | Pitch input |
| LDR 2 other leg | Uno A1 and 10 kΩ resistor to GND | Note-rate input |
| Uno D8 | Passive buzzer + | Sound |
| Passive buzzer - | Uno GND | Return |
Code
Arduino IDE, board "Arduino Uno". No libraries needed. Keep room light steady while you play. For a smoother tone try a small speaker through a 100 Ω resistor in place of the buzzer.
Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
const byte PITCH = A0, RATE = A1, BUZZER = 8;
int pLo = 1023, pHi = 0, rLo = 1023, rHi = 0;
float pSmooth = 0, rSmooth = 0;
void calibrate() {
unsigned long t = millis();
while (millis() - t < 4000) { // wave your hands over both sensors for 4 seconds
int p = analogRead(PITCH), r = analogRead(RATE);
pLo = min(pLo, p); pHi = max(pHi, p);
rLo = min(rLo, r); rHi = max(rHi, r);
delay(5);
}
}
void setup() {
pinMode(BUZZER, OUTPUT);
calibrate();
}
void loop() {
int p = analogRead(PITCH), r = analogRead(RATE);
pSmooth = 0.8 * pSmooth + 0.2 * p; // smooth to stop jitter
rSmooth = 0.8 * rSmooth + 0.2 * r;
int freq = map((int)pSmooth, pLo, pHi, 200, 1200);
int gap = map((int)rSmooth, rLo, rHi, 400, 20); // lower gap means notes more often
freq = constrain(freq, 100, 2000);
gap = constrain(gap, 20, 400);
tone(BUZZER, freq, 60);
delay(gap + 60);
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Hand over pitch sensor | Pitch falls or rises smoothly |
| Hand over rate sensor | Notes come faster or slower |
| Both uncovered | Steady high notes |
| No movement | Steady repeating note |
If it does not work
No sound
A passive buzzer needs tone(). Check D8 and the wiring.
Always the same note
Calibration failed. Reset and wave over both sensors.
Notes jitter
Increase the smoothing weight or shade the sensors from other lights.
Pitch backwards
Swap the min and max in the map or swap the LDR and resistor positions.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the light theremin?
Arduino Uno R3, LDR Photoresistor × 2, Resistor 10 kΩ × 2, Passive buzzer, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).
How long does the light theremin take to build?
About 45 minutes for a beginner maker, in 6 steps.
How do I know the light theremin works?
Hand over pitch sensor: Pitch falls or rises smoothly. Hand over rate sensor: Notes come faster or slower. Both uncovered: Steady high notes.
No sound: what should I check?
A passive buzzer needs tone(). Check D8 and the wiring.
Always the same note: what should I check?
Calibration failed. Reset and wave over both sensors.
Notes jitter: what should I check?
Increase the smoothing weight or shade the sensors from other lights.
Pitch backwards: what should I check?
Swap the min and max in the map or swap the LDR and resistor positions.
