Clocks That Can Measure Air Temperature and Humidity
by Nick Programmer in Circuits > Microcontrollers
2834 Views, 45 Favorites, 0 Comments
Clocks That Can Measure Air Temperature and Humidity
Smart Clocks is an ESP8266 d1 mini based clocks that can measure air temperature and humidity. I used to think that people don't need just the clocks and I was right. You can just take your smartphone or laptop and look at the time. But the thing you're not able to look on your smartphone is air humidity and temperature. People don't need just clocks, they need a clocks with an additional feature. This is why I made these smart clocks.
The DHT22 measures air temperature and humidity, this is why I named it "Smart".
TFT LCD 1.8 inch screen displays all the information about time, air humidity and temperature.
The ESP8266 has entry to the network, esp8266 parses information about date and time. Also esp8266 gets information about air temperature and humidity.
Supplies
- ESP8266 d1 mini x1;
- DHT22 x1;
- ST7735 TFT LCD 1.8 inch screen x1;
- Resistor 560 ohm x1;
If you haven't BOOT button on your esp8266 board, you will need to solder or connect GPIO0 to GND using 560 ohm resistor, exception if your code uploads automatically.
How It Works?
I attempt to easy explain how it works.
ESP8266 d1 mini connects to the network, then it sends request to NTP server. NTP server knows time and date and sends data to the esp8266 back. ESP8266 d1 mini receives the data.
Install and Configure Arduino IDE *Optional
If you have never used Arduino IDE, you will need to download and install it. We'll need to download and install Arduino IDE to upload the code into a microcontroller.
ATTENSION!!! Do not download 2.x versions, at the moment of 12/4/2023 there are still a lot of bugs. It better to download a 1.8.19 version.
Download it here - https://www.arduino.cc/en/software
- After Installing, navigate to File > Preferences
- Find Additional Boards Manager URLs, and paste this link into a text field - http://arduino.esp8266.com/stable/package_esp8266com_index.json
- Then, navigate to Tools > Board: > Boards Manager
- Type the "esp8266" in a search field, find and Install.
Download CH340 Driver
Download CH340 for Windows - http://wiki.amperka.ru/_media/articles:driver-ch340:ch340ser-wimdows.zip
Download CH340 for Mac - http://wiki.amperka.ru/_media/articles:driver-ch340:ch340ser-mac.zip
Attention!!! You can't open this link by click on it. Drop required link into a new tab.
- Extract .zip file;
- Open extracted file;
- Open .exe file and install;
Install Libraries
- Navigate to Sketch > Include library > Manage Libraries;
- Type every single library one by one and download:
- DHT
- SPI
- ESP8266WiFi
- NTPClient
- Adafruit_ST7735
- Adafruit_GFX
- WiFiUdp
Download Firmware Folder
Download the firmware that we will upload into a microcontroller.
GitHub Smart Clocks Repository: https://github.com/NickProgrammerOffical/Smart-Clocks
- Download .zip on my GitHub.
- Extract the "Smart-Clocks.zip" folder, then open Firmware.ino file with Arduino IDE.
Set the Time Zone and Time Signing
You can set your own time zone by GMT.
- Find time zone of your city by GMT.
- Change int GMT value to your own;
Also you can change time metric system.
There's only two metric system: AM/PM; 24Hours;
- If you want to set 24Hours, change display_time value to "24/H";
- But if you want to set AM/PM, change display_time value to "AM/PM";
Assemble Smart Clocks
Make sure that you rightly connected DHT22 Sensor and resistors.
Upload the Firmware
Change WIFI_SSID and WIFI_PASS values to your own WIFI SSID and Password.
Select Board and Port to be able to upload the firmware.
- Navigate to Tools > Board: > ESP8266 Boards > LOLIN(WEMOS) D1 mini
- Connect GPIO0 to GND pin using 560ohm resistor.
- Navigate to Tools > Port > Select your port;
- Click upload button in the left top corner;
Use It!
To be able to use it, you'll need to have Hotspot or WIFI router.
ESP8266 automatically connects to the network and parses date and time from there.