Rainbow Word Clock With a Full Rainbow Effect and More

7,251

75

50

Goals

1) Simple

2) Not expensive

3) As energy efficient as possible

Rainbow Word Clock with a full rainbow effect.

A Smiley on the Word Clock.

Update 03-nov-18 LDR for the Brightness Control of the Neopixels

Update 01-jan-19 Reducing WS2812B power consumption.

Update 15-jan-19 Smiley.

Update 23-jan-19 Code 1.6

Update 10-mar-19 Libraries links

Last update 14-apr-19 version 1.7 Choice smiley on/off collor rainbow/fix enz.

Supplies:

Step 1: The Case for the Clock

With some simple tools and a bit of skill, it's not hard to make a letter clock
I used the materials availible to me.

For the case I used a rough pine bar in which I sawed a few frames. These would make the four sides of the case, which were glued together and reinforced with a small piece of wood in the corners. Then the wood needs sanding and painting.

The letters are cut out of foil by a printer in mirror writing. The foil is at the back of the glass plate and is covered with a double layer pattern paper for better light distribution. The glass is fixated by silicone sealant.

Step 2: Neopixels

The Neopixels LEDs are arranged on a wooden plate.
In this you first drill 3 mm holes. At the front they are enlarged to letter size to 3/4 depth. After that the 3 mm at the back is increased to 10 mm, this is the size of a Neopixel. For some characters among others the W, the hole should be slightly adjusted.

I used plywood which quickly splintered, MDF may be better.

With individual LEDs you are not bound to a fixed distance, which is the case with LED strips.
The LEDs must be connected to each other. You can do this with all short pieces of wire. But the two min (-) connections are just like the two plus (+) connections internally connected, so the same connection.

You can save yourself a lot of work by soldering a piece of wire to the left LED and then to the right LED. Then solder the intermediate ones.

The data connection must of course with short pieces because the data-out goes to data-in.

Step 3: Adjusting Front Text

The front plate is now in Dutch, but simply to convert in any language.

The NeoPixels leds are switched in succession here from 0-167. The numbering goes from the first row at the top left to the right and then to the second row right-to-left etc. Adjusting can be done according to your own needs. The number of NeoPixels is determined by the amount of characters. Less or more Neopixels can be adjusted in the following line

#define NUMPIXELS 168 // How many NeoPixels are attached to the Arduino?

168 is than another number. Numbering starts at 0. You can make any text. If you change the text then you will also have to adjust the corresponding words. The numbering remains the same.

As an example, DRIE of the minutes, is determined in the code

void zetmDrie () {

Led_Aan[56]=1, Led_Aan[57]=1, Led_Aan[58]=1, Led_Aan[59]=1 ; // min-drie

}

If you want to make the word Arduino then it goes like this:

void zetArduino () {

Led_Aan [38] = 1, Led_Aan [50] = 1, Led_Aan [56] = 1, Led_Aan [93] = 1;

Led_Aan [120] = 1, Led_Aan [135] = 1, Led_Aan [147] = 1; //Word-arduino

}

So you can make words between.

For clock words it is useful if they form a contiguous word but it is not absolutely necessary. The unused letters do not need Neonpixels. I have them all filled for the use of future possibilities other than time being displayed.

If you change the starting point or change the succession sequence the numbering should change accordingly.

Step 4: Full Rainbow Effect

The clock is now so programmed that there number of times per second is counted how many neopixsels there are switched on.

The total spectrum is about the number of divided and then slightly shifted. As a result, each Neopixel a different color which changes continuously. Neopixel nr 1 and nr 167 follow each other on some color involves.

If you prefer less different colors at the same time, this is easy to adjust. The color shifts still over the entire spectrum but with a smaller part of it. Neopixel nr 1 and nr 167 no longer follow on each other some color involves.

The brightness can be set in the following line,

pixels.setBrightness(150);

A smaller number is less and a larger number more brightness.

Step 5: The Various Components

The following components I used

Arduino Pro Mini ATMEGA328 5V/16MHz

Clock Module DS3231

168 pieces Neopixels led's WS2812 LED Chip & Heatsink 5V 5050 RGB WS2811 IC Built-in

Foil letter stencil

DCF77 receiver

Step 6: Code for the Clock

Here is the code.
Added a brightness control and power off when no one is present and at night.

Added RCWL-0516 Radar Microwave Motion Sensor ( search for RADAR )

After 10 minutes of no movement, the NeoPixels go out.

Step 7: The Hardware Description

Added a RCWL-0516 Microwave Motion Sensor.

As long as there is movement in the vicinity of the clock, the NeoPixel remain on

and as soon as there is no more movement the NeoPixel go off after a few minutes.

Step 8: LDR for the Brightness Control of the Neopixels

Added an LDR for the brightness control of the neopixels.


I have glued the LDR into the space of neopixel 103. This one is not used in the time display and therefore does not influence the regulation. The paper damps the incident light, but that is no problem.

The voltage divider of LDR and 20 kohm resistor goes to A0 of the Arduino Pro Mini. The voltage is an indicator of the light intensity and therefore also an indicator of the amount of light that the neopixels have to give.

The formula that I use gives me good light control, it can be adjusted depending on the circumstances. Depending on the light quantity, the voltage can vary between 0 and 5 volts which is converted to 0 to 1024 counts which are in "LDRValue".

If the new measured value is greater than the last calculated value, the intensity is increased by 1, if it is lower than decremented by 1 and if it is equal nothing is done. In order to make the value proceed slowly, so that there is no blinking effect, only 1 is increased or decreased and because the calculation is in the loop it is only recalculated after traversing the loop 5 times.

The intensity is theoretically a minimum of 25 and a maximum of 1024/7 + 25 = 171. The maximum value that I measured was 902, which amounts to an intensity of 153. This fits well with the 150 that I have set as default value. ( see pixels.setBrightness(150) )

Step 9: Reducing WS2812B Power Consumption.

The drivers on WS2812B addressable neopixels are drawing current even when the neopixels are off, set to color 0 (no neopixels elements lit).

When all 169 neopixels are out, I measure 69 mA to the neopixels. Assuming that the clock is off 12 hours a day, total shutdown then saves: 5 (Volt power supply) * 69/1000 (Miliampere / 1000 = Ampere) * 12 (Number of hours per day) * 365 (Number of days in a year) = 1511 Watt hours. So on an annual basis 1.5 Kwh. I agree, it's not much in itself, but many small ones make a big one.

The circuit is simple.
The plus of the power supply is switched by a P-channel MosFet. The radar sensor determines whether the neopixels are on or off. I have put two MosFet parrelel to keep the ON resistance as low as possible due to loss of the MosFets. In normal use I measure 4,5 mili volts over the MosFets. The gate is controlled by output 4 from the Arduino via a 470 Kohm resistor. If the output goes to low (0) digitally, the neopixels are on and at a high (1) they are off.

Step 10: Smiley on the Word Clock

A Smiley on the Word Clock.

There appears occasionally a Smiley on the clock.
That makes you happy, however.

The Smiley is triggered by the radar sensor.

The number of times movement is a measure of the appearance of the Smiley.
The % signs indicate that motion has been detected.

With every seventh movement, the Smiley comes up with a Winky Face and after three times
a Winky Face comes the fourth time a Smiley Face sticking tongue out.

The Smiley is a small change in the code.

Step 11: Which Libraries Are Used.

Which Libraries are used.

I use them in Windows 7 with Arduino IDE 1.6 and they have also been tested in Windows 10 with Adruino IDE 1.8.8

RTClib-master https://github.com/adafruit/RTClib/archive/master....

Arduino-DS3231-master https://github.com/jarzebski/Arduino-DS3231

Adafruit_NeoPixel-master https://github.com/adafruit/Adafruit_NeoPixel

Arduino-DCF77-master https://github.com/thijse/Arduino-DCF77

Instructebles heeft problemen met deze

Share

    Recommendations

    • Classroom Science Contest

      Classroom Science Contest
    • IoT Challenge

      IoT Challenge
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest

    50 Discussions

    0
    None
    Andrév106

    2 months ago

    Hallo Jan,Nee nog niet alles is nieuw dus steile leercurve.

    In de bijlage wat foto's waar ik mee bezig ben. Moet nog 3 rijen ledjes solderen. Zoals je kunt zien heb ik bijna jou voorplaat gebruikt, ik heb het alleen laten lasersnijden.

    Bedankt voor de backup,
    André

    20190315_164641.jpg20190315_164654.jpg20190315_164708.jpg20190315_164754.jpg20190318_154524.jpg20190318_200456.jpg
    12 replies
    0
    None
    Jan5412Andrév106

    Reply 2 months ago

    Andre,


    Dat ziet er prima uit, wordt beslist een mooie klok.

    Mvg Jan.

    0
    None
    Andrév106Jan5412

    Reply 6 weeks ago

    Ha die Jan,

    Heb je toevallig de code zonder de smiley nog? En kun je me richting geven hoe ik de kleuren wit krijg i.p.v. rainbow?

    Thnx,

    André

    0
    None
    Jan5412Andrév106

    Reply 6 weeks ago

    Andre,

    Ik heb de code aangepast zodat je een en ander zelf kunt instellen.
    I have adjusted the code so that you can set things up yourself.


    Mvg Jan

    0
    None
    Andrév106Jan5412

    Reply 5 weeks ago

    Hey Jan,

    Ik ben er mee aan het experimenteren geweest, een aantal dingen zijn geslaagd. Smiley is uit, ik heb de code aangepast voor 1 kleur dus rainbow doet het niet meer. Het is echter zo dat ik geen andere kleur kan kiezen ook al verander ik de RGB codes.

    Ook is het zo dat de ledjes meeknipperen met de seconde led, ik heb maar 1 led an de rest knippert dan mee.

    Wanneer ik hem op een externe voeding aansluit heb ik heel veel storing en flikkeren de ledjes.

    Wanneer ik een andere scene laad, met bv veel verschillende animaties dan werkt alles naar behoren.

    Alvast dank voor je hulp,

    Andre

    0
    None
    Jan5412Andrév106

    Reply 4 weeks ago

    Andre,

    Stuur me de code per mail dan kijk ik ernaar.
    Mvg, Jan

    0
    None
    Jan5412Jan5412

    Reply 25 days ago

    Andre,
    Heb je de kleuren aan het werken?

    De lichtvariatie met de seconde knipper zie ik inderdaad ook en zeker bij lage helderheid.
    Bij rainbow effect valt het niet zo op omdat daar de kleur toch iedere seconde iets veranderd.
    Wordt veroorzaakt doordat de helderheids regeling constant iets verspringt.
    Opgelost door in de code + 3 en - 3 toe te voegen en xy < 25 waardoor er niet meer gereageerd wordt op een kleine variatie en iets minder snel.
    De regeling wordt trager maar dat is geen probleem.
    Je kunt het testen door in je code de regel BerLDRValue = 40; te zetten, zodat er altijd een vaste waarde 40 is.

    Lichtflitsen bij aansluiten op externe voeding heeft te maken met hoe je de voedings draden van de UNO en de Neopixels aan elkaar knoopt en de condensator vandaar de vraag.

    Mvg Jan.

    //--------------------------------------------
    // *** begin void BrightnessControl ***
    //--------------------------------------------
    void BrightnessControl() {
    LDRValue = analogRead(LDRpin); // read the value from the LDR
    // calculate the value for the light setting
    LDRValue = (( LDRValue / 7 ) + 25 ) ;
    if ( xy < 25 ) { xy = xy + 1;
    }
    else if ( LDRValue > BerLDRValue+3 ) { BerLDRValue = BerLDRValue + 1 ;
    xy = 0;
    }
    else if ( LDRValue < BerLDRValue-3 ) { BerLDRValue = BerLDRValue - 1 ;
    xy = 0;
    }
    else { // nothing to do
    xy = 0;
    }
    /*
    Serial.print(LDRValue); // print the value to the serial port
    Serial.print(" ");
    Serial.print("LRDValue");
    Serial.print(" ");
    Serial.print(BerLDRValue); // print the value to the serial port
    Serial.print(" ");
    Serial.println("BerLDRValue");
    */
    // BerLDRValue = 40;
    }
    //--------------------------------------------
    // *** einde void BrightnessControl ***
    //--------------------------------------------

    0
    None
    Andrév106Jan5412

    Reply 5 days ago

    Hey Jan,

    Wat een fantastische ondersteuning bied je, de aanpassing van de code heeft gewerkt, geen knipperende led's meer behalve de seconde LED.

    Ben langzamerhand steeds verder richting het gewenste eind resultaat, op dit moment krijg ik de DCF77 module nog niet werkend. De mosfet en de radar moet ik nog installeren en de ldr moet ik nog testen.

    Ik krijg wel in blauw funk te zien maar dan wordt ie rood en krijg dus geen signaal.

    Bedankt voor de moeite hoor,

    André

    0
    None
    Jan5412Andrév106

    Reply 5 days ago

    André

    Versie 2.0 komt er spoedig aan. Deze is met geoptimaliseerde code en IR afstandsbediening zodat je alles extern kunt instellen.

    Version 2.0 is coming soon. This is with optimized code and IR remote control so that you can set everything externally.

    Mvg Jan

    0
    None
    Andrév106Jan5412

    Reply 4 days ago

    Hey Jan,

    Wat is de waarde van jou pull up weerstand voor de DCF klok? Ik krijg hem nog niet aan de praat.

    Thnx,

    André

    0
    None
    Jan5412Andrév106

    Reply 4 days ago

    André

    Ik weet niet welke DCF module je hebt maar de weerstand waarde lijk me niet direct het probleem. Ik heb aansluitingen gezien met 10K ohm maar ook wat ik heb
    gedaan zonder weerstand.

    Zelf heb ik een RPC module DCF77. Dat is een oude ontvanger voor een computer op de seriële poort welke hoogohmig is.

    De oplossing moet je meer zoeken in de ontvangst,
    wat zie je in de seriële monitor?

    Probeer eens dichter bij een raam voor beter ontvangst en/of de module zelf verder van de klok af zetten door er één meter draad tussen te zetten.

    Er zijn ook modules die een geïnverteerd signaal leveren, maar dat zou in de DCF77 library opgelost zijn. Hier heb ik geen ervaring mee.

    Verder zou je eens op de site van Thijs http://thijs.elenbaas.net/2012/04/arduino-dcf77-radio-clock-receiver-library/
    moeten kijken, hier staat het goed beschreven wat je moet zien in de seriële monitor.
    Je kunt de test software downloaden naar je Arduino, hiervoor hoef je niets los te halen.

    Verder een link met een inverter probleem oplossing https://ednieuw.home.xs4all.nl/Woordklok/DCF77/DCF77_Arduino.html
    en een met een signaal aanpassing http://www.hjberndt.de/soft/rtctftdcf.html

    Maar de ontvangst conditie lijkt me het grootste probleem.

    Geef eens aan wat je klok moet doen buiten alleen de tijd aangeven, mogelijk kan ik je idee overnemen, sta open voor suggesties voor mijn
    andere klok project.
    https://www.instructables.com/id/Word-Clock-With-Rainbow-Effect-and-Background-Ligh/

    Succes Jan


    André

    I do not know which DCF module you have but the resistance value does not seem to me to be the problem. I have seen connections with 10K ohm but also what I have done without resistance.

    I myself have an RPC module DCF77. That is an old receiver for a computer on the serial port which is highly resistive.

    You have to look for the solution more in the reception,
    what do you see in the serial monitor?

    Try closer to a window for better reception and / or to move the module itself further away from the clock by putting one meter of wire between them.

    There are also modules that provide an inverted signal, but that would have been resolved in the DCF77 library. I have no experience with this.

    Furthermore you should take a look at the site of Thijs http://thijs.elenbaas.net/2012/04/arduino-dcf77-radio-clock-receiver-library/
    here it is well described what you should see in the serial monitor.
    You can download the test software to your Arduino, you do not have to disconnect anything.

    Furthermore, a link with an inverter problem solution https://ednieuw.home.xs4all.nl/Woordklok/DCF77/DCF77_Arduino.html
    and one with a signal adjustment http://www.hjberndt.de/soft/rtctftdcf.html

    But the reception condition seems to me to be the biggest problem.

    Specify what you need to do outside of the clock, just indicate the time, possibly I can take over your idea, be open to suggestions for my other clock project
    https://www.instructables.com/id/Word-Clock-With-Rainbow-Effect-and-Background-Ligh/

    Good luck Jan

    0
    None
    Andrév106Jan5412

    Reply 2 days ago

    Goedemorgen Jan,

    Bedankt voor al deze waardevolle tips, ik zal er eens mee aan de slag gaan en je laten weten wat de vorderingen zijn.

    Grt,

    André

    0
    None
    Andrév106Jan5412

    Reply 5 days ago

    Hey Jan,

    Klinkt goed kerel, ik heb de komende weken wat meer tijd en zal eerst de DCF in gebruik nemen en dan me op de rest concentreren. Maar het klinkt goed al die vernieuwingen, maak je het wel modulair dat het ook uitgeschakeld kan worden?

    Thnx,

    André

    0
    None
    WisonC

    Question 9 days ago

    Hi Jan,
    Can you add button for setting Fix color, rainbow, Hours,minutes, Thanks.

    6 answers
    0
    None
    Jan5412WisonC

    Answer 8 days ago

    Hello WisonC,

    Do you have the clock working?

    I'm working on a simple IR remote control.
    This is almost finished. So buttons are not necessary.

    As long as you still have to adjust it in the code.

    I have a DCF module so the time is adjusted automatically.
    What do you want for what concerned the time actually set,
    correction with sec, minutes, summer / winter transition or total date and time.
    I have the same kind of question from someone else.
    Let me know and I will look at it if I have the time.
    Sincerely,
    Jan

    0
    None
    WisonCJan5412

    Reply 8 days ago

    Do you have the clock working?
    not finish yet
    I have a DCF module so the time is adjusted automatically.
    my country no signal for DCF, I want make for my boss (Birthday gift) if time not correct in the future, she can adjust by herself

    0
    None
    Jan5412WisonC

    Reply 8 days ago

    The DS3231 module is very accurate and could have a deviation of a few seconds per month.
    When I have the IR remote control ready I will see if I can make an option that you can set the time a few seconds forward or backward.
    You can of course extract the entire DCF part from the code.
    If you still have problems getting the clock to work, let me know and maybe I can help you further.
    Mvg Jan

    0
    None
    WisonCJan5412

    Reply 6 days ago

    hi Jan, i don't worry about deviation of a few seconds per month. I worry about battery DS3231, if in the few year later, battery DS3231 is dead, user can change battery and adjust times min/hrs by them self. i hope you to make this function
    Thank you for your support.

    0
    None
    Jan5412WisonC

    Reply 5 days ago

    WisonC

    Version 2.0 is coming soon. This is with optimized code and IR remote control so that you can set everything externally, including the time.

    The battery will last around 10 years.
    Use a CR2032 battery instead of a rechargeable LIR2023 and
    remove the charging circuit for your own safety.

    Mvg Jan