An IoT project that monitors soil moisture, temperature, and humidity using NodeMCU (ESP8266) and DHT22. It automatically alerts you on Telegram and controls a servo shade to protect your plant when needed.
- π‘οΈ Reads temperature & humidity from DHT22.
- π± Detects soil moisture using an analog sensor.
- π€ Sends Telegram alerts (dry, perfect, or wet).
- π‘ RGB LED indicator for plant condition.
- βοΈ Publishes data to NETPIE using MQTT.
- βοΈ Smooth servo movement for shade control.
- Copy
secrets_example.hβsecrets.h. - Fill in your WiFi, NETPIE, and Telegram credentials.
- Open
SmartPlant.inoin Arduino IDE and upload it to your NodeMCU board. - View live data on the NETPIE dashboard and get Telegram alerts instantly.
To use this project, you need a NETPIE (broker.netpie.io) account for MQTT communication and dashboard visualization.
- Go to https://broker.netpie.io.
- Sign up and log in to your Developer Console.
- In the dashboard, click Create Device β choose a name (e.g.,
SoilMoist). - Copy the following credentials:
- Client ID
- Username
- Password
- Paste them into your local
secrets.hfile:const char* MQTT_CLIENT_ID = "your_client_id"; const char* MQTT_USERNAME = "your_username"; const char* MQTT_PASSWORD = "your_password";
Go to the Dashboard tab and click β+ Widgetβ to start adding widgets. Configure each widget with the corresponding Topic/Configuration string for easy copy-paste:
| Widget Type | Display Name (Example) | Topic/Configuration String | Control Action (If applicable) |
|---|---|---|---|
| Gauge π‘οΈ | Temperature Gauge | #["SoilMoist"]["shadow"]["temperature"] |
N/A |
| Gauge π§ | Humidity Gauge | #["SoilMoist"]["shadow"]["humidity"] |
N/A |
| Gauge π± | Moisture Gauge | #["SoilMoist"]["shadow"]["moisture"] |
N/A |
| Text Display π§Ύ | Moisture Value | #["SoilMoist"]["shadow"]["moisture"] |
N/A |
| Chart π | Trends Over Time | #["SoilMoist"]["feed"] |
N/A |
| Slider βοΈ | Servo Shade Control | #["SoilMoist"]["shadow"]["shade"] |
On Slide Action: #["SoilMoist"].publishMsg("shade", value) |
| On/Off Toggle π€οΈ | Servo Shade Toggle | (#["SoilMoist"]["shadow"]["shade"] == "0") ? true : false |
ON Action: #["SoilMoist"].publishMsg("shade", "0")OFF Action: #["SoilMoist"].publishMsg("shade", "180") |
π For more details, refer to the official NETPIE Documentation
| Component | Description |
|---|---|
| NodeMCU ESP8266 | Main microcontroller (WiFi enabled) |
| DHT22 Sensor | Measures temperature & humidity |
| Soil Moisture Sensor | Detects soil water levels |
| Servo Motor | Controls plant shade |
| RGB LED | Indicates moisture level visually |
MIT License Β© 2025 whoosh09 See LICENSE for details.
