NeoPixel NTP Clock Using ESP8266

25K12218

Intro: NeoPixel NTP Clock Using ESP8266

I recently had an idea to build a clock using NeoPixel ring and the popular ESP8266 module. I am sharing the instructions for others who may want to do the same/similar and save some time.

The hardest part was getting the code right; as I was using a clone of the Adafruit NeoPixel ring, it was wired in reverse, meaning that the led's were addressed in anti-clockwise direction. I therefore had to compensate for that in the firmware.

STEP 1: About the Project

Like one of my previous projects (WiFi enabled MP3 player) I am using the Wemos D1 mini ESP8266 module, however in this project I decided to use the Arduino IDE to write the firmware. The module comes ready to be programmed this way so it saves one extra step of installing the MicroPython interpreter.

STEP 2: Parts Required

The part list for this project is very brief making it a pretty simple project.

There are many variants in types and sizes of the NeoPixel ring, I am using a clone of the Adafruit 60 led ring which is best suited for a clock. The ring is sold as 1/4 circles with 15 LED's per 1/4. These retail for approximately $10-15 in the US or you can get them for a lot cheaper from China if you are willing to wait a month or so for shipping.

STEP 3: Assembly and Wiring

I wanted to make this really simple and keep the wring to a bare minimum. So I ended up with a solution that uses just three wires. Two for the power, ground and VCC and one for data.

Assemble the Ring

The first step is to assemble the 4 1/4 rings into one full circle. At the back of the ring you should see solder pads labeled 5v, Gnd, DOUT and Din.

You need to form a full circle and solder 5v to 5v, Gnd to Gnd and DOUT to DIN all the way round accept the last section of the ring where you have to leave the DOUT and DIN separate. (see picture)

Cut, strip and solder one end of the DuPont cables to DIN, 5v and GND on the first ring. Note DIN on this ring should not be connected to the DOUT of the adjacent ring as these mark the start and end point.

Now connect the 5v and Gnd to the 5v and Gnd of the ESP8266 and the DIN from the ring to one of the digital pin of the ESP8266, I used D4 as it is right next to Gnd and 5v.

STEP 4: The Firmware Code


In keeping things simple the code for the firmware is fairly simple after going through several iterations and simplifying things as much as possible.

In use there is simply an initial step of configuring the ESP8266 module to connect to your local Wifi and from there on it works completely autonomously get it's time from an NTP server and updating the clock face accordingly. Whilst others have used a more elaborate visual display I have kept things deliberately simple. In doing so I have managed to keep the amount of current required a relatively low value so that the ring can get it's power from the ESP8266 module instead of needing an external power supply.

At any given instance there are just three LED's active, I use color to signify what each represents, Hour, Minute and second.

You will need the following libraries for everything to work.

  • NtpClientLib
  • ESP8266Wifi
  • ESP8266WebServer
  • WifiManager
  • Adafruit_NeoPixel

Most of these are available directly through the arduino IDE; However you will have to manually add the WiFi Manager library. The WiFi manager library is a very nice utility that provides WiFi configuration magic by initially setting the ESP8266 module in access point mode and serving a web page through the HTTP server that allows the user to select a local WiFi and set the password so that the ESP8266 module can reboot and connect to it.

  • Check out the details for the WiFi manager on Github

At initial setup you will need to use a smartphone or any other wifi client to connect to the clocks AP and using a browser to configure it's WiFi to act as a WiFi client. From there on it will automatically connect to WiFi and get it's time from a pool of NTP server.

check out the video to see this working.

The code has been published on My Github Repository

13 Comments

Greetings
A while ago, I loaded this sketch and compiled it correctly. Now I'm trying to load it again and it's getting a lot of errors; is even asking for a library it never asked: ESPAsyncUDP.h. I don't know if this has to do with the NtpClientLib.h library. I'm using Arduino v.1.8.8 and esp8266 version 2.5.2. I've tried other versions of esp like 2.4.1 and the latest 3.0.2 but it has other errors. Some help? Thanks
Hello, I'd really love to make your clock, but I'm having problems compiling because of the ESP8266WebServer library.

Could you offer any help, please?

Regards
Ian
Thanks for sharing
I think it should update NTP twice a day, to compensate for drift ins the ESP

Don't see any downside to that.

Hi usear,

Would you consider selling those esp8266 modules preloaded with the necessary libraries and.*.ino file, so I only have to input wifi settings via a smartphone? If so what would it cost, cause I feel the whole arduino code learning curve is quite steep for me..

Looking forward to yr reply!

Hi,

I need to test the code again, it's been a while. Once I have done that, I can make the modules available pre-programmed. regards,

That would be so awesome. Thanks for the reply, look forward to it. Had the idea to make a glow in dark pendulum board (https://youtu.be/hXOEoH5q3Hw)
with yr led clock design around it :)

Hi everyone I'm trying to build this clock but the LEDs seem to be randomly lit I use the ws2812b led i tried with several esp12 / esp7 / wemos d1 mini but nothing what could it be? Arduino does not give me errors in compilation

ESP8266-01 mit PIN 0 oder Pin 2 OK

#define PIN 0 // digital pin on ESP8266 for the NeoPixel data line

Check the wiring. The NeoPixels docs I worked from said you definitely need a capacitor to filter the noise coming through, I missed that and had similar problems with my project.

Are you using the same code or with some modifications? had to say without looking at the code and more information.

Hi, thanks - really great
For me, this watch has been working for 2 years with the Particle Photon.

Of course the solution with the ESP8266 immediately fascinated me.
I have used the ESP8266-01 and only the #define pin set to 2 and already is the thing.
But unfortunately, the hour does not. The red LED is 3 hours ahead.
Second and minute.

please Can you tell me where the error is?
Thank you Erich

(Google Translate)

As you send a serial signal, the first data corresponds to the last Led !