+ All Categories
Home > Documents > Lessons from an HVAC Use Case using RIOT Seamless Power ...

Lessons from an HVAC Use Case using RIOT Seamless Power ...

Date post: 01-Oct-2021
Category:
Upload: others
View: 9 times
Download: 0 times
Share this document with a friend
16
Seamless Power Management on IoT Devices — Lessons from an HVAC Use Case using RIOT Jürgen Fitschen - SSV Soware Systems GmbH Slides available at: https://ssv-embedded.github.io/RIOTSummit2020/ 1 . 1
Transcript
Page 1: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices —Lessons from an HVAC Use Case using RIOT

Jürgen Fitschen - SSV So�ware Systems GmbH

Slides available at:https://ssv-embedded.github.io/RIOTSummit2020/

1 . 1

Page 2: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

Who am I?Jürgen Fitschen ( on GitHub)

Systems Engineer at , GermanyUsing RIOT since 2018

jue89SSV So�ware Systems

What we'll cover ...Why does good power management matter?

How does it work?It's all about timers!

1 . 2

Page 3: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

Why does Good Power Management Matter to us?

2 . 1

Page 4: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

Retrofit Systems are our Passion.Goal: enhance efficiency and value of existing systems and environmentsSensors and actuators must be deployed within already existing systemsSome retrofit systems require 100+ sensors

⮩ Battery-powered sensors and actuators are required!

2 . 2

Page 5: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

Example Retrofit Setup: Battery-powered Sensors

Task: Send notifications when the windows should be opened

CO2CO2 CO2CO2

CO2CO2 CO2CO2

CO2-Sensor

Gateway

Measure CO2 contentration in every roomSend the sensor reading to gatewayNotify occupier upon high sensor readings via e-mail

2 . 3

Page 6: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

The CO2 Sensor's Application Sequence

Phase Duration Current ChargeMeasure 100 ms 1,000 μA 0.1 mC

TX 50 ms 13,500 μA 0.7 mC

RX 200 ms 8,200 μA 1.6 mC

Sleep 299,650 ms 10 μA 3.0 mC

Sum: 300,000 ms 5.4 mC

Battery Charge: [1] 2,400 mAh = 8,640,000 mC

Battery Self-discharge Current: [2] 1.9 μA

Number of Cycles: 1,444,454Livetime: 13.74 years

0 5min

Current

Time

M

12mA

T R S

⮩ Reduce power consumption during sleep phase!

2 . 4

Page 7: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

How does Power Management Work?

3 . 1

Page 8: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

The Internals of the Microcontroller SAM R30[ ]

SLEEPCFG State STANDBY

RF Network Interface State SLEEP

Current Consumption 2.2μA

3

RAM

CPU

48MHz PLL

High SpeedTimer

Low SpeedTimer

RF NetworkInterface

0.0μARETENTION

1.5μARETENTION

0.0μARETENTION

0.3μAACTIVE

0.1μARETENTION

0.0μAOFF

32kHz XTAL0.3μAACTIVE

16MHz XTAL0.0μAOFF

Clock Sources CPU+Peripherals

⮩ Set the SLEEPCFG register to "STANDBY" andthe RF Network Interface to "SLEEP" during sleep phase!

3 . 2

Page 9: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

RIOT has a Driver for Power Management

Power Mode Blocker Lowest Mode?IDLE ❮

STANDBY pm_unblock(STANDBY) 1 pm_block(STANDBY)

BACKUP pm_unblock(BACKUP) 1 pm_block(BACKUP)

pm_layered keeps track of which power mode can be enteredThe idle thread enters the lowest modeSomeone must tell pm_layered which modes are allowed

⮩ For a seamless user experience, drivers must interact with pm_layered

3 . 3

Page 10: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

It's all about Timers!

4 . 1

Page 11: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

RIOT's Current Default Timer System: xtimer#include "xtimer.h"#include "timex.h" static void callback (void * arg) { puts((char*) arg);} int main (void) { /* 1. Run a callback after 3s */ static xtimer_t cb_timer = {.callback = callback, .arg = "Hello World"}; xtimer_set(&cb_timer, 3 * US_PER_SEC); /* 2. Sleep the current thread for 60s */ xtimer_sleep(60);}

123456789101112131415

static void callback (void * arg) { puts((char*) arg);}

/* 1. Run a callback after 3s */ static xtimer_t cb_timer = {.callback = callback, .arg = "Hello World"}; xtimer_set(&cb_timer, 3 * US_PER_SEC);

#include "xtimer.h"1#include "timex.h"2 3

456

7int main (void) {8

91011

12 /* 2. Sleep the current thread for 60s */13 xtimer_sleep(60);14}15

/* 2. Sleep the current thread for 60s */ xtimer_sleep(60);

#include "xtimer.h"1#include "timex.h"2 3static void callback (void * arg) {4 puts((char*) arg);5}6 7int main (void) {8 /* 1. Run a callback after 3s */9 static xtimer_t cb_timer = {.callback = callback, .arg = "Hello World"};10 xtimer_set(&cb_timer, 3 * US_PER_SEC);11 12

1314

}15

#include "xtimer.h"#include "timex.h" static void callback (void * arg) { puts((char*) arg);} int main (void) { /* 1. Run a callback after 3s */ static xtimer_t cb_timer = {.callback = callback, .arg = "Hello World"}; xtimer_set(&cb_timer, 3 * US_PER_SEC); /* 2. Sleep the current thread for 60s */ xtimer_sleep(60);}

123456789101112131415

High SpeedTimer

xtimer

Clock Source Driver Instance

xtimer_t

xtimer_t

xtimer_t

Driver Users

⮩ xtimer requires the High Speed Timer to run all the time

⮩ STANDBY mode must not be entered at any time

4 . 2

Page 12: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

There's an Alternative for the Rescue: ztimer#include "ztimer.h"#include "timex.h" static void callback (void * arg) { puts((char*) arg);} int main (void) { /* 1. Run a callback after 3s */ static ztimer_t cb_timer = {.callback = callback, .arg = "Hello World"}; ztimer_set(ZTIMER_USEC, &cb_timer, 3 * US_PER_SEC); /* 2. Sleep the current thread for 60s */ ztimer_sleep(ZTIMER_MSEC, 60 * MS_PER_SEC);}

123456789101112131415

App's Makefile:

USEMODULE += ztimer ztimer_usec ztimer_msec

App's Makefile:

samr30-based-board/include/board.h:

USEMODULE += ztimer ztimer_usec ztimer_msec ztimer_periph_rtt USEMODULE += pm_layered

# Make ZTIMER_USEC block/unblock STANDBY mode #define CONFIG_ZTIMER_USEC_REQUIRED_PM_MODE PM_SLEEPCFG_SLEEPMOD# Only block BACKUP mode on startup #define PM_BLOCKER_INITIAL 0x0001

⮩ ztimer unblocks STANDBY mode if no ztimer_t requires ZTIMER_USEC to run

4 . 3

Page 13: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

xtimer & ztimer can be Friends and Coexist!USEMODULE += ztimer ztimer_usec xtimer xtimer_on_ztimer evtimer

High SpeedTimer

ZTIMER_USEC

ztimer_t

ztimer_t

ztimer_t

xtimer

ztimer_t

ztimer_t

ztimer_t

ztimer_t

ztimer_t

ztimer_t

xtimer_t

xtimer_t

xtimer_t

evtimer

ztimer_t

ztimer_t

ztimer_t

evtimer_t

evtimer_t

evtimer_t

⮩ xtimer_on_ztimer blocks STANDBY mode all the time

USEMODULE += ztimer ztimer_usec ztimer_msec ztimer_periph_rtt ztimer_xtimer_compat evtimer evtimer_on_ztimer # evtimer_on_ztimer hasn't been merged, yet. See Pull Request #13661

High SpeedTimer

ZTIMER_USEC

ztimer_t

ztimer_t

ztimer_t

xtimer_t

evtimer

ztimer_t

ztimer_t

ztimer_t

evtimer_t

evtimer_t

evtimer_t

ZTIMER_MSEC

ztimer_t

ztimer_t

ztimer_t

Low SpeedTimer

xtimer_t

⮩ ztimer_xtimer_compat doesn't implement xtimer_*64() methods

⮩ ztimer is utilized in our use case!4 . 4

Page 14: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

RIOT & Power Management: Status Quo?

5 . 1

Page 15: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

ConclusionRIOT has all important parts for PM inside ...

... but by default they aren't configured for reasonable power saving.

RIOT has three different timer systems ...

... but the RIOT Developer Memo could lead to one standard system.(cf. )#12970

RIOT is heading in the right direction for seamless power management!

5 . 2

Page 16: Lessons from an HVAC Use Case using RIOT Seamless Power ...

Seamless Power Management on IoT Devices • Jürgen Fitschen • RIOT Summit 2020

References1. 2.

3.

Tadiran Batteries GmbH - Datasheet: SL-860Dittrich, Menachem, Yamin, Adamas - Lithiumbatterien fürFunksensornetzwerkeMicrochip Technology Inc. - SAM R30 Microcontroller

5 . 3


Recommended