XEE100 All Slides
XEE100 All Slides
XEE100 All Slides
Olav Solgaard
Bio
Olav Solgaard earned his Ph.D. degree from Stanford University in 1992. His doctoral dissertation:
“Integrated Semiconductor Light Modulators for Fiber-optic and Display Applications” was the basis
for the establishment of a Silicon Valley firm Silicon Light Machines (SLM), co-founded by Dr.
Solgaard in 1994. From 1992 to 1995 he carried out research on optical MEMS as a Postdoctoral
Fellow at the University of California, Berkeley, and in 1995, he joined the Electrical Engineering
faculty of the University of California, Davis. His work at UC Davis led to the invention of the multi-
wavelength, fiber-optical switch, which has been developed into commercial products by several
companies. In 1999 he joined Stanford University where he is now a Professor of Electrical
Engineering and the Director of Graduate Studies in the Department of Electrical Engineering.
Professor Solgaard’s research interests include optical MEMS, Photonic Crystals, optical sensors, microendoscopy, atomic force
microscopy, and solar energy conversion. He has authored more than 350 technical publications and holds 70 patents. Professor
Solgaard is a Fellow of the IEEE, the Optical Society of America, the Royal Norwegian Society of Sciences and Letters, and the
Norwegian Academy of Technological Sciences.
Ideal IoT
• Ubiquitous
Why is it important?
• Smart
• Fourth industrial • Agile
revolution • On demand
• Blend into background
• IoT will touch everything
• Secure
• Everything will have IoT
• Low maintenance
• Fast
• Upgradable
• Growing
• Adaptable
Internet
Security
Circuits
Sensors
Sensors
Dublin Airport
http://ecubelabs.com/case-studies/dublin-airport/
• Save energy
• Reduce light pollution
• Faster replacement
http://www.tvilight.com/
http://www.libelium.com/smart_parking/
http://government-2020.dupress.com/trend/connected-vehicles/
https://www.beddit.com/
http://www.proteus.com/
http://www.sfchronicle.com/business/article/Did-you-take-your-pill-Ingestible-sensors-can-11206980.php
• False positives
• Doctor’s offices will be filled with perfectly healthy, but anxious patients
Precision Agriculture
https://www.accenture.com/cn-en/insight-accenture-digital-agriculture-solutions
https://www.juicero.com/
Smart Manufacturing
https://www.slideshare.net/andrejt/ntk-2015-internet-of-things-track-iot-smart-home
# &
can measure is 𝑓 = Accelerometer modeled as
$% '
mechanical harmonic oscillator
Disturbances
and Noise
+
Proof
mass Position
Acceleration
+
+
Position Noise
Sensor +
1000 mAh
11.4 µA
http://www.mouser.com/applications/low-power-ewc-design/
offset
+ drift
thermal noise
signal
fcorner log f
§ Analog MOS circuits come with a variety of low frequency artifacts that can
easily ʺswamp outʺ DC or low-frequency signals of interest
Elicia White
Making Embedded Systems, O’Reilly
This has deep implications for how they are designed and why.
Typically, want to minimize cost/maximize lifetime for a given expected workload.
Optimized, custom software that uses as few resources as possible.
Both costs push designs to pick minimal MCU and optimize code for it
Internet
Security
Circuits
Sensors
Sensors
Outline
• Smart cities
• Healthcare
• Agriculture
• Manufacturing and logistics
http://ecubelabs.com/integrated-waste-management/
Dublin Airport
http://ecubelabs.com/case-studies/dublin-airport/
• Save energy
• Reduce light pollution
• Faster replacement
http://www.tvilight.com/
https://chess-wise.eu/en/smart-street-lighting/
http://www.govtech.com/transportation/Smart-Parking-Tech-US-Cities.html
http://www.libelium.com/smart_parking/
http://www.worldsensing.com/success-story/gliwice-smart-parking-solution/#
http://www.sensity.com/for-security-1/
Connected Vehicles
http://government-2020.dupress.com/trend/connected-vehicles/
Let’s Recap
Sensors
• Ultrasonic fill-level sensor
• Light and motion sensors
• Infrared- and magnetic-based vehicle detection sensor
• Camera
Communication Protocols
• Cellular IoT (LTE Cat-M1 and NB-IOT)
• Zigbee, LoRaWAN
• V2X
Networking Protocols
• Mesh network
Can be integrated with other IoT devices such as thermostat and camera to “close
the loop”. For example, if the baby is too warm, the thermostat will
automatically adjust.
http://mimobaby.com/ http://www.owletcare.com/smart-sock-2/
http://mimobaby.com/
https://sites.google.com/site/jagpurdue/projects/catalyst
http://rfmicron.com/health-care/ http://www.medisens.com/news/press-release-1
http://www.semtech.com/wireless-rf/internet-of-things/downloads/Semtech_Health_FallDetection_AppBrief-FINAL.pdf
Mood Enhancement
• Relaxing music could be cued to ease stress.
• Window shades could be programmed to let in the maximum amount of
natural light.
• Use IoT to encourage healthy behaviors.
• Automatically dim the lights in the home at a recommended bedtime.
• Automatically turn off the TV to encourage exercise.
https://www.beddit.com/
Anderson G. Chronic conditions: making the case for ongoing care. Baltimore, MD: Johns Hopkins University, 2010.
Sabate E. Adherence to long-term therapies: evidence for action. World Health Organization, 2003.
http://www.proteus.com/
http://www.sfchronicle.com/business/article/Did-you-take-your-pill-Ingestible-sensors-can-11206980.php
Outline
• Precision agriculture
• Connected livestock
• Food safety
https://flex.com/intelligence/iot/old-macdonalds-new-connected-farm
Precision Agriculture
https://www.accenture.com/cn-en/insight-accenture-digital-agriculture-solutions
Opportunities for
vertical integration
https://www.cbinsights.com/research/agriculture-tech-market-map-company-list/
Connected Livestock
• Around 1.4 billion cattle around the world
• Animals can't tell you when they first get sick. It can be hard for humans to
tell a cow is ill until there are visible signs of sickness.
• IoT sensors cannot diagnose an illness but it will let the farmer know when
something needs attention.
https://www.smaxtec.com/en/
https://www.smaxtec.com/en/
Connected Livestock
http://uk.smaxtec.com/smaxtec-system/
https://www.juicero.com/
Outline
• Smart manufacturing
• Smart packaging
http://www.businesswire.com/news/home/20170104005270/en/Internet-Spending-Forecast-Grow-17.9-2016-Led
Smart Packaging
• Packaging systems used with food and pharmaceutical that help extend shelf
life, monitor freshness, display information on quality, improve safety, and
improve convenience.
• Usually involve active functions beyond the inert passive containment, for
example, the ability to sense or measure an attribute of the product, the inner
atmosphere of the package, or the shipping environment. This information can
be communicated to users or can trigger other active packaging functions.
http://www.eetimes.com/author.asp?doc_id=1328602
Learning Objectives
• Describe and define performance criteria for sensors (e.g., linearity, sensitivity,
resolution, noise)
• Explain the operating mode for some common IoT transducers and sensors
(strain gage, accelerometer, gyros, temperature, pressure sensors…)
• Interpret a specification sheet and extrapolate missing performance data
Perception
Force or
of Topography or
Displacement
Stiffness
Rodin’s Cathedral
skin mechanics
stress/strain at neuron
neuron mechanics,
channel id & biophysics,
cell physiology
electrochemical response
neural circuit
past/current stimuli
behavioral response
Barrier Layer:
• Respiration/perspiration
• Cooling
skin surface
Sensory Function:
• Static Forces
• Dynamic Forces 10’s-100’s µm
• Temperature
100’s-1000’s µm
Sensor Terminology
Input
(measurand)
Sensor
Output
Measurand
Sensor Specifications
Measurand
Sensor
Output
Measurand
Non-Linearity
Voltage
Pressure
slope1
slope A
Voltage slope B
Pressure
Hysteresis
Voltage
Pressure
Voltage
Pressure
Drift
Voltage
Pressure
% full
scale
output
Voltage
Pressure
Span / Range
linear saturation
Voltage
Pressure
• Damper: F=bv k
x(t)
x(0)=0
• Spring: F=kx
X(s) 1/m
= G(s) = 2
F(s) s + bms+ k m
X(s) Kω n 2
= G(s) = 2
F(s) s + 2ζω n s + ω n 2
Step Response
Underdamped
Critically damped
Final
value
Voltage
Overdamped
Time
Slight delay
decay
combo
2nd order
system
time
Bandwidth
Δt1
Δt2
delay
decay
time
delay
decay
Bandwidth
1/Δt2 1/Δt1
frequency
Error
Correct Value
Band
at Output
Sensor
Output
Measurand
True Value of
Measurand
• Accurate x xx
x
x
• Average of sampled output is close to
real value (AC errors and noise)
• Precise Precise but Inaccurate
• Sampled output is consistently tightly
grouped with consistent offset from real x
x
Accurate but Imprecise
x x
x
x x
linear
R
Vout
Vout
Rsense
Rsense
æ Rsense ö
Vout = Vinç ÷
è Rsense + R ø
Rs = Ro + DR
Rs = Ro + DR
Recall that the Taylor series approximation of f(x) about operating point a is defined as:
æ Rsense ö
Vout = Vinç ÷ = V (Rs )
è Rsense + R ø
Rs = Ro + DR
é dV ( Rs ) ù (DR) 2 é d 2V ( Rs ) ù (DR)3 é d 3V ( Rs ) ù
V ( R s ) = V ( Ro ) + DR ê ú + ê 2 ú + ê ú ...
ë dRs û Rs = Ro 2 ë dRs û Rs = Ro 6 ë dRs 3 û Rs = Ro
Ro Ro (DR) 2 Ro (DR)3 Ro
V ( R s ) = Vin + DR - +
R + Ro ( R + Ro ) 2
4 ( R + Ro ) 3
36 ( R + Ro ) 4
Quadratic/linear =
linear
Vout
Rsense
1- (cos2wt) 2
w0 1
x˙˙ + x˙ + w 0 x = [Fsignal (t) + Fnoise (t)]
2
k Q m
[m Hz]
k
m w0 = m 4kB Tk 2
Sn force ( f ) =
ω 0Q
4k B T
Cantilever
t w Sn position ( f ) =
kω 0Q
⎛ ω 2 ⎞2 ω2
[m Hz]
2
⎜1− 2 ⎟ + 2 2
L ⎝ ω0 ⎠ Q ω0
Voltage (V)
of operating conditions
• Noise has some frequency distribution Noise
Floor
• Signal to noise ratio (SNR)
• Depends on bandwidth
Time (s)
Noise _ Density
RESOLUTION =
Sensitivity
Integrated _ Voltage _ Noise
MIN =
Sensitivity
Key features:
Outputs fused sensor data Quaternion, Euler angles, Rotation vector,
Linear acceleration, Gravity, Heading
3 sensors in one device an advanced triaxial 16bit gyroscope, a versatile,
leading edge triaxial 14bit accelerometer and a
full performance geomagnetic sensor
Data sheet
Small package LGA package 28 pins
Footprint 3.8 x 5.2 mm², height 1.13 mm²
BNO055
Power Management Intelligent Power Management: normal,
low power and suspend mode available
POR t ime
On-chipT interrupt controller
From Reset t o Normal mode
POR
Motion-triggered
650
interrupt-signal
ms
generation for
- any-motion (slope) detection
Dat a Rat e DR
- slow or no motion recognition
s. Par. Fusion Out put dat a rat es
gFS8g ±8 g
gFS16g ±16 g
photos and pictures are8 for illustration purposes only and may differ from
nd
Bandwidt h bw8 2 order filt er, bandwidt h Hz
programmable
bw16 the real product’s appearance.
16 Hz
Variable bw 31 31 Hz
Using onboard bw 63 BNO055 63 Hz
Page 14
Filters – choosebw 125 Data sheet 125 Hz
Out put Noise Densit y nrms gFS2g, TA=25°C 150 190 µg/ Hz
BST-BNO055-DS000-12 | Revi si on 1. 2 | November 2014 Nominal VDD supplies Bosch Sensortec
© Bosch Sensortec GmbH reserves al l ri ghts even i n the event Normal mode
of i ndustri al property ri ghts. We reserve al l ri ghts of di sposal su ch as copyi ng and
passi ng on to thi rd parti es. BOSCH and the symbol are regi stered trademarks of Robert Bosch GmbH, Germany.
Reported as %Full
Note: spec sheets use definitions that give the best numbers!
Note: Speci fi cati ons wi thi n thi s document are subj ect to change wi thout noti ce.
scale output
MECHANICAL C HARACTERISTICS ACCELEROMETER
Parameter Symbol Condition Min Typ Max Units
Cross Axis Sensit ivit y CAS relat ive cont ribut ion bet ween 1 2 %
any t wo of t he t hree axes
Automotive Applications:
• What might you want to measure for each?
• What sensors might you use?
• How will you use the data?
1. Seat occupancy
2. Airbag deployment
3. Tire pressure monitoring system
4. Cruise control
2. Airbag deployment
4. Cruise control
A. Klinefelter et al., "A 6.45µW self-powered IoT SoC with integrated energy-harvesting power management and
ULP asymmetric radios," 2015 IEEE International Solid-State Circuits, pp. 384-385, Feb. 2015.
Batteries
http://www.silabs.com/whitepapers/battery-life-in-connected-wireless-iot-devices
Module outline
Battery 2 x AA CR2032
Capacity 1000 mAh 225 mAh
Average current
? ?
(for 10-year lifetime)
Solution
§ 10 years = 87,600 hours
Battery 2 x AA CR2032
Capacity 1000 mAh 225 mAh
Average current
11.4 µA 2.6 µA
(for 10-year lifetime)
https://www.digikey.com/en/articles/techzone/2016/apr/achieving-wireless-connectivity-for-iot-applications-in-a-power-budget-efficient-way
http://www.mouser.com/applications/low-power-ewc-design/
http://uk.farnell.com/calculating-battery-life-in-iot-applications
Most
popular
A. Klinefelter et al., "A 6.45µW self-powered IoT SoC with integrated energy-harvesting power management and
ULP asymmetric radios," 2015 IEEE International Solid-State Circuits, pp. 384-385, Feb. 2015.
Laser Light
§ Typically expect 1 µW/mm2 under
Sunny Day
reasonable lighting conditions
Soccer Stadium § A few cm2 of solar cells may help
Overcast Day
extend the lifetime to “infinity”
Corridor Light
Street Light
Candle Light
10-3 10-2 10-1 100 101 102 103 104 Power (μW/mm2)
0
10 -1
10 10 1
10 2
10 3
10 4
10 5
10 6 Illuminance (Lux)
Storage capacitor
5 nF RL
§ Example design
VDD Current
Selector Controlled
Oscillator R1
§ Switched-capacitor
series-parallel converter
VDDL-IN
POR
Φ1 R2
Non-overlapping Clock
Switch Control Multiplexer Φ2
Generator
State § Controller adjusts
Machine
CLK
HOLD
3-Bit
Up/Down
Counter ÷N § Provides step charging of
U
R1
Reference
storage capacitance
RREF
VREF PGOOD
R2 Generator Detection
VFB PGOOD
M. Saadat and B. Murmann, "A 0.6V - 2.4V Input, Fully Integrated Reconfigurable Switched-Capacitor DC-DC
Converter for Energy Harvesting Sensor Tags," in Proc. IEEE Asian Solid-State Circuits Conf., Nov. 2015.
1
Energy loss without step charging: 𝐸4$"" = 𝐶 𝑉 6 = 192 𝑛𝐽
2 "#$%& $1#
1 6
Energy loss with step charging: 𝐸4$"" = : 𝐶"#$%& 𝑉$1#,< − 𝑉$1#,<>? = 18 𝑛𝐽
2
<
M. Saadat and B. Murmann, "A 0.6V - 2.4V Input, Fully Integrated Reconfigurable Switched-
Capacitor DC-DC Converter for Energy Harvesting Sensor Tags," in Proc. IEEE Asian Solid-
State Circuits Conf., Nov. 2015.
Wireless transceiver
Power
proportional to
data rate
3 nF, on chip
§ Supplies up to 1 mA at 5-10 cm distance
§ RF power can be supplied by cell phone
M. Taghivand, K. Aggarwal, Y. Rajavi and A. S. Y. Poon, "An Energy Harvesting 2x60 GHz
Transceiver With Scalable Data Rate of 38–2450 Mb/s for Near-Range Communication," in
IEEE Journal of Solid-State Circuits, vol. 50, no. 8, pp. 1889-1902, Aug. 2015.
M. Taghivand, K. Aggarwal, Y. Rajavi and A. S. Y. Poon, "An Energy Harvesting 2x60 GHz
Transceiver With Scalable Data Rate of 38–2450 Mb/s for Near-Range Communication," in
IEEE Journal of Solid-State Circuits, vol. 50, no. 8, pp. 1889-1902, Aug. 2015.
https://web.stanford.edu/~arbabian/Home/IoT_Radio.html
Digital circuits
???
Drawing by Peter Kairouz, Stanford
V. Sze, Y.-H. Chen, J. Emer, A. Suleiman, Z. Zhang, “Hardware for Machine Learning: Challenges
and Opportunities,” IEEE Custom Integrated Circuits Conference (CICC), Invited Paper, May 2017.
V. Sze, Y.-H. Chen, J. Emer, A. Suleiman, Z. Zhang, “Hardware for Machine Learning: Challenges and
Opportunities,” IEEE Custom Integrated Circuits Conference (CICC), Invited Paper, May 2017.
Feature-space transmission
http://uk.farnell.com/calculating-battery-life-in-iot-applications
E. Beigne et al., "Ultra-Wide Voltage Range designs in Fully-Depleted Silicon-On-Insulator FETs," 2013
Design, Automation & Test in Europe Conference & Exhibition (DATE), Grenoble, France, 2013, pp. 613-
618.
Mixed-signal interfaces
offset
+ drift
thermal noise
signal
fcorner log f
§ Analog MOS circuits come with a variety of low frequency artifacts that can
easily ʺswamp outʺ DC or low-frequency signals of interest
Analog-to-digital conversion
6
10
Energy per A/D conversion
4
10
P/f s [pJ]
2
10
Flash
Pipeline
0 SAR
10
DS
Other
20 30 40 50 60 70 80 90 100
SNDR [dB] B. Murmann, "ADC Performance Survey 1997-2016," [Online]. Available:
http://web.stanford.edu/~murmann/adcsurvey.html.
P. Harpe, et al. "A 3nW signal-acquisition IC integrating an amplifier with 2.1 NEF and a
1.5fJ/conv-step ADC," 2015 IEEE International Solid-State Circuits Conference, Feb. 2015.
Input amplifier
DC servo loop
§ 32 dB gain
§ AC coupled input
§ 370 Hz bandwidth
§ Input noise = 26 µVrms
§ Total current = 1 nA!
P. Harpe, et al. "A 3nW signal-acquisition IC integrating an amplifier with 2.1 NEF and a
1.5fJ/conv-step ADC," 2015 IEEE International Solid-State Circuits Conference, Feb. 2015.
Philip Levis
Associate Professor
Computer Science and Electrical Engineering
Stanford University
Embedded Systems
The "Things" in "Internet of Things"
Computing systems designed for a particular application
smart lightbulb
medical implant
aircraft engine controller/sensor
personal fitness tracker
Cost and energy are paramount and greatly define design
You'll learn the network and software architectures they typically use and why
You'll learn about the technology drivers behind the recent growth of the IoT
You'll learn about energy budgets and how to design an embedded system
Elicia White
Making Embedded Systems, O’Reilly
This has deep implications for how they are designed and why.
Typically, want to minimize cost/maximize lifetime for a given expected workload.
Optimized, custom software that uses as few resources as possible.
Internet(s) of Things
6lowpan
We can now inexpensively build powerful networked embedded devices
Early networking: proprietary, vertical silos
§ ZigBee defines link up to application layer
§ Zwave, etc.
§ Connect to Internet through application gateway (lock-in)
6lowpan: IETF standard for IPv6 over low-power link layers
§ Just defines IP packet formats/compression (plus UDP)
§ Routing/MAC layer independent
§ Allows interoperability and software flexiblity
§ RFC4944 (basic protocol) and RFC6282 (additional header compression)
Two Game-Changers
CortexM microcontrollers
CortexM
On-chip features/components modeled as memory-mapped peripherals
§ Each peripheral has a block of addresses for its registers
Every vendor has completely different peripheral interfaces, different chips by
the same vendor can differ significant too
§ CortexM makes it possible to use the same compiler, boot code, interrupt
handling code
§ Everything else needs to be implemented per-chip
§ Switching from one MCU family to another is a lot of engineering effort
§ E.g., switching from Atmel SAM4L to NXP K66
advertiser
peripherals
server client
http://www.atmel.com/products/microcontrollers/ARM/SAM4L.aspx
Both costs push designs to pick minimal MCU and optimize code for it
http://www.atmel.com/products/microcontrollers/ARM/SAM4L.aspx
Takeaways
If energy is important, sleep as much as possible and avoid using radio
§ Orders of magnitude differences in active vs. sleep current
§ RF is much more expensive than compute
Choose the smallest MCU you need for the application
§ Huge variations in what different MCUs/SoCs can do
§ Cost increases with features
E: energy
E = P s ⋅ ts + P a ⋅ ta P: power
t: time
E = sleep energy + active energy s: sleep
a: active
E = P s ⋅ ts + P a ⋅ ta E: energy
P: power
E = sleep power * sleep time + active power * active time t: time
s: sleep
E = 4.8µA * sleep time + 14.6mA * active time
a: active
E = 4.8µA * 999.7ms + 14.6mA * 0.3ms
E = 4.8uAs + 4.38µAs
CR2032 is 225mAh – in theory can last 3 years (in practice much less)
Sleep current assumes all RAM retained; active current assumes 0dB transmit plus CPU at 16MHz
Active time is 37 bytes @ 1Mbps = 300µS
Complication
We assumed that system instantaneously transitioned from sleep to wake
§ MCU takes time to wake up
§ Transceiver takes time to power up
Transition times – high power but no work – can be significant
§ Wake up less often, for longer, to amortize over wake period
E = P s ⋅ ts + P a ⋅ ta + P T ⋅ tT
E = sleep energy + active energy + transition energy
E = P s ⋅ ts + P a ⋅ ta + P T ⋅ tT
E: energy
P: power
E = 4.8µA * 999.6ms + 14.6mA * 0.3ms + 7.0mA * 0.14ms t: time
s: sleep
E= 4.8uAs + 4.38µAs + 1µAs
a: active
T: transition
Takeaways
Energy consumed is the sum of active and sleep energy
For ultra-low power applications, sleep and active energy can be nearly equal
Transition costs can also be significant
Based on energy budget, pick battery with desired capacity
To minimize active energy, minimize time peripherals and MCU are active
§ Perform operations in parallel to minimize active time
§ Cluster/batch operations to minimize transition times
§ Minimize clock rate
Parallelism
Parallelism allows fixed overheads to amortize over multiple operations
loop {
loop {
sample_sensor();
parallel {
radio_on();
sample_sensor();
send_value();
radio_on();
sleep();
}
}
send_value();
High-cost clocks are on longer, sleep();
in SLEEP (50µA) state longer. }
data packet
data packet
11.5s
INdT/Microsoft
Power Management in Mobile Devices (2014) 4 Philip Levis, Stanford University
LTE Batching
To minimize active energy, minimize time peripherals and MCU are active
§ Perform operations in parallel to minimize active time
§ Cluster/batch operations to minimize transition times
§ Minimize clock rate
Core registers
Handler Thread
r0 r0 return value
r1 r1
r2 r2 function arguments
r3 r3
r4 r4
r5 r5
r6 r6 Two operating modes:
r7 r7
r8 r8
thread and handler
r9 r9
r10 r10
r11 (fp) r11 (fp) frame pointer
r12 r12
r13 (sp) r13 (sp) stack pointer
r14 (lr) r14 (lr) link register
r15 (pc) r15 (pc) program counter
SVC
0x002C
reserved
0x001C
usage fault architecture defined
bus fault
mem fault
hard fault
NMI
reset
0x0000
Buses
SCL
I2C SDATA
UAR RX
T TX
CLK
MOSI
SPI MISO
CSn
Handling Interrupts
Handler Thread
r0 r0 return value
r1 r1
r2 r2 function arguments
r3 r3
r4 r4
r5 r5
r6 r6 Two operating modes:
r7 r7
r8 r8
thread and handler
r9 r9
r10 r10
r11 (fp) r11 (fp) frame pointer
r12 r12
r13 (sp) r13 (sp) stack pointer
r14 (lr) r14 (lr) link register
r15 (pc) r15 (pc) program counter
interrupts
application application
If dec() runs when inc() is at 0x8010, then result of dec() will be lost: it
has copied a into r3.
applications
libraries services
operating system
hardware
Operating System
Kernel: lowest level of software
§ Directly accesses hardware
§ Has complete control of system
§ Example: Linux, Windows, OSX
Libraries and services on top of kernel
§ Networking, storage, other utilities
General goal: minimize what's in the kernel
§ Challenge: crossing between kernel and libraries is expensive
§ If abstract requires a lot of crossings, move inside kernel
Interrupt code
Code in interrupt handler can block entire system (no interrupts handled)
§ Preemptive interrupts are especially challenging (re-use of handler context)
§ Goal: minimize code in direct handler
Use deferred procedure call (interrupt bottom half)
§ Interrupt handler does core work (e.g., pull data out of register into queue)
§ Deferred procedure call executes after interrupt handler returns
§ Interrupts can preempt deferred procedure call/bottom half
interrupts
application application
a b c interrupts
application a b c application
bottom halves
Background code
Application code: preempted by interrupts and bottom halves
Less time critical (although may still have deadlines)
Option 1: event-driven
§ Function that executes in response to an event (timer, packet reception)
§ Cross-event state stored in global variables
Option 2: threaded
§ Function that never returns: calls functions that block (resume thread on
completion)
§ Cross-event state stored on stack (higher RAM cost)
receive_callback(receive_cb);
Example: threaded
#define MAX_LEN 128
void main() {
while (1) {
uint8_t buffer[MAX_LEN];
len = receive(buffer, MAX_LEN);
send(buffer, len);
}
}
ARM Mbed OS
ARM Mbed OS provides
§ Standard APIs for chip peripherals (SPI, I2C, etc.)
§ Libraries on top of standard APIs
Supports both event-driven and threaded programming
§ Threaded programming has easier power management
§ Can write interrupt handlers, etc.
Generally speaking, APIs are richer and cleaner than FreeRTOS
But, actual Mbed implementations are by vendors so be careful
This module
You've learned what embedded systems are and how they differ from traditional
computing systems such as servers, phones, and laptops
You've learned the network and software architectures they typically use and why
You've learned about the technology drivers behind the recent growth of the IoT
You've learned about energy budgets and how to design an embedded system
Elicia White
Making Embedded Systems, O’Reilly
This has deep implications for how they are designed and why.
Typically, want to minimize cost/maximize lifetime for a given expected workload.
Optimized, custom software that uses as few resources as possible.
E = P s ⋅ ts + P a ⋅ ta + P T ⋅ tT
E = sleep energy + active energy + transition energy
applications
libraries services
operating system
hardware
To minimize active energy, minimize time peripherals and MCU are active
§ Perform operations in parallel to minimize active time
§ Cluster/batch operations to minimize transition times
§ Minimize clock rate
Connecting various devices and sensors to each other and the Internet.
Source:wonderfulenginneering.com
• Energy: • Energy:
• Static • Dynamic
• Deterministic • Random
Source:neoswarm.com
Module Outline
• Energy Harvesting Transmitters for IoT
• Wirelessly Powered Transmitters for IoT
• Massive Multiple Access
• Related Coursework
• Quiz
Operating Regimes:
W SNR ≪ 0 dB Bandwidth-limited
C∝
P/N0 SNR ≫ 0 dB Power-limited
Et: stochastic process known causally at the transmitter and not at the receiver.
Bmax = ∞
Capacity equal to that of a classical AWGN channel with
Insights:
• Use standard communication and coding techniques for the AWGN channel.
• Only relevant property in determining capacity is the average energy harvesting rate.
Ref: O. Ozel, S. Ulukus, Achieving AWGN capacity under stochastic energy harvesting, IEEE
Transactions on Information theory, 2012.
Ref: D. Shaviv, P.M. Nguyen, A. Ozgur, Capacity of the Energy Harvesting Channel with a
Finite Battery, IEEE Transactions on Information theory, 2016.
Ref: D. Shaviv, P.M. Nguyen, A. Ozgur, Capacity of the Energy Harvesting Channel with a
Finite Battery, IEEE Transactions on Information theory, 2016.
Current practice:
• Transfer energy at a constant rate.
• Periodically charge transmitter’s battery.
Charger observes the output of the Charger observes the input to the
channel. channel.
Binary Example
• Charger has no side information:
• Et = 1, ∀t: C∅ = 1 bits/channel use, Γ = 1 unit/channel use.
Binary Example
• Charger has no side information:
• Et = 1, ∀t: C∅ = 1 bits/channel use, Γ = 1 unit/channel use.
• Charger knows the message:
Ø Charge when the transmitter intends to send a 1:
• CM = 1 bits/channel use, Γ = 1/2 units/channel use.
• Charger can observe the transmitted signal Xt−1:
Ø Charge when battery is empty:
• CX = 1 bits/channel use, Γ = 1/2 units/channel use.
• Charger: Dynamically decide how much energy to transfer to the receiver based on its side
information regarding the transmission (subject to an average power constraint Γ).
• Transmitter: Dynamically adapt its transmission scheme based on its instantaneous battery level.
Exploiting side information at the charger can enable performance close to the centralized case.
Ref: D. Shaviv, A. Ozgur, H. Permuter, Capacity of Remotely Powered Communication, IEEE Transactions on Information theory, 2016.
• Carrier-sensing is energy-consuming.
• Aloha leads to high collision rates.
Node Identification
Trivial Solution: t = N.
Group Testing
• N items (soldiers).
• d defective (infected items).
• Figure out the defective group.
• Group items together and apply t tests.
t = Θ(d log N)
Joint Identification and Information Transmission: assign multiple distinct columns to each user.
Communication vs Computation