Subminiature Portable Weather Station With M5StickC

by joejackson2003 in Circuits > Microcontrollers

32 Views, 1 Favorites, 0 Comments

Subminiature Portable Weather Station With M5StickC

IMG_20250111_155436.jpg
IMG_20250111_155436_1.jpg

This is a small portable weather station for barometric pressure, temperature and humidity, using the M5Stack M5StickC Plus, and a sensor hat, which can be firmly attached to the unit. The built-in lithium battery of the M5StickC provides 1-2 hours of total run time.

Supplies

  1. M5Stack M5StickC Plus, you can get if from ThePiHut or Pimoroni, for example.
  2. Sensor hat, M5Stack M5StickC ENV III HAT

Connect Sensor Hat to M5StickC Unit

The ENV Hat fits into the external 8-pin connector on the side. If not supplied with the hat, I would recommend some heavy duty double-stick tap, such as 3M VHB foam tape to reduce flex and bending of the connectors between the hat and the M5Stick

Prepare Software

  1. You need to burn the firmware using M5Burner software for your preferred platform. This allows to pass information of your Wifi network to the unit, so it can connect immediately to your home network and issue an API key that you can then use to connect to the unit through your browser.
  2. Start up the M5StickC. Once it is connected to your Wifi, it will display an API key that you need in a moment. Programming of the M5StickC can be done either through Arduino IDE (not covered in this Instructable) or through an online IDE provided by M5Stack. There are two versions UiFlow and UiFlow2. For this project, I used the older UiFlow.
  3. In UiFlow, on the bottom left of the status bar, find the place to enter the API key. It should then allow you to connect to the unit, upload and test code. There is a slight distinction between "Run" and "Download" (buttons on right lower corner). Run just sends the project temporarily to the M5Stick for testing. Once you switch off and reboot, this project is no longer in memory. Conversely, if you choose "Download", it saves it in memory and will be permanent (until you reprogram it).

Upload Project File to M5Stick

  1. Full project file can be found here. This was developed in UIFlow using a combination of Blockly and custom blocks of code.
  2. In UIFlow, create a new project. In settings (menu on top right), select the correct device (M5StickC Plus) and enter your API key that you should be able to read off the display of the M5Stick
  3. Open the project file that you downloaded in step 1.
  4. Your M5Stick should already be connected.
  5. Run the script. The code should start running immediately

Basic Operation of Software

buttons.jpg

This needs essentially no user interaction to function and do its job.


The M5Stick only has 3 physical buttons. Button A, B and power button.

Switching on: Press the Power button briefly. It should show a menu very briefly and then automatically run the .py file we have transferred.

The only setting the running program currently allows is to change the brightness level. This can be helpful for dark environments to reduce the backlight and increase battery life.

To change brightness, press button B, a small yellow bar will appear close to button A. Cycle through the 4 different brightness levels with button A. Save current level by pressing button B again.

Switching off: As an alternative to holding the power button for about 6s (according to M5Stack specifications), you can also hold the A button for about 1s and then release, it will switch the unit off immediately.