When looping a Digital-to-Analog Converter (DAC) output into an Analog-to-Digital Converter (ADC) input on a microcontroller like the ESP32 or Arduino, you are translating between different bit resolutions and voltage domains. For the exact query of converting a mid-scale 12-bit DAC value of 2048 to a 10-bit ADC reading, the direct answer is 512 (assuming a shared 3.3V reference voltage).
The formula used to map these values substitutes the specific bit-depth limits of your hardware:
ADC_count = (DAC_count / (2^DAC_bits - 1)) * (2^ADC_bits - 1)
Substituting our values: (2048 / 4095) * 1023 = 511.6, which the microcontroller rounds to an integer reading of 512.
The Core Assumptions: Reference Voltage and Bit Depth
What assumption fixes this answer? In embedded systems, the conversion is strictly locked by the Reference Voltage (Vref) and the Bit Depth of both converters. If your DAC is referenced to 5.0V but your ADC is referenced to 3.3V, the math changes entirely, and you risk frying the ADC pin. You must always verify the Vref of both the source and the sink before wiring them together.
A common point of confusion for those crossing over from industrial electrical work or power electronics is applying AC mains formulas to embedded signals. If you are wondering how this answer shifts for 120V vs 230V vs 3-phase systems, or when the conversion becomes meaningless because the power factor (pf) is unknown: those parameters are entirely meaningless here. DAC and ADC circuits operate on low-voltage DC signaling (typically 0-3.3V or 0-5V) and discrete digital quantization. They do not deal with AC power distribution, phase angles, or RMS calculations. If you are trying to measure 120V AC mains with an ADC, you need a completely different hardware front-end, such as an isolation transformer or a dedicated RMS-to-DC converter IC, not a direct DAC-to-ADC mapping.
Neighboring Values: 12-Bit DAC to 10-Bit ADC Lookup
When calibrating a control loop, you rarely sit exactly at mid-scale. Below is a spec-sheet-table showing the expected 10-bit ADC readings for a ±20% range around our 2048 baseline, assuming a shared 3.3V Vref.
| DAC Input (12-bit) | Expected Voltage (Vref=3.3V) | ADC Output (10-bit) | Variance from Baseline |
|---|---|---|---|
| 1638 | 1.32V | 410 | -20% |
| 1843 | 1.48V | 461 | -10% |
| 2048 | 1.65V | 512 | Baseline |
| 2253 | 1.81V | 563 | +10% |
| 2458 | 1.98V | 614 | +20% |
Real-World Signal Loss and Calibration Offsets
Theoretical math assumes perfect hardware. In practice, if you wire GPIO 25 (DAC1) to GPIO 34 (ADC1) on a standard ESP32 DevKit v1, your ADC will likely read lower than 512. According to the Espressif ESP32 Datasheet, the internal ADC is notoriously non-linear, particularly near the 0V and 3.3V rails, and suffers from internal voltage drops.
To get accurate conversions, you must configure the ADC attenuation in your firmware. If you leave the attenuation at 0dB, the ADC maxes out around 1.1V. You must set it to 11dB attenuation to map the full 0-3.3V range. Furthermore, Analog Devices notes that source impedance matters; if your DAC is driving a heavy load or long wires, the voltage will sag before it reaches the ADC sampling capacitor. Keep loopback traces short, and if you are reading erratic values, place a 100nF ceramic capacitor between the ADC input pin and ground to stabilize the sample-and-hold circuit.
Frequently Asked Questions
How does a DAC to ADC converter handle 5V to 3.3V logic level shifting?
It doesn't handle it natively; you must do it in hardware. If your DAC outputs a 0-5V signal (like on an Arduino Mega) and your ADC accepts a 0-3.3V max input (like on an ESP32 or Raspberry Pi Pico), wiring them directly will destroy the microcontroller's silicon. You must use a resistive voltage divider (e.g., a 2kΩ and 3.3kΩ resistor pair) to scale the 5V DAC output down to a safe 3.3V before it reaches the ADC pin. Remember to update your firmware's Vref variable to 5.0V so the math accounts for the original DAC scale.
Why is my DAC to ADC converter reading lower than the expected output value?
There are three common culprits on the bench. First, incorrect ADC attenuation settings in your code (especially on ESP32 boards). Second, a ground loop or missing common ground between the DAC and ADC if they are on separate power rails. Third, the DAC output impedance is too high to charge the ADC's internal sampling capacitor within the acquisition time window. Adding a simple op-amp voltage follower (buffer) between the DAC and ADC will eliminate the impedance mismatch and lock your readings to the theoretical values.
What is the formula to convert an ADC reading back to voltage after a DAC to ADC conversion?
Once you have your raw ADC integer, you convert it back to a physical DC voltage using the ADC's bit resolution and reference voltage. The formula is: Voltage = (ADC_count / (2^ADC_bits - 1)) * Vref. For a 10-bit ADC reading of 512 on a 3.3V system, the math is (512 / 1023) * 3.3 = 1.65V. This confirms the signal survived the round-trip conversion without significant degradation.






