Starting Electronics Needs Your Help!
It is that time of the year when we need to pay for web hosting and buy new components and equipment for new tutorials. You can help by making a donation. Contribute to this website by clicking the Donate button. The total will be updated once daily. (You may need to clear your browser cache to see the updates.)

Target Amount: $2000
Amount Raised: $1960

Donations Received

Top Donor: C.C. $100


Project 5: Play Different Tones as Light Intensity Changes (tonePitchFollower)

Created on: 2 August 2012

Tutorial 10 – Pages

A tone will be played on the loudspeaker that will change pitch as the light intensity levels on the LDR change. Moving your hand around the LDR will cause the light intensity to change. The value from the LDR is read on the Arduino analog pin A0. This value is displayed on the Arduino serial monitor window.

Parts Needed

  • 1 × LDR (Light Dependent Resistor)
  • 1 × 8 ohm loudspeaker
  • 1 × 4k7 resistor
  • 1 × 100 ohm resistor

Arduino Website Page


In the Arduino IDE

File → Examples → 2.Digital → tonePitchFollower

Building the Circuit

The circuit diagram and breadboard connections can be found on the tonePitchFollower page on the Arduino website.

Programming and Operating the Circuit

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.

Project 5 Video

Can't see the video? View on YouTube →

← Go back to P4: ButtonGo to P6: AnalogInOutSerial →