Home    Master Clock   LCD Master Clock    Kenley Weather

Section   Top   Intro   Changes  Specs   Controls  Modes   Prototyping   Word Map   Power    Module Connections   Construction  Vinyl Sticker   Pin Outs  LEDs    DHT22  NANO  Touch Sensor   RTC Mod   MAX7219   Rset   Schematic   Wiring  MAX7219 Wiring  Dust Seals  LDR  Set Brightness  Set Clock  Sync Clock  USB Port   PIR    PIR On Off  Code

 

 

 

 

background picture from GRAPHIC GOOGLE

Arduino Word Clock with minute resolution of time in words and linear display of seconds.

There are also modes for digital clock, analogue clock, temperature & humidity, & also three games, Game of Life, Simon & Tetris.

The clock can be stand alone or run as a slave off a Master Clock if required.

There is an option for PIR control so the clock automatically turns off when no one is in the room.

The Clock measures 500mm x 500mm weighs 12lb (5.5Kg) and is designed to be wall mounted.

There are touch pads in each corner to setup and control the clock.

 

 

About Word Clocks

Word Clocks tell the time using a matrix of words or numbers and letters and have been around for many years.

There are a few different design types around that effect the complexity of the clock build.

The simplest use blocks of words to tell the time in five minute resolution eg O'CLOCK, 5 PAST, 10 PAST etc.

These clocks only use 23 individual LED blocks and therefore are the simplest to construct.

The main disadvantage of these clocks is they can only show the time in this set format.

 

below simple commercial word clock

 

 

The medium level clock has a 11x10 matrix of LEDs plus four addition LEDs around the outside of the clock.

The Raspberry Pi controlled clock below even has multicolour LEDs and as it has 110 individual LEDs it can display digits and basic images.

These clock still use a 5 min resolution in words but often add "just gone 5 past" or almost 10 to" to increase the resolution slightly.

Often the four LEDs around the corners of the frame indicate the passing four minutes to fill the gap between the 5 minute worded resolution.

These clocks are reasonable complex to build and often use strips of LEDs to make the build easier.

below Raspberry Pi Word Clock

There are commercial versions of this type of clock available.

The 450mm wall hanging version cost around 1000 and features interchangeable front panels in many colours and materials as well as smaller desktop and watches are available.

below the 450mm x 450mm QLOCKTWO commercial word clock

 

 

 

 

 

The Word Clocks with the highest level of complexity use a 16x16 LED matrix giving a full 256 LEDs to control.

These clocks have a one minute worded resolution of time as well as morning, evening, night etc.

They often tell the rough temperature in words like warm, very warm, cold very cold etc.

With the 256 LEDs to play with there are huge amounts of different display modes available.

These clocks are quite complex to build due to the number of connections in the matrix display.

Building the LED matrix on PCBs with surface mount components allows for very slim clock bodies and makes the display construction simpler but above 500mm x 500mm the PCBs start to get expensive.

Hand building the LED matrix as in my clock needs space and 500mm x 500mm is a good starting point as this can just about accommodate the large wiring looms

needed to interconnect the LEDs and display modules. Very large wall filling clocks can be built using hand built LED matrixes.

below 256 matrix Word Clock by Wouter Devinck 

 

 

 

Credits

This clock is based on the original Word Clock by Wouter Devinck full details on Facebook      Instructable      GitHub and the "Catalan" Pijuana Word Clock software based on Wouter Devinck's clock (this is a fork off the original Wouter Devinck design) here GitHub.

 

 

 

 

 

 

Changes

This clock is a mixture of the Wouter Devinck Clock hardware & the "Catalan" Pijuana clock software.  I have not used any PCBs just ready modules and three small Vero board circuits for the power.

 

The main changes are detailed below.

 

No custom PCBs are used in this version of the clock just cheap easy to come by prebuilt modules.

 

The main clock body is built from 2 x sheets of 14 mm MDF rather than a single 18mm sheet.

 

The rear sheet is 10mm smaller than the front sheet on all sides except the top so the clock appears to be only 14mm thick.

The Wouter Devinck clock is just 20mm deep including the 2mm glass whereas my clock is actually 34mm deep including the 4mm glass and 2mm dust seal on the rear.

Due to the setback of the rear 14mm panel and the 1.5mm setback of the glass panel from most angles the clock only looks 14mm deep.

This extra depth has allowed me to use a hand built LED matrix and wiring looms rather than 4 large PCBs. 

It also means I can use prebuilt maintenance friendly modules without surface mount ICs on the MAX7219 boards.

 

The main display is built direct to the display LEDs with no PCB so any size display is possible.

 

TTP223 Touch Sensor Modules are used instead of  Azoteq IQS127D mounted on the main boards.

 

The display driver boards for the MAX7219 I/C use modified LED matrix boards. These boards  come complete with all components.

 

An Arduino Nano is used to drive the clock due to it's small size.

 

A PIR sensor module is used to shutdown the display when no one is in the room (this can be disabled to keep the display always on).

 

A trimmer resistor to the circuit, accessible from the bottom of the clock with a small flat bladed screwdriver to calibrate the automatic display brightness.

 

Synchronisation to my master clock system every minute on 30 seconds. If no synchronisation pulse is available the clock will free run using the RTC. Synchronisation pulses are displayed on the main display.

 

The software is mainly based on the "Catalan" Pijuana version of the word clock so this has been translated into English for the display.

 

Credits display modified from the "Catalan" Pijuana" version to show the current software version number, my name and also the year of build.

 

The worded temperature has been removed from the clock display and a linear seconds display added to the bottom row of the Word, Digital & Analogue clocks.

 

When the PIR is turned On or Off "PIR ON" or "PIR OFF" is displayed for a few seconds on the word clock display.

 

This clock uses a DS3231 AT24C32 I2C Precision Real Time Clock Module as per the Wouter Devinck Clock & the  "Catalan" Pijuana clock.  I am not keen on using the

Lithium-Ion rechargeable battery that is supplied with the module. I use a non rechargeable battery and have modified the module to suit.

 

4mm float glass with polished edges replaces the 2mm glass.

 

The glass is fixed to the main MDF board using Chicago Fasteners rather than glue. These also act as touch pads to control the clock and allows the glass can be removed if required.

 

Two dust seals are built into the clock, one on the rear panel and one behind the removable glass display panel.

 

In clock setting Mode pressing the BOT Right button now resets seconds to 0.

 

 

 

The following changes to the English wording have been made

 

Removed the words indicating the temperature on the word clock.

 

These have been replaced with Sync status, PIR ON/OFF and Linear display of seconds.

 

Changed "MINUTES" to "MINUTE" at 1 minute past and 1 minute to the hour.

 

Added an "A" before the "QUATER" past and "QUATER" to the hour.

 

Added the missing "ELEVEN" from Wouter Devinck clock as per his notes.

 

At Midday changed the time to read TWELVE OCLOCK IN THE AFTERNOON.

 

At Midnight changed the time to read TWELVE OCLOCK AT NIGHT.

 

After Midnight the clock will always say IN THE MORNING.

 

The "O'CLOCK" is now unpunctuated and just shows OCLOCK.

 

 

 

 

 

 

Specs

Auto display dimming using an LDR

Auto display On/Off using a PIR sensor module

Display 4mm float glass, 16x16 matrix, 256 White 5mm LEDs output 13000mcd each

Dimensions 503mm x 503mm x 34mm

Weight 12lbs/5.5Kg

8 display modes Credits, Word Clock, Digital Time, Temperature & Humidity, Analogue Clock, Game of Life, Simon & Tetris

Battery backup of time using a real time clock

 

 

 

 

 

 

 

 

 

 

 

 

Controls

There are TTP223 touch control modules on the clock, top left, top right, bottom left and bottom right corners of the display.

 

 

The buttons have different functions depending on what mode the clock is in, see chart below.

  Button Location
Clock Mode Top Left Top Right Bottom Left Bottom Right
Credits Previous Mode Next Mode None None
Word Clock Previous Mode Next Mode PIR On (Enabled) PIR Off (Display always on)
Digital Clock Previous Mode Next Mode Set Time Set Time
Temp/Humidity Previous Mode Next Mode None None
Analogue Clock Previous Mode Next Mode None None
Game of Life Previous Mode Next Mode    
Simon Previous Mode Next Mode Start Game Start Gane
TETRIS Previous Mode Next Mode Start Game Start Game
         
Digital Clock Button Location
Sub Menu Top Left Top Right Bottom Left Bottom Right
Set Time (Hours) Hour Decrement Hour Increment Set Minutes/Accept Time Reset Seconds to 0
         
Digital Clock Button Location
Sub Menu Top Left Top Right Bottom Left Bottom Right
Set Time (Minutes) Minute Decrement Minute Increment Set Hours/Accept Time Reset Seconds to 0
         
Simon Button Location
Sub Menu Top Left Top Right Bottom Left Bottom Right
Game Contols Select Top Left Select Top Right Select Bottom Left Select Bottom Right
         
TETRIS Button Location
Sub Menu Top Left Top Right Bottom Left Bottom Right
Game Contols Move Left Move Right Select Bottom Left Select Bottom Right

 

 

 

 

 

 

 

 

Display Modes

Startup

On startup or if mode 1 is selected the clock displays the following
  • software version number

  • makers name

  • clock name

  • year of build

 

 

 

 

 

Clocks/Info

On each touch of the top right button the following clock & info displays are shown

Word Clock

Digital Clock

Temperature & Humidity

Analogue Clock

Touching the left button steps backwards

 

below the four clock & info modes

 

 

Games

There are 3 games built into the clock.

Conway's Game of Life

The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells,

each of which is in one of two possible states, alive or dead, or "populated" or "unpopulated".

Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically,

or diagonally adjacent. At each step in time, the following transitions occur:

  1. Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.

  2. Any live cell with two or three live neighbours lives on to the next generation.

  3. Any live cell with more than three live neighbours dies, as if by overpopulation.

  4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

The initial pattern constitutes the seed of the system.

The first generation is created by applying the above rules simultaneously to every cell in the seed

births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes

called a tick (in other words, each generation is a pure function of the preceding one).

The rules continue to be applied repeatedly to create further generations.

 

 

 

 

 

 

 

Simon

Simon memory game

When entering your sequence double tap the last entry to end your turn.

 

 

Tetris

Tetris is the Soviet tile-matching puzzle video game released in June 1984.

This game still needs some work on the buttons to control the tiles.

 

 

 

 

 

 

 

Prototyping/Testing

 

The Clock can be prototyped and tested using the original DOT Matrix LED on the MAX7219 display board.

This means you can try out your software/word layout modifications in miniature before committing to the full size version.

 

The wiring to the DOT Matrix LED will have to be modified to match the software connections.

The pic below shows how the Module is wired before modification.

The modification is quite straight forward.

First of all bend the following LED Matrix pins 90, the top pins up and the bottom pins down.

Pins 16, 15, 3, 4,10 & 11.

Insert the LED Matrix in the socket on the display PCB the above pins will now not be connected.

Solder the following link wires from the back of the socket of the display PCB to the LED Matrix pins that are sticking out.

LEDA to Dot Matrix Pin 16

LEDB to Dot Matrix Pin 15

LEDG to Dot Matrix Pin 3

LEDF to Dot Matrix Pin 4

LEDE to Dot Matrix Pin 10

LEDC to Dot Matrix Pin 11

 

 

The Table below shows where the software pin number differ from the LED pin numbers on the display board.

 

TOP

PCB Pin LEDG LEDF LED1 LEDDP LED3 LEDE LEDC LED0
LED PIN 16 15 14 13 12 11 10 9
S/W PIN 3 4 14 13 12 10 11 9
                 
                 
                 
                 
                 
                 
                 
                 
S/W PIN 1 2 16 15 5 6 7 8
LED PIN 1 2 3 4 5 6 7 8
PCB Pin LED4 LED6 LEDA LEDB LED7 LEDD LED5 LED2

BOTTOM

 

 

 

 

To test your word layouts print out a miniature version of your word display 62mm x 62mm on plain white paper.

 

 

Cut the printed layout into quarters.

 

 

 

These will then fit over the four LED Matrix displays.

 

 

 

 

The individual LEDs will light up the letters.

Note the orientation of the LED Display boards to match the software layout.

 

 

 

 

 

Fully working prototype on my test bench.

The small push button below the temp/humidity sensor is used to test the 30 second synchronisation.

The touch button modules are on the bottom left of the breadboard mounted sideways.

 

 

 

 

 

 

 

 

Time to Word Mapping Chart

The chart shows how each minute of the day is mapped to words.

 

Hour Words     Minute Words
0 TWELVE AT NIGHT     0   O'CLOCK
1 ONE IN THE MORNING     1 ONE MINUTE PAST
2 TWO IN THE MORNING     2 TWO MINUTES PAST
3 THREE IN THE MORNING     3 THREE MINUTES PAST
4 FOUR IN THE MORNING     4 FOUR MINUTES PAST
5 FIVE IN THE MORNING     5 FIVE PAST
6 SIX IN THE MORNING     6 SIX MINUTES PAST
7 SEVEN IN THE MORNING     7 SEVEN MINUTES PAST
8 EIGHT IN THE MORNING     8 EIGHT MINUTES PAST
9 NINE IN THE MORNING     9 NINE MINUTES PAST
10 TEN IN THE MORNING     10 TEN PAST
11 ELEVEN IN THE MORNING     11 ELEVEN MINUTES PAST
12 TWELVE IN THE AFTERNOON     12 TWELVE MINUTES PAST
13 ONE IN THE AFTERNOON     13 THIRTEEN MINUTES PAST
14 TWO IN THE AFTERNOON     14 FOURTEEN MINUTES PAST
15 THREE IN THE AFTERNOON     15 A QUARTER PAST
16 FOUR IN THE AFTERNOON     16 SIXTEEN MINUTES PAST
17 FIVE IN THE AFTERNOON     17 SEVENTEEN MINUTES PAST
18 SIX AT NIGHT     18 EIGHTEEN MINUTES PAST
19 SEVEN AT NIGHT     19 NINETEEN MINUTES PAST
20 EIGHT AT NIGHT     20 TWENTY PAST
21 NINE AT NIGHT     21 TWENTY ONE MINUTES PAST
22 TEN AT NIGHT     22 TWENTY TWO MINUTES PAST
23 ELEVEN AT NIGHT     23 TWENTY THREE MINUTES PAST
          24 TWENTY FOUR MINUTES PAST
          25 TWENTY FIVE PAST
          26 TWENTY SIX MINUTES PAST
          27 TWENTY SEVEN MINUTES PAST
          28 TWENTY EIGHT MINUTES PAST
          29 TWENTY NINE MINUTES PAST
          30 HALF PAST
          31 TWENTY NINE MINUTE TO
          32 TWENTY EIGHT MINUTES TO
          33 TWENTY SEVEN MINUTES TO
          34 TWENTY SIX MINUTES TO
          35 TWENTY FIVE TO
          36 TWENTY FOUR MINUTES TO
          37 TWENTY THREE MINUTES TO
          38 TWENTY TWO MINUTES TO
          39 TWENTY ONE MINUTES TO
          40 TWENTY TO
          41 NINETEEN MINUTES TO
          42 EIGHTEEN MINUTES TO
          43 SEVENTEEN MINUTES TO
          44 SIXTEEN MINUTES TO
          45 A QUARTER TO
          46 FOURTEEN MINUTES TO
          47 THIRTEEN MINUTES TO
          48 TWELVE MINUTES TO
          49 ELEVEN MINUTES TO
          50 TEN TO
          51 NINE MINUTES TO
          52 EIGHT MINUTES TO
          53 SEVEN MINUTES TO
          54 SIX MINUTES TO
          55 FIVE TO
          56 FOUR MINUTES TO
          57 THREE MINUTES TO
          58 TWO MINUTES TO
          59 ONE MINUTE TO

 

 

 

 

 

 

 

Power

I use a common 12 volt power supply unit to drive many different types of circuits throughout my house. This 12 volt supply is then stepped down locally at each circuit with a 5 volt module to supply power for the control board and various modules.

If you are running just this one circuit then any regulated 5volt supply will do as long as it can supply the current for your circuit use.

 

below my common power supply has 18 individually fused 12v circuits each with a 2A fuse. 9 of these are battery backed up.

Clock boards also have their own on board fuse.

 

The local PSU module uses a MP1584 miniature Power supply to convert the 12v input to the 5v for the clock.

There are two extra power boards constructed from Vero board. Apart from 1 holding the buzzer they just add extra power distribution points for the power wiring of the clock.

Power Requirements

I have measured the current draw from the clock and at low brightness it uses 30mA and full brightness 250mA.

This will of course vary with how many LEDs are on.

On a bright sunny day the brightness levels indicated on the serial out are 10. This is around 2 thirds of the max power of the LEDs.

Overall power consumption can be greatly reduced if the PIR is turned on. This will blank the display if movement is not detected by the clock.

 

 

 

 

 

 

 

Module Interconnections

 

The diagram above shows how the modules are connected. Most modules connect directly to the Arduino Nano.

The MAX7219 boards only connect to the NANO via module 01. The other modules are daisy chained together.

Each 8x8 LEDs matrix is then connected to a MAX7219 module.

The bulk of the wiring is the connections between the MAX7219 modules and the LED matrixes.

Keep the distance between the NANO and the 1st MAX7219 module and MAX7219 module to modules as short as possible.

Also make sure you supply power to both ends of the daisy chained MAX7219s as most of the power is drawn by this part of the circuit.

 

 

 

 

 

 

 

 

 

 

Construction

Order of build

Get vinyl transfer printed.

Get glass cut.

Cut MDF Sheets front and back.

Cut holes in front sheet for LEDs.

Paint MDF Sheets.

Cut holes for sensors in glass.

Stick Vinyl transfer to rear of glass.

Cut sensor holes in MDF front board.

Cut sensor module rebates in front board.

Cut MDF back board and make 4 access holes for sensor access.

Add melamine edge strips to MDF boards, white to front board and black to rear board.

Screw back MDF board to front MDF board.

Make Vero boards, 1 power board and 2 power distribution boards.

Modify 4 x MAX7219 boards and add wiring to LEDs. Connect at MAX7219 end only for now.

Mount all modules and Vero boards. on rear of MDF front board.

Construct all 4 LED matrixes on front MDF board and solder 256 LEDs.

Wire all Batt and Earth runs from power supply Vero board and power distribution boards.

Connect all power runs to all modules.

Connect all wiring to Nano, MAX7219 modules, RTC , Temp sensor, Touch Sensors and Buzzer.

Connect all wiring looms from modified MAX7219 boards to LED Matrixes as per wiring table.

Connect a PIR module remotely from the clock and connect the PIR connection.

Connect the 30 second sync to your Master Clock.

Mount the Glass front display panel using the Chicago bolts also fixing the touch sensors at the same time.

Test.

 

Approximate Build Times

Item Build Time Hours
Front MDF Panel  
260 holes for LEDs including countersinking  4
Painting MDF primer, 2 x top coats white spray paint and 2 coats black 2
White Melamine edging strip 1
Cathode Bus Bar support panel pins 1
   
Rear MDF Panel  
Cut out and clean up edges  0.5
Cut access holes for Chicago mounts 0.5
Matt Black Melamine edging strip 1
Drill and screw rear panel to front panel 0.5
Recess and fix hanging brackets  0.5
   
Glass Panel  
Apply Vinyl Letter cut-out 0.5
Drill 4 holes for Chicago Mounts/Sensors 0.5
   
Electronics  
Construct Power Vero board 1
Distribution Vero boards x2 0.5
Modify MAX7219 boards x4 0.5
Drill out 4 x touch sensor board mountings 0.5
Mount all boards/modules on rear of front panel 0.5
   
LED Matrix Construction & Wiring  
Each strip of 8 LEDs including bus bars and 4 bends to all 512 LED legs 25 mins x 32 strips 13.5
   
Plate Wiring  
Power wiring distribution to all modules and boards 1
Wire Arduino Nano to all board/sensors 2
Wire 16 connections from each MAX7219 to each LED Matrix 1 hour x 4  4
Lace in all wiring looms with waxed cotton twine 2
   
Total 37.5

 

 

 

 

 

 

 

 

Vinyl Sticker

The Vinyl sticker is designed in Inkscape. Inkscape is professional quality vector graphics software which runs on Windows, Mac OS X and GNU/Linux.

 It is used by design professionals and hobbyists worldwide, for creating a wide variety of graphics such as

illustrations, icons, logos, diagrams, maps and web graphics. Inkscape uses the W3C open standard SVG (Scalable Vector Graphics)

as its native format, and is free and open-source software.

 

I downloaded the original Inkscape design by Wouter Devinck from his GitHub repository and then modified it in Inkscape to suit my design.

I tried out many different versions on my miniature prototype before sending the final design off to be printed.

Don't forget to get the sticker reverse printed!

I used a company called Regal Signs & Graphics who supplied my sticker in black vinyl, reverse cut, lettering weeded out and supplied with an application tape all for around 27 inc vat.

Although they are quite local to me I paid a bit more and got my sticker delivered in a nice secure cardboard tube.

I had a few problems getting the design in the correct format for their machine but in the end I sent it from Illustrator in eps format the very helpful people at Regal Signs scaled it down to the correct size for me.

My Inkscape file can be downloaded here VINYL STICKER.

 

Below edit your design in Inkscape

 

 

 

 

 

The Vinyl sticker came from Regal Signs with the letters weeded out so this saved me lots of time.

The sticker comes with a plastic tape over the front (glass) side and an application paper on the rear.

Usually you peel the from side tape off apply the sticker and then remove the application paper.

I decided to leave the application paper on as it acted as a diffuser for the LEDs.

As I was leaving the application paper on I trimmed off the excess paper around the sticker before applying. 

 

 

 

 

 

Vinyl Sticker trimmed ready for application.

 

The sticker application was relatively easy. Just make sure you watch a few YouTube videos on Vinyl sticker application to glass before trying it yourself.

 I cleaned the glass first with acetone and made sure it was dust free.

I then put on some plastic gloves to make sure I did not get any finger prints on the sticker.

I spayed the glass with a very diluted soap and water mixture and then very slowly peeled back the plastic film from the sticker to reveal the front surface.

It is important to peel the film back slowly and at a very acute angle so the letters on the sticker stay connected to the transfer paper.

Once the sticker is completely exposed  apply it to the wet glass surface. The water/soap mixture will allow you to move the sticker to the correct place on the glass.

Next use a credit card and work away from the centre of the sticker to remove any air bubbles.

Leave the sticker to dry overnight then from the back of the sticker cut away the vinyl over the 4 mounting holes in the glass.

 

 

 

 

 

 

 

 

 

 

Main Boards

The main board of the clock is made up of 2 sheets of 14mm MDF. The rear sheet is 10mm smaller than the top sheet on all sides apart from the top.

The top has white edges while the back has black  edges. When viewed on the wall the clock will then appear to be 14mm deep.

On the original Wouter Devinck Clock & the "Catalan" Pijuana version a single 18mm thick sheet of MDF is used with the back routed out to make space for the PCB and components.

Using 2 sheets of MDF means the back board can be simply cut out using a jigsaw rather than the time consuming and dusty routing.

The top sheet is 503mm x 503mm to give a 1.5mm overlap around the glass. This will give the glass a bit of protection from knocks.

 

 

 

 

The backboard is cut out using a jigsaw and allows 14mm of component space.

The deepest PCB including components are the MAX 7219 modules that are 10mm deep.

On completion the rear board is glued or screwed to the front board.

 

 

 

 

 

 

Front Board Construction

 

The front board holds the 256 LEDs that shine through 6.5mm holes and wider 18mm countersunk holes to illuminate individual letters and numbers on the display.

The board is marked up to show the drilling position of in the centre of each display character.

Using a 500mm display I measured my vinyl sheet and the characters are 25mm apart starting 62.5mm from the edges.

I drew these lines on the MDF, the intersections being the drilling points.

 

 

I used the top edge as the datum point I measured  and marked each row from this point.

This was repeated for the vertical column using the left edge as the datum.

 

 

The intersections of the grid will be the centre point for the 6mm LED mounting holes and the 18mm countersunk holes.

 

 

 

 

 

Using an automatic centre punch ( use a nail or screw if you don't have one) I punched the 256 intersection points of the grid.

 

These punched marks will act as a guide for the 6mm drill bit for the LED mounting holes.

 

 

 

 

Using a drill bit to suite your LEDs (6mm in my case) and using the punched holes as a guide for the drill bit drill out all 256 LED mounting holes.

 

 

 

The next task is to drill the 256 18mm countersunk holes using a 20mm countersinking bit.

To keep the countersunk holes at a uniform depth and width I built a countersinking jig using an off cut of wood.

To make the jig a hole is drilled in the wood off cut to just fit the silver rotating bezel of my drill chuck.

Using a test piece of MDF the countersinking bit is then moved in and out of the chuck until a countersunk hole of the correct diameter is made when drilling through the hole upto the chuck in the off cut of wood.

Once the correct distance is found the chuck is tightened and the main board is drilled 256 times by centring the hole in the wood over the existing 6mm holes then drilling down until the chuck bezel hits the hole in the countersinking jig.

 

 

 

 

Completed front board with 256 countersunk holes and 6mm holes for the LEDs.

 

 

 

 

The board is then rubbed down and primed using MDF primer and painted white so the countersunk holes reflect the light from the LEDs.

 

 

 

A black edge is painted around the outside edge to hide the board as the glass is 1mm shorter all round.

 

 

 

Four 5mm holes are then drilled in the corners to take the Chicago Fasteners.

The Chicago Fasteners hold the glass in place, hold the touch sensors and provide a touch sensitive pad on top of the glass.

The fasteners have 3mm shafts and will have a small bit of rubber tape wrapped around the shafts to protect the glass.

 

 

 

 

 

 

 

 

Turn the board over and drill a rebate with a forstner bit to take the four touch sensors.

This hole will be offset from the hole drilled in the previous step.

 

 

 

 

 

 

The clock uses 4mm float glass and has been cut to exactly 500mm x500mm. As the edges are exposed the edges have also been polished.

This was all done by my local glaziers for 20.

5mm holes were then drilled in the glass panel using a 5mm glass drill.

 

 

 

 

 

 

 

Touch Sensor Mounting

 

See cutaway section through mounting bolt below.

The touch sensor modules are fixed to the front panel using the glass mounting bolts. The mounting bolts then act as touch sensors.

A 5mm hole is drilled through the sensor pad on the module to allow the glass mounting bolt to pass through.

The sensor pad is insulated by the MDF panel and a plastic washer.

 

 

 

 

The touch pad on the sensor module has a 5mm mounting hole drill through the sensor.

 

 

 

 

Touch sensors in rebates behind rear panel. Holes drilled into rear panel allows access to the Chicago Fasteners that hold the sensors/glass front in place.

 

 

 

 

Clock front panel with touch plates.

 

 

 

 

 

 

 

 

 

Atmega 328 Pin Connections

Pin label numbers refer to Arduino IDE number

 

 

 

Arduino Nano Pin Connections

 

 

 

 

 

 

 

 

 

LEDs

The LEDs were purchased from Bright Components

 

 

5mm White Flat Top LEDs offering a pure and consistent colour with a wide angle ultra bright light output.

Colour : White

Quantity : 256

Lenses Type : Round Flat Top Crystal Clear

Brightness : 13000mcd

Forward Voltage : 3.2v - 3.8v

Forward Current : 20mA (typical), 30mA (Max)

Viewing Angle : 120 degrees

 

 

 

 

 

 

 

 

DHT22 Temperature & Humidity Sensor

 

 

The DHT22 is a basic, low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air,
and sends out a digital signal on the data pin.
 You can only get new data from it once every 2 seconds, so sensor readings can be up to 2 seconds old.

Simply connect the first pin on the left to 3-5V power, the second pin to your data input pin and the right most pin to ground.
 

To prevent the temperature of the inside clock case being measured the top and left side vent of the DH22 are covered over with tape.

This also stops dust being drawn into the clock case.

below view of the lower edge of the clock from the rear showing the air circulation vents.

 

The DHT22 is mounted with it's right open side mounted tight against the lower rear cover.

Two small holes are drilled in the lower edge of the rear MDF board to allow air from the room to circulate around the sensor.

 

 

 

 

 

 

 

 

Arduino Nano

 

Power
The Arduino Nano can be powered via the Mini-B USB connection, 6-20V unregulated external power supply (pin 30), or 5V regulated external power supply (pin 27). The power source is automatically selected to the highest voltage source.


Memory
The ATmega328 has 32 KB, (also with 2 KB used for the bootloader. The ATmega328 has 2 KB of SRAM and 1 KB of EEPROM.

 
Input and Output
Each of the 14 digital pins on the Nano can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the FTDI USB-to-TTL Serial chip.


External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.


PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.


SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although provided by the underlying hardware, is not currently included in the Arduino language.


LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.


The Nano has 8 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the analogReference() function. Analog pins 6 and 7 cannot be used as digital pins.

Additionally, some pins have specialized functionality:
I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library (documentation on the Wiring website).


There are a couple of other pins on the board:
AREF. Reference voltage for the analog inputs. Used with analogReference().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.


Communication
The Arduino Nano has a number of facilities for communicating with a computer, another Arduino, or other microcontrollers. The ATmega328 provide UART TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). An FTDI FT232RL on the board channels this serial communication over USB and the FTDI drivers (included with the Arduino software) provide a virtual com port to software on the computer.

 The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the Arduino board. The RX and TX LEDs on the board will flash when data is being transmitted via the FTDI chip and USB connection to the computer (but not for serial communication on pins 0 and 1).

 A SoftwareSerial library allows for serial communication on any of the Nano's digital pins. The ATmega328 also support I2C (TWI) and SPI communication. The Arduino software includes a Wire library to simplify use of the I2C bus. To use the SPI communication, please see ATmega328 datasheet. 

 

 

 

 

 

 

 

 

 

 

 

 

 

TTP223 Touch Sensor Module

The Touch Sensor Module is bolted to the front panel using the glass mounting bolts. The bolt goes through a 5mm hole drilled in the middle of the sensor.

Note the mounting bolt is touched to trigger the sensor but is insulated from the sensor itself through plastic washers.

Four of these modules are used in the clock one mounted on each corner of the glass.

Note the LEDs are not required and are removed from the modules to save power.

 

 

 

 

 

 

 

 

 

 

Modification of DS3231 AT24C32 I2C Precision Real Time Clock Module

My clock uses a DS3231 AT24C32 I2C Precision Real Time Clock Module.

The module comes supplied with a Lithium-Ion rechargeable battery see diagram above. I use a non rechargeable battery so have removed resistor R5

from the module as below.

 

Location of R5 on the DS3231 module.

 

Charging Resistor R5 removed.

 

 

 

 

 

 

 

 

 

 

 

 

MAX7219 Display PCB with LED Matrix in place.

The LED matrix is removed and wires are soldered to the PCB on the solder side of the display holder pins.

 

 

 

 

MAX7219 Display PCB with LED Matrix removed

 

 

 

 

 

 

 

 

 

MAX7219 LED current limiting

The max current through the LEDs is set by a single resistor R1 on the module.

The value of resistor can be found from the following table.

The module comes with a 10K resistor preinstalled but this can be removed and a resister to match your LEDs  current added in it's place.

My LEDs Forward Voltage is 3.2v - 3.8v @ 20mA. They can handle 30mA max but for long LED life 20mA is best.

I have used 22KΩ resistors which will limit the current to around 20mA when the light levels are at their peek.

See setting automatic brightness levels.

ISEG(mA) VLED(LED)
1.5 2 2.5 3 3.5
40 12.2 11.8 11 10.6 9.69
30 17.8 17.1 15.8 15 14
20 29.8 28 25.9 24.5 22.6
10 66.7 63.7 59.3 55.4 51.2
  RSET value in KΩ

 

 

 

 

 

1088AS LED Dot Matrix display view of lower edge Pins 1 to 8 left to right

 

 

 

 

 

 

 

 

 

Schematic

Main Board Modules

 

 

 

Display Modules

 

 

 

 

 

 

 

 

Four of these display boards are required making 256 LEDs in total.

Note the LED display matrixes are rotated anti-clockwise 90 degrees from each other starting from display matrix 01.

Display Matrix 01 input is wired to the Arduino CLK,DIN and LOAD the output is taken to the input of Display matrix 02 etc etc.

 

 

 

 

 

 

 

 

 

Wiring

 

Module Locations

The module locations are shown below. The four sensors are located in the recesses on the main board behind the rear board.

Holes are cut into the rear board to allow access for fit the Chicago Bolts/Sensor pads.

The four MAX7219 Display Modules are soldered together and are mounted in the centre top of the board.

This keeps the data links between the boards as short as possible.

The Arduino Nano is mounted on the left of the MAX7219 Display Modules and the RTC on the right.

The RTC battery holder on the base of the RTC module is recessed into the main board.

The Vero board containing the power module is located on the lower part of the board.

There are two power distribution boards mounted on the top of the clock. The main 5v 2A feed cable is taken to both of these boards and power is then distributed

to the other boards from these points.

The MAX7219 board power is fed from the left board and daisy chained through each board then taken out the forth board to ensure they are fed with 0v and 5v from both ends.

 

 

 

The LED locations are shown below. The LED matrixes each contain 64 LEDs and are labelled 1 to 4.

These correspond to the 4 MAX 7219 modules mounted above numbered 1 to 4 left to right.

 

 

 

 

 

The LED Matrixes are built up off 2 types of BUS Bars per module. A Cathode Bus at 10mm high and an Anode BUS bar at 2mm high.

There are 8 Cathode and 8 Anode BUS Bars per module.

Each module has 16 x 15mm panel pins hammered into the board in the position shown to support the 10mm high Cathode BUS.

 

 

 

 

The 15mm panel pins are hammered in 5mm (I used a 10mm piece of metal bar as a gauge) leaving 10mm as Cathode BUS bar support pins.

As shown below the pins correspond with the thick parts of the board not the recess for the LEDs on the front of the board.

 

 

 

 

 

0.9mm copper wire is then soldered to each pair of pins to form the Cathode BUS Bar.

Not the rotation of each module and also the modules are in reverse as it is the back of the board the LEDs are connected to.

 

 

 

The Anode BUS Bars are shown below in Red and are supported off each LED Anode about 2mm off the MDF board.

 

 

Both Cathode & Anode BUS Bar locations are shown below.

Each LED is connected to an Anode and Cathode of the Matrix.

 

 

 

 

 

 

 

LEDs

The LEDs are bent in a jig to keep the position in the display constant and to speed up construction.

Each LED has four bends two on each leg that's 1024 in total. The Cathode leg is bent 90 from the Anode.

 

 

 

 

LED Matrix Wiring Shedule

The LEDs are connected to the matrixes and MAX7219 modules from the rear.

The LED positions will be reversed and of course rotated 90 relative to the next module.

This makes it very complicated connecting the correct LEDs and Bus bars from the rear of the board.

The table below shows the LED positions in the blue boxes with the BUS Bar matrix position in black around the outside as they appear from the back of the front MDF board.

  MODULE 02     MODULE 03  
BUS LED 7 LED 6 LED 5 LED 4 LED 3 LED2 LED 1 LED 0     LED DP LED G LED F LED E LED D LED C LED B LED A BUS
LED A D72 D71 D70 D69 D68 D67 D66 D65     D192 D184 D176 D168 D160 D152 D144 D136 LED 7
LED B D80 D79 D78 D77 D76 D75 D74 D73     D191 D183 D175 D167 D159 D151 D143 D135 LED 6
LED C D88 D87 D86 D85 D84 D83 D82 D81     D190 D182 D174 D166 D158 D150 D142 D134 LED 5
LED D D96 D95 D94 D93 D92 D91 D90 D89     D189 D181 D173 D165 D157 D149 D141 D133 LED 4
LED E D104 D103 D102 D101 D100 D99 D98 D97     D188 D180 D172 D164 D156 D148 D140 D132 LED 3
LED F D112 D111 D110 D109 D108 D107 D106 D105     D187 D179 D171 D163 D155 D147 D139 D131 LED2
LED G D120 D119 D118 D117 D116 D115 D114 D113     D186 D178 D170 D162 D154 D146 D138 D130 LED 1
LED DP D128 D127 D126 D125 D124 D123 D122 D121     D185 D177 D169 D161 D153 D145 D137 D129 LED 0
  MODULE 01     MODULE 04  
LED 0 D1 D9 D17 D25 D33 D41 D49 D57     D249 D250 D251 D252 D253 D254 D255 D256 LED DP
LED 1 D2 D10 D18 D26 D34 D42 D50 D58     D241 D242 D243 D244 D245 D246 D247 D248 LED G
LED 2 D3 D11 D19 D27 D35 D43 D51 D59     D233 D234 D235 D236 D237 D238 D239 D240 LED F
LED 3 D4 D12 D20 D28 D36 D44 D52 D60     D225 D226 D227 D228 D229 D230 D231 D232 LED E
LED 4 D5 D13 D21 D29 D37 D45 D53 D61     D217 D218 D219 D220 D221 D222 D223 D224 LED D
LED5 D6 D14 D22 D30 D38 D46 D54 D62     D209 D210 D211 D212 D213 D214 D215 D216 LED C
LED6 D7 D15 D23 D31 D39 D47 D55 D63     D201 D202 D203 D204 D205 D206 D207 D208 LED B
LED 7 D8 D16 D24 D32 D40 D48 D56 D64     D193 D194 D195 D196 D197 D198 D199 D200 LED A
BUS LED A LED B LED C LED D LED E LED F LED G LED DP     LED 0 LED 1 LED 2 LED 3 LED 4 LED5 LED6 LED 7 BUS

 

 

 

 

 

 

Below close up section of Module 1 wiring.

The Cathode BUS Bars run vertically and the Anode BUS Bars run horizontally on this module.

The Anode & Cathode BUS Bars have an 8mm vertical separation.

 

 

 

 

 

Diagram showing Bus Bar layout with panel pins supporting the Cathode Bus. This module has horizontal Cathode and vertical Anode Bus Bars.

 

 

 

Rear left of clock showing completed wiring

 

 

 

 

 

 

 

 

 

The Matrix grids are wired to the corresponding pins on the MAX7219 modules according to the layout below.

There are 16 wires to each module.

 

 

Module LED Matrix Wiring Colour Code is shown below.

Each Module has 16 wires connecting it to the LED Matrixes.

I have used 50pr 0.5mm cable so the last 14pr colours are duplicated.

On Mod 4 I went out of order and missed out the Sl/Vi at the start so have put it in at the end.

MAX 7219 Mod 01   MAX 7219 Mod 02   MAX 7219 Mod 03   MAX 7219 Mod 04
PIN Color   PIN Color   PIN Color   PIN Color
LEDG Bl-Wh   LEDG Bn-Rd   LEDG Or-Yl   LEDG Bl-Wh
LEDF Wh-Bl   LEDF Rd-Bn   LEDF Yl-Or   LEDF Wh-Bl
LED1 Or-Wh   LED1 Sl-Rd   LED1 Gn-Yl   LED1 Or-Wh
LEDDP Wh-Or   LEDDP Rd-Sl   LEDDP Yl-Gn   LEDDP Wh-Or
LED3 Gn-Wh   LED3 Bl-Bk   LED3 Bn-Yl   LED3 Gn-Wh
LEDE Wh-Gn   LEDE Bk-Bl   LEDE Yl-Bn   LEDE Wh-Gn
LEDC Bn-Wh   LEDC Or-Bk   LEDC Sl-Yl   LEDC Bn-Wh
LED0 Wh-Bn   LED0 Bk-Or   LED0 Yl-Sl   LED0 Wh-Bn
LED4 Sl-Wh   LED4 Gn-Bk   LED4 Bl-Vi   LED4 Sl-Wh
LED6 Wh-Sl   LED6 Bk-Gn   LED6 Vi-Bl   LED6 Wh-Sl
LEDA Bl-Rd   LEDA Bn-Bk   LEDA Or-Vi   LEDA Bl-Rd
LEDB Rd-Bl   LEDB Bk-Bn   LEDB Vi-Or   LEDB Rd-Bl
LED7 Or-Rd   LED7 Sl-Bk   LED7 Gn-Vi   LED7 Or-Rd
LEDD Rd-Or   LEDD Bk-Sl   LEDD Vi-Gn   LEDD Rd-Or
LED5 Gn-Rd   LED5 Bl-Yl   LED5 Bn-Vi   LED5 Sl-Vi
LED2 Rd-Gn   LED2 Yl-Bl   LED2 Vi-Bn   LED2 Vi-Sl

 

 

 

 

Before wires can be connected to the MAX 2917 modules they will need to be modified.

 

Two sets of 8 90 pin connectors will to be soldered to the lower edge of the existing LED matrix connector.

 

 

Modified MAX7219 module with 90 pin connectors soldered in place to the bottom of the old LED Matrix connectors.

Wires are taken away from these points to the LED matrix on the main MDF board as per the LED Matrix Wiring Colour Code table above.

 

 

 

Side view showing the pins soldered to the side of the old LED Matrix connector pins just above the PCB.

 

 

 

 

 

 

 

 

Dust Seals

To prevent ingress of dust two dust seals are fitted.

 

On the rear MDF board a 2mm soft foam rubber dust seal is fitted. When the clock is hung on it's hanging hooks the seal is under pressure

and seals the back of the clock to the wall. The seal is self adhesive and is fitted with a 5mm gap to the edge of the rear MDF board.

 

 

 

 

 

 

 

On top of the front board to prevent dust getting under the glass a strip of self amalgamating rubber is fitted 5mm from the board edge.

To prevent the glass from cracking when the Chicago bolts are tightened 4 small square of rubber are also fitted around the holes in the glass.

I punched holes for the Chicago Bolts in the rubber with a leather punch.

 

 

Dust seal in position on front board.

 

 

 

 

 

 

 

 

 

 

LDR

An LDR is used to sense the ambient light levels.

The LDR is around 500Ω in bright light and 10MΩ in the dark.

 

The LDR is positioned underneath the clock on the rear MDF panel.

Next to the LDR is a hole to give access to the trimmer resister to calibrate the LED brightness control.

 

 

 

 

 

 

 

 

 

Setting Automatic Brightness Levels

The clock automatically senses the ambient light and adjusts the LEDs accordingly.

When first installed the clock will need to be calibrated to the maximum light levels in it's actual location.

Connect a mobile, laptop/tablet etc via a suitable cable to the mini USB port of the clock and open an app to monitor the serial port.

I use Slick USB 2 Serial Terminal on my S7 via an OTG cable and USB to mini USB cable.

The clock will reboot and after the initial start screen you will see the following data updating down the screen.

You don't need to worry about  lightReading or constrained lightReading+hyster just light reading, and bright.

With the clock in position and the ambient light at it's maximum levels carefully insert a flat bladed  jewellers screwdriver into the access hole just to the right of the light sensor.

Turn the screwdriver slowly until the  light reading = 600 (or your level set in brightness.cpp) and bright = 15.

Your clock will now go to max brightness when the ambient light is at it's maximum.

If you turn the screwdriver too far the light reading will go over 600 but the bright reading will not increase.

If you want the clock to be dimmer right across the range of ambient light levels adjust the light reading to a level less than 600 at max ambient light levels.

Note when bright=15 this will output the max current to the LEDs. The max current is set by R1( RSET) on the MAX7219 module and this should be chosen for your type of LED used in the display.

 

 

 

 

 

 

 

 

Setting and Synchronising the clock

Setting                                                                                           

The clock is set in the digital clock mode by touching the bottom left sensor.

The hour digits will now flash twice a second to indicate the clock is in time setting mode.

In this mode the sensors have the following functions.

Top right - steps the hours or mins digits up

Top left- steps the hours or mins digits down

Bottom left 1sr press - enters the time setting mode selecting hours digits

Bottom left 2nd press -selects the mins digits for changing

Bottom left 3rd press -exits time setting mode

Bottom right - resets the seconds to 00

 

 

 

 

 

 

 

Synchronisation

If you have connected a 30 second master clock sync cable then the clock will jump back or forward to 30 seconds when out of time setting mode.

Just reset the seconds roughly in sync to the seconds (within 10 seconds either way) and wait for the clock to sync once out of time setting mode.

 

The animated loop below shows the Word Clock is running fast by several seconds. A synchronisation pulse is received from the Master Clock every 30 seconds synching the clock to 30 seconds.

The clock will ignore the 30 second synchronisation pulse from the Master Clock at 0 seconds.

Note from v3.3 clock synchronisation only happens when the Word Clock is 20 seconds past and 20 seconds to a minute.

In normal operation the sync pulse corrects the clock to within a fraction of a second so you will see the word "SYNC" appear with no visible correction to the seconds.

Note the synchronisation pulse is received every 30 seconds but the clock will ignore pulses at 0 seconds.

 

 

 

 

 

 

 

 

Wall Mounting

The clock is fixed to the wall by two metal picture hanging mounts.

These are recessed into the frame so the highest point of the bracket is level with the frame.

Two 2" countersunk  No6 screws sit in these bracket and hold the clock to the wall with a bit of tension so the dust seal is compressed.

 

 

 

 

 

 

 

 
 
 
Mini USB Port
I have fitted a Mini USB port on the right hand side of the clock.
I recessed the rear board to take the plug.
As space is tight inside the clock I stripped back the cable sheath and metal shielding around the 4 inner conductors.
 
Mini USB port fitted to the right side of the clock.
Also shows the trimmed white and black melamine edge trim and the rear board set back from the front board.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

PIR Controlled Display Shutdown

The PIR when enabled on the Word Clock menu (bott left PIR On, bott right PIR Off) turns on the display when movement is detected in the room.

When no movement is detected the display turns off after a set period of time.

When the PIR is enabled the displays shows "PIR ON" and when disabled (display always on) it shows "PIR OFF"

Note when the PIR is not enabled the display is always On.

 

The PIR module is fitted remote from the clock in a modified chrome light switch box.

The box is cut into a plasterboard wall and also contains a switch to turn the clock off.

 

A blank chrome switch plate and back box are used to house the power switch and PIR module.

 

 

Two holes are drilled in the blank switch plate for the power switch and PIR lens.

The hole are centre punched, pilot drilled and then drilled out just big enough for a step cutter to fit through.

The hole for the PIR diffuser is cut just big enough for the lens to go through with a friction fit.

 

 

The completed switch plate.

 

The 12 volt supply +ve is terminated on the switch with the 0v terminated on the earth screw.

12 volts is then fed back upto the clock PSU Vero board from the other side of the switch and again the earth screw.

5 volts are fed from the clock PSU Vero board to supply the PIR module. The 5 volts and PIR sensor wire to the clock terminate on PCB header sockets are is plugged into the PIR Module header pins.

The sync cable is terminated on a header pins and connects to the Master Clock 30 second sync cable via a single header socket.

 

 

The PIR has 2 trimmer resistors for adjusting sensitivity and also length of time the PIR & display stay activated.

 

 

 

 

 

PIR On Off Control

The PIR is turned On & Off in Word clock mode by touching the bottom left sensor to turn the PIR on or by touching the right sensor to turn the PIR off.

Note when the PIR is set to  off the display stays on permanently.

When you change the PIR setting the work "PIR ON" or "PIR OFF" is displayed for 5 seconds.

When initial power up the default is PIR off if you switch the PIR On straight away the display will go off as the PIR takes a minute or so to initialise before detecting movement.  

 

 

above & below "PIR ON" or "PIR OFF" are displayed for 5 seconds when PIR setting is changed.

 

 

 

 

 

Code

Program Files Modules

Brett_wordclock_v3_4.ino  Main program
brightness.cpp/.h  Brightness autoadjustment
character.cpp/.h    Character (digit) definitions
credits.cpp/.h  Ending Credits
display.cpp/.h Display & LED functions
life.cpp/.h Game of Life
serial.cpp/.h Serial port setup menu
simon.cpp/.h Simon Says game
temphum.cpp/.h  Temperature & Humidity display
tetris.cpp/.h Tetris game
time.cpp/.h Wordclock, digital clock
timeanalog.cpp/.h Analogue clock
touchbuttons.cpp/.h Touch buttons, mode switching
   

Third party libraries:

Chronodot.cpp/.h Chronodot library (for DS3231)
DHT.cpp/.h Temperature sensor library (for DHT22)
LedControl.cpp/.h LedControl library (for MAX7219)
stc.cpp/.h/platform.h Simple Tetris Clone library
pitches.h Note frequencies from the Arduino webpage

 

Download Code is currently v3.3

 

Changing The Code

When you want to make changes to my code you can compare my code to the "​Catalan Code" to make it easier to understand what changes you need to make.

I have added  //Brett to my code to highlight my changes.


 

Changing the code.

If like me you are not very good at coding just play around with the code to get an understanding of how it works.

I just save a different version each time I make even a tiny change. This way if I mess up I can go back a version and start again.

If you are keeping my linear seconds display update the version number on the display so you know what version  you are trying out each time. This is done in the module credit.h around  line 47.
 


 

It would take far too long to explain all the code but here is a very brief guide on how to change the words and when they are displayed.


 

 The WORDS are set in time.h

On line 52 we have 

const byte              w_the[3] PROGMEM = { 0,  0, 3 };

The word "THE" is described in this line with the LED location in the curly brackets "{ 0, 0, 3 }"

This is the co-ordinate of the LEDs we are gong to light when we call "w_the"

The LED matrix numbers starts top left and start from 0 so "{ 0, 0, 3 }" is the first LED across and down the 3 just means the 3 LEDs across including this one will light. As the letters THE are in this position the word "THE" is displayed.


 

Similarly  the word "TIME" would be lit by lighting the four LEDs here { 0,  4, 4 } or row 0, 5th LED along and light 4 LEDs (remember to count from 0).

Working you way down the page shows the position of all the words.


 


 

Photo 2 Controlling when words are lit 

This happens in the module time.cpp

Here you just make a list of rules to tell the clock what words to light at certain times.

Photo 2 shows part of the code starting with line 695

At midnight we want to make the clock say "THE TIME IS TWELVE OCLOCK AT NIGHT"

Midnight is 00 00 

"THE TIME IS" is always displayed from lines 687 

So we add the rules if minutes are 0, then if hours are 0 show the word for hours "TWELVE" and the word "OCLOCK" the word "AT" and the word "NIGHT"


 

If you follow the code down all the possible time combinations are covered.