The project idea
previously involved creating two Home Assistant-controlled devices, particularly an AC switch that truly controls the power supply to home appliances. Home Assistant automation allows you to set timers for turning on and off.
However, to achieve more intelligent functionality, sensors are needed.
For example, for a nightlight to become intelligent, a light sensor needs to detect light intensity to decide whether to turn it on, or a motion sensor needs to detect presence to turn it on.
Similarly, for air conditioning control, a temperature sensor can detect room temperature to determine whether to cool or heat,
and so on. All such intelligent controls require the participation of sensors to achieve true intelligence.
So this project is: a HomeAssistant low-power thermometer and hygrometer based on the Ai-M62 module.
Features include
: WiFi 6 2.4G connectivity; support for Ai-M62 IoT; direct connection to HomeAssistant
via WeChat mini-program (MQTT integration); 16uA sleep power consumption; 1-hour data collection interval (not dynamically configurable to ensure battery life) ; powered by a 14500mAh (1000mAh) lithium battery with battery charge/discharge protection ; battery charging support; onboard programming; Ai-M62 Rd-03L radar interface ; I2C interface for easy connection to other I2C sensors ; reserved DC-DC1V1 circuit for later DTIM low-power verification ; reserved single-bus circuit for later IO reading or control of HomeAssistant. Actual sleep power consumption test results : Power consumption declaration: I currently do not know how long the 1000mAh battery will last. If anyone knows how to calculate it, please let me know. The average current during connection is 65mA for 4-5 seconds. The system is in sleep mode at other times, with a power consumption of 16uA . Deep sleep is achieved by shutting down all radio frequency and peripheral units, leaving only the power management unit (PMU) operational. Therefore, the connection will be lost after entering deep sleep, and the system can only be restarted automatically via RTC to reconnect to the server. The default wake-up cycle is one hour. The low-power hardware design uses PMOS to control the power switch for all circuits requiring data acquisition, preventing the sensor from operating and maintaining low power consumption when entering sleep mode. The sensor power control circuit uses Q2 to control the temperature and humidity power. The ADC acquisition circuit also uses PMOS to control the power supply to prevent leakage from the resistor voltage divider. The Ai-M62-CBS low-power circuit, since the module does not have a built-in 32.786K crystal oscillator, must be externally connected to ensure the normal operation of the PMU. During power switching and charging, it is desirable that the battery no longer needs power, retaining only the 5V Type-C power supply. Therefore, a simple switching circuit with a reserved 1.1V is implemented. Note that the Ai-M62-CBS will later support DTIM mode, requiring 1.1V power, so this is reserved for future low-power keep-alive (maintaining low power consumption when connected to a server). Source code clone : GitHub: https://github.com/SeaHi-Mo/HA_LP_Sensor Gitee: https://gitee.com/seahi007/HA_LP_Sensor Cloning method: git clone --recursive https://github.com/SeaHi-Mo/HA_LP_Sensor.git Clone method on gitee: git clone --recursive https://gitee.com/seahi007/HA_LP_Sensor.git To keep the source code up-to-date, it is recommended to use the git tool for cloning. All development and compilation are done on the Linux platform, so Windows development is not recommended at this time. The 3D shell is not yet designed; you can keep an eye on it and design it later. The drawbacks of this update include the lack of network connection and configuration prompts. To address these two drawbacks, you can add LEDs to indicate the connection to the I/O. However, similarly, the LEDs need to be turned off when entering sleep mode. Firmware usage tutorial: https://bbs.ai-thinker.com/forum.php?mod=viewthread&tid=45069&extra=






