0% found this document useful (0 votes)
27 views70 pages

06 Sensors Actuators

Uploaded by

21139019
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)
27 views70 pages

06 Sensors Actuators

Uploaded by

21139019
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/ 70

Cyber-Physical Systems

Sensors and Actuators

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
The Bridge between Cyber and Physical
Ø Sensors: Ø Actuators:
§ Cameras § Motor controllers
§ Accelerometers § Solenoids
§ Gyroscopes § LEDs, lasers
§ Strain gauges § LCD and plasma displays
§ Microphones § Loudspeakers
§ Magnetometers § Switches
§ Radar/Lidar § Valves
§ Chemical sensors Ø Modeling Issues:
§ Pressure sensors § Physical dynamics, Noise, Bias,
§ Switches Sampling, Interactions, Faults
3
Sensor-Rich Cars
Ø Source: Analog Devices

4
Sensor-Rich Cars
Ø Source: Wired Magazine

5
Self-Driving Cars

Google self-driving car 2.0


Berkeley PATH Project Demo, 1999, San Diego.

6
Kingvale Blower
Ø Berkeley PATH Project, March 2005

7
Sensor Model
Ø Linear and Affine Functions
𝑓 𝑥 𝑡 = 𝑎𝑥 𝑡
𝑓 𝑥 𝑡 = 𝑎𝑥 𝑡 + 𝑏

Ø Affine Sensor Model


𝑓 𝑥 𝑡 = 𝑎𝑥 𝑡 + 𝑏 + 𝑛
Ø Sensitivity (a), Bias (b) and Noise (n)
§ Sensitivity specifies the degree to which the measurement
changes when the physical quantity changes
8
Analog-to-Digital Converter (ADC)
Ø ADC is important almost to all application fields
Ø Converts a continuous-time voltage signal within a
given range to discrete-time digital values to quantify
the voltage’s amplitudes
x(t) x(n)

ADC
quantize
continuous-time discrete-time
analog signal digital values
9
Analog-to-Digital Converter (ADC)
Ø Three performance parameters:
§ sampling rate – number of conversions per unit time
§ Resolution – number of bits an ADC output
§ power dissipation – power efficiency
Ø Many ADC implementations:
§ sigma-delta (low sampling rate, high resolution)
§ successive-approximation (low power data acquisition)
§ Pipeline (high speed applications)

10
Successive-approximation (SAR) ADC

11
Successive-approximation (SAR) ADC
Ø A sample and hold circuit to acquire input
voltage(Vin)
Ø An analog voltage comparator
§ compares Vin to the output of the internal DAC and outputs the result of the
comparison to the successive approximation register (SAR)
Ø A successive approximation register subcircuit
§ Supplies an approximate digital code of Vin to the internal DAC
Ø An internal reference DAC
§ for comparison with VREF, supplies the comparator with an analog voltage
equal to the digital code output of the SARin. 12
Digital Quantization
Ø SAR Control Logic performs Binary Search
algorithm
§ DAC output is set to 1/2VREF
§ If VIN > VREF, SAR Control Logic sets the MSB of ADC, else
MSB is cleared
§ VDAC is set to ¾ VREF or ¼ VREF depending on output of
previous step
§ Repeat until ADC output has been determined
Ø How long does it take to converge?
13
Successive-approximation (SAR) ADC
• Binary search algorithm to
gradually approaches the
input voltage
• Settle into ±½ LSB bound
within the time allowed
T!"# = T$%&'()*+ + T#,*-./$),*
T#,*-./$),* = N×T!"#_#(,12
T!"#$%&'( is software configurable

14
ADC Conversion Time
T!"# = T$%&'()*+ + T#,*-./$),*

Ø Suppose ADCCLK = 16 MHz and Sampling time = 4 cycles

For 12-bit ADC


T!"# = 4 + 12 = 16 cycles = 1µs

For 6-bit ADC


T!"# = 4 + 6 = 10 cycles = 625ns

15
Determining Minimum Sampling Time
Ø When the switch is closed, the voltage across the capacitor
increases exponentially. t= time required for the
sample capacitor voltage
4
V# t = V)* ×(1 −
3
5
e !) to settle to within one-
fourth of an LSB of the
input voltage
Sampling time is often
software programmable!
Smaller sampling error
Larger sampling time Slower ADC speed Tradeoff
16
Resolution
Ø Resolution is determined by number of bits (in binary) to represent an analog input.
Ø Example of two quantization methods (N = 3)

Δ ½Δ

0
V 0
V
Digital Result = 8loor 2 × Digital Result = round 2 ×
V123 V123
Max quantization error = Δ = VREF/23 Max quantization error = ±½ Δ = ±VREF/24
round x = 8loor(x + 0.5) 17
Quantization Error
Ø For N-bit ADC, it is limited to ±½Δ
Ø Δ = is the step size of the converter.
Δ

Ø Example: for 12-bit ADC and input voltage range [0, 3V]
1 3𝑉
𝑀𝑎𝑥 𝑄𝑢𝑎𝑛𝑡𝑖𝑧𝑎𝑡𝑖𝑜𝑛 𝐸𝑟𝑟𝑜𝑟 = ∆= = 0.367𝑚𝑉
2 2×245

Ø How to reduce error?


18
Aliasing
Ø Example 1:
§ Consider a sinusoidal sound signal at 1 kHz : 𝑥 𝑡 = cos(2000𝜋𝑡)
§ Sampling interval T = 1/8000
§ Samples 𝑠 𝑛 = 𝑓 𝑥 𝑛𝑇 = cos(𝜋𝑛/4)
Ø Example 2:
§ Consider a sinusoidal sound signal at 9 kHz : 𝑥′ 𝑡 = cos(18000𝜋𝑡)
§ Sampling interval T = 1/8000
897 97 97
§ Samples 𝑠 6 7 = 𝑓 𝑥 𝑛𝑇 = cos = cos + 2𝜋𝑛 = cos = 𝑠(𝑛)
: : :

Ø There are many distinct functions x that when


sampled will yield the same signal s.
19
Minimum Sampling Rate
Ø In order to be able to reconstruct the analog input signal, the sampling rate
should be at least twice the maximum frequency component contained in the
input signal
Ø Example of two sine waves have the same sampling values. This is called
aliasing.

Nyquist–Shannon Sampling Theorem

Ø Antialiasing
§ Pre-filtering: use analog hardware to filtering out high-frequency components and only
sampling the low-frequency components. The high-frequency components are ignored.
§ Post-filtering: Oversample continuous signal, then use software to filter out high-
frequency components
20
ADC Conversion
Ø Input Range
§ Unipolar (0, VADCMAX)
§ Bipolar (-VADCMAX, +VADCMAX)
§ Clipping:
o If |VIN| > | VADCMAX |, then |VOUT| = | VADCMAX |

21
Automatic Gain Control (AGC)
Ø Closed loop Feedback regulating circuit in an
amplifier
Ø Maintains a suitable signal amplitude at its output,
despite variation of the signal amplitude at the input
Ø The average or peak output signal level is used to
dynamically adjust the gain of the amplifiers
Ø Example Use: Radio Receivers, Audio Recorders,
Microphone
22
Range and Dynamic Range
Ø Range

Ø Dynamic Range

Ø Precision (p)
23
Power and RMS of Signal
670
1
Ø Average Power of a signal 𝑃3 = + |𝑥2 |1
𝑁
245

|𝑥89:; |
Ø Crest Factor 𝐶=
𝑥-./
Ø Square root of the arithmetic mean of the squares
of the values 1
𝑥-./ = (𝑥0 1 + 𝑥1 1 + ⋯ + 𝑥2 1 )
𝑛

Ø Crest Factor
§ Sine Wave ~ 3.01dB, OFDM ~12dB
24
PAPR
Ø Crest Factor in dB
|𝑥89:; |
𝐶<= = 20𝑙𝑜𝑔05
𝑥-./

Ø Peak to Average Power Ratio (PAPR)


|𝑥89:; |1
𝑃𝐴𝑃𝑅 =
𝑥-./ 1
|𝑥89:; |1
𝑃𝐴𝑃𝑅<= = 10𝑙𝑜𝑔05 = 𝐶<=
𝑥-./ 1
25
Noise
Ø Measured signal – Actual signal

Ø Sensor Distortion Function: Sensor imperfections


and errors due to quantization can be modeled as
noise

26
Noise measured
Ø The root mean square (RMS) of the noise is equal
to the square root of the average value of n(t)2
Ø Noise Power

Ø Signal to Noise Ratio (SNR)

27
Noise modeled as statistical property
Ø x(t) is a random variable with
uniform distribution ranging from 0
to 1

Ø n(t) = f(x(t)) – x(t)


§ ranges from −1/8 to 0

28
Precision and Accuracy
Ø Precision: how close the two measured values can
be
Ø Accuracy: how close is the measured value to the
true value

29
Noise & Signal Conditioning
|Xd (w) |2
|Xn (w) |2
w

Filter: F (w)

Filtered signal:
|Xd (w) F (w) |2

|Xn (w) F (w) |2


w

30
Example Gain Control
Ø AD8338

31
Digital-to-analog converter (DAC)
Ø Converts digital data into a voltage signal by a N-bit DAC
𝐷𝑖𝑔𝑖𝑡𝑎𝑙 𝑉𝑎𝑙𝑢𝑒
𝐷𝐴𝐶678978 = 𝑉:;< ×
2=
Ø For 12-bit DAC
𝐷𝑖𝑔𝑖𝑡𝑎𝑙 𝑉𝑎𝑙𝑢𝑒
𝐷𝐴𝐶678978 = 𝑉:;< ×
4096
Ø Many applications:
§ digital audio
§ waveform generation
Ø Performance parameters
§ speed
§ resolution
§ power dissipation
§ glitches
32
DAC Implementations
§ Pulse-width modulator (PWM)
§ Binary-weighted resistor (We will use this one as an example)
§ R-2R ladder (A special case of binary-weighted resistor)

33
Binary-weighted Resistor DAC
-Vref
D3 D2 D1 D0

Rref
R/8 R/4 R/2 R

Vout

𝑅]^_
𝑉Z[\ = 𝑉]^_ × ×(𝐷`×2` + 𝐷a×2a + 𝐷b×2 + 𝐷c)
𝑅 34
Digital Music
0 1 2 3 4 5 6 7 8
C 16.352 32.703 65.406 130.813 261.626 523.251 1046.502 2093.005 4186.009
C# 17.324 34.648 69.296 138.591 277.183 554.365 1108.731 2217.461 4434.922
D 18.354 36.708 73.416 146.832 293.665 587.330 1174.659 2349.318 4698.636
D# 19.445 38.891 77.782 155.563 311.127 622.254 1244.508 2489.016 4978.032
E 20.602 41.203 82.407 164.814 329.628 659.255 1318.510 2637.020 5274.041
F 21.827 43.654 87.307 174.614 349.228 698.456 1396.913 2793.826 5587.652
F# 23.125 46.249 92.499 184.997 369.994 739.989 1479.978 2959.955 5919.911
G 24.500 48.999 97.999 195.998 391.995 783.991 1567.982 3135.963 6271.927
G# 25.957 51.913 103.826 207.652 415.305 830.609 1661.219 3322.438 6644.875
A 27.500 55.000 110.000 220.000 440.000 880.000 1760.000 3520.000 7040.000
A# 29.135 58.270 116.541 233.082 466.164 932.328 1864.655 3729.310 7458.620
B 30.868 61.735 123.471 246.942 493.883 987.767 1975.533 3951.066 7902.133

Musical Instrument Digital Interface (MIDI) standard assigns the note A as pitch 69.
𝑓 = 440×2(93?@)/CD = 440
𝑓
𝑝 = 69 + 12× log D
440
35
Digital Music
Generate Sine Wave Ø No (Floating Point Unit) FPU
available on the processor to
compute sine functions
Ø Software FP to compute sine is
slow
Ø Solution: Table Lookup
§ Compute sine values and store in table
as fix-point format
§ Look up the table for result
§ Linear interpolation if necessary

36
Digital Music: Attack, Decay, Sustain, Release
Ø ADSR: Amplitude Modulation of Tones (modulate music amplitude)
Attack

Decay

Sustain

Release

Implemented by a simple digital filter:


ADSR n = g×ADSR + (1 − g)×ADSR(n − 1)
where
ADSR is the target modulated amplitude
value, g is the gain parameter.
37
Digital Music: ADSR Amplitude Modulation
Attack

Decay

+
Sustain

Release

38
Music with ADSR

39
Degrees of Freedom (DoF)
Ø Movement of a rigid body in space
Ø 3 DoF
§ Translational Movement (x, y, z)
§ Rotational Movement (roll, yaw, pitch)
Ø 6 DoF
§ Combine 3 Translational Movement and 3 Rotational Movement
Ø 9DoF
§ Sensor Fusion with Magnetometer

40
Accelerometers
The most common design measures the distance between
Ø Uses: a plate fixed to the platform and one attached by a spring
and damper. The measurement is typically done by
§ Navigation measuring capacitance.
§ Orientation
§ Drop detection
§ Image stabilization
§ Airbag systems
§ VR/AR systems

41
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.
42
Spring-Mass-Damper System

43
Measuring tilt

Ø Digital Accelerometer produces measurement f(x)

44
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 quadraticly.

45
Feedback
Ø Improves Accuracy & Dynamic Range
Ø The Berkeley Sensor and Actuator Center (BSAC) created the first silicon
microaccelerometers, MEMS devices now used in airbag systems,
computer games, disk drives (drop sensors), etc.

V/F

Digital

T
+
-

M. A. Lemkin, “Micro Accelerometer Design with Digital Feedback


Control”, Ph.D. dissertation, EECS, University of California,
Berkeley, Fall 1997 46
Changes in Orientation: Gyroscopes
Ø Gyroscopes measure angular velocity
§ how fast something is spinning about an axis.
Ø MEMS Gyros: microelectromechanical
systems using small resonating structures
Ø Optical Gyros:
§ 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.
47
Magnetometers
Ø 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.
Image source: Wikipedia Commons
Edwin Hall discovered this effect in 1879. 48
Magnetometers

49
Magnetometers: Issues
Ø Dependent on location
Ø Magnetic field near a sensor changes the result
Ø Indoor: a building generates its own field due to
ferromagnetic metals
Ø Moving elevator (for example) changes magnetic
field

50
Inertial Navigation Systems
Ø Combinations of:
§ GPS (for initialization and periodic correction).
§ Three axis gyroscope measures orientation.
§ Three axis accelerometer, double integrated for position after correction
for orientation.
Ø Typical drift for systems used in aircraft have to be:
§ 0.6 nautical miles per hour
§ tenths of a degree per hour
Ø Good enough? It depends on the application!
51
How often to calibrate?

52
Design Issues with Sensors
Ø Calibration Ø Sampling
§ Relating measurements to the physical § Aliasing
phenomenon § Missed events
§ Can dramatically increase
Ø Noise
manufacturing costs
§ Analog signal conditioning
Ø Nonlinearity
§ Digital filtering
§ Measurements may not be
§ Introduces latency
proportional to physical phenomenon
§ Correction may be required Ø Failures
§ Feedback can be used to keep § Redundancy (sensor fusion problem)
operating point in the linear region § Attacks (e.g. Stuxnet attack)

53
Minimizing Error

Head Tracking for the Oculus Rift, 2014


54
Light Emitting Diodes
Ø Read from book – 7.3.1

55
Motor
Ø DC motor consists of an electromagnet
Ø When current flows through the wires, the core
spins

56
Model of a Motor
Back electromagnetic
Ø Electrical Model: force constant
Angular velocity

Back EMF Voltage


R is the resistance and L the inductance of the coils in the motor

Ø Mechanical Model (angular version of Newton’s second law):


Torque is proportional to the
current flowing through the
motor, adjusted by friction
and any torque that might
Moment of Torque Friction Load be applied by the
inertia constant torque mechanical load
57
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.

58
Pulse-Width Modulation (PWM)
Ø Delivering power to
actuators can be
challenging. If the device
tolerates rapid on-off
controls (“bang-bang”
control), then delivering
power becomes much
easier.
Duty cycle around 10%
59
Violent Pitching of Qantas Flight 72
Ø An Airbus A330 en-route from Singapore to Perth on 7 October 2008
Ø Started pitching violently, unrestrained passengers hit the ceiling, 12
serious injuries, so counts it as an accident.
Ø Three Angle Of Attack (AOA)
sensors, one on left (#1),
two on right (#2, #3) of nose.
Ø Have to deal with inaccuracies,
different positions, gusts/spikes,
failures.

60
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
Ø à However, must be careful how you use it!

61
How to deal with Sensor Errors
Ø Difficult Problem, still research to be done

Ø Possible approach: Intelligent sensor


communicates an interval, not a point value
§ Width of interval indicates confidence, health of sensor

62
Sensor Fusion: Marzullo’s Algorithm
Ø Axiom: if sensor is non-faulty, its interval
contains the true value
Ø Observation: true value must be in overlap of
non-faulty intervals
Ø Consensus (fused) Interval to tolerate f faults in n:
Choose interval that contains all overlaps of n − f;
i.e., from least value contained in n − f intervals
to largest value contained in n − f
63
Example: 4 sensors, at most one faulty
Ø Interval reports range of possible values.
Ø Of S1 and S4, one must be faulty.
Ø Of S3 and S4, one must be faulty.
Ø Therefore, S4 is faulty.
Ø Sound estimate is the overlap of the remaining
three. S1
S2
S3
S4
Probable value 64
Example: 4 sensors, at most one faulty
Ø Suppose S4’s reading moves to the left
Ø Which interval should we pick?
S1
S2
S3
S4
??
??

65
Example: 4 sensors, at most one faulty
Ø Marzullo’s algorithm picks the smallest interval
that is sure to contain the true value, under the
assumption that at most one sensor failed.
Ø But this yields big discontinuities. Jumps!
S1
S2
S3
S4

consensus 66
Schmid & Schossmaier’s Fusion Method
Ø Recall: n sensors, at most f faulty

Ø Choose interval from f+1st largest lower bound to


f+1st smallest upper bound

Ø Optimal among selections that satisfy continuity


conditions.
67
Example: 4 sensors, at most one faulty
Ø Assuming at most one faulty, Schmid and
Schossmaier’s method choose the interval between:
§ Second largest lower bound
§ Second smallest upper bound
§ This preserves continuity, but not soundness

S1
S2
S3
S4
consensus 68
Algorithm
Ø sort the lower and upper bounds of all the sensor
readings into ascending order à O(nlogn)
Ø scan the sorted list from smallest to largest,
maintaining an intersection count
§ increments by one for every lower bound and decrements by
one for every upper bound
Ø the lower bound l of the fusion interval is the first
value where the count reaches n − f
http://infolab.stanford.edu/pub/cstr/reports/csl/tr/83/247/CSL-TR-83-247.pdf 69
Network Time Protocol (NTP)
Ø Intersection Algorithm:
(Modified Marzullo’s
Algorithm)
Ø NTP client regularly polls
one or more NTP servers Source: https://en.wikipedia.org/wiki/Network_Time_Protocol

Ø Client computes its time


offset and round-trip delay

70

You might also like