EE522
Advanced Embedded Systems
Sources: [Introduction to Embedded Systems, Edward A.
Lee and Sanjit A. Seshia, UC Berkeley.
Embedded Networked Systems, Kai Huang, TU Munich]
2-1
What is a sensor? An actuator?
A sensor is a device that measures a physical
quantity
Input / “Read from physical world”
An actuator is a device that modifies a physical
quantity
Output / “Write to physical world”
2-2
Sensors and Actuators – The Bridge
between the Cyber and the Physical
Sensors: Actuators:
Cameras Motor controllers
Accelerometers Solenoids
Rate gyros LEDs, lasers
Strain gauges LCD and plasma
Microphones displays
Magnetometers Loudspeakers
Radar/Lidar Switches
Chemical sensors Valves
Pressure sensors …
Switches
…
2-3
Sensors and Actuators – The Bridge
between the Cyber and the Physical
Modeling Issues:
Physical dynamics
Noise
Bias
Sampling
Interactions
Faults
2-4
Self-Driving Cars
2-5
Sensor-Rich Cars
2-6
Sensor-Rich Cars
2-7
Magnetometers
A very common type is the Hall
Effect magnetometer.
Charge particles (electrons, 1)
flow through a conductor (2)
serving as a Hall sensor.
Magnets (3) induce a magnetic
field (4) that causes the charged
particles to accumulate on one
side of the Hall sensor, inducing
a measurable voltage difference
from top to bottom. The four
drawings at the right illustrate
electron paths under
different current and magnetic
field polarities.
Edwin Hall discovered this effect
in 1879. 2-8
Magnetometers
A Hall effect sensor/magnetometer is a
transducer that varies its output voltage in
response to a magnetic field.
Hall effect sensors are used for proximity
switching, positioning, speed detection, and
current sensing applications.
Source [Wikipedia]
2-9
Accelerometers
Uses:
Navigation
Orientation
Drop detection
Image stabilization
Airbag systems
A movable mass is attached via a spring to a fixed frame. Assume that the sensor
circuitry can measure the position of the movable mass relative to the fixed frame
(this can be done, for example, by measuring capacitance). When the frame accelerates
in the direction of the double arrow in the figure, the acceleration results in
displacement of the movable mass, and hence this acceleration can be measured.
2-10
Spring-Mass-Damper Accelerometer
A movable mass is attached via a
spring to a fixed frame. Assume
that the sensor circuitry can
measure the position of the
movable mass relative to the
fixed frame (this can be done,
for example, by measuring
capacitance). When the frame
accelerates in the direction of the
double arrow in the figure, the
acceleration results in displacement
of the movable mass, and hence
this acceleration can be measured. 2-11
Spring-Mass-Damper Accelerometer
By Newton’s second
law, F=ma.
For example, F could
be the Earth’s
gravitational force.
The force is balanced
by the restoring force
of the spring.
2-12
Spring-Mass-Damper System
Exercise: Convert to an integral equation with initial
conditions. 2-13
Measuring Tilt
An accelerometer can measure
the tilt (relative to gravity) of the
fixed frame.
Any acceleration experienced
by the fixed frame will add or
subtract from this measurement.
2-14
Difficulties Using Accelerometers
Separating tilt from acceleration
Vibration
Nonlinearities in the spring or damper
Integrating twice to get position: Drift
Position is the integral of
velocity, which is the
integral of acceleration.
Bias in the measurement
of acceleration causes
position estimate error to
increase quadraticaly.
2-15
Inertial Navigation Systems (INS)
INS uses combinations of:
GPS (for initialization and periodic correction)
Three axis Gyroscope measures orientation
Three axis Accelerometer, double integrated for
position after correction for orientation
Position is estimated by dead reckoning. Dead
reckoning starts from a known initial position and
orientation, and then uses measurements of
motion to estimate subsequent position and
orientation.
Typical drift for systems used in aircraft have to
be: 0.6 nautical miles per hour 2-16
Measuring Changes in
Orientation: Gyroscopes
Optical gyros: Leverage the Sagnac effect, where a
laser light is sent around a loop in opposite directions
and the interference is measured. When the loop is
rotating, the distance the light travels in one direction
is smaller than the distance in the other. This shows up
as a change in the interference.
2-17
Measuring Sound: Microphone
A microphone measures changes in sound pressure.
A number of techniques are used,
Electromagnetic induction (where the sound pressure
causes a wire to move in a magnetic field) or
Capacitance (where the distance between a plate
deformed by the sound pressure and a fixed plate
varies, causing a measurable change in capacitance), or
The piezoelectric effect (where charge accumulates in
a crystal due to mechanical stress).
2-18
Other Sensors
There are many more types of sensors. For example:
Temperature sensors: Measuring temperature is central
to HVAC systems, automotive engine controllers,
overcurrent protection, and many industrial chemical
processes.
Chemical sensors can pick out particular pollutants,
measure alcohol concentration, etc.
Cameras and photodiodes measure light levels and color.
Clocks measure the passage of time.
2-19
Design Issues with Sensors
Calibration
Relating measurements to the physical phenomenon
Nonlinearity
Measurements may not be proportional to physical phenomenon
Correction may be required
Feedback can be used to keep operating point in linear region
Sampling
Aliasing
Missed events
Noise
Analog signal conditioning
Digital filtering
Introduces latency
2-20
Models of Sensors and Actuators
Sensors and actuators connect the cyber world
with the physical world
Numbers in the cyber world bear a relationship
with quantities in the physical world
Need models of that relationship
Having a good model of a sensor or actuator is
essential to effectively using it
2-21
Linear and Affine Models
Many sensors may be approximately modeled by
an affine function
2-22
Range
No sensor or actuator truly realizes an affine
function.
In particular, the range of a sensor, the set of
values of a physical quantity that it can measure, is
always limited.
Outside that range, an affine function model is no
longer valid
The sensor is reasonably modeled by an affine
function within an operating range (L;H),
2-23
Dynamic Range
Digital sensors are unable to distinguish between two
closely-spaced values of the physical quantity.
The precision p of a sensor is the smallest absolute
difference between two values of a physical quantity
whose sensor readings are distinguishable.
The dynamic range D of a digital sensor is the ratio
(usually expressed in dB)
2-24
Quantization
A digital sensor represents a physical quantity using an
n-bit number, where n is a small integer
There are only 2n distinct such numbers, so such a
sensor can produce only 2n distinct measurements
For actual physical quantity, the sensor must pick one of
the 2n numbers to represent it, this process is called
Quantization
An ideal n-bit digital sensor will have a precision
and dynamic range
2-25
Quantization
Sensor distortion function for a 3-bit digital
sensor capable of measuring a range of zero to
one volt, where the precision p = 1/8.
2-26
2-27
Noise
By definition, noise is the part of a signal that we do
not want. If we want to measure x(t) at time t, but
we actually measure x’ (t), then the noise is the
difference
A measure of (the square root of) noise power
Signal to noise ratio (SNR, in decibels) is defined in
terms of RMS noise and signal
2-28
Sampling
A digital sensor will sample the physical quantity at
particular points in time to create a discrete signal.
In uniform sampling, there is a fixed time interval T
between samples; T is called the sampling interval.
Aliasing
Sampled data is vulnerable to aliasing, where high
frequency components masquerade as low frequency
components.
Careful modeling of the signal sources and analog
signal conditioning or digital oversampling are
necessary to counter the effect.
2-29
Sampling
Illustration of aliasing, where samples of a 9 kHz
sinusoid taken at 8,000 samples per second are the
same as samples of a 1 kHz sinusoid taken at 8,000
samples per second.
2-30
Harmonic Distortion
A form of nonlinearity that occurs even within the
operating range of sensors and actuators is harmonic
distortion.
For example, a microphone may be less responsive to
high sound pressure than to lower sound pressure.
Harmonic distortion is a nonlinear effect that can be
modeled by powers of the physical quantity.
Specifically, second harmonic distortion is a dependence
on the square of the physical quantity
where d2 is the amount of second harmonic distortion
2-31
Signal Conditioning
Noise and harmonic distortion often have significant
differences from the desired signal
We can exploit those differences to reduce or even
eliminate the noise or distortion
The easiest way to do this is with frequency
selective filtering i.e. condition the signal by
filtering it with an LTI system called a conditioning
filter
2-32
Signal Conditioning
2-33
Faults in Sensors
Sensors are physical devices
Like all physical devices, they suffer wear and tear,
and can have manufacturing defects
Cannot assume that all sensors on a system will
work correctly at all times
Solution: Use redundancy (multiple sensors)
However, must be careful how you use it!
2-34
How to deal with Sensor Errors
Difficult Problem, still research to be done
Possible approach: Intelligent sensor
communicates a difference between two readings,
not a point value
Width of interval (difference) indicates confidence,
health of sensor
2-35
Light-Emitting Diodes (LEDs)
LED is an actuator that provides a convenient way for
an embedded system to provide a visual indication of
some activity
Very few actuators can be driven directly from the
digital I/O pins (GPIO pins) of a microcontroller.
GPIO pins can source or sink a limited amount of
current, and any attempt to exceed this amount risks
damaging the circuits.
One exception is LEDs, which when put in series with
a resistor, can often be connected directly to a GPIO
pin
2-36
Motor Controllers
Bionic hand from Touch Bionics
costs $18,500, has and five DC
motors, can grab a paper cup
without crushing it, and turn a
key in a lock. It is controlled by
nerve impulses of the user’s arm,
combined with autonomous
control to adapt to the shape of
whatever it is grasping.
Source:
IEEE Spectrum, Oct. 2007. 2-37
Pulse-Width Modulation (PWM)
Delivering power to
actuators can be challenging.
Most DACs cannot deliver
much power, and require a
power amplifier between
the DAC and the device
being powered
If the device tolerates rapid
on-off controls (like DC
Motor), then delivering
power becomes much
easier using PWM.
2-38
Pulse-Width Modulation (PWM)
PWM allows you to control analog circuits and
actuators with a processor's digital outputs.
A pulse width modulated signal is a periodic
digital output waveform with a controlled period,
duty cycle, and polarity.
These waveforms can be used to drive stepper
motors, servo-motors, relays, LEDs (Light-
Emitting Diodes), and many other actuators.
By varying the duty cycle (the percentage of the
time that the PWM output is in its active state),
the average value of the PWM signal can be
changed. It can be employed to vary the intensity
of light put out by an LED, for example.
2-39
Model of a Motor
Model of a Motor
2-40
Cameras
Computer-controlled digital cameras
Digital video cameras
Specialized cameras
infrared
ultra fast/high resolution
motion trackers
2-41