ADC and DAC in Microcontrollers: Working, Types, Formula, Applications Explained

ADC and DAC in Microcontrollers Working, Types, Formula & Applications

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:

  • ADC and DAC in microcontrollers
  • Analog and digital signals
  • ADC and DAC working principles
  • ADC resolution and formulas
  • Types of ADC and DAC architectures
  • ADC and DAC applications
  • ADC and DAC in embedded systems
  • LPC1768 and STM32 ADC/DAC features
  • Sampling theorem and accuracy factors
  • Real-world industrial applications

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.

Understanding Analog and Digital Signals

Before understanding ADC and DAC in embedded systems, it is important to understand the difference between analog and digital signals.

Analog Signal

An analog signal varies continuously with time. The signal can take infinite voltage values within a specific range.

Examples of analog signals include:

  • Microphone output
  • Temperature sensor voltage
  • Battery voltage
  • ECG signals
  • Pressure sensor output
  • LDR voltage variation

Analog signals are smooth and continuous in nature.

Characteristics of Analog Signals

  • Continuous waveform
  • Infinite possible values
  • More sensitive to noise
  • Used in real-world sensing applications

Digital Signal

A digital signal contains discrete voltage levels.

Typically:

  • 0 → LOW
  • 1 → HIGH

Digital systems process binary values such as:

0101011010

Microcontrollers operate using digital logic, which means they cannot directly process analog voltages generated by sensors.

This creates the need for ADC in microcontrollers.

What is ADC?

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.

Why ADC is Needed in Embedded Systems

Most sensors generate analog outputs.

Examples:

SensorOutput Type
LM35Analog Voltage
PotentiometerVariable Voltage
LDRAnalog Signal
Pressure SensorAnalog Voltage
Gas SensorAnalog 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.

 

 

registor_now_P

 

 

ADC Working Principle

The ADC samples the analog voltage and converts it into a corresponding digital value.

For example:

Suppose:

  • Reference Voltage = 5V
  • ADC Resolution = 8-bit

Then:

2^8 = 256 levels

The ADC can represent values from:

0 to 255

The input analog voltage is mapped into one of these digital levels.

ADC Conversion Formula

The ADC digital output can be calculated using the following formula:

[
Digital\ Value = \frac{V_{in}}{V_{ref}} \times (2^n - 1)
]

Where:

  • (V_{in}) = Input voltage
  • (V_{ref}) = Reference voltage
  • (n) = ADC resolution

This ADC formula is widely used in embedded systems and microcontroller programming.

Example ADC Calculation

Suppose:

  • Input Voltage = 2.5V
  • Reference Voltage = 5V
  • Resolution = 8-bit

Then:

[
Digital\ Value = \frac{2.5}{5} \times (2^8 - 1)
]

[
= 0.5 \times 255
]

[
= 127.5
]

Approximate digital output:

128

ADC Resolution

ADC resolution determines how accurately the analog signal can be represented digitally.

Higher ADC resolution provides better precision.

ADC Resolution Formula

[
Resolution\ Step\ Size = \frac{V_{ref}}{2^n}
]

Example ADC Resolution Calculation

For:

  • 10-bit ADC
  • 5V reference voltage
[
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.

Types of ADC

Different ADC architectures are used depending on speed, accuracy, power consumption, and application requirements.

1. Flash ADC

Flash ADC is the fastest ADC architecture.

Features of Flash ADC

  • Very high conversion speed
  • Uses multiple comparators
  • Low conversion delay
  • Expensive implementation

Applications of Flash ADC

  • Oscilloscopes
  • RF systems
  • High-speed communication systems

2. Successive Approximation ADC (SAR ADC)

SAR ADC is the most commonly used ADC architecture in microcontrollers.

Features of SAR ADC

  • Good accuracy
  • Moderate speed
  • Low power consumption
  • Compact design

Microcontrollers Using SAR ADC

  • LPC1768
  • STM32
  • PIC
  • AVR
  • Arduino

SAR ADC is widely used in embedded systems and IoT devices.

3. Dual Slope ADC

Dual slope ADC provides very high accuracy.

Features

  • Very accurate
  • Excellent noise rejection
  • Slow conversion speed

Applications

  • Digital multimeters
  • Precision instrumentation

4. Sigma Delta ADC

Sigma Delta ADC provides extremely high precision.

Features

  • High resolution
  • Excellent noise reduction
  • Suitable for low-frequency signals

Applications

  • Audio systems
  • Medical electronics
  • Biomedical instruments

ADC in Microcontrollers

Many modern microcontrollers include built-in ADC modules.

Examples of ADC in Microcontrollers

MicrocontrollerADC Resolution
8051External ADC Required
Arduino UNO10-bit ADC
LPC176812-bit ADC
STM3212-bit ADC

Built-in ADC peripherals simplify sensor interfacing and reduce external hardware requirements.

ADC Channels in Microcontrollers

Microcontrollers usually support multiple ADC channels.

Examples:

  • ADC0.0
  • ADC0.1
  • ADC0.2

This enables the microcontroller to interface with multiple sensors simultaneously.

ADC Conversion Steps

The ADC conversion process typically involves the following steps.

Step 1

Analog voltage is applied to the ADC input pin.

Step 2

A sample-and-hold circuit captures the voltage.

Step 3

The ADC converts the analog voltage into a binary value.

Step 4

The digital output is stored in the ADC register.

The microcontroller then reads this digital data for processing.

Practical ADC Example in Embedded Systems

Potentiometer Interface with LPC1768

Components Used

  • Potentiometer
  • LPC1768 Microcontroller
  • LCD Display

Working Principle

  • Rotating the potentiometer changes voltage
  • ADC reads the varying voltage
  • The analog voltage is converted into digital data
  • LCD displays the ADC value

This is one of the most common ADC interfacing examples in embedded systems.

ADC Applications

ADC applications are extremely important in embedded systems and electronics.

Sensor Interfacing

ADC is used for interfacing:

  • Temperature sensors
  • Gas sensors
  • Pressure sensors
  • Light sensors
  • Humidity sensors

Battery Monitoring

Used in:

  • UPS systems
  • Electric vehicles
  • Battery management systems

Industrial Automation

ADC is used for monitoring analog industrial parameters.

Examples:

  • Temperature monitoring
  • Process control
  • Industrial instrumentation

Robotics

Used for reading:

  • Joystick inputs
  • Motion sensors
  • Proximity sensors

What is DAC?

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.

Why DAC is Needed

Microcontrollers generate digital signals, but many external devices require analog voltages.

Examples include:

  • Speakers
  • Analog motor control systems
  • Audio amplifiers
  • Waveform generators
  • Analog communication circuits

DAC enables the microcontroller to generate these analog outputs.

DAC Working Principle

DAC receives a digital input and generates a proportional analog voltage.

The analog output voltage depends on the digital input value and reference voltage.

DAC Formula

The DAC output voltage is calculated as:

[
V_{out} = \frac{D}{2^n -1} \times V_{ref}
]

Where:

  • (D) = Digital input value
  • (n) = DAC resolution
  • (V_{ref}) = Reference voltage

Example DAC Calculation

Suppose:

  • 8-bit DAC
  • Digital input = 128
  • Reference voltage = 5V

Then:

[
V_{out} = \frac{128}{255} \times 5
]

Output:

[
≈ 2.5V
]

Types of DAC

1. Binary Weighted DAC

Binary weighted DAC uses weighted resistors.

Drawbacks

  • Difficult resistor matching
  • Less accurate for higher resolutions

2. R-2R Ladder DAC

R-2R Ladder DAC is the most popular DAC architecture.

Advantages of R-2R DAC

  • Simple design
  • Better accuracy
  • Easy implementation
  • Cost effective

R-2R DAC is widely used in embedded systems.

DAC in Microcontrollers

Some modern microcontrollers include built-in DAC peripherals.

Examples

MicrocontrollerDAC Availability
LPC176810-bit DAC
STM32Built-in DAC
Arduino UNOPWM-based DAC

DAC peripherals are useful for analog output generation and waveform creation.

DAC Applications

Audio Systems

DAC is used for generating audio signals.

Waveform Generation

DAC can generate:

  • Sine waves
  • Square waves
  • Triangle waves

Motor Control

DAC is used for analog speed control systems.

Communication Systems

Used in signal generation and modulation systems.

 

 

Explore Courses - Learn More

 

 

Difference Between ADC and DAC

FeatureADCDAC
Full FormAnalog to Digital ConverterDigital to Analog Converter
InputAnalogDigital
OutputDigitalAnalog
PurposeReading sensorsGenerating analog signals

ADC vs DAC Example

ADC Example

Temperature sensor → Microcontroller

DAC Example

Microcontroller → Speaker amplifier

This simple ADC vs DAC comparison helps beginners understand the direction of signal conversion.

ADC Accuracy Factors

Several factors affect ADC accuracy in embedded systems.

Resolution

Higher ADC bits provide better precision.

Noise

Electrical noise affects ADC conversion accuracy.

Reference Voltage Stability

An unstable reference voltage causes incorrect ADC readings.

Sampling Rate

Sampling rate determines ADC conversion speed.

Sampling Theorem

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 in Embedded Systems

ADC and DAC are essential components in modern embedded systems.

Automotive Electronics

Applications include:

  • Engine monitoring
  • Battery management systems
  • Sensor interfacing
  • Automotive control systems

IoT Devices

Used in:

  • Environmental monitoring
  • Smart sensors
  • Wireless sensor nodes
  • Home automation systems

Medical Electronics

Applications include:

  • ECG acquisition
  • Biomedical sensors
  • Patient monitoring systems

Consumer Electronics

Used in:

  • Smart appliances
  • Audio systems
  • Portable electronics

ADC and DAC in LPC1768

LPC1768 is widely used in embedded systems training and industrial applications.

ADC Features of LPC1768

  • 12-bit resolution
  • Multiple ADC channels
  • Fast conversion speed
  • Built-in ADC module

DAC Features of LPC1768

  • 10-bit DAC
  • Analog output generation
  • Suitable for waveform generation

Applications

  • Analog control systems
  • Waveform generation
  • Embedded signal processing

Challenges in ADC and DAC Design

ADC Challenges

  • Quantization noise
  • Conversion delay
  • Input noise
  • Accuracy limitations

DAC Challenges

  • Output ripple
  • Non-linearity
  • Settling time
  • Signal distortion

Future Trends in ADC and DAC

Modern embedded systems are increasingly using:

  • High-speed ADCs
  • Ultra-low-power converters
  • AI-enabled sensor interfaces
  • High-resolution DACs
  • Smart embedded signal processing systems

Applications are growing rapidly in:

  • Autonomous vehicles
  • Industrial IoT
  • Smart manufacturing
  • Wearable electronics
  • AI-powered embedded systems

Conclusion

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:

  • ADC resolution
  • Sampling theorem
  • ADC and DAC formulas
  • DAC operation
  • ADC architectures
  • Signal conversion techniques

is extremely important for:

  • Embedded engineers
  • Electronics designers
  • IoT developers
  • Automation engineers
  • Robotics engineers
  • Embedded Linux developers

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.

 

 

Talk to Academic Advisor

FAQs

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.

Author

Embedded Systems trainer – IIES

Updated On: 13-05-26


10+ years of hands-on experience delivering practical training in Embedded Systems and it's design