Created on: 2 August 2012
Updated on: 17 January 2023
In this Arduino tutorial for beginners a tone is played on a loudspeaker that changes pitch as the light intensity levels on an LDR change. Moving your hand around the LDR causes the light intensity to change. The value from the LDR is read on the Arduino analog pin A0. This value is displayed in the Arduino serial monitor window.
An Arduino Uno, USB cable, breadboard and wire links are needed for the Arduino tone pitch follower project, as well as the following electronics components.
The following video shows that moving one's hand around the LDR causes the light levels on the LDR to change. This in turn causes the tone on the loudspeaker to change.
The tonePitchFollower Arduino web page shows the circuit diagram and breadboard layout for this project.
Find the sketch for this project by selecting File → Examples → 2.Digital → tonePitchFollower from the top menu of the Arduino IDE.
The circuit diagram and breadboard connections can be found on the tonePitchFollower page on the Arduino website.
To build the circuit, use a breadboard to connect a 100Ω resistor to pin 8 of the Arduino. Now connect one of the loudspeaker leads to the free end of the 100Ω resistor. Connect the other loudspeaker lead to an Arduino GND pin.
Connect one of the LDR pins to the Arduino 5V pin, and the other to the Arduino A0 pin. Finally connect a 4k7 resistor from the A0 pin to an Arduino GND pin.
Select File → Examples → 2.Digital → tonePitchFollower in the Arduino IDE to open the sketch for this project. Upload the sketch to the Arduino board.
If you would like to see the values that are being read on analog pin A0 of the Arduino, then open the serial monitor from the Arduino IDE. Move your hand around the LDR and hear the pitch played on the loudspeaker change.