WS2812 LED Binary Clock Project Documentation

Hardware Description

Schematics

The schematic was created in KiCad. It includes:

KiCad Schematic

Bill of Materials

Cantitate Ref Valoare Capsulă Obs Furnizor, cod produs Preț unitar (lei)
24 D1-D24 LED BAND THT UPB
4 R1,R2,R3,R4 330Ohm THT ardushop.ro, CJADNL_CR1/4W-330R-5pc-ST26 0.27 RON
2 C1,C2 22pF SMD UPB
1 U1 ATMega16A DIP40 UPB
1 C3 100pF THT UPB
1 X1 Crystal THT UPB
Board overview
Overview
Front side of the board
Front side
Back side of the board
Back side

Additional Hardware Features

The project uses WS2812 LED strips for visual time display, controlled via a single data line on PB1. Four push-buttons connected to PB3, PB6, PB7, and PD5 allow user interaction for setup and time adjustment:

Software Description

Overview

Firmware was developed for the ATmega164A microcontroller running at 20 MHz using CVAVR compiler. The main functions include displaying time on WS2812 LEDs in binary-coded decimal, supporting setup mode for time adjustment via buttons, and using blinking LEDs to indicate system state.

Software Logic

The main loop polls buttons to detect mode toggling and increments time units when in setup mode. Time is displayed by sending color data representing each binary digit of HH:MM:SS to the WS2812 LED strip. The system wraps time values appropriately and provides visual feedback using red LEDs for bits set and blinking green LEDs for status.

Results and Conclusions

The project successfully implements a binary clock displayed on WS2812 LEDs. Time can be set intuitively with push-buttons using hold-to-increment functionality. Visual feedback distinguishes normal mode (blinking green LEDs) from setup mode (solid green LEDs). Precise timing for WS2812 communication was accomplished using assembly NOP instructions.

Bibliography