Skip to content

flixcoo/atmega48a-binary-clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🕒 ATmega48A - Binary Clock

AVR License Platform Status HTWK Leipzig

A compact binary clock implementation using ATmega48A microcontroller with power-saving features and brightness control

🛠️ Hardware Configuration

📍 Pin Overview

atmega48a layout

📡 Circuit Board

Front View Back View
Front view of PCB showing component placement Back view showing PCB traces
Component side with LEDs and microcontroller Trace side with solder connections

💡 LED Indicators

Function Bit Pin
Hours 2⁰ PD7
PD6
PD5
PD4
2⁴ PD3
Minutes 2⁰ PC5
PC4
PC3
PC2
2⁴ PC1
2⁵ PC0

🔘 Buttons

  • Button 1: PB0
  • Button 2: PB1
  • Button 3: PD2

🕰️ Time & Measurements

  • Clock crystal: PB6 + PB7
  • Timing measurement: PD0

✨ Features

🔌 Initialization

  • ⚡ Power-on sequence with LED chase animation
  • 🕛 Default start time: 12:00
  • ⏳ Auto-sleep after 2.5 minutes inactivity

🎛️ Button Functions

Combination Action
Button 1 Toggle power saving mode
Button 2 ➕ Increment hours (0→23)
Button 3 ➕ Increment minutes (0→59)
Button 1 & 2 ⚙️ Timing test mode
Button 2 & 3 💡 Cycle brightness (5 levels)

⚙️ Advanced Features

🔧 Timing Measurement Mode
  • All LEDs light up for 2s on activation
  • PD0 toggles every second
  • Buttons disabled during test
  • Exit by pressing 1+2 again (3x LED blink)
🔋 Power Saving Mode
  • All LEDs turned off
  • MCU in power-save mode
  • Wake via PD0 interrupt or Button 1
  • Full button functionality maintained
🌓 Brightness Control
  • 5 adjustable brightness levels
  • PWM-controlled LED intensity
  • Settings persist through power cycles
  • Cycle through levels with 2+3 button combo

🎬 Demonstration

Boot Sequence

startup sequence

// Boot sequence in the code
void startup_sequence() {
    for (int i = 7; i >= 3; i--) {
        PORTD |= (1 << i);
        _delay_ms(50);
        PORTD &= ~(1 << i);
    }

    for (int i = 3; i < 8; i++) {
        PORTD |= (1 << i);
        _delay_ms(50);
        PORTD &= ~(1 << i);
    }

    for (int i = 5; i >= 0; i--) {
        PORTC |= (1 << i);
        _delay_ms(50);
        PORTC &= ~(1 << i);
    }

    for (int i = 0; i < 6; i++) {
        PORTC |= (1 << i);
        _delay_ms(50);
        PORTC &= ~(1 << i);
    }

    _delay_ms(300);
}

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.


Developed with ❤️ during my studies at HTWK Leipzig
🚀 Feel free to contribute or fork this project!

About

A compact binary clock implementation using ATmega48A microcontroller

Resources

License

Stars

Watchers

Forks