Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to build a smart clock that measures temperature and humidity

By Ayush Jain October 29, 2024

These smart clocks, powered by the ESP8266 D1 Mini, offer more than just timekeeping. In addition to displaying the current time, they measure temperature and humidity, making them versatile tools for monitoring environmental conditions.

Equipped with a DHT22 sensor, these clocks provide accurate air temperature and humidity readings, displayed alongside the time on a 1.8-inch TFT LCD screen. Below we’ll cover how to design your own smart clock!

Figure 1. The prototype.

Thanks to the ESP8266’s network capabilities, this smart clock retrieves the date, time, temperature, and humidity, providing essential data all in one place. These features make it practical and easy to use.

Components

  1. ESP8266 D1 mini board
  2. DHT22 sensor
  3. A 1.8-inch TFT LCD screen (ST7735 chipset)
  4. A 560-ohm resistor

Note: If your ESP8266 board lacks a BOOT button, you may need to connect the GPIO0 to the GND by using the 560-ohm resistor (unless the code uploads automatically).

Figure 2. The components.

How it works

The ESP8266 D1 Mini connects to the network, requesting the time and date from an NTP server. The server then sends this data to the ESP8266 D1 Mini.

Figure 3. The working principle.

How to install and set-up Arduino IDE

  1. Download and install Arduino IDE — ideally Version 1.8.19 (the newer versions may have bugs).
  2. After installing, go to “File” > “Preferences.”
  3. In the “Preferences” window, find “Additional Boards Manager URLs” and paste this link: http://arduino.esp8266.com/stable/package_esp8266com_index.json
  4. Next, go to “Tools” > “Board” > “Boards Manager.”
  5. In the “Boards Manager” window, type “esp8266” in the search field.
  6. Find the ESP826 boards package and click “Install.”

Figure 4. Screenshots for reference.

How to download the CH340 driver

For Windows:

  1. Download the CH340 driver from this link:
    http://wiki.amperka.ru/_media/articles:driver-ch340:ch340ser-wimdows.zip
  2. Extract the downloaded .zip file.
  3. Open the extracted folder.
  4. Run the .exe file and follow the installation prompts.

For Mac:

  1. Download the CH340 driver from this link:
    http://wiki.amperka.ru/_media/articles:driver-ch340:ch340ser-mac.zip
  2. Extract the downloaded .zip file.
  3. Open the extracted folder.
  4. Install the driver as per the instructions provided.

Figure 5. Installing the CH340 driver.

How to install the libraries

  1. Go to “Sketch” > “Include Library” > “Manage Libraries.”
  2. Search for each library one by one and download them:
    • DHT
    • SPI
    • ESP8266WiFi
    • NTPClient
    • Adafruit_ST7735
    • Adafruit_GFX
    • WiFiUdp

How to download the firmware

  1. Go to the Smart Clocks GitHub repository: https://github.com/NickProgrammerOffical/Smart-Clocks
  2. Download the “Smart-Clocks.zip” folder.
  3. Extract the downloaded folder.
  4. Open the “Firmware.ino” file using the Arduino IDE.

Figure 6. Screenshot for reference.

Setting the time zone and format

  1. Find your city’s GMT offset for its proper time zone.
  2. Adjust the “int GMT” value in the code to match your city’s GMT offset.
  3. Choose your time display format:
    • For 24-hour format, set “display_time” to “24/H”.
    • For AM/PM format, set “display_time” to “AM/PM”.\\

Figure 7. Setting the time.

The assembly

Ensure that the connection between the DHT22 sensor and resistors is secure and done correctly.

Figure 8. The circuit connections.

Updating the firmware

  1. Update the WIFI_SSID and WIFI_PASS values with your Wi-Fi network’s SSID and password.
  2. Select the board and port for uploading the firmware.
  3. Go to “Tools” > “Board” > “ESP8266 Boards” > “LOLIN(WEMOS) D1 mini.”
  4. Connect GPIO0 to the GND pin using a 560 ohm resistor.
  5. Go to “Tools” > “Port” and select your port.
  6. Click the upload button in the top left corner to upload the firmware.

Figure 9. A working prototype.

Using the smart clock

To use the smart clock, you’ll need a hotspot or Wi-Fi router. The ESP8266 board will automatically connect to the network and retrieve the date and time.

Final Code

You may also like:


  • How to build your own smart home

  • What sensors are used in fitness-based smartwatches?

  • How do smart TVs work as embedded systems?

  • How does a smartwatch work as an embedded system?

  • The top IoT projects for enhancing everyday life

  • How to design a heart-rate monitor using LoRa and Arduino

Filed Under: Circuit Design
Tagged With: circuit, circuitdesign, esp8266, humidity, sensor, smartclock, temperature
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • How best to synchronise the UCC38C45?
  • unknown component z1
  • CMOS ring oscillator
  • Self-powered Current Transducer Buyer's Guide
  • Question on options of set_clock_group

RSS Electro-Tech-Online.com Discussions

  • Fixing board, Easy question HEX SCHMITT
  • Can I make two inputs from one??
  • Display TFT ST7789 (OshonSoft Basic).
  • Home Smoke detectors are all Beeping Batteries are not dead.???
  • The Analog Gods Hate Me

Featured – LoRa/LoRaWan Series

  • What is the LoRaWAN network and how does it work?
  • Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices

Recent Articles

  • How to monitor temperature and humidity on a TFT display with graphics
  • Tria modules integrate edge AI processing with multi-core processors
  • pSemi introduces RF switch with 52 dBm PMAX,PEAK and 90-dBm IIP3 linearity
  • XP Power launches 1.3 kW power supply with 58.9 W/cm³ density
  • How to enable Wi-Fi provisioning in ESP32-based IoT products

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe