Arduino Light Instrument

Arduino Light Instrument

This project creates an instrument that’s pitch is determined by the light level. Move your hand over the
light or air strum over it at different heights to block more or less light creating different pitches.

Components Needed:

1x Breadboard
1x Arduino
2x LDRs
2x 100 or 220 Ohm Resistor
2x 10K Resistors
2x Speakers or Piezo Buzzers

Components can be found at
This Project uses and Arduino Board and LDR Add-on Kit

The Code:

void setup() {
void loop() {
int sensorReading = analogRead(A0);
int sensorReading1 = analogRead(A1);
int thisPitch1 = map(sensorReading, 400, 1000, 120, 1500);
tone(10, thisPitch1, 10); // change the last value to change how long the speaker holds it's tone for.
delay(100); // Change delay time for different timing, but don't go under tone duration of 10.
int thisPitch2 = map(sensorReading1, 400, 1000, 120, 1500);
tone(11, thisPitch2, 10);


Go to for more fun projects!



  • Epilog X Contest

    Epilog X Contest
  • Warm and Fuzzy Contest

    Warm and Fuzzy Contest
  • Cardboard Challenge

    Cardboard Challenge


Daniel Thomson

1 year ago

the code doesn't want to compile... any suggestions?