Practical applications

Applications of ADC and DAC in Embedded Systems

Understand how Analog-to-Digital and Digital-to-Analog converters are used in sensor interfacing, motor control, audio processing, and industrial instrumentation.

Visual

SensorAmplifierADCDACMCU / DSPProcessingDisplayActuator

Concept overview

An Analog-to-Digital Converter (ADC) samples a continuous voltage and produces a binary number proportional to its magnitude. A Digital-to-Analog Converter (DAC) does the reverse, converting a digital code into a proportional output voltage or current. Together they form the boundary between the physical world and the digital processing core of any microcontroller or DSP-based system. Resolution in bits determines the number of discrete levels, and sampling rate in samples per second determines the highest frequency that can be represented without aliasing.

Real-world applications

Temperature Sensing with STM32 ADC
Industrial Instrumentation
The STM32F4 series microcontroller includes a 12-bit SAR ADC that can read the output of an NTC thermistor or a TMP36 voltage-output sensor. The ADC converts the analogue voltage to a 12-bit integer that firmware maps to degrees Celsius using a calibration lookup table stored in flash.
Audio Playback via I2S DAC
Consumer Audio
The PCM5102A stereo DAC from Texas Instruments receives a 24-bit I2S digital audio stream from an ESP32 microcontroller and produces a differential analogue output at up to 384 kHz sample rate. The output feeds a class-D amplifier driving a speaker, which is the signal chain used in portable Bluetooth speakers.
Motor Current Sensing in BLDC Drives
Motor Control
In the Texas Instruments DRV8305 three-phase gate driver evaluation board, shunt resistors on the motor phase lines produce millivolt-level voltages proportional to current. These are amplified and fed into the ADC inputs of a TMS320F28379D DSP for field-oriented control. The ADC conversion must complete within one PWM period, typically 50 microseconds at 20 kHz switching.

How it works in practice

In a successive approximation ADC, the conversion begins when the sample-and-hold circuit freezes the input voltage at the moment of sampling. A comparator then tests successive bits from MSB to LSB: the SAR logic sets each bit, generates a trial voltage from an internal DAC, and keeps the bit if the trial is below the input or clears it if above. After N clock cycles for an N-bit converter, the register holds the final code. For a 12-bit ADC running at 1 MSPS with a 3.3 V reference, the LSB size is 3.3 V divided by 4096, approximately 0.8 mV. The DAC side uses an R-2R ladder network. Each bit switches a node between the reference voltage and ground. The superposition of all weighted currents through the ladder produces the output voltage. Settling time of the output operational amplifier determines the maximum update rate. In embedded motor control, the timing of ADC conversion relative to the PWM carrier is critical: sampling at the centre of the PWM on-time avoids switching noise that appears at the edges.

Examples

Reading a Pressure Sensor on Arduino Mega
The MPX5700AP pressure sensor outputs 0.2 V to 4.7 V across its 0 to 700 kPa range. Connected to the Arduino Mega ADC pin with the internal 5 V reference, the 10-bit ADC reads values from 41 to 964. Firmware computes pressure as: pressure_kPa = (ADC_value / 1023.0) times 5.0 minus 0.2, divided by 0.004. Noise in the reading is reduced by averaging 16 consecutive samples in software, a technique called oversampling that also improves effective resolution by approximately 2 bits.
Waveform Generation with MCP4921 DAC
The MCP4921 is a 12-bit SPI DAC. A microcontroller stores a 256-point sine table in flash where each entry is a 12-bit value between 0 and 4095. A timer interrupt fires at a rate equal to the desired sine frequency multiplied by 256. Each interrupt reads the next table entry and writes it to the DAC over SPI using a 16-bit transfer with the two high bits as configuration. The DAC output voltage follows the table values, reproducing a sine wave whose amplitude spans 0 V to Vref and whose frequency equals the interrupt rate divided by 256.

Future scope

Delta-sigma ADCs with 24-bit resolution and integrated digital filters, such as the ADS1256 from Texas Instruments, are displacing older successive-approximation designs in precision instrumentation where conversion speed above a few kilosamples per second is not required. Time-interleaved ADC arrays that run multiple lower-speed converters in parallel and stitch their outputs together are reaching sampling rates above 100 GSPS in test and measurement equipment from Keysight and Tektronix. On the DAC side, current-steering architectures for RF direct-digital synthesis are enabling software-defined radio transmitters to generate waveforms directly at IF or RF frequencies without a separate upconversion stage.