eecs 388: embedded systemsheechul/courses/eecs388/w5.sensors.pdf · eecs 388: embedded systems 5....

67
EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1

Upload: others

Post on 26-Sep-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

EECS 388: Embedded Systems

5. Sensors and Actuators

Heechul Yun

1

Page 2: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Agenda

• Sensors vs. actuators– Analog vs. digital

– DAC, ADC

• Sensors– Accelerometers, gyro, magnetometer, GPS, radar,

lidar, camera.

– Nonlinearity, bias, dynamic range, quantization, noise, sampling, calibration

• Actuators– DC motors, PWM

2

Page 3: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Embedded/Cyber-Physical System

3

Computer Actuators

PhysicalPlant

Sensors

Page 4: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Sensors and Actuators

4

Page 5: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

DeepPicar

5

PlayStation Eye camera

DC Motors

• Sensors and Actuators

Page 6: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

KU AFS

• Sensors and Actuators

6

NVIDIA Tegra TK1 (Tegra K1)- 2GHz 4x Cortex-A15, GPU - 2GB DDR3L DRAM, 16GB eMMC

Arduino Due (AT91SAM3X8E)- 84MHz Cortex M3- 96KB SRAM, 512KB Flash Servo

MotorsGPS/IMU

Radar, Camera

USB serial

Page 7: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

7https://www.nytimes.com/interactive/2016/12/14/technology/how-self-driving-cars-work.html

Google Self-Driving Car Sensors

Page 8: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Sensors and Actuators

• Sensor

– Measure a physical quantity

– Input: “Read from physical world”

• Actuator

– Alter a physical quantity

– Output: “Write to physical world”

8

Page 9: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Digital vs. Analog Signals

9

This Photo by Unknown Author is licensed under CC BY-SA

0

1

Physical world

Cyber world

Page 10: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

ADC and DAC

• ADC (analog-to-digital converter)– Convert an analog signal into a digital one

• DAC (digital-to-analog converter)– Convert a digital signal into an analog one

10

Page 11: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Sensors

• Accelerometer

• Gyro

• Magnetometer

• GPS

• Ultrasonic

• Lidar

• Radar

• Camera

11

Page 12: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Accelerometer

• Measure acceleration

– F = ma

– Earth’s gravitational force is balanced by the restoring force of the spring

12

Spring-Mass-Damper model

Source: E. A Lee, UCB

Page 13: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

MEMS Accelerometer

13

• Micro-electro mechanical systems (MEMS)

– Very small mechanical structure (moving parts)

https://www.youtube.com/watch?v=RLQGZl0lpjQ

Page 14: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Gyroscope

14

• Measure angular velocity

– Coriolis force

https://howtomechatronics.com/how-it-works/electrical-engineering/mems-accelerometer-gyrocope-magnetometer-arduino/

Page 15: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

MEMS Gyroscope

15

https://howtomechatronics.com/how-it-works/electrical-engineering/mems-accelerometer-gyrocope-magnetometer-arduino/

Page 16: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Magnetometer

• Measure magnetic field– Hall effect

• Use cases– Compass

– Proximity sensor

– Wheel speed sensor

– Camshaft position sensor

– …

16

https://en.wikipedia.org/wiki/File:Hall_Sensor.webm

Page 17: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Inertial Measurement Unit (IMU)

• Accelerometer + gyroscope + (magnetometer)

• Use cases: Maneuver UAV, satellite, etc.

17

Apollo Inertial Measurement Unit

https://en.wikipedia.org/wiki/Inertial_measurement_unit

Roll, Yaw, Pitch

https://en.wikipedia.org/wiki/Flight_dynamics_(fixed-wing_aircraft)

Page 18: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

MPU-6050

• 3-axis gyroscopes, 3-axis accelerometers

• A single chip MEMS sensors

• I2C interface

• 16 bit ADC

18

MCU MPU-6050

0b1101000

SCL

SDA

Page 19: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

MPU-6050

19

Page 20: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

GPS

• Global positioning system: a satellite based system owned and operated by US gov.

• Fundamental– Radio signals from satellites

moves at a constant speed– The time difference is

proportional to the distance– With at least four satellites,

location can be determined– 50 bit/s, takes 30-40 sec,

5-10 meter position errors

20

By Paulsava, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=47210072

Page 21: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Ultrasonic

• Use sound waves to detect objects

• Cheap, works well in bad weather

• Short range

21

https://electronics.stackexchange.com/questions/177897/what-sensors-shall-be-used-to-detect-if-a-dustbin-is-full-light-weight-material

Page 22: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Radar

• Use radio waves to detect objects

• Does well in bad weather

• Low resolution

22Self-Driving Cars State of the Art (2019), https://deeplearning.mit.edu

Page 23: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Lidar

• Use light (laser) to detect objects

• Very accurate 360 degree depth information

• Used by most self-driving cars

• Expensive

23Self-Driving Cars State of the Art (2019), https://deeplearning.mit.edu

Page 24: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Electromagnetic Waves: Radio (Radar) vs. Light (Lidar)

24

https://en.wikipedia.org/wiki/Electromagnetic_spectrum#/media/File:EM_Spectrum_Properties_edit.svg

Page 25: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

TFMini Lidar

25

• Use LED (instead of laser) to detect objects

• Single direction (single point estimate)

• UART interface

Page 26: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

TFMini Lidar

• Detection range

26

12M7M3M30cm

Blindrange

OutdoorHigh sunshine

OutdoorNormal sunshine

IndoorCondition

Page 27: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

TFMini Lidar

• Data format

27

Page 28: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Camera

• Inexpensive, highest resolution

• Require high computing capacity

• Not good in bad weathers, at depth estimation

28Self-Driving Cars State of the Art (2019), https://deeplearning.mit.edu

Page 29: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Recap

• Digital vs. Analog

• ADC vs. DAC

• Accelerometer, Gyro, Magnetometer, IMU

• Ultrasonic, Lidar, Laser, Camera

29

Page 30: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

30https://cleantechnica.com/2016/07/29/tesla-google-disagree-lidar-right/

Page 31: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

31https://cleantechnica.com/2016/07/29/tesla-google-disagree-lidar-right/

Page 32: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

32https://cleantechnica.com/2016/07/29/tesla-google-disagree-lidar-right/

Page 33: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

33https://cleantechnica.com/2016/07/29/tesla-google-disagree-lidar-right/

Page 34: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Sensor Fusion

34https://cleantechnica.com/2016/07/29/tesla-google-disagree-lidar-right/

Page 35: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Two Approaches to Self-Driving

• Lidar camp

– Use Lidar and detailed 3D map

– Good: accurate, explainable

– Bad: expensive (both Lidar and the map)

• Camera camp

– Use camera as the primary sensor (like human)

– Good: cheap(ish)

– Bad: not accurate, not explainable

35

Page 36: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Tesla Autopilot Sensors

36https://www.tesla.com/autopilot

Page 37: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Tesla Autopilot Sensors

37https://www.tesla.com/autopilot

Page 38: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Tesla Autopilot Sensors

38https://www.tesla.com/autopilot

Page 39: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Tesla Autopilot Sensors

39https://www.tesla.com/autopilot

Page 40: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Tesla Autopilot Sensors

40https://www.tesla.com/autopilot

Page 41: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Design Issues with Sensors

• Calibration

• Nonlinearity

• Sampling

• Noise

• Failures

• Sensor Attacks

41

Page 42: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Sensor Calibration

• A sensor measures a physical quantity x and reports it to be f(x)

• Linear and affine model

f(x) = ax + b

where a is the sensitivity (gain) and b is the bias

• Calibration: Determine a and b

42

Page 43: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Sensor Calibration

43

Acceleration (g)x

-3.6 0 +3.6

Measured voltage (V)f(x)

0 1.5 3.0f(x) = ax + b

0 32768 65535

16 bit ADC [0,3v] -> [0, 216-1]

Q: Calculate a (gain) and b (bias)

A: a = 1.5/3.6, b = 1.5

Page 44: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Analog Devices ADXL330 Data Sheet

https://www.sparkfun.com/datasheets/Components/ADXL330_0.pdf

Page 45: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Nonlinearity

45

Linear Non-linear

Page 46: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Nonlinearity

46

Non-linearity=+-5% Non-linearity=+-0.5%

Page 47: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Analog Devices ADXL330 Data Sheet

https://www.sparkfun.com/datasheets/Components/ADXL330_0.pdf

Page 48: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Sampling

48This Photo by Unknown Author is licensed under CC BY-SA

Page 49: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Aliasing

49

Page 50: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Noise

• All sensors are noisy (at varying degrees)

• Filtering improve robustness

– Low/high pass filters (cut off low or high values of certain thresholds)

– Exponential weighted moving average (EWMA) filter: S(t) = a * Y(t) + (1-a) * S(t-1)

– …

50

Page 51: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Kalman Filter

• Estimating variables that cannot be directly measured using indirect measurements

• Model based optimal estimation algorithm

51

https://www.youtube.com/watch?v=4OerJmPpkRg

Page 52: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Sensor Failures

• Sensors are physical devices and thus can fail

– Some are more prone than others, but all can fail

• Common causes

– Wear and tear, physical damage

– Obstruction (e.g., dust), bad weathers

– …

• You cannot assume all sensors of a system will work all the times.

52

Page 53: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Ethiopian Air 302 (2019)

• MCAS relied on a single sensor

– Single source of failure

53

https://www.seattletimes.com/business/boeing-aerospace/failed-certification-faa-missed-safety-issues-in-the-737-max-system-implicated-in-the-lion-air-crash

Page 54: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Redundancy

• Triple Modular Redundancy (TMR)

54

Module #1

Module #2

Module #3

Voting

Majority outcome

Page 55: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Lufthansa A321 (2014)

• Three redundant AoA sensors, but two freeze up simultaneously.

• The correct sensor’s outputs were discarded.

55

Page 56: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Sensor Attacks

• Hackers may deliberately affect sensor performance

• Examples– Drone hack: Spoofing attack demonstration on a

civilian unmanned aerial vehicle. GPS World, August 2012

– Rocking Drones with Intentional Sound Noise on Gyroscopic Sensors, USENIX Security, 2015

56

Page 57: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Drone GPS Spoofing (2012)

• Fool GPS sensors

– Attacker can control the trajectory of the UAV

57https://radionavlab.ae.utexas.edu/images/stories/files/papers/drone_hack_shepard.pdf

Page 58: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Sound Attack on IMU Sensor (2015)

58

https://youtu.be/k1FcDTeOSVI?t=821

Page 59: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Sensor Input SpoofingAttack & Defense

Drew DavidsonUniversity of Kansas EECSCybersecurity @ ITTC

Page 60: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Actuators

• DC motors

• PWM

60

Page 61: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

DC Motor

• Transforms electrical energy into mechanical energy– Lawrence law– Periodically change the direction

of current flow

• Brushed DC motor– Use mechanical switches to

change current flow

• Brushless DC motor– Use electronic mechanisms

to change current flow

61

How do DC motors work?:https://www.youtube.com/watch?v=LAtPHANEfQohttps://www.youtube.com/watch?v=bCEiOnuODac

This Photo by Unknown Author is licensed under CC BY-SA

Page 62: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Servo Motor

• Precisely control the angle

– E.g., car steering, robot arm, …

• A closed loop feedback system

– MCU + sensor + motor

62

Controller DC Motor

Position feedback

Input angle

error+

-

voltage

Page 63: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Pulse-Width Modulation (PWM)

• Encode analog signal using digital outputs

63

CC BY-SA 4.0. by Thewrightstuff

Page 64: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Pulse-Width Modulation (PWM)

• Actuators need time to react to input change

• Resulting gradual changes makes PWM effective for control

• Rapid on/off control is called as “bang-bang” control

64

Page 65: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Pulse-Width Modulation (PWM)

• PWM based servo motor control

– Angle = F(duty cycle length)

• E.g., 1ms = 0 degree, 1.5ms = 90 deg., 2ms = 180 deg.

65

Page 66: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Summary

• Sensors

– “Read from physical world”

– Essential for many (most) embedded systems

– No sensor is perfect: calibration, nonlinearity, noise, sampling, failure, security and other issues.

• Actuators

– “Write to physical world”

– Motors and PWM based control

66

Page 67: EECS 388: Embedded Systemsheechul/courses/eecs388/W5.sensors.pdf · EECS 388: Embedded Systems 5. Sensors and Actuators Heechul Yun 1. Agenda •Sensors vs. actuators –Analog vs

Acknowledgements

• These slides contain material developed by

– Edward A. Lee and Prabal Dutta (UCB) for EECS149/249A

– Lex Fridman (MIT) for 6.S094

67