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: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

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

  • Reducing "shoot-through" in offline Full Bridge SMPS?
  • High Side current sensing
  • How to simulate power electronics converter in PSpice?
  • Voltage mode pushpull is a nonsense SMPS?
  • Layout IRN reduction in Comparator

RSS Electro-Tech-Online.com Discussions

  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

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