What Is the ADC? Wiring and Errors (2026 Guide)
Share
What Is the ADC? Wiring and Errors (2026 Guide)
ADC stands for Analog-to-Digital Converter — the part of a microcontroller that takes a continuous voltage, say 2.47V from a sensor, and turns it into a number the chip can compute with. Microcontrollers live in a digital 0/1 world; the ADC is the bridge that lets them read the real, analog world.
Quick answer: The ADC turns a voltage into a number via analogRead(pin). On an Arduino Uno it's 10-bit, mapping 0–5V onto integers 0–1023 (about 4.88mV per step). The scale changes on other boards — ESP32 and Pico are 12-bit (0–4095) at 3.3V — so never assume the Uno's 1023/5V numbers apply elsewhere.
Proof of work: the explanation and code below are Soldr's actual answer to "What is the ADC and how do I use it?", asked through Compoden's AI build assistant on 11 August 2026. Published 11 August 2026 · Last updated 11 August 2026.
How does analogRead actually convert a voltage to a number?
The ADC samples the voltage on a pin and reports it as an integer scaled to the board's resolution and reference voltage. On an Arduino Uno's ATmega328P, that resolution is 10-bit, giving 1024 possible values (0–1023) across a 0–5V range — each step represents about 4.88mV. The classic first experiment is a potentiometer wired as a voltage divider into A0: twist the knob, the wiper voltage swings across the full 0–5V range, and the raw number climbs smoothly from 0 to 1023.
| Property | Value |
|---|---|
| Resolution | 10-bit (0–1023) |
| Reference voltage | 0–5V (board-dependent) |
| Step size | ~4.88mV per step |
| Read function | analogRead(pin) |
| Usable pins | A0–A5 only |
How do you wire a potentiometer to read on an Arduino Uno?
Wire the potentiometer's two outer legs to 5V and GND, and its middle wiper leg to A0 — that's the voltage-divider pattern every analog sensor read follows. This is the exact sketch from Soldr's session:
const int ADC_PIN = A0;
void setup() {
Serial.begin(9600);
Serial.println("[SOLDR] adc-demo | board:uno | v1.0");
}
void loop() {
int raw = analogRead(ADC_PIN);
float volts = raw * (5.0f / 1023.0f); // convert
Serial.print("raw: "); Serial.print(raw);
Serial.print(" volts: "); Serial.println(volts);
delay(200);
}
Captured from the session's Firmware tab; the print/delay lines complete the standard read-and-report loop the setup implies, not independently compile-checked for this post.
Why does analogRead return garbage or a stuck value?
Two gotchas catch almost everyone. First, the scale changes with the board — an ESP32 or Pico is 12-bit (0–4095) at 3.3V logic, not the Uno's 1023/5V, so a sketch ported without updating the divisor and full-scale voltage will report wrong numbers that still look plausible rather than obviously broken. Second, analogRead only works on analog pins — A0 through A5 on the Uno — and wiring a potentiometer to a digital pin returns meaningless noise rather than a clear error, because a digital pin still returns some value on a read, it's just not a meaningful one.
What do you need to try this yourself?
An Uno R3 CH340G ATmega328P Board (Rs.230) and a 10k Potentiometer (Linear Taper) (Rs.45) — the exact two parts Soldr's session used, Rs.275 total, nothing else needed to watch the raw ADC number move in real time.
Frequently asked questions
ADC ka matlab kya hota hai?
ADC ka matlab hai Analog-to-Digital Converter - yeh microcontroller ka woh hissa hai jo ek continuous voltage (jaise sensor se aane wali 2.47V) ko ek number mein badalta hai jise chip samajh sake. Bina ADC ke, microcontroller sirf digital 0 aur 1 hi samajh sakta hai.
Why is the ADC 12-bit on an ESP32 but 10-bit on an Arduino Uno?
It comes down to the ADC hardware built into each chip — the ATmega328P (Uno) has a 10-bit ADC peripheral, while the ESP32's ADC peripheral is 12-bit. Neither is "better" for most hobby sensor work; the practical impact is just that the same voltage produces a different raw number on each board, so code that assumes 1023 as the maximum needs updating when you switch boards.
What is the price of a 10k potentiometer in India?
The 10k Potentiometer (Linear Taper, 10k Ohm, Rotary) costs Rs.45 at Compoden, with cash on delivery available across India. Paired with an Uno R3 CH340G board (Rs.230), the full ADC starter setup from this guide costs Rs.275. Prices checked 11 August 2026.
Can I read more precision out of a 10-bit ADC?
Not from the hardware itself — 10-bit means 1024 distinct values no matter how you read it. What you can improve is noise: averaging several consecutive readings smooths out small fluctuations, and using a stable, well-regulated reference voltage matters more for accuracy than any software trick.