M5Stack Smart Plant Watering
2021-10-19 | By M5Stack
License: General Public License Environmental Arduino
* Thanks for the source code and project information provided by @Kernel Control
- Collects soil moisture, air humidity, temperature and pressure
- Button push (A) for watering
- Reuses configured Wifi connection
- Publishes Home Assistant state
- Support Home Assistant auto-discovery
- Reconnect to Wifi with a button (B)
- Send manual MQTT configuration and state with a button (C)
- Signal lack of water with RGB bar (on M5Stack Fire) and warning image
Installation
Hardware
- Plug the ENV unit in Port A
- Plug the Watering unit in port B
- Plant the Watering unit in the soil
- Connect the internal pipe of the watering unit to a water source
- Put the external pipe of the watering unit in the soil
- Boot the M5Stack in Wifi mode
Software
- Download or clone this same repository
- Open M5Stack UI Flow and connect your M5Stack using the API Key
- Open the src/drunken_plant.m5f file in M5Stack UI Flow
In the readSensors function, update the from low and from high values according to your Watering unit calibration.
- Update the MQTT configuration in the code to suit your own MQTT server.
- Still in UI Flow, use the Manager to upload the code and images to the device.
Note: Swap Unit Env II with Unit Env III in UI Flow if needed as the former has reached its end of life
Usage
- When started, the application connects to the existing Wifi, initiates the MQTT client configuration and publishes the Home Assistant discovery message.
- Every 30 seconds, it reads the sensors values, updates the displayed values and publishes the state messages for Home Assistant on MQTT.
- Press button A to start watering. Release the button to stop.
- Press button B to re-initiate the Wifi connection sequence (will be triggered only when disconnected).
- Press button C to manually publish the Home Assistant configuration and sensors state to MQTT.
TODO
- Icons for button actions
- Watering via MQTT
- Show battery and Wifi status
Code
https://github.com/kernelcontrol/m5stack-smart-plant-watering
Software apps and online services
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum