Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Miikka
Published © GPL3+

Simple Temperature and Humidity Meter

Student appartments can get very cold during finnish winter, so I built a simple thermometer.

BeginnerShowcase (no instructions)181
Simple Temperature and Humidity Meter

Things used in this project

Hardware components

MC78L05 Voltage Regulator
If you deside to use something other than 5V supply.
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
ATmega328
Microchip ATmega328
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
16 MHz Crystal
16 MHz Crystal
×1
Resistor 10k ohm
Resistor 10k ohm
×2
Capacitor 22 pF
Capacitor 22 pF
×2
Capacitor 10 µF
Capacitor 10 µF
×1
Capacitor 100 nF
Capacitor 100 nF
×1
Capacitor 330nF
×1
Slide Switch
Slide Switch
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Custom parts and enclosures

th_cover_jBF9uPbGkg.stl

th_box_1oIUT4YHDd.stl

Schematics

Schematic

Note that you don't want to be having the battery and power grid options at the same time.

Code

The code

Arduino
There are many ways to program an ATmega328. I wired it to an Arduino Uno, which you can find instructions from the internet.
/* THM
 Temperature- & Humiditymeter
 10.7.2022

 Including the needed libraries & defining the used sensor as type 22
 [we use quite non-traditional library dht_nonblocking from https://github.com/olewolfDHT_nonblocking by wolf@blazingangles.com]
 as this enables you to read sensor values from the DHT22 temperature and humiditiy sensors without blocking other code execution.
*/
#include <dht_nonblocking.h>
#include <LiquidCrystal.h>

#define DHT_TYPE DHT_TYPE_22

// Defining essential pins

static const int DHT_PIN = 8;
DHT_nonblocking sensor(DHT_PIN, DHT_TYPE);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// Only the LCD-screen requires setup here, so we do that

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

}

void loop(){
  
  // declaring variables
  
  float temperature;
  float humidity;
  
  // set the cursor to the beginning
  
  lcd.setCursor(0, 0);
  
  // measure the temperature and humidity

  sensor.measure(&temperature, &humidity);
  
  // Print to LCD: temperature and its value, set cursor to the beginning of the next row, print humidity and its value.
  
  lcd.print("Temp: ");
  lcd.print(temperature, 1);
  lcd.print(" C,");
  lcd.setCursor(0, 1);
  lcd.print("Humidity: ");
  lcd.print(humidity, 1);
  lcd.print("%");
  
}

Github Repository

Credits

Miikka
2 projects • 3 followers
Contact

Comments

Please log in or sign up to comment.