Skip to content
BENIBIX Learn

Analog-to-Digital Converter (ADC)

Development🔌 Embedded & IoTInputs and Outputs

Also known as ADC, Analog Input, analogRead

A part that reads how strong a signal is. It turns that into a number.

Think of it like

It is like a ruler for power in a wire. It turns how much into a number.

Example

An Arduino Uno's ADC has 10 bits. It turns 0 to 5 volts into a number from 0 to 1023.

Why it matters

Most of the real world is not just on or off. The ADC lets code read heat, light and sound levels.

Definition

An analog-to-digital converter turns a smooth voltage into a number a chip can use. Many sensors, like a light sensor or a dial, give a voltage that slides up and down. A plain digital pin only sees high or low. The ADC measures how high the voltage is and gives back a whole number. More bits mean finer steps.

Example code

cpp
int level = analogRead(A0);  // 0 to 1023 on an Uno
One call reads the voltage on pin A0 and gives back a number.
The ADC, second row, turns a knob's voltage into 0 to 1023.

Common mistake

Feeding it more volts than the board runs on. A higher voltage reads as the top number at best, and can harm the pin.

Key takeaways

  1. 1
    Voltage in. A sliding signal from a sensor.
  2. 2
    Number out. A whole number code can use.
  3. 3
    Bits set steps. 10 bits gives 1,024 steps.