l10 power management - peopleboser/courses/49...circuits consume? • how can we find out? • hmm,...

1

Upload: others

Post on 07-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 1

Electronics for IoT

Power Management

Bernhard E. BoserUniversity of California, Berkeley

[email protected]

IoT49: Power Management

Page 2: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 2

Power ESP32 from Solar Cell

IoT49: Power Management

Page 3: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 3

Challenges

• Solar cell only deliver ~ 30mA– ~ 100mA in full sun

• ESP32 consumes up to 200mA

• No sun at night

• How connect solar cell to ESP32?

• ESP32 needs 3.3V

• Solar cell generates up to 5V

IoT49: Power Management

Page 4: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 4

Huzzah32 Power Supply

• USB is 5 Volts

• ESP32 needs 3.3 V

• How does the Huzzah32 generate 3.3 V from 5 V?

IoT49: Power Management

Page 5: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 5

Power Regulators

IoT49: Power Management

Time

Page 6: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 6

Types of Regulators

IoT49: Power Management

Page 7: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 7

Power Regulator Efficiency

IoT49: Power Management

Page 8: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 8

Huzzah32 Power Regulator

IoT49: Power Management

Page 9: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 9

Huzzah32 Power Supply

IoT49: Power Management

Page 10: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 10

AP2112 600mA Regulator

IoT49: Power Management

Page 11: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 11

AP2112

IoT49: Power Management

Page 12: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 12

AP2112

IoT49: Power Management

Page 13: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 13

Power Huzzah32 from Solar Cell

IoT49: Power Management

Page 14: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 14

Huzzah32 Current

IoT49: Power Management

Time

Page 15: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 15

Solar Power

IoT49: Power Management

Page 16: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 16

Running Huzzah32 from Solar Cell

IoT49: Power Management

Page 17: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 17

Solar Powered Weather Station

• Design plan:1) Reduce Huzzah32 power requirement2) Add battery for nights, cloudy days

• Let’s address first (1), then (2) …

IoT49: Power Management

Page 18: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 18

Weather Station Requirements

IoT49: Power Management

Page 19: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 19

ESP32 Current Consumption

IoT49: Power Management

Page 20: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 20

ESP32 Deepsleep

IoT49: Power Management

Page 21: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 21

ESP32 Average Current - Example

IoT49: Power Management

Page 22: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 22

No so fast …

IoT49: Power Management

Page 23: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 23

Not so Fast

• Lots of stuff on Huzzah32 board

• Not just ESP32!

• How much current do the other circuits consume?

• How can we find out?

• Hmm, lots of datasheets to consult …

IoT49: Power Management

Page 24: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 24

Measure Huzzah32 Supply Current

• No need for USB– Do not power it!

• Connect supply to battery

• But how make the connection?

IoT49: Power Management

AdafruitHUZZAH32MicroPython

GPIO ALT µPy µPy ALT GPIO

1

2

3

4

26 DAC2 A0 5 28

25 DAC1 A1 6 27

34 ADC6 A2 7 26

39 ADC3 A3 8 25 A12 LED 1336 ADC0 A4 9 24 A11 BOOT 124 A5 10 23 A10 275 SCK A16 11 22 A9 ADC5 3318 MOSI A17 12 21 A8 1519 MISO A18 13 20 A7 ADC4 3216 A19 14 19 A6 1417 A20 15 18 A15 SCL 2221 A21 16 17 A14 SDA 23

BOOT(A11)hasabuilt-inpull-down sup ADC SPIConnectto3.3Vonpower-upforsafeboot. GND DAC I2C

BOOT VBAT/2 LEDEN3.3V:tietoGNDtodisableregulator

VBAT/2tiedtoVBAT2

VBAT

VUSBEN3.3V

inputonly!

RESET3.3V

GND

Bootmode: Legend:

Page 25: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 25

Lab Supply

IoT49: Power Management

Page 26: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 26

Power from Lab Supply

IoT49: Power Management

AdafruitHUZZAH32MicroPython

GPIO ALT µPy µPy ALT GPIO

1

2

3

4

26 DAC2 A0 5 28

25 DAC1 A1 6 27

34 ADC6 A2 7 26

39 ADC3 A3 8 25 A12 LED 1336 ADC0 A4 9 24 A11 BOOT 124 A5 10 23 A10 275 SCK A16 11 22 A9 ADC5 3318 MOSI A17 12 21 A8 1519 MISO A18 13 20 A7 ADC4 3216 A19 14 19 A6 1417 A20 15 18 A15 SCL 2221 A21 16 17 A14 SDA 23

BOOT(A11)hasabuilt-inpull-down sup ADC SPIConnectto3.3Vonpower-upforsafeboot. GND DAC I2C

BOOT VBAT/2 LEDEN3.3V:tietoGNDtodisableregulator

VBAT/2tiedtoVBAT2

VBAT

VUSBEN3.3V

inputonly!

RESET3.3V

GND

Bootmode: Legend:

Page 27: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 27

Huzzah32 Current Consumption

• Just processor on 43 mA

• Processor & WiFi on 120 … 200 mA

• Deepsleep 420 µA

• Hmm, a bit more than 10 µA

• Are we still ok?

• What if not

IoT49: Power Management

Page 28: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 28

ESP32 Average Current - Example

ESP32 Huzzah32

IoT49: Power Management

Page 29: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 29

Battery

IoT49: Power Management

Page 30: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 30

Battery only Run-Time

IoT49: Power Management

Time

Page 31: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 31

Energy vs Ah

IoT49: Power Management

Page 32: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 32

Minimum Battery Capacity

IoT49: Power Management

Page 33: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 33

LiPo Batteries for Huzzah32

IoT49: Power Management

Page 34: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 34

Solar Power at Night

IoT49: Power Management

Page 35: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 35

Putting Everything Together …

• Huzzah32– Peak current– Average current

• Solar cell– Peak current– Average current

• Battery– Max run time– Average current– Capacity

• Are we good?

IoT49: Power Management

Page 36: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 36

What is Deepsleep?

• Processor off

• RTC still running– Can wake up the processor

• What is this good for?

IoT49: Power Management

Page 37: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 37

10mA à 200mA

• Keep ESP32 in deepsleep most of the time

• Wake up every 10min or so to take measurements– Send results to cloud

• E.g.– 6 measurements per hour

• 10 seconds @ 200mA– Deepsleep for rest of time

• 3600 – 60 sec @ 10µA– Average current

IoT49: Power Management

Page 38: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 38

Putting Everything Together

• Solar cell

• Huzzah32 with ESP32

• INA219 (why?)

• Weather sensors

• Firmware

IoT49: Power Management

Page 39: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 39

Deepsleep

• Processor, WiFi OFF

• Only functions still power– RTC, including deepsleep wakeup timer– Small amount of memory– Few peripherals

• After deepsleep, processor restarts– Executes boot.py, main.py– WiFi disconnected (reconnect if needed)– RTC still has correct time

IoT49: Power Management

Page 40: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 40

Enter Deepsleep

• Processor restarts after milli_seconds delay

• Optional: wake from external pin (later)

IoT49: Power Management

Page 41: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 41

Deepsleep Memory

• RTC memory– 64 integers (32 bits), pos 0 … 63– One string, up to 2048 characters– Retained during deepsleep

• Syntax:

IoT49: Power Management

Page 42: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 42

Keeping Track of Measurements

IoT49: Power Management

Page 43: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 43

Thingspeak.com

IoT49: Power Management

Page 44: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 44

Skeleton boot.py for Solar Weather Station

IoT49: Power Management

Page 45: L10 Power Management - Peopleboser/courses/49...circuits consume? • How can we find out? • Hmm, lots of datasheets to consult … IoT49: Power Management B. E. Boser 24 Measure

B. E. Boser 45

Summary

• Low power operation– Turn power off (most of the time)– Deepsleep– Average current << peak current– Duty cycle

• Beware of other circuits that consume power– Sensors?– Sleep/power down modes?– Check datasheets and/or measure

• Test!

IoT49: Power Management