Welcome

Software

The software is written to enable the user to configure the clock at run-time using only two buttons: the '+'-button increases the current setting, the 'adv'-button saves the current setting and allows one to setup the next.

If the microcontroller is fresh from the programmer, the firmware doesn't yet know what the hardware looks like, so stuff like the type of fan and the angles the hands are on should be set up first. After that, the user can input the current time and after that's confirmed, the clock will start running.

The software mainly works by using three interrupts: the first one kicks in 500 times a second and is used for button debouncing and keeping time. The second one is dynamically adjusted to kick in 60 times per rotation of the fan and handles the showing of the hands by enabling and disabling the three colors of the RGB-led. The third one kicks in every time the fan generates an RPM-pulse. When that happens, the microcontroller will evaluate the speed at which the rotation-timer happens and adjust it when necessary.

The software for the clock is written in avr-gcc and released under the GPL v3, so if you want, you can modify it to display a clock on anything rotating quickly enough. If you come up with something interesting, please let me know!

Video of the led-fan-clock in action:

« Prev 3 

Last 10 comments Show all

samand wrote at 14 Apr 2014, 5.45:

Thank you for your reply! What`s max & min fan RPM for proper circuit performance?

Evil.Spock wrote at 13 Apr 2014, 1.26:

samand, The direction of rotation is irrelevant. It's the strobe rate of the LED that determines the perceived motion. Nice POV clock BTW. Personally, I would've used a 555 instead of a uC.

samand wrote at 12 Apr 2014, 15.27:

Good job,but for clockwise rotating fan what must we do?

Sprite_tm wrote at 3 Mar 2011, 16.51:

You can use any old 8MHz crystal. 10 or 12MHz makes the clock run faster; you'd have to change a few things in the code and recompile to make that work.

makakasirapuka wrote at 2 Mar 2011, 23.34:

Thank you for your reply! What crystal did you use in the project? What's the part number? Is there any other difference but for the frequency? What would happen if I use a 10MHz crystal or 12MHz? Should I change something in the code for the clock to work correctly?

Sprite_tm wrote at 2 Mar 2011, 23.00:

Yes, you could go without a crystal... but with the rc-osc having an 1% deviation, the clock could be running 14 minutes a day slow or fast. The warnings: Yes, I know they are there and what they warn about. It's basically the compiler being anal about syntax or processor-specific details, you can ignore them.

makakasirapuka wrote at 2 Mar 2011, 0.11:

holly shit! 我不想

makakasirapuka wrote at 2 Mar 2011, 0.08:

Probably, it's one of the most remarkable attiny2313 projects I've seen so far :-) Is there a way to get rid of that 8MHz crystal? Why can't we set up the fuses in such a manner to use the inbuilt crystal? Besides, I used crosspack on a mac to compile your code and got several warnings... : avr-gcc -c -mmcu=attiny2313 -I. -gstabs -I ../core/ -Os -Wall -Wstrict-prototypes -std=gnu99 main.c -o main.o In file included from main.c:4: io.h:14: warning: function declaration isn't a prototype main.c:11: warning: function declaration isn't a prototype main.c:22:2: warning: no newline at end of file avr-gcc -c -mmcu=attiny2313 -I. -gstabs -I ../core/ -Os -Wall -Wstrict-prototypes -std=gnu99 io.c -o io.o In file included from io.c:4: io.h:14: warning: function declaration isn't a prototype io.c:53: warning: function declaration isn't a prototype io.c:81:2: warning: no newline at end of file avr-gcc -c -mmcu=attiny2313 -I. -gstabs -I ../core/ -Os -Wall -Wstrict-prototypes -std=gnu99 rtc.c -o rtc.o avr-gcc -c -mmcu=attiny2313 -I. -gstabs -I ../core/ -Os -Wall -Wstrict-prototypes -std=gnu99 run.c -o run.o In file included from run.c:5: io.h:14: warning: function declaration isn't a prototype run.c: In function `__vector_4': run.c:20: warning: unused variable `mux' avr-gcc -c -mmcu=attiny2313 -I. -gstabs -I ../core/ -Os -Wall -Wstrict-prototypes -std=gnu99 setup.c -o setup.o In file included from setup.c:4: io.h:14: warning: function declaration isn't a prototype setup.c:20: warning: function declaration isn't a prototype setup.c: In function `init_offsets': setup.c:21: warning: passing arg 1 of `eeprom_read_byte' makes pointer from integer without a cast setup.c:22: warning: passing arg 1 of `eeprom_read_byte' makes pointer from integer without a cast setup.c:23: warning: passing arg 1 of `eeprom_read_byte' makes pointer from integer without a cast setup.c:24: warning: passing arg 1 of `eeprom_read_byte' makes pointer from integer without a cast setup.c: In function `btn_tick': setup.c:51: warning: passing arg 1 of `eeprom_write_byte' makes pointer from integer without a cast setup.c:66: warning: passing arg 1 of `eeprom_write_byte' makes pointer from integer without a cast setup.c:78: warning: passing arg 1 of `eeprom_write_byte' makes pointer from integer without a cast setup.c:93: warning: passing arg 1 of `eeprom_write_byte' makes pointer from integer without a cast avr-gcc -mmcu=attiny2313 -I. -gstabs -I ../core/ -Os -Wall -Wstrict-prototypes -std=gnu99 main.o io.o rtc.o run.o setup.o --output ledclock.elf -lm avr-objcopy -O ihex -R .eeprom ledclock.elf ledclock.hex avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \ --change-section-lma .eeprom=0 -O ihex ledclock.elf ledclock.eep avr-objcopy: --change-section-lma .eeprom=0x00000000 never used

sam wrote at 15 Dec 2009, 7.36:

Awsome projects.... dont get tired of reading your articles. A+

biosman wrote at 30 Oct 2009, 6.52:

What a kick ass ! you should become a scientist, keep up !

Leave a comment:

Your name:

What does this picture say?
Sorry, this is a captcha

Your comment:


© 2006-2013 Sprite_tm - Contact