Greenhouse Temperature and Humidity Sensor with Web Dashboard

Greenhouse Temperature and Humidity Monitor

I grow African Violets in a small greenhouse. They’re picky, so I made a temperature and humidity monitoring system. Data is sampled several times a minute and visualized on a web-based dashboard. If it gets too hot or dry, the violets send a warning email. Data is tracked for 30 days so it’s easy to see patterns and improve conditions.

Live Demo

](IO - Adafruit)

Check on greenhouse conditions right now.

How it Works

1. The Hardware

The DHT-22 Sensor (PDF) is a combined temperature and humidity sensor with a huge range (-40C – 80C, 0 – 100% RH). The sensor in this setup runs off a Node MCU dev board. The board runs Arduino C code and is easily programmed via USB with the Arduino IDE.

2. The Code

The Arduino C code instructs the hardware to take a reading from the sensor, print the result to the serial port, and also send it over the web to Adafruit.io. After a short delay, this process repeats. No data storage or analysis happens on the board. That’s where Adafruit.io comes in.

3. Data and Alerting

Adafruit.io saves and displays data in a customizable dashboard. There are some limitations at the free service tier, such as only 30 days of data storage, and rate-limiting to 10 samples per minute. It’s more than enough to get started though. Adafruit.io also sends out the data (as feeds) to IFTTT.com where alerting is set up. I use email notification but there are lots of options.

Instructions

Parts Required (Cost ~ $25)

  1. Node MCU ESP8266 12E dev board (narrow to fit breadboard)
  2. DHT-22 temperature and humidity sensor
  3. Micro-USB A cable
  4. Breadboard and wires
  5. Optional: 5V USB power supply

My greenhouse is an Ikea Socker with an LED grow light which cost about $40 total.

Process

If you’re new to dev boards and Arduino here’s how to get started. Minimal coding is required and you can easily teach yourself!

Step 1: Set up third-party tools. Create an account at Adafruit.io and follow this tutorial to set up a secret key and feed. Create an account at IFTTT.com.

Step 2: Set up the hardware. Mount your board on the breadboard, hook up the DHT-22 sensor pins to 3.3V power, ground, and pin D2.

Step 3: Plug the hardware into your computer via USB. Open the Arduino IDE and install the required sensor libraries.

Step 4: Download the code, open it in the IDE and add your personal info.

line 5: #define IO_USERNAME “Adafruit.io username
line 6: #define IO_KEY “Adafruit.io secret key
line 23: #define WIFI_SSID “network name (2.4Ghz)
line 24: #define WIFI_PASS “network password

  • Save and upload the sketch.
  • Open the serial monitor at 115200 baud.
  • Data should appear.
  • If you see “nan” or another error, check your wiring and network.
  • Lightly breathe on the sensor to see if values change.
  • If so, your hardware setup is complete!

Step 5: Login to Adafruit.io, and create two feeds, “temperature” and “humidity”. Create a dashboard and add dials and graphs to it. You should see the data update in the dashboard.

Step 6: To set up alerts, choose “Services” from the tab at the top of the page, and follow the prompts to connect to IFTTT.com.

Step 7: Visit IFTTT.com/create. Choose Adafruit as “This” and your desired alerting method as “That”. I used email.

Optional: If you want to run this without a computer, just plug it into a USB power supply.

Next steps would be to build an enclosure for this project, or permanently solder wiring if you wish. You may also want to add other sensors like this soil moisture sensor. Have fun!

3 Likes

I should also add, if you’d like to set up the same thing, I highly recommend picking up something like this kit on amazon:

https://www.amazon.ca/gp/product/B085HB3781/

This project is a great intro to working with ESP8266 dev boards. The sensor range is impressive!

2 Likes

This system has been working really well and I just picked up a few more DHT-22 sensors from aliexpress. Amazingly they got here in 2 weeks. Here’s the store link if anyone wants to order their own.

Now that I have this setup working I’ll be moving on to making a Python version that works with Grafana. It’s a good stretch for me learning-wise. I’ll also be documenting it if anyone is interested. Thanks to @lukecyca for the free Grafana account. Much appreciated.

Edit: should mention it’s very simple to modify the code and run multiple board/sensor combos with all data visualized on the same arduino.io dashboard. Right now I have two in my apartment (different greenhouses).

1 Like

Just an update about the ifttt.com side on this project. You may have heard they recently moved to put some limits on their free tier. You now have the ability to create only 3 apps however that’s more than enough to monitor a few dht-22 sensors! There is an option to pay for a pro version but don’t do that!

Instead, check out the free open source Home Assistant! It has a DHT-22 integration and all kinds of other fun goodies to play with. Also perfect if you’d like to delve more into the coding side of things.

There is ESP integration with Home Assistant so you can set up a core control system on a pi and it’ll talk to all your esp devices, other devices, and handle alerting.

Have fun!

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.