Introduction
When air temperature increases☀️, air can hold more water molecules💧, and its relative humidity decreases. When temperatures drop⛅️, relative humidity increases.
Let’s check our surrounding temperature and humidity using this Grove Beginner Kit without doing any wiring. It’s so easy!
Video
This video shows how to read surrounding temperature and humidity using Grove Beginner Kit.
Hardware Preparation
This is the list of items used in the video.
Sample Program
This is python3 sample program for sending a video to telegram. You can use it with Thonny Python IDE.
#include "DHT.h" | |
#include <Arduino.h> | |
#include <U8x8lib.h> | |
#define DHTPIN 3 | |
#define DHTTYPE DHT11 // DHT 11 | |
DHT dht(DHTPIN, DHTTYPE); | |
U8X8_SSD1306_128X64_ALT0_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE); | |
#define LED 4 | |
#define PIEZO 5 | |
float temp, humi; | |
void getReading(){ | |
temp = dht.readTemperature(); | |
humi = dht.readHumidity(); | |
u8x8.setFont(u8x8_font_chroma48medium8_r); | |
u8x8.setCursor(0, 33); | |
u8x8.print("Temp:"); | |
u8x8.print(temp); | |
u8x8.print("C"); | |
u8x8.setCursor(0, 50); | |
u8x8.print("Humidity:"); | |
u8x8.print(humi); | |
u8x8.print("%"); | |
u8x8.refreshDisplay(); | |
delay(200); | |
} | |
void setup(void) { | |
Serial.begin(9600); | |
Serial.println("DHTxx test!"); | |
dht.begin(); | |
u8x8.begin(); | |
u8x8.setPowerSave(0); | |
u8x8.setFlipMode(1); | |
pinMode(LED, OUTPUT); | |
pinMode(PIEZO, OUTPUT); | |
} | |
void loop(void) { | |
getReading(); | |
if (temp>32){ | |
digitalWrite(LED,HIGH); | |
tone(PIEZO,1000,500); | |
delay(700); | |
} | |
else{ | |
digitalWrite(LED,LOW); | |
noTone(PIEZO); | |
} | |
} |
Thank You
References:
Thanks for reading this tutorial. If you have any technical inquiries, please post at Cytron Technical Forum.
“Please be reminded, this tutorial is prepared for you to try and learn.
You are encouraged to improve the code for better application.“
1 thought on “Read Surrounding Temperature and Humidity Using Grove Beginner Kit”
Is there a sketch that allows you to see data from all the sensors on the OLED display? I have found sketchs for the different sensors, but I can’t find a way to integrate them into one. I would like to display light level, sound level, air temp, humidity, and air pressure at the same time on the OLED. Is there a sketch for this?