Skip to content

ednieuw/Word-Colour-Clock-SK6812-WS2812

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Character Word Colour Clock
WS2812/SK6812 for Arduino Nano Every, ATMEGA 328/1284, MKR1010

Two SK6812 clocks
This software drives the display with RGB(W) LEDs for a word clock.
When using the RGBW SK6812 LEDs the display of characters can show the whole spectrum of colours
but also pure white. With WS2812 RGB LEDs white has a shadows because it made by the combination of R, G en B.
The software makes intensive use of defines to select the several options and modules attached.
This makes the program very large. Remove the code between and #ifdef en #endif of parts you do not use.

The clock can be used for the languages Dutch, French, German and English.
For a four-languages word clock see here: https://github.com/ednieuw/FourLanguageClock

The Arduino code version Character_Clock_WS2812_Dec2020 is designed to run with the
ATMEGA328 (Uno, Nano, Mini), ATMEGA1284 chip and controls the LED strips of type WS2812.
Later versions uses more memory and are suited for SK6812 and WS2812 LED strips.

The last version is V087. This is free of compiler warnings and the code is optimized.
Copy the libraries from librariesV087.zip (separate zip file) in your libraries folder or install the necessary ones in the IDE by yourself.
With DEFINES in the source code options can be turned On and Off.
Compile and upload.
Open the serial monitor or the terminal app on your phone when you have installed a Bluetooth module
image

When a DCF77 module is attached time is adjusted to the second with a German longwave time signal.
Version V070 and higher uses two methods to receive the DCF77 time.
One method uses the DCF77 Arduino library that uses interrupts.
The other method samples over 25000 signals a second in the loop and is therefore less prone for spikes in the signal.
But ... the code may not be delayed to much by other processes.
In the source you can find methods keep delays to a minimum.
Combining both methods results in a 50% improvement of the received time.
In the source one of both methods can be selected to be used.

#define DCFMOD // Use the Arduino DCF77 library with interrupts.
#define DCFNOINT // Use the Tiny DCF algorithm in this program.

More here: https://github.com/ednieuw/DCF77_NoInterrupt
The DCF77 signal is disturbed by the colour LEDs.
Turn off the power to the LEDs during the night or place the receiver at least 10 cm away from the LEDs.
Also cheap power supplies, PC's, magnetrons and other high frequency apparatus can disturb the signal.
If the signal falls away or is erratic, turn off all electrical devices and power supplies
and find the culprit.

a better alternative since 2024 is to add an ESP32 See: https://github.com/ednieuw/ESP32SerialNTP-BLE-Clock

More about the construction of the word clock see this page in Dutch:
The page is in Dutch but can be translated with Google translate. If needed mail me for a translation.

https://ednieuw.home.xs4all.nl/Woordklok/Bouwpakket/WoordklokSK6812.htm Two SK6812 clocks

The source contains code for the following modules:

  • RTC DS3231 ZS-042 clock module
  • KY-040 Keyes Rotary Encoder
  • LDR light sensor 5528
  • Bluetooth RF Transceiver Module HC05 and HM10 BLE
  • DCF77 module DCF-2
  • LCD
  • HC12 wireless transceiver
  • 4x3 and 3x1 Keypads
  • WIFI on MKR 1010 to get NTP time NEW
  • NTP time with an ESP32 https://github.com/ednieuw/ESP32SerialNTP-BLE-Clock

For the ATMEGA1284 Load and install in IDE:
https://mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json

The HC05, HM-10 (CC254x) and nRF52 Bluetooth modules can be used to read and write information or instructions to the clock with a IOS or android mobile phone.
To use it a serial terminal app must be installed on your phone.
With a rotary encoder time and several display modes can also be selected.


Note for Character_Clock_WS2812_Dec2020 for Arduino Uno, Nano with WS2812 or SK6812 LEDs:
Program size with an Arduino UNO or Nano must stay below approx 23572 bytes when 144 LEDs are used.
Due to a Adafruit Neopixel bug the usage of memory by the LEDs is not subtracted from the avaiable memory.
With the Nano Every, Mega or chips with larger memory program size this is (still) no issue.

With an Arduino MKR1010, WIFI can be used to receive the time from a timeserver

To set the time with the rotary button:
One press on rotary: UUR is flashing -> turn to set hour.
Second press on rotary: HET IS WAS flashes --> turn to set minute the following presses are various display modes with the DIGITAL choice as second last.
Last press on rotary: many letters turns on --> turn to set intensity level of the LEDs Press again of wait for one minute to return to normal operation.
Displaymodes (Qn):
DEFAULTCOLOUR = 0; Yellow text. HET Green to Red hour IS WAS Green to Red Minute
HOURLYCOLOUR = 1; Every hour other colour text. HET Green to Red hour IS WAS Green to Red Minute
WHITECOLOR = 2; All white text
OWNCOLOUR = 3; All own colour
OWNHETISCLR = 4; All own colour. HET Green to Red hour IS WAS Green to Red Minute
WHEELCOLOR = 5; Every second another colour of rainbow
DIGITAL = 6; Digital display

PCB
PCB layout

************************************************************************************
Changes.: 0.24 Built in Clock Michelle en JoDi klok.
Changes.: 0.25 0.26 Optimised and ready for SK6812 RGBW
Changes.: 0.27 Colour changes per minute. New Function HSVtoRGB
Changes.: 0.28b 144 LED EJN_SK6821 clock with Digits in display BLUETOOTH not possible bug with Softwareserial & Adafruit_neopixel. connect BT to pin 0 & 1
Changes.: 0.29 FAB_LED library added. Doet het redelijk. Kost meer global variabel space. Serial en BT werkt ook niet met Bluetooth enabled
Changes.: 0.30 Digits in matrix.
Changes.: 0.31 Bluetooth to pin 0 and 1. Removed software serial. Added EJN to defines
Changes.: 0.32 3D array in PROGMEM to avoid memory problem with NEOpixel library.
Changes.: 0.33 Program size must stay below approx 23572, 1129 bytes with 144 LEDs. BLUETOOTH on pin 0 & 1, No software serial
Program compatible with ATMEGA 1284
Changes.: 0.34-c Added FR, DE en UK
Changes.: 0.35 Ready for testing in four languages clock.
Changes.: 0.36 Added MKR1010. #if defined(ARDUINO_SAMD_MKRWIFI1010)
Changes.: 0.37 Added webserver for MKR1010
Changes.: 0.38 ATMEGA 1280 gave problems with Bluetooth. Solved by adding Softwareserial.h at the top. Probably the double #ifdef
Changes.: 0.39 NB. Bluetooth with 1280 boards on serial port pins 0 en 1 Softwareserial.h not needed anymore
Changes.: 0.39 DCF HIGH LOW in definition, introduced shorter #define ATmega644_1284
Changes.: 0.40 Repaired 'press rotary' to set time. Moved SetSecondColour() and SetMinuteColour() occurences to DisplayTime()
Changes.: 0.41 Stores chosen display mode in EEPROM. Reset function added.
Changes.: 0.42 Changed time settings in rotary one press change hour, 2 presses change minutes, then display choices and last light intensity
Changes.: 0.43 Stable version Removed HET IF WAS turning off in display. Store Own colour in EEPROM. Cleaned up code. Software for ATMEGA 1280 25cm Klok No36 en No37
Changes.: 0.44 #define WS2812 and #define SK6812 changed to #define LED2812 #define LED6812 remove WS1812 library and uses Adafruit_NeoPixel for both LED types
Zet_Pixel() aangepast
Changes.: 0.45 Adapted for WS2812 96LEDS Massaranduba clock No7
Changes.: 0.46 Removed DCF77 library and used own DCF77decoding. Receive DCF77 after turning off display of colour LEDs at night
Changes.: 0.47 Stripped down for use with WS2812 92 LEDs clock with Arduino Nano.
Changes.: 0.48 Maintenance
Changes.: 0.49 Changed variable name error: SumMinuteSignal -->SumSecondSignal. Added "A DCF Debug" to menu
Changes.: 0.50 TinyDCF identical with improved code in DCF_HC12TransmitterV28
Changes.: 0.51 Added VERSION. Better 'installed mods' texts
Changes.: 0.52 For wordclock No38 with 144 SK6812 LEDs. HC-12 transceiver module added
Changes.: 0.53 Shortened filename. improved menu. Replaced DCF decoding. Identical with DCF77-NoIntV01.ino
Changes.: 0.54 Added every hour DCFlocked = false; Identical to DCF77-NoIntV02c
Changes.: 0.55 Stable in WS2812 96 LEDs Massaranduba clock No7. Optimized time decoding from DCF. Identical to DCF77-NoIntV03.
Changes.: 0.56 SignalFaults=0 every hour. MinutesSinceStart > 0X0FFFFFF0.

Changes.: 0.57 Changed the DebugInfo line. Changed updating time when TimeOK = 1 and 2. Introduced use of Daylight saving flag BOnehourchange.
Changes.: 0.58 Made for 144 LEDs, rotary, DCF and Bluetooth SK6812
Changes.: 0.59 Added Thhmmss in menu. Removed Secpulse and simplified Brightness calculation. Cleaned coding.
DCF77 and DCFtiny can be used seperately or together
Changes.: 0.60 Four languages clock. Werkende versie New name --> Four-language Clock_V001
Changes.: 0.61 Corrected errors in English lay-out. Added colours as text instead of HEX.
Serialcheck in Demomode() and Selftest(). Changed own color entry to Pwwrrggbb instead of Prrggbb
Changes.: 0.62 Counters for DCF Wrong times reported added. LedsOnOff added. sorage in Mem. EEPROM added
Changes.: 0.63 Removed SetMinuteColour() and CheckColourStatus() and fused them in SetSecondColour(). Optimized DCFtiny code TimeMinutesDiff <2 --> <10
Changes.: 0.64 SIX->SIXUK Added EEPROM.put in setup Added || Dday>31in pdateDCFclock
Changes.: 0.65 sizeof(menu) / sizeof(menu[0]). Added PrintLine sub routine
Changes.: 0.66 Minor changes
Changes.: 0.67 Copied ReworkInputString() from FibonacciKlok_V021. Optimised loop() Version not tested !!!!
Added KEYPADs. Changed rotary processing to combine it with the KEYPADs
Changes.: 0.68 Solved compiler warnings. Changed constrain(mem,0,250) -->= min(mem,250). Added in Reset() EEPROM.put(0,Mem);
Changes.: 0.69 Moved sprintf(sptext,"--> EdT:%ld Ed:%ld Th:%ld EdW:%ld ThW:%ld....
case 59: if(MinOK && HourOK) TimeMinutes = Dhour * 60 + Dminute; else TimeMinutes++;
if(Dminute>59) MinOK=0; Sometimes MinOK HourOK etc. parity was OK but the time was definitely wrong
Corrected error BOnehourchange and COnehourchange at BitPos 16
refined DCFNoInt with: if((millis() - DCFmsTick) >1010) break;
Removed TimeOK=5
Dsecond, ..., Dyear --> tmElements_t D time struct
Isecond, ..., Iyear --> tmElements_t I time struct V069.17
Tekstprintln() changed coding
Added two "One wire keypad" routines
Added more fault dates control in DCFNoInt
Made GetSecondsSince2000DCFNoInt() more robust when no signal is received
Main source code comparable with Four-language_Clock_V004
Added LIBSK6812 to be used instead of NEOPIXEL
Changes.: 0.70 Added self written SK6812 library EdSoft_SK6812.h
Changes: 0.71 Renamed DCFMOD -> DCFTH
Changes: 0.72 Added HT16K33tijd 4-digit display
Optimized for Arduino Nano Every
Changes: 0.73 RP2040 #if defined(ARDUINO_ARCH_RP2040).
Changes: 0.74 BluetoothSerial function identical with Fibonacciklok_V036
Changes: 0.75 Added MAXBRIGHTNESS and Mem.UpperBrightness to regulate maximum luminosity. Changed MAXBRIGHTNESS to SLOPEBRIGHTNESS
Mem.LightReducer is the slope.
Changes: 0.76 Checked and corrected DCF77 functionality
Changes: 0.77 Version fitted for 4-language clock
Changes: 0.78 Renamed SetSecondColour() in SetMinuteColour()
Changes: V079 Added Mem.Checksum in EEPROM storage. Bug resoved in void ProcessKeyPressTurn --> if (encoderPos == 0)
Changes: V080 Changing source code to be suitable for RP2040. Added DCF_counts. Added in setup() while (Serial.available()) Serial.read();
// Flush the serial input buffer. When a Bluetooth module is connected to RX/TX pin 0&1 garbage can set the time to 00:00:00
Changes: V081 Added nRF52 BLE protocol.
Added several ARCHitectures #if defined(AVR_ATmega328P) || defined(ARDUINO_ARCH_RP2040) || defined (ARDUINO_AVR_NANO_EVERY)|| defined
(ARDUINO_AVR_ATmega4809) || defined(ARDUINO_ARCH_SAMD)
Added WIFIMOD and remove MKR1010 defines
Changes: V082 Bugs in menu corrected. Deze versie compileert niet meer goed.

Changes: V083 Used for 4-language clock No1 with Nano Every and compiled with MegaCore X, ATMega4809, JTAG2UDPI
Updated menu. Added toggle On/Off LEDs