ADC Resolution in Arduino: What It Means and How It Works
ADC resolution in Arduino is the number of bits the analog-to-digital converter uses to represent an analog input value as a digital number. For most Arduino boards, this resolution is 10 bits, meaning the input voltage is converted into a number between 0 and 1023.How It Works
Think of the ADC resolution like a ruler that measures voltage. A higher resolution means the ruler has smaller marks, so it can measure more precisely. In Arduino, the ADC converts an analog voltage (like from a sensor) into a digital number. The resolution tells you how many steps the ADC can divide the voltage range into.
For example, a 10-bit ADC divides the voltage range (usually 0 to 5 volts) into 1024 steps (from 0 to 1023). If the input voltage is halfway, the ADC will output about 512. This helps the Arduino understand the exact voltage level in a way it can process.
Example
void setup() { Serial.begin(9600); } void loop() { int sensorValue = analogRead(A0); // Read analog input on pin A0 Serial.print("ADC Value: "); Serial.println(sensorValue); // Print the digital value (0-1023) delay(1000); // Wait 1 second before next read }
When to Use
Use ADC resolution when you need to convert real-world analog signals, like temperature, light, or sound, into digital values your Arduino can understand. Higher resolution means more precise readings, which is important for sensitive measurements.
For example, if you are building a thermometer or a light meter, knowing the ADC resolution helps you interpret sensor data correctly and improve accuracy.
Key Points
- ADC resolution defines how finely the analog input voltage is measured.
- Most Arduino boards have a 10-bit ADC, giving values from 0 to 1023.
- Higher resolution means more precise voltage measurement.
- Understanding ADC resolution helps in reading sensors accurately.