Power Save - Deep Sleep for DHT and LCD
Materials
AmebaD [AMB21 / AMB22 / AMB23 / BW16] x 1
DHT11 or DHT22 or DHT21 x 1
LCD I2C screen x 1
Example
Introduction
Ameba-D supports low power modes which are deepsleep mode. Deepsleep mode turns off most of the system power domain. The power consumptions of core module in DeepSleep Mode is around 7uA to 8uA compare to normal state around 22mA. This example gives demo of system switch between “working” and “sleep”(power save).Using DHT sensor to read data and display on LCD screen when system is awake. After 5 seconds system auto enter DeepSleep Mode for power save. System will wake up by wakeup source.( Aon timer, Aon Pins or RTC timer).
“File” -> “Examples” -> “AmebaPowerSave” ->
“DeepSleep_DHT_LCD_Example”
DS_WAKEUP_SOURCE
is used to set the wake-up source, user can chose 3
wake up sources now,AON timer (SET_DS_AON_TIMER_WAKEUP);
AON pins (SET_AON_WAKEPIN_WAKEUP);
RTC timer (SET_DS_RTC_WAKEUP);
AON_TIMER_SLEEP_DURATION
SET_AON_GPIO_WAKEUP_GPIOA25
or the pin that you want to use as shown in the picture below.DS_RTC_ALARM_DAY
,
DS_RTC_ALARM_HOUR
, DS_RTC_ALARM_MIN
, and DS_RTC_ALARM_SEC
DHTPIN
is used to set DHT sensor data pin. User can choose any GPIO
pins.DHTTYPE
is used to set DHT sensor type. (DHT11, DHT22 and DHT33)When finished the condition values setting, system will run and switch between normal working mode and deepsleep mode controlled by wakeup source. LCD screen will display the temperature and humidity data measured from DHT sensor when system is awake.
Code Reference
Please refer to the API Documents PowerSave section for detail description of all API.