NeoPixel Ring Clock

I recently bought a 24 LED NeoPixel Ring. These things are great and I would highly recommend you getting one as they are great fun and very easy to use. They are individual 5mmx5mm RGB LED’s with an integrated WS2812 LED driver chip. Controlling them is very simple via the Adafruit Neopixel library.

So, once I had the ring I had to decide what I was going to do with it. I messed around with demos for a while and even turned it into a Cheerlight for a while, but then decide it was a waste. So, at Medway Makers at the weekend I finally decided to make some kind of clock out of it. Not wanting to copy other Neopixel clocks I’d seen online I purposely avoided looking at those first and thought of what I could do. I decided in the end to display hours, minutes and seconds with different colours and the natural choice were RGB with red for hours, green for minutes and blue for seconds. The resultant clock looks like this.

The processor I am using is the excellent Wemos D1 Mini which is an ESP8266 wifi based unit with a huge 4M of flash ram (1M flash/3M SPIFF or 3M flash/1M SPIFF). Time is obtained over the internet from an NTP server and the code keeps track of the seconds, updating the time every hour.

The code is as follows. Please feel free to modify it and let me know what you’ve made with it.

#include <Adafruit_NeoPixel.h>

#define PIN D5

#include <ESP8266WiFi.h>
#include "TimeClient.h"

long lastUpdate = millis();
long lastSecond = millis();

String hours, minutes, seconds;
int currentSecond, currentMinute, currentHour;

char ssid[] = "xxxxxxx";  //  your network SSID (name)
char pass[] = "xxxxxxx";       // your network password

const float UTC_OFFSET = 0;
TimeClient timeClient(UTC_OFFSET);

Adafruit_NeoPixel strip = Adafruit_NeoPixel(24, PIN);

void setup()


  // We start by connecting to a WiFi network
  Serial.print("Connecting to ");
  WiFi.begin(ssid, pass);

  while (WiFi.status() != WL_CONNECTED) {

  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  updateTime() ;
  lastUpdate = millis();
  lastSecond = millis();

void loop()
  if ((millis() - lastUpdate) > 1800000) updateTime();

  if ((millis() - lastSecond) > 1000)
    strip.setPixelColor(currentSecond / 2.5, 0, 0, 0);
    strip.setPixelColor(currentMinute / 2.5, 0, 0, 0);
    strip.setPixelColor(currentHour * 2, 0, 0, 0);;
    lastSecond = millis();
    if (currentSecond > 59)
    { currentSecond = 0;
      if (currentMinute > 59) {
        currentMinute = 0;
        if (currentHour > 12) currentHour = 0;
    String currentTime = String(currentHour) + ':' + String(currentMinute) + ':' + String(currentSecond);

    strip.setPixelColor(currentSecond / 2.5, 0, 0, 255);
    strip.setPixelColor(currentMinute / 2.5, 0, 255, 0);
    strip.setPixelColor(currentHour * 2, 255, 0, 0);;


void updateTime() {
  hours = timeClient.getHours();
  minutes = timeClient.getMinutes();
  seconds = timeClient.getSeconds();
  currentHour = hours.toInt();
  if (currentHour > 12) currentHour = currentHour - 12;
  currentMinute = minutes.toInt();
  currentSecond = seconds.toInt();
  lastUpdate = millis();

It is highly unlikely I will keep the ring as a clock so this is just a proof of concept more than anything. However, I think with the ring underneath a piece of etched acrylic it would look great. Another option would be to get another 2 rings of differing sizes to go inside each other with the separate ‘hands’ on each ring.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.