DIY Temperature and Humidity Monitor for the Garden

This week I’m building a temperature and humidity monitor to take measurements in the Cold Frame I placed outdoors.  This is mainly for my own curiosity and will help assess how well the Cold Frame is at maintaining stable temperature and humidity.  I will also be using this monitor in my seed germination station.  I will be using an ESP8266 WiFi Arduino module along with a DHT22 temperature and humidity sensor to collect data.


Last summer I built some multi-purpose sensors to monitor the temperature and humidity around the house to determine if we needed a repair or replace our home heating and air conditioning system.  I put together the multi-purpose sensor on a breadboard as you can see in the image below.

My DIY Multi-Sensor Project
My DIY Multi-Sensor Project

In this project, I used a NodeMCU V2 ESP8266 (a WiFi enabled microcontroller controller) and connected it to a DHT22 sensor (shown in white above), a motion sensor and a photodiode for measuring light.  Finally, the NodeMCU connects to a MQTT server I have running in the house and the data is plotted in home-assistant.

Next, I’ll walk you through putting together a simple wireless temperature and humidity monitor that you can use around the house or in the garden.

Simple Temperature and Humidity Monitor

These are the things you will need:

  • NodeMCU V2 (or any other ESP8266 enabled board)
  • A DHT22 or DHT11 temperature and humidity sensor
  • A Breadboard (Optional)
  • A 1K Resistor
  • Solder (Optional)
  • Hookup or Jumper Wire
  • A 6V battery holder

Assemble the circuit according to the schematic below.

Temperature and Humidity Sensor Schematic
Temperature and Humidity Sensor Schematic

The connections are as follows:

For the DHT22 Sensor:

  • 1 connects to the NodeMCU V2 3.3V Output
  • 2 connects to  the NodeMCU V2 D2 Input
  • 2 connected to the 3.3V Output via a 1K Pull-Up Resistor
  • 4 is connected to the common ground.

And for the NodeMCU:

  • D0 is connected to the NodeMCU V2 RST Pin (for Deep Sleep)
  • VIN connected to 6V positive
  • GND connected to 6V negative

Try putting this together on a breadboard first to make sure you get the circuit right and solder everything together for a more robust permanent solution.

Once everything comes together, the final product will look similar to this.

Wireless Temperature and Humidity Sensor Monitor
Wireless Temperature and Humidity Sensor Monitor

The Code

Use the code below to set up a basic temperature and humidity monitor system.  The code publishes a JSON packet to your MQTT server every 10 minutes.  You will need to edit the essid, password, and server fields to match your network configuration.

After the board has been programmed it will send an update to the MQTT server every 10 minutes and go to a low power sleep mode after.

To program the board you can use the Arduino IDE or my favorite, PlatformIO.

The Sensor in Action

I placed this sensor inside of my cold frame and have been monitoring the temperature and humidity for the past few days.  This will give me an ideal of how hot it gets inside the cold frame and whether or not I need to automatically vent the cold frame if it gets too hot.

Cold Frame Temperature Data
Cold Frame Temperature Data
Cold Frame Humidity Data
Cold Frame Humidity Data

And there it is, a portable DIY Temperature and Humidity Monitor.  Feel free to leave comment if you like this post or if you have any questions.