NederlandsKlik deze knop voor de Nederlandstalige website

Grove for Arduino: Temperature & Humidity Display

Creating a temperature and humidity display with Arduino is really easy. Connect an Arduino, an LCD screen and a sensor with wires and you are ready to start programming. Grove from Seeed Studio makes it even easier by its modular approach and replacing the tangle of loose wires with flat cables.

Arduino Nano Temperature & Humidity Display Project
Arduino Nano Temperature & Humidity Display Project

As a first introduction to the Grove system, we will be building a simple thermometer and hygrometer. For this small project we will use the following items:

We will connect these parts, and then, we will upload the code to the Arduino. And that’s all, after that you are ready to experiment and make your own adjustments. But first, let’s see what this Grove system is all about.

What is Grove?

Grove is an open-source, modular, standardized prototyping system. It takes a building block approach to assembling electronics. Compared to the traditional jumper or solder based systems, it is easier to connect, experiment and build and simplifies the learning.

The system consists of a base shield for the microcontroller and various modules with standardized connectors. The base shield allows for easy connection of any input or output from the modules.

The Grove system
The Grove system

Every module addresses a single function, such as a button or a sensor. There are already more than 280 modules and each one comes with clear documentation and demo code to help you get started quickly.

A base shield isn’t actually required to connect up to Grove modules. You can use a cable (Grove to Pin Header Converter) to run from the pins on the Raspberry Pi or Arduino to the modules.

Grove Shield for Arduino Nano

We will use the “Grove shield for Arduino Nano” as the base shield for this project. As the name implies, this shield is made for Arduino Nano compatible boards. Seeed Studio has it’s own original Seeeduino Nano board, but you can use a generic clone instead.

Grove Shield for Arduino Nano - Pinout
Grove Shield for Arduino Nano – Pinout

The shield breaks out the pins of the Nano and expands to 8 Grove connectors. Those are 3 digital connectors, 3 analog connectors, 1 I2C connector, and 1 UART connector. A very nice feature is that you can solder standard female header connectors to the board. This way you can use both the Grove connectors and regular jumper wires together.

Grove 16×2 LCD Display

For the display, we will use a simple 16×2 monochrome white-on-blue LCD display. It can display 2 rows of 16 white characters on a blue background and it has a very bright backlight. There are also black on red and black on yellow displays available. The display comes with a Grove cable.

Grove 16x2 Monochrome LCD Display
Grove 16×2 Monochrome LCD Display

The display is controlled by the I2C bus and therefore easy to control by just two data wires. Furthermore, it is compatible with 3.3V and 5V, so you can use it not only with the 5V Arduino but also with the 3.3V Raspberry Pi and microcontrollers like the ESP8266 and ESP32.

Grove DHT11 Temperature & Humidity Sensor

DHT11 is the most common temperature and humidity module for Arduino and Raspberry Pi. The sensor can measure temperature from 20 to 60℃ with ±2% accuracy and relative humidity from 5 to 95% with ±5% accuracy. It is widely favored by hardware enthusiasts for its advantages like low power consumption and good long-term stability.

Grove DHT11 Temperature & Humidity Sensor
Grove DHT11 Temperature & Humidity Sensor

The single-bus digital signal is output through the built-in ADC, which saves the I/O resources of the control board. You can, therefore, connect it to one of the digital pins of the microcontroller. The sensor comes with a Grove cable.

Hooking it up

Building the project is very easy. First, we will look at the hardware:

  • Insert the Arduino Nano into the headers on the shield. Make sure the orientation is correct: see the location of the USB port printed on the shield.
  • Connect the LCD display to the I2C port on the shield.
  • Then, connect the DHT11 sensor to the D2 port on the shield.
  • Finally, connect the Arduino to your PC with the USB cable.
Arduino Temperature & Humidity Display - Connections
Arduino Temperature & Humidity Display – Connections

When you have connected all the components, we are ready to install the libraries and upload the sketch.

Arduino Libraries

Before we can compile and upload the sketch, we first need to install the libraries for the display and the sensor.

In the Arduino IDE, you can install the libraries by adding the .zip files via the Sketch menu:

  • Sketch > Include LibraryAdd .ZIP Library…

After adding both libraries, you are now ready to write a sketch or use the example sketch below.

Arduino Sketch

You can use the following example sketch as a starting point for your own experiments. See also the examples that came with the libraries. The sketch below is actually based on those examples, so make sure to chem those out!

/*
  Grove weather station
  With DHT 11 and 16x2 LCD
*/

#include "DHT.h"
#define DHTPIN 2     // Digital pin
#define DHTTYPE DHT11   // DHT 11

DHT dht(DHTPIN, DHTTYPE);

byte degree_symbol[8] =
{
  0b00111,
  0b00101,
  0b00111,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000
};

#include 
#include "rgb_lcd.h"

rgb_lcd lcd;

void setup()
{
  Wire.begin();
  dht.begin();
  
  lcd.begin(16, 2); // set up the LCD's number of columns and rows:

  lcd.createChar(1, degree_symbol);

  // Print a message to the LCD.
  lcd.setCursor(0, 0);
  lcd.print("Seeedstudio");
  lcd.setCursor(0, 1);
  lcd.print("Weather station");

  delay(3000);
  lcd.clear();
}

void loop()
{
  float temp_hum_val[2] = {0};


  lcd.setCursor(0, 0);

  if (!dht.readTempAndHumidity(temp_hum_val)) {
    lcd.print("Temp.: ");
    lcd.print((int)temp_hum_val[1]);
    lcd.print("\tC");

    lcd.setCursor(0, 1);
    lcd.print("Humidity: ");
    lcd.print((int)temp_hum_val[0]);
    lcd.print("%");
  }
  else {
    lcd.setCursor(0, 0);
    lcd.print("Failed to read");
    lcd.setCursor(0, 1);
    lcd.print("sensor values");
  }
  delay(3000);
}

To be continued

The Grove system makes it very easy to quickly build your electronics projects. There are many parts and modules available and there’s also a very informative WiKi. There will definitely be more Grove projects on this blog in the future!

Grove Components
Grove Components

 

Add a Comment

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