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: $1159
Top Donor: C.C. $100
Created on: 2 August 2012
An analog value is continuously read from one of the analog input pins of the Arduino board. The analog value that is read is continuously sent out of the serial port and displayed in the Arduino IDE serial monitor window. A potentiometer is used to change the analog value.
1 × 10k panel-mount potentiometer or 10k preset potentiometer.
If you don't have a potentiometer, you can still load the program and measure analog values from the 5V, 3.3V and GND pins of the Arduino using a wire link.
File → Examples → 1.Basics → AnalogReadSerial
If you are using a panel-mount potentiometer, then connect it to the Arduino board as shown on the Arduino website page for this project.
If you are using a preset potentiometer, then it will be easier to use a breadboard to connect the potentiometer to the Arduino board.
Connect the middle pin or wiper of the potentiometer to the A0 analog Arduino pin. Connect one of the outer pins of the potentiometer to a GND pin of the Arduino. Connect the other outer pin to the 5V pin of the Arduino.
The photo below shows a preset potentiometer connected to the Arduino.
Start the Arduino IDE and select File → Examples → 1.Basics → AnalogReadSerial to open the Arduino code (sketch) for the project. Verify and then upload the sketch. Now open the serial monitor window from the Arduino IDE.
The serial monitor will display the value that is being read from the A0 analog pin of the Arduino. Turn the shaft of the potentiometer to see the value change. Use a screwdriver to adjust the potentiometer if using a preset potentiometer.
When the potentiometer shaft is turned all the way to the pin that is connected to GND, the value displayed in the serial monitor will be 0. When turned all the way to the pin that is connected to 5V, the value will be 1023.
If you do not have a potentiometer, then insert a single core wire into the A0 connection on the Arduino board. To see the value change in the serial monitor window, connect the other end of the wire to the 5V, 3.3V or GND connections of the Arduino.
Can't see the video? View on YouTube →