0% found this document useful (0 votes)
65 views11 pages

Bài Report IOT102

Bài report IOT102

Uploaded by

trungrichie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views11 pages

Bài Report IOT102

Bài report IOT102

Uploaded by

trungrichie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Digital Clock

1st Tran Le Nhat Vien, 2nd Nguyen Thanh Trung, 3rd Nguyen Dinh Khoi,
4th Tran Trong Tan, and Duc Ngoc Minh Dang
FPT University, Ho Chi Minh Campus, Vietnam
{vientnlse184359, trungntse183755, khoindse180300, tanttse184357}@fpt.edu.vn, and [email protected]
Abstract
The measurement and management of time have played a crucial role throughout human history, evolving significantly from
ancient practices to modern advancements in technology. Early methods relied on natural phenomena like the sun’s position and
seasonal changes, essential for activities such as agriculture and religious observances. Progress continued with the development
of devices such as sundials, water clocks, and later mechanical clocks during medieval times in Europe, marking important steps
toward more precise and standardized timekeeping.
The ongoing evolution of timekeeping underscores its enduring importance in shaping how societies structure daily routines,
work schedules, and scientific endeavors. From ancient methods to modern innovations, the quest for accuracy and efficiency in
time measurement remains a constant theme throughout human history.

I. I NTRODUCTION
The Digital Clock Project is an innovative project that combines the DS1307 Real-Time Clock (RTC), Arduino, and the
ESP8266 Wi-Fi module to produce a sophisticated and highly functional smart clock. By leveraging the strengths of these
components, this project provides a precise, reliable, and internet-based timekeeping system.
The central processing unit for controlling the clock’s various inputs and outputs is the Arduino microcontroller, which also
serves as the project’s main component. Due to its open-source nature and strong community support, Arduino is a popular
and versatile choice for both novice and experienced hobbyists in the electronics and embedded systems fields.
The clock’s functionality is enhanced by the ESP8266 module, which provides internet connectivity. This feature allows the
clock to synchronize with internet time servers to ensure accurate timekeeping.
II. M AIN P ROPOSAL
In the 20th century, the advent of electronic and atomic clocks brought revolutionary levels of precision, supporting global
positioning systems and international time standards. The digital age further transformed access to time through ubiquitous
devices like smartphones, computers, and smartwatches, integrating scheduling and time management tools seamlessly into
daily life. Contemporary innovations such as the Internet of Things (IoT) and wearable technology have continued to personalize
and enhance the integration of timekeeping in everyday activities.
A. System Models and Block Diagram

Fig. 1. Block diagram of the developed system.

The developed system integrates both hardware and software components. It incorporates sensors: temperature. The Arduino
Uno and NodeMCU serve as IoT development platforms, utilizing the NodeMCU’s integrated Wi-Fi module to take data from
a local host server. A display unit is employed to present the system’s outputs. Figure 1 illustrates a block diagram of the
system configuration.
B. Components and Peripheral Devices

TABLE I
S YSTEM ’ S COMPONENTS AND PERIPHERAL DEVICES

Components/devices ID/remarks
Arduino Uno R3 ATmega328P based
NodeMCU ESP8266
Liquid-crystal Display LCD
Temperature Sensor LM35
Speaker Buzzer Piezo
Real Time Clock DS1307

Fig. 2. Hardware interfacing.


Fig. 3. Hardware interfacing.

The advanced control system integrates essential electronic components, including an ESP8266 module and a DS1307 Real-
Time Clock (RTC), to enhance its functionality. The ESP8266 serves as a powerful microcontroller with integrated Wi-Fi
capabilities, enabling seamless connectivity to local networks and the internet. This connectivity allows the system to receive
real-time data updates and commands, ensuring efficient and responsive operation based on current environmental conditions
and user inputs.
C. Software Programming
The code integrates various hardware components and functionalities using an Arduino and an ESP8266. The Arduino code
manages several sensors and devices such as a temperature sensor, an LCD for displaying data, a buzzer for alarms, and a
button for switching displays. It also interfaces with an RTC (Real-Time Clock) module to keep track of time and set alarms.
When the Arduino receives commands via I2C from the ESP8266, it processes these commands to either set an alarm or
adjust the current time. The main loop of the Arduino code checks the button state to cycle through different displays on the
LCD and periodically checks if the current time matches the alarm time to trigger the buzzer.
The ESP8266 code sets up a WiFi access point and a web server to serve different HTML pages for setting the alarm and the
time. When a user submits a form on these web pages, the ESP8266 processes the input and sends the appropriate command
to the Arduino via I2C. The ESP8266 also synchronizes the current time with an NTP server to ensure accurate timekeeping
and can handle weather data retrieval.
D. Real-Time Clock and Sensor Setup
1) RTC and Display: The DS1307 RTC module maintains accurate time and date, even during power loss. A LiquidCrystal
display shows time and temperature with connections to digital pins 2 through 12. I2C communication initializes the RTC,
displaying an error if not found.
1 RTC_DS1307 rtc;
2 char daysOfTheWeek[7][12] = {
3 "Sun",
4 "Mon",
5 "Tue",
6 "Wed",
7 "Thu",
8 "Fri",
9 "Sat"
10 };
11

12 const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;


13 LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
Listing 1. RTC Initialization

And the setup for RTC:


1 void setup() {
2 Serial.begin(9600); /* start serial for debug */
3 Wire.begin(8); /* join I2C bus with address 8 */
4 Wire.onReceive(receiveEvent); /* register receive event */
5 Wire.onRequest(requestEvent); /* register request event */
6

7 // DS1307
8 if (! rtc.begin()) {
9 Serial.println("Couldn’t find RTC");
10 while (1);
11 }
12 // sets the RTC to the date & time on PC this sketch was compiled
13 rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
14

15 // other devices
16 pinMode(buzzerPin, OUTPUT);
17 pinMode(buttonPin, INPUT);
18 lcd.begin(16, 2);
19 }
Listing 2. RTC Setup

2) Temperature: The temperature sensor (LM35) connects to analog pin A0. The following example demonstrates initial-
ization:
1 const int sensorPin = A0;
2 float sensorValue;
3 float voltageOut;
4 float temperatureC;
Listing 3. Temperature Sensor Initialization

And use the ‘getTemp()‘ function to get the temperature:


1 float getTemp() {
2 int val;
3 val = analogRead(sensorPin);
4 float mv = (val / 1023.0) * 5000;
5 float cel = mv / 10;
6 return cel;
7 }
Listing 4. Get Temperature

3) ESP8266 Access and Transfer Data Locally: To access and modify data between Arduino and ESP8266, we use a local
website connected to a WiFi:
1 // Create Access Point WiFi ESP8266
2 const char* ssid = "FPTU_Library";
3 const char* password = "12345678";
Listing 5. WiFi Setup

E. Programming Flowchart

Fig. 4. Flowchart of the Arduino system process.


Fig. 5. Flowchart of the ESP8266 system process.

III. R ESULTS AND D ISCUSSION


A. Prototype Implementation
The Digital Clock project integrates various functionalities, such as setting alarms, adjusting the current time, and retrieving
real-time data. Users can set and manage alarms, ensuring they are reminded at the desired time. The clock can be synchronized
with internet time servers to adjust the current time accurately. It retrieves the current time from the DS1307 Real-Time Clock
(RTC) module, ensuring precise timekeeping. Additionally, the project includes features to fetch weather information from
online sources and measure the ambient temperature using a temperature sensor (LM35). These capabilities make the Digital
Clock a comprehensive and multifunctional device for everyday use.
Fig. 6. Implemented Prototype Of The Developed System.

B. Experimental Results
The experimental results demonstrate the successful implementation of the digital clock system integrated with the DS1307
Real-Time Clock (RTC) and LM35 temperature sensor. The system was tested under various conditions to evaluate its
functionality and accuracy.
Fig. 7. Fetch weather information.
Fig. 8. Fetch the room temperature.
Fig. 9. Adjust the current time.

Fig. 10. Set alarm time.


• Time Synchronization: The clock was synchronized with an NTP server via the ESP8266, achieving an accuracy of
within ±1 second over an extended period. This precision is essential for applications requiring reliable timekeeping.
• Temperature Readings: The LM35 temperature sensor provided consistent temperature readings. In multiple trials,
the readings fluctuated between 24°C to 28°C, with an average temperature of 26°C recorded during normal operating
conditions. This accuracy validates the sensor’s reliability in monitoring ambient temperature.
• Web Interface Functionality: The local website hosted on the ESP8266 allowed users to set the clock and alarm time
effectively. User inputs were processed without noticeable delays, demonstrating the system’s responsiveness.
• Display Output: The LCD displayed real-time data, including the current time and temperature, with clear visibility under
various lighting conditions. The integration of the LCD with the Arduino was seamless, ensuring smooth data updates.
C. Discussion
The results obtained from the experimental implementation indicate that our digital clock project meets the design objectives
outlined at the project’s inception. The integration of IoT technologies through the ESP8266 significantly enhances the
functionality of the clock, allowing for time synchronization and remote configuration.
• Impact of IoT Integration: By utilizing the ESP8266, the project not only provides accurate timekeeping but also
connects to the internet, showcasing the potential for future expansions. For instance, adding features like weather updates
or notifications could further increase the clock’s utility in daily life.
• Sensor Reliability: The LM35 temperature sensor’s consistent performance confirms its suitability for this application.
Its analog output was reliably converted to temperature values, contributing to the overall system’s performance.
• User Interaction: The design emphasizes user-friendly interaction through a local web interface, allowing easy configu-
ration of the clock settings. This accessibility is crucial in modern IoT applications, where user engagement significantly
influences system adoption.
• Future Enhancements: While the current implementation is functional, future work could explore additional features,
such multiple time zone support, or integration with other IoT devices. Additionally, developing a mobile application
could further enhance user interaction and accessibility and integrate a battery backup to maintain operation during power
outages.
IV. C ONCLUSION
By integrating the DS1307 RTC, LM35 temperature sensor, and ESP8266, this project aims to create a reliable and interactive
system for timekeeping, temperature monitoring, and alarm functionality. The inclusion of an NTP server ensures that the time
remains accurate, and the local web interface offers a convenient way for users to manage their settings.
V. AUTHOR ’ S C ONTRIBUTION

TABLE II
AUTHOR ’ S CONTRIBUTION

# Student ID Student Name Tasks Contribution


1 SE184359 Tran Le Nhat Vien Tinkercard, Present Preparation 20%
2 SE183755 Nguyen Thanh Trung Code and Design Block Diagram, FlowCharts 40%
3 SE180300 Nguyen Dinh Khoi Study conception and Craft the physical project 20%
4 SE184357 Tran Trong Tan Write Report and Prepare Overleaf 20%
Total 100%

R EFERENCES
[1] J. Tellez, F. Morilla, and J. Garcia, “Design of an IoT-based Temperature and Humidity Monitoring System,” Journal of Sensors, vol. 2016, pp. 1-10,
2016, doi: 10.1155/2016/7190495.
[2] H. Simon, Introduction to Arduino: A Hands-On Approach, Springer, 2020.
[3] K. Pahlavan and P. Krishnamurthy, “Wireless Information Networks,” Journal of Wireless Communications and Mobile Computing, vol. 2019, pp. 1-10,
2019, doi: 10.1155/2019/8579312.
[4] A. Kumar and R. Sharma, “IoT-based Smart Home Automation System,” in 2021 IEEE International Conference on Computer Science and Network
Technology (ICCSNT), 2021, pp. 90-94, doi: 10.1109/ICCSNT53734.2021.9671984.
[5] Y. Zhang and X. Li, “Real-Time Clock Synchronization for Wireless Sensor Networks,” IEEE Transactions on Wireless Communications, vol. 17, no.
10, pp. 6401-6411, 2018, doi: 10.1109/TWC.2018.2873548.

You might also like