Condensation Alert

A small project to check out M5StickC with MicroPython by combining it with a useful application in my apartment.

Similar projects worth following
I have an air condition build into the suspended ceiling of my bathroom. Last summer I found water stain on the ceiling. The water stains are exactly where the cold air output is connected to the air pipes, which are pulled through the whole apartment. I assume that the thermal isolation is not enough for the combination of humidity and the temperature difference. This results in condensation. This problem must be solved before next summer…

...Near the water stains I have an inspection opening which is big enough to put one hand inside but too small to fix the thermal isolation. The effort to open the ceiling is too high compared to the size of the stains. My idea is to put a saucer below the pipes at the place where the stains are. In the end it will be a solution like a refrigerator gets rid of its condensation water. To be sure not to have too much water in the ceiling I want to measure the humidity and the temperature in the ceiling. And I want to know when the condensation is happening. This means that I will implement some moisture sensors in the saucer.

This is a good opportunity for me to check out a new gadget and a new programming language. I will use for this a M5StickC, which is based on ESP32. And I want to play around with MicroPython that I have not used yet. In the ceiling I do not have any power supply, this means that I must use a battery pack for the M5StickC and that I must check if there is a possibility for a deep sleep mode in MicroPython.

For the display of the data and simple configurations of the M5StickC I will use Node-RED on a Banana Pi BPI-M2 Berry.


  • Set up Node-RED --> DONE
  • Simple measurement with M5StickC and readout with Node-RED --> DONE
  • Implement deep sleep + battery pack test --> deep sleep (lightsleep) implemented; test started
  • Build saucer with moisture sensor
  • Test complete setup before summer…


You need for this the node-red-dashboard and node-red-contrib-coap nodes.

JavaScript Object Notation (JSON) - 5.87 kB - 12/11/2019 at 21:22


  • 1 × M5StickC
  • 1 × M5StickC ENV Hat (DHT12, BMP280, BMM150)
  • 1 × Banana Pi BPI-M2 Berry With Armbian

  • Resignation

    Nikola02/28/2020 at 20:24 0 comments

    I have now tried different approaches to save power with my setup, but unfortunately nothing really worked.

    I have turned every unnecessary module off via the PMIC. With this setting the M5Stick+ENV Hat were five days in operation. After this test I thought that maybe the ENV Hat draws to much current. So I repeated the test without the Hat. This gave me one day more run time.

    The deep-sleep mode that I used is actually called light-sleep. In this mode the RAM still has power (see

    So I tried the the real deep-sleep mode. Unfortunately in that case to Micropython scripts starts from the beginning. So I changed the code a little bit. I made it to connect, measure and send the data to the RasPi every hour. But the connecting costs to much battery power and this setup worked only for one and a half days.

    Maybe I could save the data in the flash and then connect once a day like planned, but I am to lazy and do not have enough motivation to finish this project.

  • Power Save Mode

    Nikola02/09/2020 at 13:22 0 comments

    Since the last log entry I have made a lot of changes and tests:

    1.) I have switched to a Raspberry Pi Zero W. I had troubles with the network port of the Banana Pi

    2.) I found out that my USB-battery-pack turns off, if there is no current consumption. This means everytime the M5StickC switched to deep-sleep it turned off and the long term test failed. I am now using PowerBooster 1000 Charger from Adafruit with a 2000mAh Lipo.

    Still with this change I got only one day of data. My time unit for the long term test is a day. Because the module connects only once in 24h and there is no way to have a console. I looked a little bit deeper in the schematic of the M5StickC and found out that there is a PMIC (AXP192) that supplies all ICs on the module. I have also learned (from here that it is possible to turn all chips off except the RTC.

    I have now implemented the turn off command in the (see script and started again a new long term test.

    From the datasheets I know that the ENV Hat consumes 1.5mA, but this module is just a place holder for the tests. The end version should have only one low power sensor.

  • M5StickC code read for long term test

    Nikola01/02/2020 at 20:14 0 comments

    I have now finished the code for the long term test. Now I want to know:

    • How long will the M5StickC + ENV sensor run with my battery pack?
    • Is the MicroPython code correct for a long term use?
    • Is the BananaPi + Node-RED good enough for a long term use?

    I have done some changes in the Node-RED flow and added the flow to the GitHub repository.

  • M5StickC - pre-version

    Nikola12/15/2019 at 21:00 0 comments

    I have successfully received the current time and the divisor. And also send data to the Node-RED server. The code is pushed to GitHub.

    For now I have some troubles with the MicroPython code, but I am not sure where to locate the problem. Sometimes the code gets stuck and the ampy tool shows a timeout.

    When this problem is fixed, I will start a long-time test run without deep-sleep (M5StickC plugged to a power supply).

  • Node-RED Server

    Nikola12/11/2019 at 21:21 0 comments

    The installation of Node-RED in Armbian is straight forward. For the dashboard I installed the node-red-dashboard and for CoAP the node-red-contrib-coap node.

    I have tested the Node-RED server over the Wifi with the coap-clieant (--> libcoap) installed on my laptop.

    The Node-RED flow looks as follows

  • Concept

    Nikola12/11/2019 at 21:11 0 comments

    My concept is to make a simple MicroPython script on the M5StickC. I have no experience with humidity measurement. I do not know how often is enough to measure. That’s why I will have a variable (divisor) in the script which is set by the Node-RED interface. Each measurement should be saved with time stamp. The M5StickC shall not connect to the Wifi for a time check. It should get once a day one time stamp from the Node-RED server and calculate the rest of the time stamps by adding 24h/divisor. Once a day the data should be pushed to the Node-RED server. The server should display the data on a dashboard (in a browser) and should save the data in a csv file on the BPI Berry. My preferred protocol for this kind of tasks is CoAP.

    The following figure shows the workflow of the whole system.

View all 6 project logs

Enjoy this project?



Jeff wrote 12/19/2019 at 18:42 point

Out of curiosity, why not MQTT? Your sensor/M5 can publish humidity data every 10 minutes or so and the NR flow subscribes to it.  The NR flow can publish the time every now and again for the sensor/M5 to subscribe to.  I just got an M5StickC and am wondering what to do with it.

  Are you sure? yes | no

Nikola wrote 12/19/2019 at 21:36 point

I am used to CoAP and for this setup MQTT is to much overhead. I do not need to set up a broker. This setup should stay active for months with one battery pack (10A/h). It should measure at max. 48x a day. The rest of the time it should go into the deep-sleep. 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates