Learn ADC and DAC in microcontrollers including working principles, conversion formulas, resolution, architectures, ADC vs DAC, sampling theorem, and applications in embedded systems, IoT, robotics, automotive, and industrial automation.
Modern embedded systems continuously interact with the real world through sensors, actuators, and intelligent control systems. Real-world signals such as temperature, sound, light intensity, pressure, speed, and voltage are analog in nature. However, microcontrollers process only digital data. Because of this difference, embedded systems require conversion mechanisms that can bridge the analog world and digital electronics. This is where ADC (Analog-to-Digital Converter) and DAC (Digital-to-Analog Converter) become essential. ADC and DAC in microcontrollers are among the most important peripherals used in embedded systems, IoT devices, industrial automation, automotive electronics, robotics, medical electronics, communication systems, and consumer electronics. An ADC converts analog signals into digital values that a microcontroller can understand, while a DAC converts digital data into analog voltages for controlling external analog devices. A strong understanding of ADC and DAC working principles, conversion formulas, architectures, resolution, sampling, and applications is extremely important for embedded engineers, electronics designers, IoT developers, and automation engineers.
In this article, we will explore:
Learn ADC and DAC in microcontrollers including working principles, conversion formulas, resolution, architectures, ADC vs DAC, sampling theorem, and applications in embedded systems, IoT, robotics, automotive, and industrial automation.
Before understanding ADC and DAC in embedded systems, it is important to understand the difference between analog and digital signals.
An analog signal varies continuously with time. The signal can take infinite voltage values within a specific range.
Examples of analog signals include:
Analog signals are smooth and continuous in nature.
A digital signal contains discrete voltage levels.
Typically:
Digital systems process binary values such as:
0101011010Microcontrollers operate using digital logic, which means they cannot directly process analog voltages generated by sensors.
This creates the need for ADC in microcontrollers.
ADC stands for Analog-to-Digital Converter.
An ADC converts an analog voltage into a digital number that can be processed by the microcontroller.
ADC in microcontrollers is widely used for sensor interfacing, signal monitoring, industrial control systems, battery management systems, and IoT devices.
Most sensors generate analog outputs.
Examples:
| Sensor | Output Type |
|---|---|
| LM35 | Analog Voltage |
| Potentiometer | Variable Voltage |
| LDR | Analog Signal |
| Pressure Sensor | Analog Voltage |
| Gas Sensor | Analog Voltage |
Since microcontrollers process only digital data, analog sensor signals must be converted into digital values using ADC.
Without ADC, microcontrollers would not be able to understand real-world sensor data.
The ADC samples the analog voltage and converts it into a corresponding digital value.
For example:
Suppose:
Then:
2^8 = 256 levelsThe ADC can represent values from:
0 to 255The input analog voltage is mapped into one of these digital levels.
The ADC digital output can be calculated using the following formula:
[
Digital\ Value = \frac{V_{in}}{V_{ref}} \times (2^n - 1)
]Where:
This ADC formula is widely used in embedded systems and microcontroller programming.
Suppose:
Then:
[
Digital\ Value = \frac{2.5}{5} \times (2^8 - 1)
]
[
= 0.5 \times 255
]
[
= 127.5
]Approximate digital output:
128ADC resolution determines how accurately the analog signal can be represented digitally.
Higher ADC resolution provides better precision.
[
Resolution\ Step\ Size = \frac{V_{ref}}{2^n}
]For:
[
Resolution = \frac{5}{1024}
]
[
= 4.88\ mV
]Meaning:
Each digital step represents approximately 4.88 mV.
This is an important concept in ADC and DAC tutorials for embedded systems.
Different ADC architectures are used depending on speed, accuracy, power consumption, and application requirements.
Flash ADC is the fastest ADC architecture.
SAR ADC is the most commonly used ADC architecture in microcontrollers.
SAR ADC is widely used in embedded systems and IoT devices.
Dual slope ADC provides very high accuracy.
Sigma Delta ADC provides extremely high precision.
Many modern microcontrollers include built-in ADC modules.
| Microcontroller | ADC Resolution |
|---|---|
| 8051 | External ADC Required |
| Arduino UNO | 10-bit ADC |
| LPC1768 | 12-bit ADC |
| STM32 | 12-bit ADC |
Built-in ADC peripherals simplify sensor interfacing and reduce external hardware requirements.
Microcontrollers usually support multiple ADC channels.
Examples:
This enables the microcontroller to interface with multiple sensors simultaneously.
The ADC conversion process typically involves the following steps.
Analog voltage is applied to the ADC input pin.
A sample-and-hold circuit captures the voltage.
The ADC converts the analog voltage into a binary value.
The digital output is stored in the ADC register.
The microcontroller then reads this digital data for processing.
This is one of the most common ADC interfacing examples in embedded systems.
ADC applications are extremely important in embedded systems and electronics.
ADC is used for interfacing:
Used in:
ADC is used for monitoring analog industrial parameters.
Examples:
Used for reading:
DAC stands for Digital-to-Analog Converter.
A DAC converts digital values generated by a microcontroller into analog voltages.
DAC in microcontrollers is widely used in waveform generation, audio systems, analog control systems, and communication devices.
Microcontrollers generate digital signals, but many external devices require analog voltages.
Examples include:
DAC enables the microcontroller to generate these analog outputs.
DAC receives a digital input and generates a proportional analog voltage.
The analog output voltage depends on the digital input value and reference voltage.
The DAC output voltage is calculated as:
[
V_{out} = \frac{D}{2^n -1} \times V_{ref}
]Where:
Suppose:
Then:
[
V_{out} = \frac{128}{255} \times 5
]Output:
[
≈ 2.5V
]Binary weighted DAC uses weighted resistors.
R-2R Ladder DAC is the most popular DAC architecture.
R-2R DAC is widely used in embedded systems.
Some modern microcontrollers include built-in DAC peripherals.
| Microcontroller | DAC Availability |
|---|---|
| LPC1768 | 10-bit DAC |
| STM32 | Built-in DAC |
| Arduino UNO | PWM-based DAC |
DAC peripherals are useful for analog output generation and waveform creation.
DAC is used for generating audio signals.
DAC can generate:
DAC is used for analog speed control systems.
Used in signal generation and modulation systems.
| Feature | ADC | DAC |
|---|---|---|
| Full Form | Analog to Digital Converter | Digital to Analog Converter |
| Input | Analog | Digital |
| Output | Digital | Analog |
| Purpose | Reading sensors | Generating analog signals |
Temperature sensor → Microcontroller
Microcontroller → Speaker amplifier
This simple ADC vs DAC comparison helps beginners understand the direction of signal conversion.
Several factors affect ADC accuracy in embedded systems.
Higher ADC bits provide better precision.
Electrical noise affects ADC conversion accuracy.
An unstable reference voltage causes incorrect ADC readings.
Sampling rate determines ADC conversion speed.
For accurate signal reconstruction:
[
f_s \geq 2f_{max}
]This is called the Nyquist Sampling Criterion.
Sampling theorem is extremely important in digital signal processing and embedded systems.
ADC and DAC are essential components in modern embedded systems.
Applications include:
Used in:
Applications include:
Used in:
LPC1768 is widely used in embedded systems training and industrial applications.
Modern embedded systems are increasingly using:
Applications are growing rapidly in:
ADC and DAC in microcontrollers are essential building blocks of embedded systems and digital electronics. ADC enables microcontrollers to understand real-world analog signals, while DAC allows digital systems to generate analog outputs for controlling external devices.
A strong understanding of:
is extremely important for:
Mastering ADC and DAC concepts helps engineers design accurate, efficient, and intelligent electronic systems for modern embedded applications. As embedded systems continue evolving with Edge AI, Industrial IoT, robotics, and automotive electronics, ADC and DAC technologies will remain fundamental components of real-world electronic design.
ADC (Analog-to-Digital Converter) is a peripheral that converts analog voltages from sensors into digital values that a microcontroller can process and analyze in embedded systems.
ADC converts analog signals into digital data, while DAC converts digital values into analog voltages for generating signals and controlling analog devices.
ADC and DAC are widely used in sensor interfacing, industrial automation, IoT devices, robotics, medical electronics, waveform generation, audio systems, and automotive embedded applications.
Indian Institute of Embedded Systems – IIES