A modern Binary Clock built with Python and Streamlit that displays the current local time using Binary Coded Decimal (BCD) representation.
The project follows a simple and clean architecture by separating the clock logic from the graphical interface, making the code easier to understand, maintain, and extend.
- 🕒 Displays the current local time in real time
- 💡 Binary Coded Decimal (BCD) representation
- 🎨 Modern LED-style interface
- ⚡ Updates automatically every second
- 🧩 Clean separation between backend and frontend
- 🐍 Built entirely with Python and Streamlit
binary-clock/
│
├── clock.py # Backend logic for generating the binary clock matrix
├── gui.py # Streamlit UI and LED rendering
├── main.py # Application entry point
└── README.md
Contains the core logic of the application.
Responsibilities:
- Get the current local time
- Convert each decimal digit into a 4-bit binary number
- Generate a 4×6 binary matrix used by the GUI
Main methods:
get_current_time_digit()digit_to_binary_list()get_binary_clock_matrix()
Responsible for rendering the binary clock using Streamlit.
Features include:
- Custom CSS for LED styling
- Binary matrix visualization
- Hour, Minute, and Second column separation
- Digital clock displayed underneath for verification
- Automatic refresh every second
The application's entry point.
Responsibilities:
- Configure the Streamlit page
- Launch the graphical interface
- Python 3.8+
- Streamlit
Install the required package:
pip install streamlitStart the application with:
streamlit run main.pyThe binary clock will automatically refresh every second to display the current local time.
Each decimal digit of the current time is converted into a 4-bit binary value.
Example:
Time
14 : 39 : 58
Digits
1 4 3 9 5 8
Binary
0001
0100
0011
1001
0101
1000
Each column represents one decimal digit, while each row represents a binary bit.
An illuminated LED indicates 1, while a dark LED indicates 0.
- Smooth LED animations
- Modern dark theme
- Glowing active LEDs
- Clear spacing between Hours, Minutes, and Seconds
- Digital clock for easy comparison
- Python
- Streamlit
- HTML/CSS (via Streamlit Markdown)
The application displays:
- Six binary columns
- Four binary rows
- LED indicators
- Live digital clock
- 12-hour format option
- Theme switcher (Dark/Light)
- Adjustable LED colors
- Timezone selection
- Animated startup effect
- Responsive layout improvements
This project is open source and available under the MIT License.