กลับไปหน้ารวมไฟล์
arduino-clock-without-rtc-with-temperature-and-humidity-c2f9bd-en.md

Don't mind the look of it but it works very fine. I used the Arduino Nano as the programming board for the project. This project is ideal for beginners who want to learn how to work with DHT family sensors and manage display output on an LCD using the I2C communication protocol.

Main Components Used

  1. Arduino Nano: A small but powerful microcontroller board, offering high flexibility for embedded projects.
  2. DHT11 Sensor: A popular sensor that measures both humidity and temperature, outputting data as a single-bus digital signal.
  3. 16x2 LCD with I2C Module: Using an I2C Module is crucial as it significantly simplifies wiring. Instead of 6-10 wires, only 4 wires are needed (VCC, GND, SDA, SCL), saving a lot of time and reducing potential errors. If you don't have an I2C module, believe me, you need to buy it; it saves a lot of wire and effort.

Setting Initial Time in the Code

For this project, the clock system operates at the software level. Therefore, before uploading the program to the board, you need to define the initial time for the variables in the header section of the code so that the clock starts running from your desired current time.

Defining time variables before entering the Setup function

In-depth Details and Technical Troubleshooting

I used the Simple DHT library, which makes working with the DHT11 sensor easier by simplifying the reading of raw data signals and converting them into usable numerical values.

Clock Calibration: During testing while running the program on an Arduino Nano, I discovered an interesting issue: the clock ran too fast, approximately 1 second per cycle. To resolve this in software, I fine-tuned the second's increment rate. I changed the increase rate of seconds to 0.50 to align with the actual cycle occurring on my Nano board, as when I finalized it with Arduino Nano it started moving 1 second faster (idk why). This made the displayed time more stable and accurate.

Section for tuning time logic to align with hardware operation

Wiring Diagram

Connecting the various components is quite straightforward, and to me, the wiring along with I2C is simple. You can edit the code if you want to use a normal LCD display.

1. Connecting the DHT11 Sensor

So for the connections, I used a DHT11 with 4 pins, and here's its pinout:

DHT11 sensor Pinout
  • VCC: Connect to the Arduino board's 5V power supply.
  • GND: Connect to the board's Ground.
  • Data Pin: Connect to Digital pin 11 (as per the code).

2. Connecting the LCD (via I2C Module)

  • VCC: Connect to Arduino 5V (same for the DHT11 sensor).
  • GND: Connect to Arduino GND (same for the DHT11 sensor).
  • SCL (Serial Clock): Connect to pin A5 of the Arduino Nano.
  • SDA (Serial Data): Connect to pin A4 of the Arduino Nano.

Note: Pins A4 and A5 are dedicated pins for I2C communication on the Arduino Nano (ATmega328P) board.

This is all for the project. This was my first upload; pardon me if any mistakes.

Conclusion and Developer's Comments

This project serves as a good first step for learning Embedded Systems. The most important thing isn't just connecting wires correctly, but understanding how each component communicates, for example, why I2C is necessary, or troubleshooting software-based Clock Drift as I encountered.

In the future, I am thinking to upgrade it with a few more things, like adding an RTC (Real-Time Clock) module, such as the DS3231, to allow the time to run independently even without power, and possibly add buttons for setting the time without modifying the code.

I hope this project is beneficial and inspires everyone who is starting in electronics.

Thanks,

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino IDE"
author: "harshitmehra2007"
category: ""
components:
  - "1x Jumper wires (generic)"
  - "1x Nano 33 BLE Sense"
  - "1x I2C 16x2 Arduino LCD Display Module"
  - "1x DHT11 Temperature & Humidity Sensor (4 pins)"
  - "1x Solderless Breadboard Half Size"
description: "This project is a arduino clock made without using an rtc and it is totally accurate it also displays the temperature and the humidity"
difficulty: "Easy"
documentationLinks: []
downloadableFiles:
  - "https://projects.arduinocontent.cc/0a9662a3-17fa-4b05-9757-66871a271bfa.ino"
  - "https://projects.arduinocontent.cc/0a9662a3-17fa-4b05-9757-66871a271bfa.ino"
encryptedPayload: "U2FsdGVkX1+Jc6yJQchN34vGs0UZWIexXLHuE0Cfebmjsq+M3YoZmQNXNKeExjsYU/TBJ5kMvufkvxUZDZCeIVJnMzVChHQIPKkta50DBqk="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/arduino-clock-without-rtc-with-temperature-and-humidity-c2f9bd_cover.jpg"
lang: "en"
likes: 1
passwordHash: "7d7528bc9ffeb778b4f1fdce583cabae46359151689da60057087e760edb7d37"
price: 1120
seoDescription: "Build an accurate Arduino Clock without an RTC. Displays real-time Temperature and Humidity sensor data."
tags:
  - "weather"
  - "easy"
  - "arduino"
  - "clocks"
  - "without rtc"
  - "lcd_i2c"
  - "lcd"
  - "dht11"
title: "Arduino Clock (without rtc) with temperature and humidity"
tools: []
videoLinks: []
views: 6090