Skip to content

Arduino project: build a digital thermometer

In this project I want to combine 2 components, the 1602 LCD Display

and the DHT11 temperature and humidity sensor

to create a digital thermometer we could actually use in the real world.

Before we start, read the DHT11 tutorial where we write a program that reads the data from the sensor:

and also read the 1602 LCD tutorial where I explain how to write to the display:

Once you do so, all you need to do from the circuits perspective is to add both circuits to the same Arduino based project:

Here it is in practice:

On the code side, we do a similar thing. We include both the DHT and the LiquidCrystal libraries first, then we initialize the 2 components.

We initialize them in setup() and in loop() we check every 2 seconds the data coming from the sensor, and we print it to the LCD display:

#include <LiquidCrystal.h>
#include <DHT.h>

DHT dht(2, DHT11);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
  lcd.begin(16, 2);

void loop() {
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  if (isnan(h) || isnan(t)) {

  lcd.setCursor(0, 0);
  lcd.print((String)"Temp: " + t + "C");
  lcd.setCursor(0, 1);
  lcd.print((String)"Humidity: " + h + "%");

Here is the project running:



You might be interested in those things I do:

  • Learn to code in THE VALLEY OF CODE, your your web development manual
  • Find a ton of Web Development projects to learn modern tech stacks in practice in THE VALLEY OF CODE PRO
  • I wrote 16 books for beginner software developers, DOWNLOAD THEM NOW
  • Every year I organize a hands-on cohort course coding BOOTCAMP to teach you how to build a complex, modern Web Application in practice (next edition February-March-April-May 2024)
  • Learn how to start a solopreneur business on the Internet with SOLO LAB (next edition in 2024)
  • Find me on X

Related posts that talk about electronics: