Yes, it is possible to put the AtomS3R into deep or light sleep mode and wake it up using the accelerometer, but this functionality is not directly available through the UIFlow 2.0 API. However, you can achieve this using Arduino by leveraging the ESP32's low-power features and the accelerometer's interrupt capabilities.
Steps to Implement in Arduino:
Deep/Light Sleep Setup:
Use the esp_sleep_enable_ext0_wakeup() or esp_sleep_enable_ext1_wakeup() functions to configure the wake-up source from the accelerometer's interrupt pin.
The accelerometer's INT pin is connected to XTAL_32K_N (as you noted), which can be used as a wake-up trigger.
Accelerometer Configuration:
Configure the accelerometer (e.g., MPU6886 or similar) to generate an interrupt when a significant acceleration is detected.
Set the threshold for acceleration to trigger the interrupt.
Putting the Device to Sleep:
Call esp_deep_sleep_start() for deep sleep or esp_light_sleep_start() for light sleep.
Example Code (Arduino):
#include <M5AtomS3.h>
void setup() {
M5.begin(); // Initialize M5AtomS3
M5.Imu.Init(); // Initialize the IMU (accelerometer)
// Configure accelerometer interrupt
M5.Imu.setIntEnable(1); // Enable interrupt
M5.Imu.setWakeOnMotionThreshold(10); // Set threshold (adjust as needed)
M5.Imu.setWakeOnMotionEnabled(true); // Enable wake-on-motion
// Configure wake-up from accelerometer interrupt
esp_sleep_enable_ext0_wakeup(GPIO_NUM_X, HIGH); // Replace X with the correct GPIO for XTAL_32K_N
Serial.println("Going to sleep...");
delay(100);
esp_deep_sleep_start(); // Enter deep sleep
}
void loop() {
// This will not run after deep sleep
}
Notes:
UIFlow 2.0 Limitation: UIFlow 2.0 does not currently expose APIs for configuring sleep modes or accelerometer-based wake-up. You must use Arduino for this functionality.
GPIO Pin: You need to identify the correct GPIO pin connected to XTAL_32K_N (check the AtomS3R schematic or documentation).
Power Consumption: Deep sleep significantly reduces power consumption, while light sleep retains some peripherals (like Wi-Fi) but consumes more power.
Alternative Approach:
If you prefer UIFlow, you might need to use a workaround (e.g., periodic wake-up and check accelerometer values), but this is less efficient than hardware-triggered wake-up.
https://chat.m5stack.com/