In this article, I use the DHT11 temperature and humidity sensor and the Arduino UNO to display the current temperature and humidity readings as a 4bit 7-segment LCD. The DHT11 is a digital sensor that makes it easy to get your project’s relative humidity and temperature readings. Due to its low cost and small size, the DHT11 sensor is ideally suited for many different DIY electronic projects. Some of the useful DHT11 projects include remote weather stations, home environment control systems and agricultural / garden monitoring systems.
By using this easy method to use a 4-digit 7-segment LED module, remove it from the serial monitor to show the value from the sensor.
Thanks to the I2C bus, you can use just 2 wires to control it, leaving more pins on the Microcontroller to connect to other devices.
Arduino modules are fast and easy to use because all the required components are contained in a PCB (resistor, capacitor, etc.).
To make things interesting, we will use the DHT11 temperature and humidity sensor to display its reading on the Nixie tube display.
DHT11 Technical Specifications:
- Humidity range: 20-90% RH
- Humidity accuracy: ± 5% RH
- Temperature range: 0-50 ° C
- Temperature accuracy: ± 2% ° C
- Operating voltage: 3V to 5.5V
Next, I’ll walk you through the related images, how to connect the 7-segment 4-digit display to the Arduino, and the DHT11 sensor-related connections.
As mentioned earlier, because the digital tube display uses the I2C bus, we only need 2 connections.
DHT11 uses only 1 pin.
Both of these modules require 5v and Ground to operate, so we use the breadboard to use its VCC and Ground Rails.
Download Required Libraries
The code will use 2 libraries, one for DHT11 and one for display.
Download both and extract them to your library folder, then restart your IDE software.
The following code assumes that the received temperature and humidity data always has 2 digits. If you want to experiment, you can use some IF statements to modify the code if these values exceed 2 digits or add negative signs for negative temperature values.
For example: -19 degrees Celsius or more than 100 degrees.
As always, you can check out the tutorial video for more information.
Copy and paste the code above into the Arduino IDE to program your Arduino.
Download the DHT11 library. https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTlib
Download the TM1637 library
After the download is complete, simply extract the contents of the zip file in “arduino / libraries” folder.
#define dht_pin 2 // Pin sensor is connected to
#define CLK 3//Pins for TM1637
#define DIO 4
//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
delay(1500);//Delay to let system boot
//Start of Program
int temp = DHT.temperature;
int humidity = DHT.humidity;
int digitoneT = temp / 10;
int digittwoT = temp % 10;
int digitoneH = humidity / 10;
int digittwoH = humidity % 10;
tm1637.display(3,12); // put a C at the end
//Wait 3 seconds before accessing sensor again.
//Fastest should be once every two seconds.
}// end loop()
NOTE If you face any problem regarding this project then please write a comment below
Visit similar projects tutorials on Raspberry Pi and Arduino