The binary number of states in a digital circuit is the total count of discrete output values a component can produce, calculated as 2 raised to the power of its bit-depth ($2^n$). When you wire an analog sensor to a microcontroller or set hardware addresses on an I2C module, this calculation dictates the absolute minimum voltage step your system can detect and the maximum addressable combinations available to your logic.
In a real circuit, the binary number of states changes your system's physical granularity. A higher state count shrinks the voltage gap between adjacent digital readings, allowing your firmware to detect smaller physical changes in temperature, light, or position. Conversely, in digital logic like DIP switches or encoders, it defines the exact number of unique hardware addresses or positions you can map before your bus experiences collisions or your mechanical system loses precision.
What It Is and What It Changes
What it is: The total discrete steps a digital component can resolve, defined by $2^n$ where $n$ is the bit-depth.
What it changes: The minimum detectable voltage step (resolution) in analog circuits, and the maximum unique addressing capacity in digital logic circuits.
The Core Concept: Calculating the Binary Number of States
Digital systems do not understand continuous voltage; they chop analog reality into discrete buckets. The number of buckets is determined by the bit-depth of the hardware. To find the binary number of states, you simply calculate $2^n$.
However, knowing the total states is only half the battle. To find out what each state actually represents in the physical world, you must calculate the step size (or Least Significant Bit voltage, LSB). The formula is:
Step Size = V_ref / (Total States - 1)
We subtract 1 from the total states because the counter starts at zero. A 2-bit system has $2^2 = 4$ states, but the maximum count value is 3 (0, 1, 2, 3).
Worked Numeric Example: ESP32 vs. Arduino Uno ADCs
Let us look at two common microcontrollers reading an analog signal to see how the binary number of states impacts real-world bench measurements.
| Parameter | Arduino Uno (ATmega328P) | ESP32-S3 (Internal ADC) |
|---|---|---|
| Bit-Depth ($n$) | 10-bit | 12-bit |
| Binary Number of States ($2^n$) | $2^{10} = 1024$ states | $2^{12} = 4096$ states |
| Maximum Count Value | 1023 | 4095 |
| Nominal Reference Voltage | 5.0V | 3.3V (with 0dB attenuation) |
| Step Size (Resolution) | 5.0V / 1023 = 4.887 mV | 3.3V / 4095 = 0.805 mV |
The Bench Reality: On paper, the ESP32-S3 offers roughly six times better resolution than the Uno. However, if you are using the original ESP32-WROOM-32 chip, the internal ADC is notoriously non-linear and saturates around 3.1V. This means your top ~250 states are essentially useless, effectively reducing your practical binary number of states to around 3800. For precision work on the original ESP32, you must use the esp_adc_cal library or switch to an external ADC.
Where You Meet This in Practice
- Analog-to-Digital Converters (ADCs): When reading a 10k potentiometer for a motor speed dial, the binary number of states determines how 'smooth' the speed ramp feels. A 10-bit ADC gives you 1024 speed steps; an 8-bit ADC gives you only 256, which might cause noticeable jitter at low RPMs.
- DIP Switches and Jumpers: When setting the I2C address on a PCA9685 PWM driver, you use 6 address pins. The binary number of addressable states is $2^6 = 64$. This means you can stack exactly 62 of these modules on a single I2C bus (reserving 0x00 and 0x03 for general calls).
- Absolute Rotary Encoders: A 12-bit magnetic encoder like the AS5600 outputs 4096 distinct angular positions per revolution. This yields a resolution of 360° / 4096 = 0.087° per step, which is critical for robotic arm joint positioning.
Common Confusions: States vs. Maximum Count vs. ENOB
Another major confusion is assuming the theoretical binary number of states equals the Effective Number of Bits (ENOB). A microcontroller might boast a 12-bit ADC (4096 states), but if the power supply has 15mV of high-frequency ripple, the last 4 or 5 bits will just be reading noise. In that scenario, your ENOB might only be 8 bits (256 usable states). Always check the datasheet's ENOB specification, not just the marketing bit-depth, when designing precision measurement circuits.
Decision Tree: Picking the Right Resolution for Your Build
Do not default to the highest bit-depth available; higher resolution ADCs are slower, more expensive, and highly susceptible to PCB layout noise. Use this decision path to select the exact part for your next build.
| If your application requires... | Then you need this binary number of states (Bit-Depth) | Concrete Part / Solution Pick |
|---|---|---|
| Basic user inputs (potentiometers, LDRs, basic battery voltage monitoring where ±50mV error is acceptable). | 10-bit to 12-bit (1024 to 4096 states) |
Internal MCU ADC. Use the Arduino Uno (ATmega328P) or ESP32-S3 internal ADC. Cost: $0 (built-in). |
| Precision DC measurements (load cells, RTD temperature sensors, 4-20mA industrial loops, lab-grade multimeters). | 16-bit to 24-bit (65,536 to 16.7M states) |
Texas Instruments ADS1115 (16-bit, I2C) or ADS1232 (24-bit, SPI). Cost: ~$3 to $8 per IC. |
| High-speed waveform capture (audio sampling, ultrasonic sensors, fast transient detection). | 12-bit minimum, but prioritize Sample Rate (MSPS) over state count. | Microchip MCP3008 (10-bit, 200ksps) or TI ADS4142 (14-bit, 65MSPS). Cost: $2 to $25. |
| Hardware addressing (setting I2C addresses for LED drivers, motor controllers, or IO expanders). | 3-bit to 7-bit (8 to 128 states) |
Standard 0.1' pitch DIP switch arrays. Use a 4-position switch for up to 16 addresses, 7-position for 128. |
Frequently Asked Questions
Q: Can I increase the binary number of states in software by oversampling?
A: Yes, but with diminishing returns. By taking multiple samples and averaging them, you can reduce noise and theoretically gain extra bits of resolution. The rule of thumb is that you need $4^n$ samples to gain $n$ extra bits. To turn a 10-bit ADC (1024 states) into a 12-bit ADC (4096 states), you must oversample by $4^2 = 16$ times. This works well for slow-moving DC signals like battery voltage, but will destroy your bandwidth if you are measuring audio or fast motor currents.
Q: Why do some 12-bit ADCs only output values up to 4095, while others output up to 4096?
A: A true 12-bit ADC has 4096 distinct states, numbered 0 through 4095. If a datasheet or library claims a maximum output of 4096, it is either a documentation error, or the library is artificially scaling the math (e.g., shifting bits or adding an offset) to make percentage mapping easier. Always verify the raw register output against the manufacturer's technical reference manual.
Q: Does the binary number of states matter for digital PWM outputs?
A: Absolutely. PWM resolution dictates how finely you can control duty cycle. An 8-bit PWM gives you 256 states (0-100% in 0.39% increments). A 16-bit PWM gives you 65,536 states, allowing for ultra-smooth LED dimming without visible stepping at low brightness levels. The ESP32's LEDC peripheral allows you to configure this bit-depth dynamically in code.






