2cm Height 7 Segments 6 Digits AVR Clock With 4 Digits Thermometer
by arick in Circuits > Microcontrollers
4685 Views, 12 Favorites, 0 Comments
2cm Height 7 Segments 6 Digits AVR Clock With 4 Digits Thermometer
This project is explaining how to create yourself a 6 digits 7 segments clock with AVR microcontroller
Prepare the Parts for This Project
We need to prepare a parts for this project,
6x 7 Segments Common Anode
6x PNP transistors for driver, I used 2N3906
6x 1K 1/WW resistors
1x Module ATMEGA128
1x NTC resistor 10K
1x 10K resistor 1/4W
2x Push button for adjusting the hour and minute
1x USB ASP
1x Atmel studio
The Segment Code
I have written the segment code for this project,
Please have a look on the picture in this step....
That's how I drive each seven segment with PNP transistor, it's cheap but more than enough for driving 8 segments
The Firmware and MCU Selection
You're going to need at least 15 I/O from your MCU for this project,
In my case I used ATMEGA128, but you can use ATTiny2313,ATMEGA8,ATMEGA16 and others family of AVR 8-bits
I'm using interrupt and timer to increase second, you can upgrade to a calendar as well if you one, quite simple and straight forward.
Hex file is included if you want to use ATMEGA128
Here's the setup for my timer and ISR :
ISR(TIMER1_COMPA_vect)
{ seconds++;
if(seconds == 60) {
seconds = 0;
minutes++; }
if(minutes == 60)
{ minutes = 0; hours++; }
if(hours > 23) hours = 0; }