A 12-bit DAC digital analog converter outputting a digital code of 2048 with a 3.3V reference produces exactly 1.650V. If you are instead using a 16-bit DAC with a 5.0V reference, the equivalent mid-scale proportion (code 32768) yields exactly 2.500V. There is no mystery to the math once you lock in your reference voltage and bit depth.
The universal formula for this conversion is:
V_out = V_ref × (Digital_Code / 2^n)
Substituting our baseline 12-bit values:
1.650V = 3.3V × (2048 / 4096)
The answer is fixed entirely by two assumptions: your reference voltage (V_ref) and the resolution in bits (n). If either of these shifts, your voltage per step (LSB weight) changes completely.
The Core Bit-to-Volt Conversion Formula
Every DAC digital analog converter relies on a resistor ladder or string architecture that divides the reference voltage into discrete steps. The total number of steps is 2^n. For a 12-bit DAC, that is 4,096 steps (0 to 4095). For a 16-bit DAC, it is 65,536 steps.
To find the voltage of a single Least Significant Bit (LSB), divide V_ref by the total steps:
- 12-bit @ 3.3V: 3.3 / 4096 = 0.805 mV per step
- 12-bit @ 5.0V: 5.0 / 4096 = 1.220 mV per step
- 16-bit @ 3.3V: 3.3 / 65536 = 0.050 mV (50 µV) per step
How Reference Voltage Shifts the Output
The conversion is not universal; it scales linearly with V_ref. Here is how the answer shifts across common embedded power domains:
| V_ref Source | Nominal Voltage | 12-Bit Mid-Scale (2048) | 1 LSB Weight |
|---|---|---|---|
| ESP32 / STM32 VCC | 3.3V | 1.650V | 0.805 mV |
| Arduino Uno 5V Rail | 5.0V | 2.500V | 1.220 mV |
| Precision External Ref | 2.048V | 1.024V | 0.500 mV |
| Precision External Ref | 4.096V | 2.048V | 1.000 mV |
Notice the 2.048V and 4.096V references. These are industry-standard precision references (like the TI REF3020) chosen specifically because they yield clean, integer-based millivolt steps, eliminating floating-point rounding errors in your microcontroller code.
Neighboring Values Lookup Table (12-Bit @ 3.3V)
If you are tuning a bias voltage or setting a threshold, you rarely land exactly on mid-scale. Here is a lookup table for a 12-bit DAC at 3.3V, covering a ±20% range around the 2048 center point (codes 1638 to 2458).
| Digital Code (Hex) | Digital Code (Dec) | Analog Output (V) | Delta from Mid-Scale |
|---|---|---|---|
| 0x666 | 1638 | 1.320V | -330 mV |
| 0x708 | 1800 | 1.451V | -199 mV |
| 0x7D0 | 2000 | 1.611V | -39 mV |
| 0x800 | 2048 | 1.650V | 0 mV (Center) |
| 0x898 | 2200 | 1.773V | +123 mV |
| 0x93A | 2362 | 1.904V | +254 mV |
| 0x99A | 2458 | 1.981V | +331 mV |
Decision Tree: Picking the Right DAC IC
Do not default to the internal DAC built into your microcontroller unless you are generating low-fidelity audio or simple beeps. The internal DAC on the original ESP32 (GPIO 25/26) is only 8-bit, highly non-linear, and saturates around 3.1V. For actual control loops, sensor biasing, or programmable power supplies, use an external IC.
| If your project needs... | Then choose this architecture... | Concrete Part Pick (2026 Pricing) |
|---|---|---|
| I2C bus, low speed, general purpose biasing | 12-bit I2C DAC with EEPROM | Microchip MCP4725 (~$1.50 IC / $5.00 Adafruit Breakout Product ID: 935) |
| SPI bus, high precision DC, dual channel | 16-bit SPI DAC with internal ref | TI DAC8562 (~$6.50 IC) |
| High-speed waveform / Audio output | I2S Interfaced Stereo DAC | TI PCM5102A (~$4.00 on breakout) |
| 4-20mA industrial current loop control | 16-bit DAC + Precision Current Source | Analog Devices AD5420 (~$12.00 IC) |
Default Recommendation: For 90% of hobbyist and prosumer embedded tasks (motor control reference voltages, op-amp biasing, LED dimming control), terminate your search and buy the MCP4725. It requires only two wires (SDA/SCL), has a massive open-source library footprint, and includes non-volatile memory to remember its output state on reboot.
When DAC Conversions Become Meaningless
The math above assumes an ideal, unloaded circuit. Your calculated voltage becomes meaningless in the real world under three specific failure modes:
- Unbuffered Outputs Driving Low Impedance: Many basic DACs (and resistor-ladder networks) have high output impedance. If you connect a 12-bit DAC directly to a 1kΩ load, the load will form a voltage divider with the DAC's internal resistance, pulling your 1.650V down to 1.4V or lower. Fix: Buffer the DAC output with a rail-to-rail op-amp like the MCP6001.
- Floating or Noisy V_ref: If your V_ref is derived from a switching buck converter with 40mV of ripple, your analog output will inherit that ripple. A 16-bit DAC is completely wasted here, as the noise floor exceeds the 50µV LSB weight. Fix: Add an LC filter or use a dedicated linear LDO for the V_ref pin.
- Missing the Code Offset: Some DACs map 0x000 to 0V, but others (especially bipolar or industrial DACs) map 0x000 to a negative voltage or require a specific offset register to be cleared on boot. Always check the datasheet's 'Transfer Function' graph.
Frequently Asked Questions
Can I use PWM instead of a DAC digital analog converter?
Yes, but only if you add a hardware low-pass RC filter to smooth the square wave into a DC voltage, and your load doesn't require fast transient response. A filtered PWM signal will always have higher ripple and slower settling times than a true DAC. Use PWM for LED dimming; use a DAC for precision op-amp references.
Why does my 12-bit DAC max out at 4095 instead of 4096?
Because counting starts at zero. A 12-bit register has 4,096 total states, ranging from 0 (0x000) to 4095 (0xFFF). If you send the value 4096 to a 12-bit register, it will overflow and wrap around to 0, dropping your output voltage to 0V. Always cap your software variables at (1 << n) - 1.
What is the settling time of the MCP4725?
According to the Microchip MCP4725 datasheet, the typical settling time to within 0.5 LSB of the final value is roughly 6 µs. This is more than fast enough for DC biasing and slow control loops, but too slow for high-fidelity audio generation (where you need I2S DACs like the PCM5102A).






