Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Sensor Series
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • 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
  • 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

Log in to leave a comment:

Lost your password?

Don't have an account? Register here

Submit a Guest Post

submit a guest post

EE TECH TOOLBOX

“ee
Tech Toolbox: Sensors
In this Tech Toolbox, we cover some of those technologies driving the next generation of connected systems, including ultra-low-power sensing strategies that extend node battery life, and 60 GHz CMOS radar for contactless health and presence detection.

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.

  • Non-synchronized SMPS's are fine?
  • Short between PCB layers if no board outline clearance rule?
  • effect of calibration on s-parameters
  • Heat capacity or storage of heat...
  • Use an external Signal Generator to tune the PLL output of a circuit from 3Ghz to 10GHz

RSS Electro-Tech-Online.com Discussions

  • Mitsubishi Electric IPM module lot code format - how to decode?
  • Replacement IGBT for DGG4015 for Honda Motorcycle ECU
  • TDK Lambda ESS 500-20-11-D-LB-RSTL Parallel Operation
  • Programmable 1kV DC Power Supply – Budget ~$600 with Display
  • effect of calibration on s-parameters

Featured Tutorials

Learn - VHDL Tutorials (22 Part)

  • VHDL Tutorial – 11: Designing half and full-subtractor circuits
    VHDL Tutorial – 11: Designing half and full-subtractor circuits
  • VHDL Tutorial – 12: Design a 8-bit parity generator and circuit checker
    VHDL Tutorial – 12: Design a 8-bit parity generator and circuit checker
  • VHDL tutorial 13: Design 3×8 decoder and 8×3 encoder using VHDL
    VHDL tutorial 13: Design 3×8 decoder and 8×3 encoder using VHDL
  • VHDL Tutorial 14: Design 1×8  demultiplexer and 8×1 multiplexer using VHDL
    VHDL Tutorial 14: Design 1×8  demultiplexer and 8×1 multiplexer using VHDL
  • VHDL Tutorial 17: Design a JK flip-flop (with preset and clear) using VHDL
    VHDL Tutorial 17: Design a JK flip-flop (with preset and clear) using VHDL
  • VHDL Tutorial 18: Design a T flip-flop (with enable and an active high reset input) using VHDL
    VHDL Tutorial 18: Design a T flip-flop (with enable and an active high reset input) using VHDL
More Tutorials >

Recent Articles

  • GigaDevice targets optical modules with new MCUs
  • HMS Networks bridges Automotive Ethernet and standard Ethernet
  • Nuvoton adds post-quantum security to secure MCU
  • TI battery monitor delivers less than 2 mV accuracy
  • Qorvo adds 10 W X-band radar front end

EE ENGINEERING TRAINING DAYS

engineering
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • 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 © 2026 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
      • Sensor Series
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • 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
  • Guest Post Guidelines
  • Advertise
  • Subscribe