Arduino with Grove DHT11 Sensor and 4-Digit Display

This post shows how to interface Arduino uno board with Seeed Studio Grove DHT11 sensor and 4-digit display.
The Arduino reads temperature & humidity values from the DHT11 sensor and print them on 4-digit 7-segment display which is also provided by Seeed Studio.

At any time, the Grove 4-digit display shows the value of one quantity (temperature or humidity) and the Arduino automatically toggles between them every 10 seconds. A push button (Grove button module) is connected to the Arduino board which is also used for the same purpose.

Arduino UNO with DHT11 sensor and 7-segment display from Seeed Studio

About the Grove DHT11 sensor:
It’s a low cost digital temperature and humidity sensor module which based on the new DHT11 sensor. The Grove DHT11 sensor requires only one I/O pin for the communication with the master device.

The Grove DHT11 temperature & humidity sensor uses the upgraded version of DHT11. In this version, resistive humidity components is replaced by capacitive humidity components, temperature and humidity measurement ranges are wider and temperature resolution is higher.
The following image shows the basic differences between old (AOSONG) and new (ASAIR) versions:

DHT11 ASAIR VS AOSONG
DHT11 ASAIR VS AOSONG

Grove DHT11 Features:

  • Full range temperature compensation Calibrated
  • Single bus digital output
  • High precision capacitive humidity sensor
  • Long transmission distance and excellent long-term stability
  • Low power consumption
  • Cost-effective

Grove DHT11 hardware overview:
The following image shows a basic hardware overview of the Grove DHT11 sensor board.

Grove DHT11 sensor pinout
Grove DHT11 sensor pinout

About the Grove 4-digit display:
The Grove 4-digit display module is shown below (face):

Seeed Studio Grove 4-digit 7-segment display TM1637

And the following image shows its back:

Seeed Studio Grove 4-digit 7-segment display TM1637

The Grove 4-digit display module consists of TM1637 integrated circuit (datasheet), 2x10k SMD resistors, 4 SMD capacitors and Grove 4-pin cable socket. SMD: Surface Mounted Device.
With the TM1637 IC, number of pins required by the 4-digit 7-segment display is minimized to 2.
This module supports 3.3V and 5V systems.

This display module is connected to Seeed Studio Base Shield via 4-pin Grove cable, the base shield is an add-on board that directly mounted to the Arduino/Genuino uno board.
The 4-pin cable pins are: GND, VCC, DIO (data input/output) and CLK (clock).
The digital pins DIO and CLK control the displayed content and the brightness of the display.

Grove button:
The following image shows the Grove button module:

Seeed Studio Grove button

The button module has a pull down resistor of 10k ohm, if the button is pressed the state of SIG (signal) pin will change from low to high.

Hardware Required:

Arduino with Grove DHT11 sensor 4-digit display circuit:
The following image shows the connection of the 3 modules with the Grove base shield where three 4-pin cables are used for the connection between the Grove modules.
Note that the base shield is directly mounted to the Arduino UNO board.

Arduino Grove DHT11 sensor 4-digit 7-segment display

The Grove DHT11 sensor module is connected to base shield port D2 with:
GND pin is connected to Arduino GND,
VCC pin is connected to Arduino +5V pin,
NC is a not connected pin (it looks as it is connected to pin D3),
SIG (signal) pin is connected to Arduino digital pin 2.

The Grove 4-digit display is connected to base shield port D4 where:
GND pin is connected to Arduino GND,
VCC pin is connected to Arduino +5V pin,
DIO is connected to Arduino digital pin 4,
CLK is connected to Arduino digital pin 5.

The Grove button module is connected to base shield port D6 where:
GND pin is connected to Arduino GND,
VCC pin is connected to Arduino +5V pin,
NC (not connected) is not connected pin (using the 4-pin cable it looks as it is connected to base shield D7 pin),
SIG pin is connected to Arduino digital pin 6.

Arduino with Grove DHT11 sensor 4-digit display code:
To be able to compile the Arduino code below with no error, a library for the 4-digit display (TM1637) is required, download link is below:
Grove 4-digit display Library

Seeed Studio provide a library for their Grove DHT11 sensor but I recommend to use the one given by Adafruit Industries which can be installed also through library manager (in the search box write “dht sensor” and choose the one written by Adafruit) or manually, download links are below:
Adafruit DHT library           —>   direct link

After the manually download of the 2 library files, go to Arduino IDE —> Sketch —> Include Library —> Add .ZIP Library … and browse for the .zip file (previously downloaded).
The same thing for the 2nd library file.

In the Arduino code there are 2 libraries which are included as shown below:

Definition of sensor type, its data pin connection and the initialization of the DHT library:

Definition of the Grove 4-digit display pins (CLK and DIO) and initialization of its library (TM1637 library):

Rest of code is described through comments.

The resolution of temperature and humidity measurements are respectively is 1°C and 1%.

Full Arduino code:

The following video shows my simple hardware circuit:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.