After killing many African Violets in my mini greenhouse, something had to change. I built an Internet of Things (IoT) monitoring system to track temperature and humidity, visualize it on a web dashboard, and send alerts when conditions aren't optimal.
Greenhouse with African Violets, monitoring hardware, and live dashboard
Dashboard screenshot showing data patterns over time
- Real-time temperature and humidity monitoring
- Web-based dashboard with customizable visualizations
- Email alerts when conditions are outside safe ranges
- 30-day data history for pattern analysis
- Low cost (~$25 in parts)
- Easy setup with minimal coding required
- How It Works
- Parts Required
- Prerequisites
- Installation
- Configuration
- Usage
- Troubleshooting
- Future Improvements
The DHT-22 sensor is a combined temperature and humidity sensor with an impressive range (-40°C to 80°C, 0-100% RH). The sensor connects to a NodeMCU ESP8266 dev board that runs Arduino C code and can be easily programmed via USB using the Arduino IDE.
The Arduino sketch instructs the hardware to:
- Take a reading from the DHT-22 sensor
- Print the result to the serial port for debugging
- Send data over WiFi to Adafruit.io
- Wait briefly, then repeat
Adafruit.io stores data and provides a customizable dashboard. The free tier includes:
- 30 days of data storage
- Rate limit of 10 samples per minute
- Data feeds that can trigger alerts
Adafruit.io connects to IFTTT.com for alerting. I use email notifications, but SMS, push notifications, and other options are available.
All components needed for the greenhouse monitoring system (laptop not shown)
Total cost: ~$25
- NodeMCU ESP8266 12E dev board (narrow version to fit breadboard)
- DHT-22 temperature and humidity sensor
- Micro-USB cable
- Breadboard and jumper wires
- Laptop for programming
- Optional: 5V USB power supply (for standalone operation)
- Basic understanding of Arduino (or willingness to learn—getting started guide)
- Computer with USB port
- 2.4GHz WiFi network (5GHz not supported by ESP8266)
- Free accounts at:
- Create an account at Adafruit.io and generate a secret key
- Create two feeds:
temperatureandhumidity - Create an account at IFTTT.com
- Mount the NodeMCU on the breadboard.
- Connect the DHT-22 sensor:
- VCC → 3.3V
- GND → Ground
- DATA → Pin D2
NodeMCU and DHT-22 sensor connected on breadboard
- Download and install the Arduino IDE
- Add ESP8266 board support (File → Preferences → Additional Board URLs)
- Install required libraries (Sketch → Include Library → Manage Libraries):
- DHT sensor library by Adafruit
- Adafruit Unified Sensor by Adafruit
- Adafruit IO Arduino by Adafruit
- Download this repo and open it in the Arduino IDE
- Update the configuration (see Configuration below)
- Select the board: Tools → Board → NodeMCU 1.0 (ESP-12E Module)
- Select the correct port: Tools → Port
- Click Upload
Edit these lines in "secrets_example.h" and save the file as "secrets.h".
// Adafruit.io credentials
#define IO_USERNAME "your_adafruit_username"
#define IO_KEY "your_adafruit_secret_key"
// WiFi credentials (must be 2.4GHz network)
#define WIFI_SSID "your_network_name"
#define WIFI_PASS "your_network_password"Open Serial Monitor (Tools → Serial Monitor) at 115200 baud to verify temperature and humidity readings appear. Breathe on the sensor to confirm values change, then check your Adafruit.io dashboard for incoming data. Create a new dashboard and add each data field as a guage.
- Log in to Adafruit.io
- Go to Services and connect to IFTTT
- Visit IFTTT.com/create
- Configure your alert:
- If This: Choose Adafruit and set your threshold (e.g., temperature > 30°C)
- Then That: Choose your notification method (email, SMS, etc.)
Once everything is working, disconnect from your computer and plug the NodeMCU into any 5V USB power supply. It will automatically connect to WiFi and start sending data.
| Problem | Solution |
|---|---|
| Serial Monitor shows "nan" | Check sensor wiring, ensure connections are secure |
| Can't connect to WiFi | Verify you're using 2.4GHz network, check credentials |
| No data on Adafruit.io | Verify IO_USERNAME and IO_KEY are correct, check feed names |
| Sensor readings seem off | DHT-22 needs 2-second intervals between readings (already in code) |
| Upload fails | Check correct board and port are selected, try different USB cable |
Future iterations could include a custom enclosure, integrated fan control, and a soil moisture sensor with automatic watering.
- Built with Adafruit.io
- Inspired by the need to keep African Violets happy
African Violet, "Allegro Once In a While"