loading

how do I programme a colour changing LED clock?

Hi, 

I would like to make a clock using RGB LEDs where the colour changes once every hour (12 colours, like an analog clock's numbers) with a 3 second fade between each change. With another set of LEDs changing every minuet, again with a 3 second fade between the colours, using 60 colours around the colour spectrum to represent the minuets. 

This has to be able to work without wifi or usb, I want to be able to set the time on it with an hour button and a minuet button, and for it to work off mains voltage with one plug. 

Any ideas? 

sort by: active | newest | oldest
iceng2 years ago
-max-2 years ago

You can also just go the microcontroller method and have some sensors rigged up to the minute or second hand to keep track of time, and have a ATtiny85 programmed to count a variable up every time the minute hand makes a full revolution, then use the variable to define what colors the LEDs should be, and use the analogOut function to define the change in LED color. For each hour of the day, you will need to assign some RGB value to the LEDs, that can be done by defining the a red LED variable, blue LED variable, and green LED variable, then a lot of if/else statements. It's been awhile since I have touched an arduino, so I cant think up of the code in more detail.

chrisstevemorris (author)  -max-2 years ago

Awesome, thanks allot for the advice, theres plenty on here for me to get started with, it doesn't sound as complicated as I first thought which is good! Ill post the progress.

-max-2 years ago

Microcontroller? You don't need no stinkin microcontroller! I have drawn out a simple way to do something very similar with a RGB LED, and a modified potentiometer (a circular carbon track, where the wiper is the hour hand), and a single resistor. The color will fade smoothly and linearly through the ROYGBIV colors throughout the day as the wiper on the "pot" moves. You can make it more advanced by scraping away some of the track right under where the hours are so that the resistance in that area is lower, causing a greater voltage change over time (movement of hour hand) in that area, which will cause the LED fading to occur faster there and proportionally slower elsewhere.

2011-10-24 14.18.08.png

Neopixels are your friend. And an Arduino.

You can either use an RTC, or count cycles of the mains supply - 60 counts = 1 second.

chrisstevemorris (author)  steveastrouk2 years ago

Thanks for the advice, really helpful!

Arduino looks like a great option. Would I be able to programme it to correspond with only an RTC once plugged into the mains?

Yes, simple enough, even the RTC isn't vital, if you have a crystal on the Arduino, and use a 1Sec timer.