project-highlight-image

Time-Synchronization-via-Sensing

This project developed a lightweight time synchronization protocol for distributed embedded systems using ESP32 devices and a Raspberry Pi gateway. Instead of using heavy protocols like NTP, the system leverages timestamped sensor events (from LM393 sound sensors) to synchronize clocks. The Raspberry Pi calculates network delay, estimates clock drift, and sends correction messages to the ESP32 devices. This approach achieves accurate synchronization while minimizing computational and communication overhead, making it suitable for resource-constrained IoT systems.
Home
Questions?
hero-image

Shruti Parab

Project Timeline

Sep 2024 - Dec-2024

HighlightS

  • Designed and implemented a lightweight time synchronization protocol for ESP32-based embedded systems.
  • Developed clock offset, network delay, and drift compensation mechanisms to improve synchronization accuracy.
  • Achieved millisecond-level precision by incorporating round-trip delay correction.
  • Built a scalable IoT architecture using ESP32, LM393 sensors, Bluetooth communication, and a Raspberry Pi gateway.

SKILLS

ESP32 Microcontroller
Raspberry Pi
Bluetooth Communication
LM393 Sound Sensor
Time Synchronization Protocol
Clock Drift Estimation
Offset Calculation
Round-Trip Delay Compensation
JSON Data Logging
Real-Time Data Processing
Python Programming

OVERVIEW:

The project implements a lightweight time synchronization system using two ESP32 microcontrollers connected to LM393 sound sensors and a Raspberry Pi gateway. When a sound event is detected, each ESP32 generates a timestamp and sends it to the Raspberry Pi via Bluetooth. The Raspberry Pi records the received timestamps, calculates the clock offset between devices, estimates network delay, and detects clock drift over time. Based on these calculations, it sends correction messages back to the ESP32 devices to adjust their clocks. This process runs periodically to maintain synchronization while minimizing communication and computational overhead. The basic timestamp difference experiment showed large offsets (around 3.5–4.5 seconds) due to network delay and timing inconsistencies. However, after incorporating round-trip delay compensation and drift correction, the ground truth experiment achieved high precision with offsets confined within approximately ±0.0015 seconds (millisecond-level accuracy). This demonstrates that delay and drift correction significantly improves synchronization accuracy in resource-constrained embedded systems.

| lowinertia |
Engineering Portfolio in 15 minutes
Create Your Portfolio