Overview

This project uses the DS1307 Real Time Clock with an Arduino to display the time as a series of colored arcs.

With the new NeoPixel 60 Ring, we have a perfect display for presenting the time with RGB LEDs!

Hours are represented by red, minutes by green, seconds by blue. The arcs overlap and the colors mix. Minutes and seconds are each represented by a single green or blue LED, respectively. In the 12 hour version, a single red LED represent 24 minutes. The image above represents 3:48.

To build this project you will need:

If you are new to microcontrollers and Arduino, I would recommend starting out by building the circuit using the Arduino Uno and a breadboard.

If you are more familiar with Arduino, you can use a Trinket 5V and perfboard to build a more permanent electronics project.

NeoPixel 1/4 60 Ring - 5050 RGB LED w/ Integrated Drivers

PRODUCT ID: 1768
The biggest NeoPixel Ring yet! With four of these you can make a huge ring with 60 ultra bright smart LED NeoPixels are arranged in a circle with a 6.2" diameter. Each...
$9.95
IN STOCK

Adafruit DS1307 Real Time Clock Assembled Breakout Board

PRODUCT ID: 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...
$7.50
IN STOCK

Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE

PRODUCT ID: 3500
The Adafruit Trinket M0 may be small, but do not be fooled by its size! It's a tiny microcontroller board, built around the Atmel ATSAMD21, a little chip with a lot...
$8.95
IN STOCK

Building the Circuit

led_pixels_neopixelringclock_bb.png
circuit diagram using a Trinket 5V - in reality the NeoPixel Ring should be full circle
led_pixels_1768-02.jpg
the connections between each 1/4 60 Ring should look something like this

Solder 4 pieces of the the NeoPixel 1/4 60 Ring together, connecting GND to GND, 5V to 5V and DIN to DOUT. Butt the ends together and use a small piece of stripped wire as a 'bridge' to give some mechanical support.

led_pixels_1768-00.jpg
the fully constructed NeoPixel Ring should end up looking like this

Leave one pair of DIN and DOUT disconnected- this will be where the NeoPixel strand begins and ends. The microcontroller data pin will connect to the DIN here.

The ring is very delicate! So please mount onto a backing or use care when moving around!

 

NeoPixel Ring connects as follows:

  • +5V → 5V pin on Arduino or USB pin on Trinket (red wire)
  • GND → GND pin on Arduino or Trinket (black wire)
  • DIN → D3 pin on Arduino or #3 Trinket (blue wire)

DS1307 RTC connects as follows:

  • +5V → 5V on Arduino or Trinket (red wire)
  • GND → GND on Arduino or Trinket (black wire)
  • SDA → Analog 4 on Arduino or #0 on Trinket (green wire) 
  • SCL → Analog 5 on Arduino or #2 on Trinket (orange wire) 

 Assemble the DS1307 breakout following these instructions if it's not pre-assembled.

Important note: when running this code, you should probably use an external power supply (say 9VDC into the Arduino). When I ran the code on USB power, the NeoPixels drew too much current and this caused the RTC to provide strange numbers to the Arduino.

Download the code and uncompress in your Arduino sketch folder.

This Arduino sketch relies on a few Arduino libraries:

Follow the DS1307 RTC breakout tutorial to learn how to install the RTC library and set the time on the DS1307 RTC.

You will also need to install the NeoPixel library.

The DST_RTC library is used to keep the time accurate for Daylight Saving Time. 

See the following tutorial to learn how to install Arduino libraries.

Understanding the Code

 

Brightness

The clock operates with two different brightness levels, so that it can switch to a dimmer level at nighttime. The two brightness levels are DAYBRIGHTNESS and NIGHTBRIGHTNESS. These values can be 0-255 although with 0 you won't be able to see anything.

The daytime / nighttime cutoffs are set with the MORNINGCUTOFF and NIGHTCUTOFF values, which define which hours the brightness transitions take place.

Download: file
// nighttime dimming constants
// brightness based on time of day- could try warmer colors at night?
#define DAYBRIGHTNESS 64
#define NIGHTBRIGHTNESS 20

// 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

Start Pixel

You can define STARTPIXEL to define where the "midnight" point on the clock is. This can useful, for example, if you have the clock in an enclosure and you're unable to physically rotate the NeoPixel Ring.

Download: file
#define STARTPIXEL 0 // where do we start on the loop? use this to shift the arcs if the wiring does not start at the "12" point

A value of 0 would mean the colored arcs would begin and end where the DIN wire connects from the microcontroller to the NeoPixel Ring. You can change the value from 0-59 to change where the arcs begin.

Finishing It Up

This is the back of the clock, pictured here with the discontinued USB Boarduino. As stated before, this project works great with the Trinket 5VArduino UnoMetro or other Arduino compatible microcontroller board!

I used a spare circular piece of black plexi to hide the electronics behind, since I'm just hanging the clock near a desk.

If you want to you can create a more sophisticated enclosure for this clock. arradan created this enclosure to 3D print on Thingiverse!

This guide was first published on Jul 01, 2014. It was last updated on Jul 01, 2014.