# NeoMatrix 8x8 Word Clock

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/026/332/medium800/led_matrix_Word_Clock_iso_lit_ORIG_01_%281%29.jpg?1436389040)

Are you fascinated with the passage of time? Do you want a stylish, modern and functional timepiece to add to your clock collection? The word clock is a one-of-a-kind time telling device, using a grid of letters to spell out the time. While you could spend thousands&nbsp;of dollars on [other versions of this idea](http://store.biegertfunk.com/us/), this project is an inexpensive and quick&nbsp;way to build one for yourself.

The word clock uses the&nbsp;[Adafruit NeoPixel NeoMatrix 8x8](https://www.adafruit.com/product/1487) to create a colorful word clock! As such, it features an original 8x8 layout of letters in order to form all of the different time phrases. You can power it over USB so it makes for a great desk time-keeper.&nbsp;This clock also uses the [DS1307 Real Time Clock breakout kit](https://www.adafruit.com/products/264)&nbsp;so it'll keep time even while unplugged! The DS1307 has an accuracy of +/- 2 seconds per day, and&nbsp;the clock tells the time with a precision of five minutes. The microcontroller board we're using is the [Pro Trinket 5V](https://www.adafruit.com/products/2000) but you can swap it with any Arduino compatible or microcontroller that can use I2C and NeoPixels.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/540/medium800thumb/led_matrix_WordClockGIF.jpg?1448319097)

# NeoMatrix 8x8 Word Clock

## Parts List

## Parts

- [Trinket Pro 5V](https://www.adafruit.com/product/2000)
- [DS1307 Real Time Clock breakout board](https://www.adafruit.com/product/3296)
- [NeoPixel NeoMatrix 8x8](https://www.adafruit.com/products/1487)
- Wordclock laser-cut acrylic enclosure
- 4-40 black nylon screws (x14)
- 4-40 black nylon nuts (x14)
- [2-56 black SS machine screws](http://www.mcmaster.com/#91249a058/=xya2h9)&nbsp;(x2)
- 2-56 Black SS Hex Nut (x4)&nbsp;
- Wires, [silicone cover are easiest to use](https://www.adafruit.com/product/1970)but [just about any ~22-26 AWG wires will do](https://www.adafruit.com/products/1311)
- [MicroUSB cable](https://www.adafruit.com/products/2008)&nbsp;(for uploading the code and powering the clock)
- [5V 1A USB port power supply](https://www.adafruit.com/products/501)&nbsp;(if you don't want to just power the clock from your computer)

![](https://cdn-learn.adafruit.com/assets/assets/000/026/251/medium800/led_matrix_Word_Clock_kit_01_ORIG.jpg?1436289986)

### Adafruit NeoPixel NeoMatrix 8x8 - 64 RGB LED Pixel Matrix

[Adafruit NeoPixel NeoMatrix 8x8 - 64 RGB LED Pixel Matrix](https://www.adafruit.com/product/1487)
Put on your sunglasses before wiring up this LED matrix - 64 eye-blistering RGB LEDs adorn the NeoMatrix for a blast of configurable color. Arranged in an 8x8 matrix, each pixel is individually addressable. Only one microcontroller pin is required to control all the LEDs, and you get 24 bit...

In Stock
[Buy Now](https://www.adafruit.com/product/1487)
[Related Guides to the Product](https://learn.adafruit.com/products/1487/guides)
![Adafruit NeoPixel NeoMatrix 8x8 - 64 RGB LED Pixel Matrix lit up rainbow](https://cdn-shop.adafruit.com/640x480/1487-00.jpg)

### Adafruit DS1307 Real Time Clock Assembled Breakout Board

[Adafruit DS1307 Real Time Clock Assembled Breakout Board](https://www.adafruit.com/product/3296)
This is a great battery-backed real time clock (RTC) that allows your microcontroller project to keep track of time even if it is reprogrammed, or if the power is lost. Perfect for datalogging, clock-building, time stamping, timers and alarms, etc. The **DS1307** is the most...

In Stock
[Buy Now](https://www.adafruit.com/product/3296)
[Related Guides to the Product](https://learn.adafruit.com/products/3296/guides)
![Angled shot of a Adafruit DS1307 Real Time Clock Assembled Breakout Board.](https://cdn-shop.adafruit.com/640x480/3296-03.jpg)

## Tools

- a computer which can program the Trinket Pro 5V
- [a soldering iron](https://www.adafruit.com/products/1204)
- [solder](https://www.adafruit.com/products/2473)
- [wire strippers](https://www.adafruit.com/products/527)
- [diagonal cutters](https://www.adafruit.com/product/152)
- [small flathead screwdriver](https://www.adafruit.com/products/424)&nbsp;(2.4mm)

# NeoMatrix 8x8 Word Clock

## Circuit Assembly

## Overview

This circuit stays a bit more compact by having the DS1307 RTC breakout soldered directly onto the Pro Trinket 5V. This makes the reset button on the Pro Trinket 5V more difficult to access, but you can still enter bootloader mode by using tweezers to push the button or just by unplugging and plugging the Pro Trinket 5V into the USB port. When the Pro Trinket 5V first powers up, it will be in bootloader mode.

You don't have to do this, it simply makes the circuit assembly more compact by using **A2** and **A3** as power pins (The DS1307 is powered by turning **A2** low and **A3** high in the Arduino code.) You can also just freewire the RTC breakout.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/318/medium800/led_matrix_wordclock.png?1436307866)

 **DS1307 Real Time Clock breakout board**

Start by assembling the [DS1307 Real Time Clock breakout board](../../../../ds1307-real-time-clock-breakout-board-kit)&nbsp;by following&nbsp;[this learn guide](../../../../ds1307-real-time-clock-breakout-board-kit), if you don't have the [newer pre-assembled version](https://www.adafruit.com/product/3296). You only need to solder in the male headers for GND, 5V, SDA and SCL. You can leave off SQW since it isn't used and the header won't fit nicely on top of the Pro Trinket. If you do solder it in, you can clip the bottom lead off.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/246/medium800/led_matrix_IMG_0493.jpg?1436287935)

Once the DS1307 breakout is assembled with headers, you can solder it on top of the Trinket Pro 5V so that the DS1307 GND lines up with the Pro Trinket A2, 5V with A3, SDA with A4 and SCL with A5. Make sure the boards are lined up correctly! SDA and SCL need to be connected to A4 and A5, respectively.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/248/medium800/led_matrix_IMG_0498.jpg?1436288119)

Solder the DS1307 RTC board onto the Pro Trinket 5V and then clip the excess leads.

 **NeoPixel NeoMatrix 8x8**

Connect the NeoMatrix GND to the Trinket Pro GND, 5V to 5V and DIN to Pin 8. Cut the wires 5-8 inches or 13-20 centimeters long. Solder the wires into the back of the NeoMatrix so that the wires won't be visible from the front.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/249/medium800/led_matrix_IMG_0488_cropped.jpeg?1436288431)

Here are the connections into the Pro Trinket 5V:

![](https://cdn-learn.adafruit.com/assets/assets/000/026/250/medium800/led_matrix_IMG_0494.jpg?1436288538)

And this is what the finished circuit should look like!

![](https://cdn-learn.adafruit.com/assets/assets/000/026/247/medium800/led_matrix_IMG_0489.jpg?1436288060)

# NeoMatrix 8x8 Word Clock

## Uploading Code

Make sure to use [Arduino IDE 1.6.4 or higher](https://www.arduino.cc/en/Main/Software)&nbsp;and follow [this tutorial](../../../../add-boards-arduino-v164)&nbsp;to install the Adafruit boards.

Download [the code](https://github.com/andydoro/WordClock-NeoMatrix8x8)&nbsp;from github by clicking&nbsp; **Download ZIP**.&nbsp;Uncompress the file and copy the folder to your Arduino sketchbook folder.

You will also need to install some Adafruit Arduino libraries. Follow [this tutorial](../../../../adafruit-all-about-arduino-libraries-install-use)&nbsp;if you are unfamiliar with how to do this. You need to install the following Adafruit Arduino libraries:

- [RTClib](https://github.com/adafruit/RTClib)
- [DST\_RTC](https://github.com/andydoro/DST_RTC)
- [Adafruit\_GFX](https://github.com/adafruit/Adafruit-GFX-Library)
- [Adafruit\_BusIO](https://github.com/adafruit/Adafruit_BusIO)
- [Adafruit\_NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel)
- [Adafruit\_NeoMatrix](https://github.com/adafruit/Adafruit_NeoMatrix)

Once that is done, open the sketch and select **Tools →&nbsp;Board&nbsp;→&nbsp;Pro Trinket 5V/16MHz (USB)**. See if the code compiles. If the libraries aren't installed correctly you will see errors.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/294/medium800/led_matrix_Screenshot_2015-07-07_15.23.32.png?1436298945)

Put the Pro Trinket into bootloader mode either by unplugging and replugging the Pro Trinket into the computer with your MicroUSB cable or by hitting the reset button. The reset button can be difficult or impossible to access if you've soldered the RTC on top or if you've already installed the circuit into the enclosure! So I find plugging the board into USB to work best.

When the red LED on the Pro Trinket is pulsing, the board is in bootloader mode.&nbsp;Once you're in bootloader mode, upload the code! If everything was done correctly, it should start telling you the time!

&nbsp;

# Understanding the Code

## &nbsp;

## Startup Sequence

When the clock starts up, all of the individual words will light up sequentially during the startup sequence. This sequence is defined by the `flashWords()` function in the `setup() `function.

## &nbsp;

## Setting the Time

The first time the code is run, the time on the RTC module will be set to the time that the code was compiled on your computer.

```cpp
if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(__DATE__, __TIME__));
    // DST? If we're in it, let's subtract an hour from the RTC time to keep our DST calculation correct. This gives us
    // Standard Time which our DST check will add an hour back to if we're in DST.
    DateTime standardTime = RTC.now();
    if (dst_rtc.checkDST(standardTime) == true) { // check whether we're in DST right now. If we are, subtract an hour.
      standardTime = standardTime.unixtime() - 3600;
    }
    RTC.adjust(standardTime);
  }
```

If you need to reset the time, this can be done by commenting out the **if statement** here but leaving in the line:

```cpp
RTC.adjust(DateTime(__DATE__, __TIME__));
```

Since this clock only displays the time within five minutes, some find it helpful to add 2.5 minutes (or 150 seconds) to the actual time to give a closer account of the time.

```cpp
// get the time
theTime = dst_rtc.calculateTime(RTC.now()); // takes into account DST
// add 2.5 minutes to get better estimates
theTime = theTime.unixtime() + 150;
```

## Daylight Saving Time

Do you live in a territory that observes&nbsp;[daylight saving time](https://en.wikipedia.org/wiki/Daylight_saving_time) (DST)? If you do, you usually have to reprogram your clocks twice a year! This clock includes some code so that the adjustments are made automatically. The code follows&nbsp;[the current rules for DST in the USA](https://en.wikipedia.org/wiki/Daylight_saving_time_in_the_United_States) and Canada. If you live somewhere that follows different DST rules you may be able to modify the code to suit your rules— just look in the DST\_RTC&nbsp;library functions. Wikipedia has [a great reference on daylight saving time rules](https://en.wikipedia.org/wiki/Daylight_saving_time_by_country).

If you live in a territory that doesn't observe daylight saving time, just alter the following line by changing the **1** to **0**.

```cpp
#define OBSERVE_DST 1
```

The daylight saving time code works by keeping the real time clock on "standard time" and checking to see if the current date falls within daylight saving time. If the date falls within daylight saving time, an hour is added to the displayed time to convert from standard time to daylight saving time.

&nbsp;

## Brightness Adjustment

The clock is programmed to change brightness based on the time of day, operating at a lower brightness at nighttime. You can change these settings in the code.

**DAYBRIGHTNESS** is the brightness level during the day, **NIGHTBRIGHTNESS** is the brightness level during the night. Any number between 0-255 is acceptable, but at 0 you won't see anything! 255 is maximum brightness.

**MORNINGCUTOFF** and **NIGHTCUTOFF** set which hours the clock will operate at **DAYBRIGHTNESS** and **NIGHTBRIGHTNESS**. These hours are for a 24 hour clock, so 22 would be 10pm. Between midnight and 1am, the hour is 0.

```cpp
// brightness based on time of day- could try warmer colors at night?
#define DAYBRIGHTNESS 80
#define NIGHTBRIGHTNESS 40

// cutoff times for day / night brightness. feel free to modify.
#define MORNINGCUTOFF 7  // when does daybrightness begin?   7am
#define NIGHTCUTOFF   22 // when does nightbrightness begin? 10pm
```

If you don't want the clock to change brightness throughout the day, you can also just comment out the&nbsp;**adjustBrightness()** function in the main **loop()**.

## &nbsp;

## Color Shifting Speed

The speed at which the colors shift is controlled with a delay in milliseconds defined as **SHIFTDELAY**. To speed up&nbsp;the color shifting, decrease the number. To slow down the color shifting, increase the number.

```auto
#define SHIFTDELAY 100   // controls color shifting speed
```

## &nbsp;

## Monochrome Mode

Maybe the constant color shifting makes you queasy. You can simply run the clock to light the display in a single color.

First, we define that color- in this case white:

```cpp
// if you want to just run the clock monochrome
#define WHITE 200, 255, 255
```

255, 255, 255 would be pure white, but with RGB LEDs this can look a little purple so you can try adjusting the numbers.&nbsp;

Now in the colorFunctions tab, edit the two lines which set the Pixel color. Comment out the longer line and uncomment out the shorter line.

```cpp
//matrix.setPixelColor(i, Wheel(((i * 256 / matrix.numPixels()) + j) & 255));
matrix.setPixelColor(i, WHITE);
```

# NeoMatrix 8x8 Word Clock

## Enclosure Assembly

Now that your circuit is complete, it's time to assemble&nbsp;the laser cut enclosure. You'll need to find a laser-cutting shop, hacker space or other friend with a laser cutter to cut out the pieces. [You can find the files to cut in this github repository](https://github.com/fredvomjupiter/WordClock-NeoMatrix8x8), use 1/8" clear and black acrylic - or get creative and do something else!

Start by attaching the neopixel matrix to the acrylic plate that will hold it in place within the enclosure.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/252/medium800/led_matrix_IMG_0501.jpg?1436290544)

There are four screws that hold it in place.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/026/253/medium800/led_matrix_IMG_0503.jpg?1436290559)

Now take the back panel and attach the stainless steel machine screws which will hold the Pro Trinket in place.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/254/medium800/led_matrix_IMG_0508.jpg?1436290588)

Attach&nbsp;the Pro Trinket to the back plate, making sure the screws are tightened down firmly.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/255/medium800/led_matrix_IMG_0509.jpg?1436290604)

Connect the neopixel matrix to the back plate with&nbsp;the&nbsp;side panel, being careful to use&nbsp;the one with the hole for the micro USB.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/256/medium800/led_matrix_IMG_0510.jpg?1436290909)

Now you can add the other side panel and the top and bottom pieces, attaching each with the black nylon screws as you go.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/257/medium800/led_matrix_IMG_0512.jpg?1436290933)

![](https://cdn-learn.adafruit.com/assets/assets/000/026/258/medium800/led_matrix_IMG_0513.jpg?1436290949)

Once all the clear acrylic pieces are put together, you are ready to&nbsp;add the pixel guard and diffuser.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/259/medium800/led_matrix_IMG_0514.jpg?1436290965)

Put&nbsp;the pixel guard in place on top of the neopixel grid. This will help contain the light from each pixel, making&nbsp;each letter on your clock crisper and easier to read.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/026/651/medium800/led_matrix_IMG_0977.jpg?1437497889)

If you would like to add a diffuser, now is the time. Diffusers are used to spread out the light from the neopixels and make the text on the faceplate easier to read.&nbsp;

You can make a diffuser from a plain sheet of paper, or any other material that will even out the bright light from the neopixels. Just trace the outline of the neopixel matrix and cut it out.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/265/medium800/led_matrix_IMG_0520.jpg?1436291141)

Place the diffuser on top of the neopixel matrix.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/026/261/medium800/led_matrix_IMG_0521.jpg?1436291068)

Now you are ready to attach the faceplate.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/271/medium800/led_matrix_IMG_0462.jpg?1436295106)

Before putting the faceplate in place, pull the protective paper cover off the faceplate. Any letter pieces should get pulled out along with the paper.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/026/272/medium800/led_matrix_IMG_0464.jpg?1436295156)

Use tweezers to poke out any bits of letters that don't fall out when the paper is pulled off.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/262/medium800/led_matrix_IMG_0522.jpg?1436291090)

Now you can screw down&nbsp;the faceplate onto the enclosure, sealing the diffuser inside.

Use the final four screws to affix the faceplate to the enclosure.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/263/medium800/led_matrix_IMG_0517.jpg?1436291104)

![](https://cdn-learn.adafruit.com/assets/assets/000/026/273/medium800/led_matrix_IMG_0528.jpg?1436295489)

Your wordclock is assembled! Revel in your accomplishment.


## Featured Products

### Adafruit NeoPixel NeoMatrix 8x8 - 64 RGB LED Pixel Matrix

[Adafruit NeoPixel NeoMatrix 8x8 - 64 RGB LED Pixel Matrix](https://www.adafruit.com/product/1487)
Put on your sunglasses before wiring up this LED matrix - 64 eye-blistering RGB LEDs adorn the NeoMatrix for a blast of configurable color. Arranged in an 8x8 matrix, each pixel is individually addressable. Only one microcontroller pin is required to control all the LEDs, and you get 24 bit...

In Stock
[Buy Now](https://www.adafruit.com/product/1487)
[Related Guides to the Product](https://learn.adafruit.com/products/1487/guides)
### Adafruit DS1307 Real Time Clock Assembled Breakout Board

[Adafruit DS1307 Real Time Clock Assembled Breakout Board](https://www.adafruit.com/product/3296)
This is a great battery-backed real time clock (RTC) that allows your microcontroller project to keep track of time even if it is reprogrammed, or if the power is lost. Perfect for datalogging, clock-building, time stamping, timers and alarms, etc. The **DS1307** is the most...

In Stock
[Buy Now](https://www.adafruit.com/product/3296)
[Related Guides to the Product](https://learn.adafruit.com/products/3296/guides)
### Adafruit Pro Trinket - 5V 16MHz

[Adafruit Pro Trinket - 5V 16MHz](https://www.adafruit.com/product/2000)
 **Deprecation Warning: The Pro Trinket bit-bang USB technique it uses doesn't work as well as it did in 2014, many modern computers won't work well. So while we still carry the Pro Trinket so that people can maintain some older projets, we no longer recommend it.** Please...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2000)
[Related Guides to the Product](https://learn.adafruit.com/products/2000/guides)

## Related Guides

- [LED Campfire](https://learn.adafruit.com/led-campfire.md)
- [LED Art with Fadecandy](https://learn.adafruit.com/led-art-with-fadecandy.md)
- [Mindfulness Clock OF DOOM](https://learn.adafruit.com/mindfulness-clock-of-doom.md)
- [Animated Scrolling "Mario Clouds" TFT Jewelry](https://learn.adafruit.com/scrolling-mario-clouds-tft-jewelry.md)
- [Wizzy: A Needle Felted Cat](https://learn.adafruit.com/wizzy-a-needle-felted-cat.md)
- [The PICsellator](https://learn.adafruit.com/the-picsellator.md)
- [Adding Third Party Boards to the Arduino v1.6.4+ IDE](https://learn.adafruit.com/add-boards-arduino-v164.md)
- [Square NeoPixel Display with Black LED Acrylic](https://learn.adafruit.com/sqaure-neopixel-display-with-black-led-acrylic.md)
- [MicroPython Displays: Drawing Text](https://learn.adafruit.com/micropython-displays-drawing-text.md)
- [Portable Trellis Sound Board](https://learn.adafruit.com/portable-trellis-sound-board.md)
- [Talking d20 20-Sided Gaming Die](https://learn.adafruit.com/talking-d20-20-sided-gaming-die.md)
- [DS1307 Real Time Clock Breakout Board Kit](https://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit.md)
- [Ray Gun Blaster](https://learn.adafruit.com/ray-gun-blaster.md)
- [Fiddy - the FTDI Clip](https://learn.adafruit.com/fiddy-ftdi-pogo-pin-clip.md)
- [I2C Addresses and Troublesome Chips](https://learn.adafruit.com/i2c-addresses.md)
