🛠 Home Automation with M5Stamp Timer Power 2

M5Stamp Timer Power 2 (PY32L020) · intermediaire · Apprenez à configurer le M5Stamp Timer Power 2 pour contrôler des périphériques domotiques en mode veille ultra-basse consommation.

Objectives

This tutorial aims to create an autonomous sensor node for home automation. You will learn to use the M5Stamp Timer Power 2 (PY32L020) to wake up a main microcontroller only when necessary, thanks to multi-step energy management. The goal is to maximize battery life by exploiting deep sleep modes (12.27uA) while maintaining reliable communication.

Required Hardware

Steps

  1. Basic Wiring: Connect the EXT_5V_INOUT input or the 3.7V battery input to your power source. Ensure the Ground (GND) is common between the M5Stamp and the main controller.
  2. I2C Connection: Connect the SDA and SCL pins of the M5Stamp to the I2C bus of your main controller. The default address is 0x6E.
  3. Output Management: Connect the 3V3_DCDC_OUT output to the power supply of your sensor or the main microcontroller if it is powered by the module. Use PY_3V3 for sensitive logic circuits.
  4. Wake-up Programming: In your code, configure the M5Stamp to cut power to non-essential peripherals. Use the scheduled wake-up feature to activate the system at regular intervals (e.g., every 10 minutes).
  5. I2C Configuration: Send commands via I2C to set the charging current (650mA for fast charging, 180mA for battery preservation) and enable shutdown mode when the system is inactive.

Verification

Measure the current consumption with a multimeter in series with the battery. In sleep mode, the current should drop close to 12.27uA. Verify that the system wakes up at the scheduled times and that the 3V3 outputs are powered during activity.

Further Exploration

Integrate an environmental sensor on one of the 5 programmable IOs (ADC) and use external interrupts (IRQ) to wake the system only upon motion detection or temperature change, further reducing consumption.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials