0% found this document useful (0 votes)
6 views

Lecture7_Analog Interfacing

This document outlines the fundamentals of embedded systems, focusing on sensors and actuators, and the conversion between analog and digital values. It explains the necessity of measuring physical parameters, the functioning of various sensors, and the process of analog-to-digital conversion. Additionally, it covers the principles of digital-to-analog conversion and the importance of quantization and sampling in signal processing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Lecture7_Analog Interfacing

This document outlines the fundamentals of embedded systems, focusing on sensors and actuators, and the conversion between analog and digital values. It explains the necessity of measuring physical parameters, the functioning of various sensors, and the process of analog-to-digital conversion. Additionally, it covers the principles of digital-to-analog conversion and the importance of quantization and sampling in signal processing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

VietNam National University

University of Engineering and Technology

EMBEDDED SYSTEM FUNDAMENTALS


(ELT3240, NHẬP MÔN HỆ THỐNG NHÚNG)

TS. Nguyễn Kiêm Hùng


Email: [email protected]
Objectives

In this lecture you will be introduced to:


– Sensors, Actuators and Other hardware
components

3
Outline
• Sensor and Actuators
• Converting Between Analog and
Digital Values
• Analog to Digital conversion concepts
• Summary

4
Why It’s Needed
• Embedded systems often need to measure values of physical parameters
• These parameters are usually continuous (analog) and not in a digital form
which computers (which operate on discrete data values) can process

• Temperature • Pressure
– Thermometer (do you have a fever?) – Blood pressure monitor
– Thermostat for building, fridge, – Altimeter
freezer – Car engine controller
– Car engine controller – Scuba dive computer
– Chemical reaction monitor – Tsunami detector
– Safety (e.g. microprocessor thermal • Acceleration
management)
• Light (or infrared or ultraviolet) – Air bag controller
intensity – Vehicle stability
– Digital camera – Video game remote
– IR remote control receiver • Mechanical strain
– Tanning bed
– UV monitor • Other
– Touch screen controller
• Rotary position – EKG, EEG
– Wind gauge – Breathalyzer
– Knobs
Simplified Block Diagram

actuator
s
Sensors and Actuators
• Sensors:
– Capture physical stimulus
(e.g., heat, light, sound,
pressure, magnetism, or
other mechanical motion) mic
– Typical generate a
proportional electrical
current
– May require analog Temperature
+ Humidity compass
interface

accelerometer
Sensors
• Processing of physical data starts with capturing this data.

• Sensors can be designed for virtually every physical


stimulus
– heat, light, sound, weight, velocity, acceleration, electrical
current, voltage, pressure, ...

• Many physical effects used for constructing sensors.


– law of induction (generation of voltages in an electric field),
– light-electric effects.
Example: Acceleration Sensor

 MEMS device

 Small mass in
center

 When accelerated:
 Mass displaced from
center
 Resistance of wires
connected to mass
change
 Detect change in
resistance and model
acceleration

•Courtesy & ©: S. Bütgenbach, TU Braunschweig


CMOS Image Sensors
• Based on standard production process for CMOS chips,
allows integration with other components.
Charge-coupled devices (CCD)

Image Sensors: Based on charge transfer to next pixel cell


Example: Biometric Sensors
Example: Fingerprint sensor (© Siemens, VDE):

Integrated into ID
mouse.
Other examples of sensors
– Heart monitoring sensors
• “Managing Care Through the Air”
» IEEE Spectrum Dec 2004
– Rain sensors for wiper control
• High-end autos
– Pressure sensors
• Touch pads/screens
– Proximity sensors
• Collision avoidance
– Engine control sensors
– Audio sensors
– Motion sensors
– Thermal sensors
• SARS detection (“high fever”)
Simplified Block Diagram

actuators

15
Sensors and Actuators
• Actuators
– Convert a command to a
physical stimulus (e.g., heat,
light, sound, pressure,
magnetism, or other solenoid
mechanical motion) speaker
– May require analog
interface
laser diode/transistor

dc motor
16
Actuators
• Output physical stimulus varies in range and modality
– Large (industrial) control actuators
• Pneumatic systems: physical motion
– Optical output
• IR
– Thermal output
– Small motor controllers (stepper motors)
– MEMS devices
– List goes on…..

17
MEMS Actuators
Huge variety of actuators and output devices.

Microsystems motors as examples (© MCNC)


(Dimensions in the order of several microns)

(© MCNC)
18
Outline
• Sensor and Actuators
• Converting Between Analog and
Digital Values
• Analog to Digital conversion concepts
• Summary

19
The Big Picture – A Depth Gauge
V_ref // Your software
ADC_Code = ADC0->R[0];
Analog to V_sensor = ADC_code*V_ref/1023;
Pressure Pressure_kPa = 250 * (V_sensor/V_supply+0.04);
Digital
Sensor Depth_ft = 33 * (Pressure_kPa –
Converter
Atmos_Press_kPa)/101.3;
Water
Pressure
V_sensor Voltages ADC
Output Codes
ADC_Code V_ref 111..111
111..110
111..101
111..100

V_sensor ADC_Code

000..001
Ground 000..000
1. Sensor detects water pressure and generates a
proportional output voltage V_sensor
2. ADC generates a proportional digital integer
(code) based on V_sensor and V_ref
3. Code can convert that integer to a something
more useful
1. first a float representing the voltage,
2. then another float representing pressure,
3. finally another float representing depth
Getting From Analog to Digital
• A Comparator tells us “Is Vin > Vref?”
– Compares an analog input voltage with
an analog reference voltage and Comparator

determines which is larger, returning a Vin


0
1-bit number Vref
– E.g. Indicate if depth > 100 ft
– Set Vref to voltage pressure sensor
returns with 100 ft depth.
A/D Converter
Vref
• An Analog to Digital converter [AD or 0

ADC] tells us how large Vin is as a Vin


1

fraction of Vref. 0
Clock 1
– Reads an analog input signal (usually a
voltage) and produces a corresponding
multi-bit number at the output.
– E.g. calculate the depth
Digital to Analog Conversion
• May need to generate an analog voltage or
current as an output signal
– E.g. audio signal, video signal brightness.
• DAC: “Generate the analog voltage which is
this fraction of Vref ” D/A Converter
0
• Digital to Analog Converter equation 1
– n = input digital value 0
Vout
1
– B = number of bits of resolution of converter
Vref
– Vref = reference voltage
– Vout = output voltage. Either
• Vout = Vref * n/(2B) or
• Vout = Vref * (n+1)/(2B)
• The offset +1 term depends on the internal
tap configuration of the DAC – check the
datasheet to be sure
Waveform Sampling and Quantization
Digital value

time

• A waveform is sampled at a constant rate – every t


– Each such sample represents the instantaneous amplitude at the instant of
sampling
– “At 37 ms, the input is 1.91341914513451451234311… V”
– Sampling converts a continuous time signal to a discrete time signal
• The sample can now be quantized (converted) into a digital value
– Quantization represents a continuous (analog) value with the closest discrete
(digital) value
– “The sampled input voltage of 1.91341914513451451234311… V is best
represented by the code 0x018, since it is in the range of 1.901 to 1.9980 V
which corresponds to code 0x018.”
Forward Transfer Function Equations
What code n will the ADC use to represent voltage Vin?

General Equation Simplification with V-ref = 0 V


n = converted code
Vin = sampled input voltage
V+ref = upper voltage reference 
Vin  2
B

V-ref = lower voltage reference n   1/ 2


 V ref 
B = number of bits of resolution in ADC

3.30v 210
V  B
in V ref 2
n 
 5v
 1/ 2

 676
n   1/ 2
 V ref  Vref 

X  = I floor function: nearest integer I such that I <= X


floor(x+0.5) rounds x to the nearest integer
Inverse Transfer Function
What range of voltages Vin_min to Vin_max does code n represent?

General Equation Simplification with V-ref = 0 V


n = converted code
Vin_min = minimum input voltage for code n
Vin_max = maximum input voltage for code n
V+ref = upper voltage reference
V-ref = lower voltage reference
B = number of bits of resolution in ADC
Outline
• Sensor and Actuators
• Converting Between Analog and
Digital Values
• Analog to Digital conversion concepts
• Summary

27
A/D – Flash Conversion
• A multi-level voltage divider is used to
set voltage levels over the complete
1V
range of conversion. 7/8 V
R Comparators

A comparator is used at each level to


+
• R
-
7

determine whether the voltage is lower 6/8 V +


6
R
or higher than the level. 5/8 V
-

• The series of comparator outputs are


+
R 5
-

encoded to a binary number in digital 4/8 V


+ Encoder
R 4 3
logic (a priority encoder) 3/8 V
-

• Components used Dout


+
R 3
-
– 2B resistors 2/8 V +
R 2
– 2B-1 comparators -
1/8 V +
R 1
-

Vin
1 0
ADC - Successive Approximation Conversion

Converter Schematic

Analog Input +
Comparator output

D/A Converter

Digital Output 12 Successive


Approximation
Start of Conversion Register
Status

Clock
ADC - Successive Approximation Conversion

• Successively approximate 111111


input voltage by using a binary
search and a DAC Test voltage
(DAC output)

• SA Register holds current


Analog
approximation of result Input
100110

Voltage
• Set all DAC input bits to 0 100100
100000
• Start with DAC’s most

know xxxxxx, try 100000

know 1001xx, try 100110


know 10xxxx, try 101000

know 100xxx, try 100100

know 10011x, try 100111


know 1xxxxx, try 110000
significant bit

know 100110. Done.


• Repeat
– Set next input bit for DAC to 1
– Wait for DAC and comparator
to stabilize T1 T2 T3 T4 T5 T6
000000

– If the DAC output (test Start of


Conversion
Time
voltage) is smaller than the
input then set the current bit
to 1, else clear the current bit
to 0
ADC Performance Metrics

• Linearity measures how well the transition voltages lie on a


straight line.

• Differential linearity measure the equality of the step size.

• Conversion time: between start of conversion and generation


of result

• Conversion rate = inverse of conversion time


Sample and Hold Devices
Sampling
switch
Output
Signal
Analog Input
Hold
Signal Capacitor

• Some A/D converters require the input analog signal to be held


constant during conversion (e.g. successive approximation devices)
• In other cases, peak capture or sampling at a specific point in time
requires a sampling device.
• A “sample and hold” circuit performs this operation
• Many A/D converters include a sample and hold circuit
Sampling Problems

• Nyquist criterion
– Fsample >= 2 * Fmax frequency component
– Frequency components above ½ Fsample are aliased, distort measured
signal
Inputs
• Differential
– Use two channels, and compute difference between them
– Very good noise immunity
– Some sensors offer differential outputs (e.g. Wheatstone Bridge)

• Multiplexing
– Typically share a single ADC among multiple inputs
– Need to select an input, allow time to settle before sampling

• Signal Conditioning
– Amplify and filter input signal
– Protect against out-of-range inputs with clamping diodes
Outline
• Sensor and Actuators
• Converting Between Analog and
Digital Values
• Analog to Digital conversion concepts
• Summary

35
Summary
• How a digital microcontroller can measure and generate
analog signals

• Examining quantization and sampling

• A digital-to-analog converter allows the MCU to generate an


analog signal.

• An analog-to-digital converter measures an analog voltage and


provides a proportional digital representation.

You might also like