Open main menu

Potentiometer and speaker circuit with Arduino

This example shows how to read a potentiometer using the Arduino and use its value to change the frequency of a sound coming out of a speaker.

Open the Serial Monitor window in the Arduino software to view the debugging messages output by the program.

The circuit

Potentiometer and Speaker Circuit with Arduino

The code

Potentiometer and speaker circuit with Arduino code


  1. The speaker is connected directly to power and ground... Isn't that a short circuit and therefore dangerous?
  2. The sound produced by this circuit is not very loud. What would you have to do to get the sound louder?
  3. Are we having fun yet?


What links here