Making your own temperature/humidity measuring gadget can be a fun and rewarding experience. Using an Arduino microcontroller, this DIY project can be used to monitor the temperature and humidity of your room, especially in hot summer.

Furthermore, it can also help you evaluate the performance of your air conditioner. For temperature and humidity sensing, we will be using an electronic sensor, which will be connected to a microcontroller which will receive the data from the sensor and present it on the display.

Connect Arduino Mega Microcontroller

Connect the Arduino board to your PC or laptop using a USB cable. This cable not only powers the Arduino module and serves as its power supply, but also lets the computer communicate with the Arduino board for code execution and commands. When connected to a computer via a USB cable, the Arduino shows that it is in operating condition by switching on its LED light.

From the menu bar of the Arduino IDE, go to the Tools tab and select Arduino Mega from the Board options. Similarly, under the same Tools tab, select COM Port.

Prepare the Sensor and LCD

The project uses a DHT22 temperature/humidity sensor and a 16×2 LCD screen, for which you will need the relevant Arduino IDE libraries.

DHT22 sensor

The DHT11 and DHT22 are electronic sensors that measure the temperature and humidity levels of the environment. They work on similar principles, but differ in the range of their specifications. For this DIY project, we are using a DHT 22 sensor (specifically the wired AM2302 version). The DHT22 is a better choice in terms of wider range and accuracy for both temperature and humidity sensing.

The easiest way to use DHT sensors with Arduino microcontrollers is to install the DHT.h library, which can be used for both DHT11 and DHT22 sensors. This library is usually pre-installed in the Arduino IDE. If missing, you can install it from the Library Manager under the Tools tab.

lcd 16×2 display

To show the sensor readings, we are using a 16×2 LCD Display for Arduino. This display has 16 hardware pins and requires a microcontroller interface to control its functionality. The following table shows the hardware pins of the LCD and their functionality.

A 16×2 LCD can display using either four data buses or eight data buses. Here we are using four data buses from the microcontroller to the LCD. Only the four data (DB4 to DB7) pins of the 16×2 LCD are connected to the Arduino along with the RS (Register Select) and EN (Enable) pins.

In 4-bit mode, data/commands are sent in 4-bit nibble format. First, it sends 4-bit high and then 4-bit low of the data/command. Because of such connections, we can save four GPIO pins on our Arduino that can be used for another application. Note that the purpose of pins 15 and 16 (the background LEDs) is to illuminate the display, for better visibility only.

You can use LiquidCrystal.h Arduino library to control 16×2 LCD. This library is usually pre-installed. If missing, you can install it from the Library Manager under the Tools tab in the Arduino IDE.

Create circuit to connect sensor and LCD

The Arduino Mega board provides power connections to both the LCD and the sensors, as they are low-power modules and can be easily managed through this board.

For LCD brightness control, we are using a resistive voltage divider, placed such that about 0.1V to 0.5V is provided to pin 3 (VEE) of the LCD for optimum brightness. Alternatively, a potentiometer can be used in place of this voltage divider. Pin 5 (R/W) of the LCD is set to ground for write-only operation.

Upload your code to arduino

Now it’s time to upload your code to the Arduino Mega board to perform the necessary tasks, including receiving sensor data from the DHT22 and displaying it on the LCD.

The wiring connections of the circuit are designed as shown in the code step 3. Now you can test it for performance evaluation.

Test module

To make sure the sensor is working properly and detecting temperature and humidity, we hold the sensor a few inches above a cup of hot water (emitting hot vapor). Do not submerge the DHT 22 sensor under water, as this may cause a short-circuit and permanent damage to the sensor! After a few seconds, an increase in temperature and humidity percentage can be observed, indicating that the module is working fine.

You have made your own thermometer and humidity meter

Now that you’ve built your thermometer and humidity meter, you can take this idea further by incorporating remote monitoring of temperature and humidity by transmitting this information to another device using a Wi-Fi or Bluetooth adapter. You can set your room air conditioner or exhaust system to automatically turn on and off as per the desired settings to maintain the temperature/humidity inside your room or workplace.

Leave a Reply

Your email address will not be published. Required fields are marked *