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.
