Introduction: Fibonacci Clock Modified

Picture of Fibonacci Clock Modified

Introduction

It is for so long now I have absorbed so much information from the web, especially learnt so much from the Arduino projects on this site it has got time to do something in return. I hope you can enjoy it, build it, learn from it.

When I saw the description of the Fibonacci Clock at Instructables by Philippe Chrétien I had to order and build one myself. See here:

https://www.instructables.com/id/The-Fibonacci-Cloc...

and

https://www.instructables.com/id/The-Fibonacci-Cloc...

What a great idea to design a clock like this! Fantastic!

Philippe has published every detail and encourages to hack the clock to your own requirements. And that is what I did. The result is the following description of my clock. I added a new Fritzing schematics without taking care of how it looks like on the breadboard tab because the schematics sheet is the base I work with.

Sorry for the first few pictures but I hope you get the idea.

Step 1: Modifications Description

Accurate clock

Because I hate clocks that are not running on time I wanted to be able to synchronize the clock with my DCF77 wall clock up to the full minute. While setting the time this requires a display not only of the hours but also of the minutes (5 minutes increment) as well as the four minutes in between.

BTW, because my RTC is loosing 6 seconds a day I think am going to replace the DS1307 by a DS3231. The DS3231 is far more accurate. Still to be implemented.

Hourly chime

A nice feature is an hourly chime using a piezo buzzer. So for the last five seconds before the full hour a beep will sound every second and on the hour a longer beep with a higher pitch. To controll the volume of the buzzer I included a potentiometer in the buzzer circuit. The chime can be shut off automatically during the night.

Automatic brightness controll

To controll the brightness I added an LDR so the ambient lightlevel is measured and the brightness of the display is set accordingly: high brightness level in a very bright environment and a low level in the dark.


Minute display LEDs

Because I would like to see something happening on the clock every minute I also wanted to see the four minutes (0 – 4) between the 5 minute resolution of the original clock. I came up with 5 extra 3mm clear leds that are mounted at the right side of the 5 value square of the clock.

There are 4 green leds and at the top there is an orange led with two possible functions. So for every minute in the range of 0 – 4 there are an increasing number of leds lit.

The orange led can be set as AM/PM indicator but as an alternative it can be set to be lit for the last five seconds as an indicator that that a new 5 minute count is imminent.

Brightness controll for the 5 LEDs

To be able to controll the brightness of the 5 leds as well I added a transistor in the common cathode lead of all leds. This transistor is controlled via a PWM port of the Arduino so all leds are controlled by just one output port.

Setting the parameters

The five LEDs are also used during the setup of the clock showing the value of a parameter as a binary value. Five LEDs can show values between 0 – 31.

Loading/Saving the parameters to EEPROM

I have used the EEPROMex library written by Thijs Elenbaas. This enables one to keep all parameters in a struct and load/save it in one go from/to EEPROM.

When the settings are not loaded correctly (maybe not in EEPROM yet) the default settings are used. See the serial monitor for relevant messages. You can save the settings by selecting parameter number 22 during setup mode (see below).


Alarm

I have implemented an alarm as well. The hardware is available for it: we will use the buzzer. It is just a matter of adding some code in the sketch.

MP3 player to play the chimes

To be implemented yet.

I have ordered some MP3 player boards which can be triggered to play an MP3 file by pulling a pin low (to GND). It even comes with a small spreaker. For details see Brett Olivers description at:

http://home.btconnect.com/brettoliver1/Regulator_...

or Google for: JQ6500-28P or JQ6500-16P

Step 2: Hardware Modifications

For all this to work a few modifications and extra components are required on the original PWA. Another option is to build a new PWA with all mods and connectors. I used/modified the original board because I did not want to put it aside and have it gather dust for ever.

So here is a list of the modifications on the original PWA:

- For the five leds: add five resistors and a universal transistor with a resistor in the base lead, plus a female connector for all wires to the leds.

- For the buzzer and LDR assy: add a resistor for the transistor at the buzzer and a connector.

- Cut a few traces to rewire a few Arduino ports because PWM had impact on a few digital ports.

Note: maybe the cutting/rewiring is not necessary anymore because at first I used all PWM outputs of the Arduino to dim the leds; later I implemented the transistor plus resistor and used only one PWM port. I have to check!

Step 3: External Components

LDR/buzzer assy

For the LDR, the buzzer + transistor + potmeter, I cut a small experiment board to solder the parts and the wires with connector on it.

For the LDR drill a hole at the top right back corner of the case 15mm from the right and 15mm from the back. For the buzzer dril a hole in the top left corner of the back panel (as viewed from the back of the clock) 15mm from the left and 12mm from the top of the panel. Push the buzzer in the hole from the back and hot glue the buzzer/ldr assy to the back of the panel.


Minute LEDs

For the five leds you will need 5 clear 3mm leds: 4x green and 1x orange.

I drilled 5 holes of 3mm diameter (and 7 mm at the back so the leds can be pushed a bit more to the front) in the plexiglass front. The bottom led is 35mm from the bottom side and 25mm from the right side of the front plate, and led to led spacing is 15mm. The leds are glued to the front plate with clear hobby glue.

Then I wired all the leds: five anode wires and one common cathode wire to a connector. Note: use very thin wires so the light is not blocked or at least as little as possible.


LED string mod

I had to modify the first led of the led string of the value 5 leds because it was interfering with the PWA. For this I had to cut the plastic just passed the soldering pads on the little pcb in the led. Now I was able to (or I had to) solder new wires. Note that there is an input side (with the arrow on the pcb) and an output side (with the little chip). The input side is connected to the value 3 leds and the output side is connected to the other three value 5 leds.

Step 4: Firmware/software (sketch) Modifications

Buttons library, Metro library and FSM

To be able to use the four buttons in a more flexible way and to implement a brightness controll I had to remove all blocking code in the original sketch and used the Buttons library written by JChristensen

https://github.com/Jchristensen/Button

and the Metro library by Thomas Fredericks

https://github.com/thomasfredericks/Metro-Arduino...

for the timers.

I implemented a FSM (finite state machine). FSM means that the clock can be in various states: the RUNNING, TO_SELECT, SELECT (an intermediate state) states, and finally the SETTINGS state.

To get from the RUNNING state into the SETTINGS state the user must press and hold the white button for two seconds (a long press).

In the SELECT state the user has to select a parameter to change by pressing the UP (black) button and the DOWN (green) button and then press the SELECT/DONE (red) button when this is the correct parameter.

In the SETTINGS state the user modifies the value of the parameter by again using the UP/DOWN buttons.

When done the user presses the SELECT/DONE (red) button again to confirm the setting and return to the RUNNING state.

Value display on the LEDs

To be able to see which parameter to change and the value of the parameter the LEDs are used as a binary display. The led at the bottom is the least significant bit (LSB) and the top (orange) led is the most significant bit (MSB). So we can display a value from 0 to 31.

Setting the clock

Setting the time we will use a different method displaying the values.

When setting the hour and the minutes (with 5 minute increments) the value is displayed on the Fibonacci display: red squares when setting the hour and green squares when setting the minutes.

The color pattern for every digit is fixed so the user can get used to the pattern when setting the time.

The orange led at the top is now used as AM/PM indicator.

The 0–4 minutes not shown on the Fibonacci display are shown on the four green leds and can be set as well. The greater the value the more leds are lit (like an analog thermometer) as is shown in clock mode.

Setting the parameters

Setting the parameters starts by a long press of the SETTINGS (white) button. The green leds are starting to flash fast with the last parameter number that was used.

By pressing the UP (black) or DOWN (green) buttons the parameter number can be changed. After pressing the SELECT (red) button you can change the value of the parameter. The leds are now flashing slow.

Parameter listing

Which parameter number to select for a parameter to change its value is shown in the list below.

  1. Hours The current hour is shown on the Fibonacci display using the redcolour, also the top orange led is used as AM/PM indicator.
  2. Minutes The current minutes (as multiple of 5) is shown on the Fibonacci display using the green color.
  3. Minutes<5 The 4 minutes in between are shown on the green leds.
  4. Full minute sync Synchronise the clock with an external clock at the moment the second hand shows zero seconds. If seconds >= 30 then the minutes are automatically incremented and the seconds will be reset to zero. Note: you can also press the DOWN (green) button when the clock is running. See description below.
  5. Alarm 1=alarm_off, 2=alarm_on Note: when the alarm sounds you can turn it off by pressing the UP (black) button.
  6. Alarm hours Set the hour for the alarm, 0 - 23
  7. Alarm minutes Set the minutes for the alarm, 0 – 11 (multiples of 5 minutes)
  8. AM/PM The orange minute led is used as:

    1 = 5th minute indicator for 5 seconds, 2 = AM/PM indicator

  9. Mode Set the mode of the unit: 1=CLOCK, 2=RAINBOW, 3=LAVA

  10. Interval Set the speed for the color changes in the Rainbow/Lava modes. Values: 0 –-> 31 (translates to 16 – 512).

  11. Palette Set the palette used in CLOCK mode. 1 = the default: RED for the hours, GREEN for the minutes, BLUE for both hours and minutes, YELLOW for none.

  12. Chime 1=chime_off, 2=chime_on

  13. Chime start The starting hour the chime is active (0 - 23).

  14. Chime end The last hour the chime is active (0 – 23).

  15. LDR min The minimum level measured. Values: 0 --> 31. (translates to 32 – 1023).

  16. LDR max The maximum level that is measured. Values: 0 --> 31 (translates to 32 – 1023).

  17. Display 1=display_off, 2=display_on

  18. Display min The minimum brightness level for the display. Values: 0 --> 31 (translates to 8 - 255).

  19. Display max The maximum brightness level for the display. Values: 0 --> 31 (translates to 8 - 255).

  20. Minute LEDs min The minimum brightness level for the minute LEDs (0-31, translates to 8 - 255).

  21. Minute LEDs max The maximum brightness level for the minute LEDs (0-31, translates to 8 - 255).

  22. Save settings After changing one or more settings you have to save the settings to EEPROM so after a power up the settings are restored.

  23. Print parameters Print all parameters on the serial monitor.

Power On Diagnostics

When you press the UP (black) button during the boot sequence - keep pressed until the beep sounds - the clock will show several tests:

  • minute leds show an increasing minute count
  • low/high brightness of the minute leds
  • display shows all colors (Red, Green, Blue) plus all combinations of two colors and the white color.
  • low/high brightness of the displayed
  • hour (red) count 1-12
  • minute (green) count 1-12 (or 5, 10, ...60)
  • both hour and minute count 1-12 will show in blue


Full minute sync

You can use this feature to synchronize the clock conveniently when the clock is gaining max 29 seconds or is maximum 30 seconds slow. Otherwise you need to set the time as described above.

When the time is displayed and you want the RTC to synchronize with an external accurate clock you can press/release the DOWN (green) button at the moment the external clock shows a full minute (seconds hand is at 12).

When the seconds count of the RTC is greater or equal than 30 seconds then the minute count is incremented by one and the seconds are reset to zero.

Note: "Setting" parameter number 4 will have the same result: first select the parameter number 4 and then press SELECT/DONE at the full minute of the external clock. You can cancel this procedure by pressing the UP or DOWN button.

Step 5: Summary of Operation

Power up diagnostics (demo)

To run diagnostics after a power-off / power-on cycle press and hold the UP (black) button until the buzzer sounds.

When the clock is running you have the following options.

  1. UP (black) button - Turn off the alarm.
  2. DOWN (green) button - Full minute synch
  3. Long press SETTINGS (white) button. - Enter the settings mode.

To save the settings you just have changed to EEPROM in step 3 you have to select parameter 22 in step 3 then press SELECT/DONE to save the settings. To cancel the save settings just press the UP or DOWN button.

Settings overview

You can print the relevant page (8) in the attached document and cut the framed text and glue it on the back panel of the clock.

Files

This update to version 2 consists of the following files:

  • FibonacciClockV2Manual.odt this document in LibreOffice odt format
  • FibonacciClockV2Manual.pdf the PDF version of this document
  • FiboClock2.fzz Fritzing project containing the schematics page
  • FiboClock2_schema.pdf the export to PDF of the schematics page
  • FibonacciClock.ino the version 2 sketch
  • Metro.h and Metro.cpp modified (by me, I think) Metro library
  • Button library possibly modified as well, I am not sure, I renamed it because there are more libraries out there named Button.

All other libraries (RTClib, Adafruit_NeoPixel, EEPROMex) should be downloaded from their respective webpages, also described here and in the original Fibonacci article.

Step 6: Pictures - PWA Modifications

Picture of Pictures - PWA Modifications

To get an idea of all the modifications in the steps below a few pictures with detailed descriptions

Picture 1

Modifications on top of the board. At the bottom left the connector for the LDR and buzzer. On the right the connector with resistors for the minute LEDs, below the connector the transistor and resistor for brightness controll of the LEDs.

Picture 2

Modifications at the back of the board. At the top the connector for the LDR and buzzer, below that the resistor for the transistor driving the buzzer, the white wire is for measuring the brightness.

Step 7: LDR and Buzzer

Picture of LDR and Buzzer

LDR and buzzer assy with potmeter to control the volume and connector

Picture 3 Top view of the LDR/buzzer assy

Picture 4 Bottom view with buzzer which should be placed on the hole drilled for it.

picture 5 Connector

Step 8: LED String Pixel Modification

Picture of LED String Pixel Modification

Picture 6 Modification of the first 5-value LED in the string so that the circuitboard has got more room to be mounted on the backpanel.

Cut the fist of the 5-value leds on both sides in the middle. Use a sharp knife to peel off the plastic tube first then piece by piece peel off / cut the silicone (?) to free the solder pads on both sides of the small pcb. Solder a few extension wires to the LED. Solder the LED back into the string. Be sure the input side (with the arrow printed on the small pcb) is connected to the 3-value LED and the other output side (with the chip on the pcb) is connected to the second 5-value LED.

Picture 7 Here you can see how much lower the board can be mounted between the other LEDs

Step 9: Minute LEDs

Picture of Minute LEDs

Picture 8 The connector plus wiring for the minute LEDs

Picture 9 The wiring inside the 5-value square

Step 10: Put All Together

Picture of Put All Together

Picture 10 All connected and powered up. The LDR on bottom left slides in the hole in the top of the case while positioning/closing the back panel.

Picture 11 The settings overview pasted on the back panel.

Step 11: ToDo / Wish List / Suggestions

Picture of ToDo / Wish List / Suggestions

What I may change later .


RTC

Replace the DS1307 RTC with a DS3231 for more accuracy. The RTC on my board runs for 2 seconds a day and another RTC is running slow 6 seconds a day. Picture 12 shows a sample of the DS3231 module.

Automatic synchronisation

I would like to build a clock with an Arduino, display and DCF77 radio receiver or a GPS recever. This can output a minute synchronisation signal so other clocks - like this one - can be synced automatically. In that case a DS1307 would be acceptable.

RTC library

Modify the RTC library to deal with daylight saving time during the summer.

Chime

Add an MP3 player which can be triggered by the Arduino to play a chime every 1/4 (Westminster chime) or every 1/2 hour and a full hour chime. Picture 13 shows the JQ6500-16P MP3 player which can be used perfectly for this purpose: 5 trigger pins, speaker output (mono), audio output (stereo).

FTDI connector

To ease reprogramming extend the FTDI connector with wires and male/female connectors and glue the male connector to the back panel so it is accessible without opening the box.

Step 12: Conclusion

With this article I hope I can contribute to the popularity of this clock as the inventor Philipe Cretien deserves it.

It is intriguing to watch this clock and check/calculate if it is showing the correct time over and over again!

If you want to order the kit I found these URLs :

http://basbrun.com/2015/05/04/fibonacci-clock/

https://www.adafruit.com/products/3117

I really hope I have included all files you need.

Any questions/remarks/suggestion/bugs: don't hesitate to ask, report, let me know.

Well, thats all folks!

Regards, Eric

Comments

burgerrain (author)2016-11-26

Wow, a lot of thought went into adding these features. Great work adding to this already way cool project! I'll be referring to your instructible in the future.

etko (author)burgerrain2016-11-28

Thanks. Glad you like it.

About This Instructable

2,019views

21favorites

License:

More by etko:Fibonacci Clock Modified
Add instructable to: