Introduction: NeoPixel NTP Clock Using ESP8266

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Comments

artic1980 (author)2017-05-17

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

diverich (author)artic19802017-09-20

ESP8266-01 mit PIN 0 oder Pin 2 OK

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

kturpin (author)artic19802017-06-26

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.

usear (author)artic19802017-06-20

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

diverich made it! (author)2017-09-20

Wie man sieht ist es 10:10:26

Minute und Sekunde passt, die Stunde ist aber auf 5 Uhr ???

diverich (author)diverich2017-09-20

Alles bestens !

// NTP.begin("es.pool.ntp.org", -8, true); // get time from NTP server pool.
NTP.begin("es.pool.ntp.org", +1, true); // get time from NTP server pool.

siehe:
https://de.wikipedia.org/wiki/Network_Time_Protoco...

diverich (author)diverich2017-09-20

Eine Stunde später: IRRTUM!

Die Stunde stand nicht auf 5 Uhr. Die Stund stand auf 1 Uhr

Jetzt ist es 11:00 - es wird 2:00 angezeigt

Also ist die Anzeige 3 Stunden voraus!

Noch eine Erkenntnis: Die Stunden LED springt in der Minute 20, 30, 40, 50 jeweils eine Minute weiter.

Bei mir aber leider 3 Stunden zu spät!

diverich (author)2017-09-19

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)

Jesper MartinS (author)2017-03-19

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

usear (author)Jesper MartinS2017-06-20

Don't see any downside to that.

rafununu (author)2016-12-22

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