A unique mechanical digital clock that uses servo motors to physically flip segments, creating a mesmerizing analog-like digital display. Built with ESP-IDF framework, this project combines precise servo control with accurate timekeeping to deliver a distinctive time display experience.
Key innovations:
- Mechanical 7-segment display using 28 micro servos (7 per digit)
- Hybrid digital-analog visual effect
- Silent operation through optimized PWM control
- Energy-efficient design with sleep modes
The system uses two I2C devices:
-
DS1307 Real-Time Clock (Default address 0x68)
- Provides accurate timekeeping
- Battery-backed for continuous operation
-
PCA9685 PWM Controllers (Addresses 0x40 and 0x41)
- Controls 32 servo motors (16 channels per controller)
- 12-bit resolution for precise angle control
- 50Hz PWM frequency standard for servos
I2C Troubleshooting Tips:
- Verify connections with
i2cdetect
tool - Ensure pull-up resistors (4.7kΩ) are present on SDA/SCL
- Check for address conflicts if adding more devices
- Monitor I2C errors in ESP-IDF logs
- 4-digit display using servo-controlled segments
- Precise timekeeping with DS1307 RTC
- PCA9685 PWM controller for servo management
- Customizable segment angles
# Clone this repository
git clone --recursive https://github.com/PiyushPatle26/Counter-Clock.git
cd Counter-Clock
# Build and flash
idf.py build
idf.py -p /dev/ttyUSB0 flash monitor
- Adjust
pulse_0deg
andpulse_90deg
infinal_clock.c
for your servo calibration - Set proper I2C addresses in config.h
- ESP32 microcontroller
- 28 servo motors (7 per digit)
- 2x PCA9685 PWM controllers
- DS1307 real-time clock