Introduction: Rainbow Word Clock With a Full Rainbow Effect and More

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.

Simple IR remote control

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

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

Last update 01-jun-19 version 2.0 IR remote control and code redesign

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.

About version 2.0

The memory usage was too much, with runs out of memory warnings in the compiler. That is why I have completely changed the code, but the operation has remained the same and an IR receiver has been added.

There is a piece of code to provide the EEPROM with data.
Run this once by temporarily removing the / * and * /. Search for => run this once to provide the EEPROM with data

At the beginning of the void loop is code to read the code from your own remote control.
You can run this by temporarily removing the / * and * /, don't forget to put them back afterwards. You can also define your own buttons. The code read must be entered in => Define your own buttons here

The Samsung remote control works better than the (very cheap) simple.

Step 7: The Hardware Description

There are different versions of the Arduino Pro Mini. Please note, the connections may differ.

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.

In version 2.0 the DCF77 receiver is supplied with power via pin 13. This pin is defined as output and set high when the DCF77 routine is addressed. The DCF77 receiver uses 0.28 mA and is only needed for a few minutes per day.

Switching off saves

5 Volts * 0.28 mA / 1000 * 24 hours * 365 days * 1 / 0.85 efficiency power supply = 14.4 watts a year.

This doesn't seem like much, but every bit helps.

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 25 times.

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

In version 2.0 you can set the control via the remote control.
The following parameters have been added: Brightness_min as minimum and Brightness_max as maximum setting and Brightness_Offset as setting parameter. Brightness_min and _max are the values that can depend on your own situation. Brightness_Offset is a value that can be set with the remote control and with which more or less brightness can be set.

There is also a dead band of 3 between measured LDRValue and calculated BerLDRValue values.

Use the print statements in the void BrightnessControl to check the brightness setting.

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 169 mA to the neopixels. Assuming that the clock is off 12 hours a day, total shutdown then saves: 5 (Volt power supply) * 169/1000 (Miliampere / 1000 = Ampere) * 12 (Number of hours per day) * 365 (Number of days in a year) = 3701 Watt hours. So on an annual basis 3.7 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 ohm 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 (adjustable) is a measure of the appearance of the Smiley. The % signs indicate that motion has been detected. With every tenth (adjustable) 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

Ken Shirriff's IRremote Library https://github.com/z3t0/Arduino-IRremote/archive/...

Because there is always confusion about the library used, I add the one I use.

The IRremote library uses a lot of memory.
In the IRremote.h it is indicated that you can disable any unused protocol

// Each protocol you include costs memory and, during decode, costs time
// Disable (set to 0) all the protocols you do not need/want!

I have everything disabled except the NEC and Samsung protocol. This gives a memory saving of 10%. At the moment there is no longer a problem with the amount of memory, so for the time being the disableling is not necessary.

Step 12: Simple IR Remote Control

The assembly.

As you can see in the photos, the hole for LED 132 has turned out to be a little too large. I made good use of this and added the IR receiver to it. Connect the data pin of the IR receiver VS1838 to pin 7 of the Arduino. Furthermore connect the plus and minus power supply. The IR receiver uses 0.21 mA and could also be connected to the plus power supply after the FET switch. This results in a saving, if the clock is on 50% of the time, of 5 Volts * 0.21 mA / 1000 * 12 hours * 365 days * 1 / 0.85 efficiency power supply = 5.4 watts per year. This doesn't seem like much, but every bit helps.

Operation is as follows.

Press any key on the IR remote control and then the OK key. The first time you press, you will end up in the IR processing and the second time you will detect whether it was a justified request. The second time OK must follow quickly the first key press because otherwise it goes back again. I made this construction so that I hardly got the first code correctly decoded and therefore did not end up in the IR handling.

Once in the IR handling then a number of LEDs go on for info, for explanation read further and view the first image.

The description is for the simple remote control but you can use any remote control and define your own keys. I also used a Samsung remote control.

The first four keys correspond to the top four rows of LEDs.
Four LEDs turn left or right depending on the setting. When the keys 1 to 4 are pressed, the state is reversed and stored in the memory.

1 fixed color or rainbow effect

2 second flash off or second flash on

3 smiley off smiley on

4 DCF77 off or DCF77 on

The number of the key is displayed on the following keys

5 smiley counter

6 rainbow spectrum width

7 fix red setting

8 fix green setting

9 fix blue setting

Row 6, 7 and 8 of the LEDs now correspond to the set value, row 6 indicates the units, row 7 the tens and row 8 the hundred. Each row starts with the value zero. So the first led in the row is 0 the second is 1 etc.

0 time setting

/\ brightness setting

When the 0 button is pressed, the "ten" LEDs light up to indicate that you want to set the time and when you press 0 a second time, the set time appears on the display.

The time can now be set and is shown in the display.

Set the correct time and then if the minute is the same on a reference clock, press the OK button.

The time is adjusted.

If you do not operate the minutes or hours button, no time change will be made. If you do press them, the time will be set immediately.

The value for keys 5 to 9 can be changed with the keys

right is plus 1

left is minus 1

forward is plus 10

reverse is minus 10.

and for the time setting

right is plus 1 minute

left is minus 1 minute

forward is plus 1 hour

reverse is minus 1 hour

It sometimes happens that the keypress is not recognized or is carried out twice. So pay attention if the setting goes well otherwise try or correct again. The Samsung remote control which I also tested worked many times better than the (very cheap) simple remote control.

When setting the color you see the change directly on the entire display.
For a site with an overview of colors see http://www.helderester.nl/kleurentabel.html. You can of course set any value.

If rainbow spectrum width has a value of 0 the spectrum is very narrow and the display has one color that changes constantly.

The disadvantage of setting the time in this way is that you cannot calculate a summer / winter transition because we have the date incorrect. It doesn't matter for the clock itself because we don't use it now.

Step 13: What Nexts ?

What follows, sound, if the free memory is still sufficient.

I already have the loudspeaker boxes. They are from an old laptop.

LED Contest 2017

Participated in the
LED Contest 2017