Design and Fabrication of Clock Synchronization System Based on Single Chip Microcomputer

Ming Tang, Yawei Li2018 · DOI

Abstract

The introduction of the Internet of Things system facilitates the involvement of traditional industries, but the problem of time synchronization between the upper computer system and the lower computer system of the Internet of Things may be worth studying and solving. This paper mainly introduces a complete set of solutions for the Internet of Things clock system. The hardware system introduces the clock display and storage system based on a 51-core microcontroller; the software system introduces the Bluetooth communication data docking system for Android. The system solution uses the SCM interrupt system to send Bluetooth data. The data contains an accurate communication protocol, completes the checking of data header, data body, and data CRC16 data. The accurate synchronization of the clock system is accomplished through high-speed data communication.

Introduction

In the era of the Internet of Things (IoT), precise time synchronization is critical for applications ranging from smart home automation to unmanned warehouse management. Traditional clock synchronization devices often suffer from complex physical interfaces with cumbersome button setups and significant time drift over long periods. Re-calibrating these devices manually is a tedious process that creates a "usability gap" for non-technical users.

This paper presents a streamlined IoT-based solution that replaces physical buttons with a sleek Android application. By bridging an Android "upper computer" with a 51-series microcontroller "lower computer" via Bluetooth, the system achieves second-level time accuracy and a significantly improved user experience.

System Design

Hardware Architecture

The core of the hardware system is an STC89C52 microcontroller, which serves as the central processing unit. Timekeeping is handled by a dedicated DS1302 clock chip paired with a 32.768MHz crystal oscillator. To enhance precision, 6pF capacitors were added across the crystal to stabilize the frequency. Wireless communication is facilitated by an HC-06 Bluetooth module, allowing the system to interface with mobile devices.

Circuit diagram showing the connection between the 89C52 MCU and the DS1302 clock chip.

The display utilizes a digital tube with dynamic scanning techniques. This method rapidly switches between digits to create a flicker-free visual for the human eye while minimizing the number of MCU pins required for operation.

Software Implementation and Communication Protocol

A key challenge in using the STC89C52 is its lack of a native hardware SPI interface. To communicate with the DS1302, the authors implemented a software-simulated SPI protocol. Precise timing is essential; data must be read on the positive edge of the clock signal to avoid errors caused by the MCU's processing speed relative to the clock chip.

Timing diagram for the DS1302 communication protocol, highlighting the relationship between SCLK and I/O data.

To ensure robust data transfer over Bluetooth, a custom communication protocol was developed. This protocol includes a specific data header (0x550xAA), the data payload, and a CRC16 checksum for error detection. This industrial-grade reliability ensures that data corruption in noisy environments does not lead to synchronization errors. On the user side, a custom Android application provides a graphical interface for calibrating time, setting alarms, and managing countdowns.

Results and Discussion

The system successfully achieves second-level synchronization between the Android terminal and the DS1302 clock source. Functional verification confirmed that the system reliably handles multiple modes, including real-time display and remote management of alarms via the Bluetooth link.

A significant insight from this project is the efficiency gained by offloading user interface logic to a smartphone. This allows the embedded hardware to remain simple and cost-effective while providing an intuitive user experience. However, the use of the aging 8051 architecture presents some constraints, such as the lack of modern hardware peripherals. Future iterations could benefit from ARM-based microcontrollers or Wi-Fi integration for Network Time Protocol (NTP) synchronization.

Conclusion

The developed clock synchronization system demonstrates an effective integration of legacy embedded hardware with modern mobile platforms. By utilizing a robust communication protocol and a user-friendly Android interface, the system solves the usability and accuracy issues inherent in traditional manual clock devices, providing a viable solution for various IoT applications.

Summary updated

Abstract

The introduction of the Internet of Things system facilitates the involvement of traditional industries, but the problem of time synchronization between the upper computer system and the lower computer system of the Internet of Things may be worth studying and solving. This paper mainly introduces a complete set of solutions for the Internet of Things clock system. The hardware system introduces the clock display and storage system based on a 51-core microcontroller; the software system introduces the Bluetooth communication data docking system for Android.The system solution uses the SCM interrupt system to send Bluetooth data. The data contains an accurate communication protocol, completes the checking of data header, data body, and data CRC16 data. The accurate synchronization of the clock system is accomplished through high-speed data communication.
BibTeX
@misc{tang2018design,
  author = {Ming Tang and Yawei Li},
  title = {{Design and Fabrication of Clock Synchronization System Based on Single Chip Microcomputer}},
  year = {2018},
  doi = {10.2991/jiaet-18.2018.57},
}
Figure