Building the Fibonacci clock with SK6812 or WS2812 colour LEDs

Fibonacci wand

Back to start  Dutch version

The Fibonacci clock was a kick starter project of Philippe Chrétien.
What make this idea so beautiful is it simplicity, its ingenuity and the ever changing Mondriaan look alike display. Mondriaan searched and reached his ultimate simplicity in his paintings from realism to cubism and finding presenting his portraits and landscapes in primary colours and rectangles.
But a clock? Fibonacci?

fibonacci-12h Lay-out

Red+Blue = hour, (Yellow+Blue)*5 = minutes.

5 + 3 = 8 hours, 1 + 3 = 4, 4 x 5 = 20 minutes
It is 8:20

That's all that is inside.

Fibonacci was Italian mathematician and he described a number sequence. This was not just a number sequence but it appears in many biological settings, like sunflowers and shellfish. The sequence is simple. To get the next number in the sequence just add the previous ones. So: 1, 1, 2, 3, 5, 8.
If we add all the numbers in the example we get 12. Now we can present the time in hours with these number from the example.
Lets say it is 4 o'clock. That is: 1+1+2 or 1+3.
Lets say it is 8 o'clock. That is: 1+1+2+4, or 1+3+4 or 3+5 or .... and so on
What the clock does is turning on the light of the numbers to add.
For example: The 3 and 5 with the colour red to display 8 hours.
An hour is 60 minutes and that are twelve parts of 5 minutes. 
So 26 minutes = 26 / 5 is the fifth part. Five can be added up in several ways; 1+1+3 or 1+4 or 2+3 or 5. So the clock turns yellow lights on for lets say, the 2 and 3.

Now we have a problem; the three can not be red and yellow at the same time? Yes it can, we will give this a colour blue.
All the other, not used numbers, will be turned on with white light.
Confusing? That is why the clock keeps you and your visitors busy for a long time.
Fibonacci clock
Another time display:
3+2 red + 5 blue = 10 hour.
1 yellow + 5 blue = 6 * 5 = 30 minutes. The time is between 10:30 - 10:34


Of course we can use other colour themes but the Mondriaan theme is a attracting one. In the software some other palettes are available
housing
 
The casing building blocks

First make the case. In this example a case of 10 x 10 x 20 cm.
Then the light compartments and the ground plate on which the colour LEDs are glued.
The inside of the compartments should be pure white to avoid colour bleeding in the display. 

Case

 

Hardware

You can use this Fritzing design but the clock can easily be made without it

PCB V014

     
Arduino Nano    
PCB for Fibonnacci-klok

 Fritzing PCB V014
 
1 x RCT DS3231 Precision clock module ZS-042  
1 x CR 2032 3V lithium battery  
1 x Dupont-kabel F-F, 20-wires  
2 x 6-pin female socket connector  
1 x  KY-040 Keyes Rotary Encoder  
1 x light sensor  
1 x 22kΩ resistor  
1 x 1000 µF capacitor  
1 x 470Ω + 1.1kΩ + 2.2kΩ resistor  
1 x Power supply 5V DC 2 Ampere    
1 x 50 cm black-red power wire (0.14 mm2)    
1 x set schrink tube 20 cm x 1.5 mm diam + 10 cm x 5 mm diam  
12 LEDs WS2812B or SK6812  
     
Optional    
Wireless Serial 6 Pin Bluetooth RF Transceiver Module HC05 (Android, W10    
Wireless Serial 6 Pin Bluetooth RF Transceiver Module HM10 (voor Iphone, IPad)    
DCF77 DCF-2 module  

Soldering the parts

Always check the resistors with a multimeter before soldering them.
The Arduino Nano is not soldered to the PCB. Use the 15-pin sockets. It is then still possible to replace the Arduino if it becomes defective
To solder the feet parallel, it is useful to insert the Arduino loosely (do not press it all the way in) and solder the corner points first.

The longest leg of the capacitor is the +, positive terminal.
The - also indicated by the white vertical line is often printed with a - on the capacitor.

The longest leg of the LED is the +, positive pole.
The minus of the LED is connected to the triangular piece of metal in the LED.

The light-sensitive sensor (LDR) has no polarity.
Preferably mount the LDR in the edge of the cabinet.
In my clocks I drill a hole slightly diagonally horizontally through the top shelf.

The 1.1 and 2.2 kohm resistors are needed when a Bluetooth module is connected.
The resistance values ​​are indicated on the PCB.

The clock with up to 15 LEDs can be powered with the USB cable that goes into the Arduino.
It is also possible to connect 5V in various places on the PCB, which then also feeds the Arduino.
Cut an old USB cable and use an old telephone plug-in power supply as a power source.
The clock draw a maximal current of 0.15A at 5V.

The RTC time module contains a LIR2032 or CR2032 battery.
The LIR2032 is a rechargeable CR2032. If there is a CR2032 in the RTC time module, it is advisable to remove the small resistor above the text SCL on the back of the module.
This resistor can be desoldered with a soldering iron.
Cut resistor DS3231

Rotary knob
If a rotary knob is connected, connect:

D3 to DT on decoder,
D4 to SW on decoder,
D8 to CLK on decoder
and connect the + to 5V and GND to GND.

The clock can be operated with the rotary by pressing the button.
Pressing the button activates the menu.
After 60 seconds you must press again.
This prevents interference pulses from the mains from changing the time.
Once you press the button, the hours can be adjusted by turning the knob. Two pushes the minutes.
Press three times to increase the brightness. Pressing four times or more gives a choice between the various color palettes.
Default is the Mondrian color palette.

It is quite difficult to set the time with the rotary dial.
The membrane buttons or a Bluetooth connection with a mobile phone app are recommended.

 

 

4x3 membrane keypad

Voorkant fibinacciklokAchterkant Fibinacciklok


If a 4x3 keypad is used the 7 connection can be connected to pin 6 - 12 on the Nano.
If you look at the top of the keypad the wire below # is connected to pin6.

Bluetooth met de HM10 BLE voor Apple IOS en Android

With a HM10 BLE module the clock can communicate with Apple IOS and Android.

Install on your iPhone the app "BLEserial HM-10", "BLESerial Pro" or the free "BLEserial tiny" (App store).


BLEserialandroid


Serial Bluetooth Terminal  from Kai Morich works fine as terminal on Android.

Connect with "Serial Bluetooth Terminal" to start communication.
After connection with the clock time and light intensity is transmitted every 30 seconds.
With the commando: I of i a menu with possible commands is transmitted and displayed in the terminal of the app.

More info about Bluetooth here

Software

The last stable version. Source code V038

Older simple version  Source code V007

All on Github 

Used libraries

#include <Encoder.h>             // http://www.pjrc.com/teensy/td_libs_Encoder.html
#include <Wire.h>                // Default Arduino library
#include <RTClib.h>              // https://github.com/adafruit/RTClib 
#include <EEPROM.h>              // Default Arduino library To store data in EEPROM
#include <TimeLib.h>             // Arduino library Time by Michael Margolis   http://playground.arduino.cc/Code/Time/   
#include <Adafruit_NeoPixel.h>   // https://github.com/adafruit/Adafruit_NeoPixel   for LED strip WS2812 or SK6812
#include "Adafruit_Keypad.h"     // https://github.com/adafruit/Adafruit_Keypad//                       
#include <SoftwareSerial.h>      // Arduino library for HC12 or Bluetooth

Libraries in ZIP

FibonacciKlok_V007 (Als zip file)

Oudere versies

Fibonacci Versie 16. (As ZIP-file) This version works with the Arduino Nano and a Bluetooth module.
With the #defines options in the source code, like a DCF77 receiver, can be turned on or off

Light weight library to control WS2811/WS2812 based LEDS and LED Strings for 8-Bit AVR microcontrollers.

If link is broken the library from my place

Ed Nieuwenhuys,

26 november 2023

11 juli 2022, 10 mei 2022, 15 december 2019 29 april 2019, 29 October 2018