Back to Projects
BeginnerArduino Uno R3
15 minutes build
Light theremin
An instrument you play by waving your hand over a light sensor.
Interactive Simulation
Light thereminarduino-uno
Required Components Checklist
Assembly Steps
1
Sensor divider
LDR from 5V to A0, 10 kΩ from A0 to GND.
2
Map to pitch
Convert the reading to 120–1500 Hz and play it with tone().
Arduino Sketch
const int SENSOR = A0;
const int BUZZER = 8;
void setup() {
Serial.begin(9600);
}
void loop() {
int light = analogRead(SENSOR);
int pitch = map(light, 100, 1000, 120, 1500);
pitch = constrain(pitch, 120, 1500);
tone(BUZZER, pitch, 40);
Serial.println(pitch);
delay(50);
}
Challenges & Extensions
Ready to take this project further? Try these challenges:
- •Snap the pitch to musical notes (a scale array).
- •Add a button that mutes the sound.
- •Calibrate the range during the first 5 seconds.