Arduino: Read Sensors with ADC
Read an analogue sensor, convert the ADC value and inspect it over Serial.
◷ 40 minParts and tools
- Arduino Uno
- 10 kΩ potentiometer
- Breadboard
Lesson
Learning objective
Read an analogue sensor, convert the ADC value and inspect it over Serial.
Procedure
- Review the circuit and confirm the board voltage.
- Build and inspect the wiring before applying power.
- Upload the example, observe the result and record your readings.
- Change one parameter, predict the result and test again.
Troubleshooting
Check power, ground, pin selection, polarity, compiler target and serial output. Use a multimeter or logic analyser where appropriate.
Example code
void setup(){ Serial.begin(9600); }
void loop(){ int raw=analogRead(A0); Serial.println(raw); delay(100); }Knowledge check
What is the Uno ADC range by default?
