Introduction: Wol Clock ESP8266-12E + 60 LED WS2812B Analogue Digital Clock
This instructable will guide you through the process of connecting the following parts to create an interesting and accurate analogue / digital clock which will automatically set the time from the internet.
Parts needed:
ESP8266-12E module (can be bought for £3 from eBay)
Ring Wall Clock 60 WS2812 (can be bought for £9 from eBay)
Connecting wires
Tools needed:
Pliers
Soldering iron
Step 1: Connecting the Ring Wall Clock 60 WS2812 Boards Terminals Together
Separate into 4 quarter circle boards and remove any rough edges or tabs from the boards.
First connect the GND terminals
Arrange two boards on a flat surface, and solder a piece of wire (I used one of the pins from the supplied connecting strip) between the GND terminals on the boards; add another board to the free end and again solder a pin between the GND terminals; repeat this until all GND terminals are joined.
At this stage, all 4 PCBs should form a ring; correct any alignment errors by heating the GND terminals with the soldering iron and adjusting to make perfect.
Next connect the 5V terminals
This time, using the soldering iron; connect wire between each of the 4 pairs of 5V terminals.
Finally, sorting the ins and outs of data
You now have power connected to all the boards, not for you to be able to control the LEDs, you will need to supply data to each LED.
Each LED has a data in pin and a data out pin. Each LED requires 24 bits (3 bytes) of data to work. The data is sent as 8 bits of green intensity, 8 bits of red intensity and finally 8 bits of blue intensity. Once the LED has received 24 bits total of data on its data pin; it refuses any more and sends any further data to the data out pin. The data out pin should be connected to the next LED's data in pin.
Take a look at the WS2812B datasheet.
Hopefully, you have worked out that for all the 4 boards to work, you need to connect three links between data in and data out. The 4th and final data in and data out pair should not be connected as these will connect to the ESP8266-12E controller board.
Attachments
Step 2: Connecting the Ring Wall Clock 60 WS2812 Boards Power and Data Terminal Wires
Using 4 pins of the supplied terminal connector, solder these at an angle so you can bring the 5V, Data in, Data out and GND terminals out to the connector without creating a short circuit.
I have shown them in the picture with my connecting wires fitted (actually you do not need data out).
I have connected the wires as below:
Red -> 5V
Blue -> Data In
Black -> GND
Step 3: Connect the LED Ring to Your ESP8266-12E Board.
Now we connect the wires from the LED ring to the ESP8266-12E board.
At the end nearest to the USB connector; you should find 5V and GND pins; connect your red and black wires here.
On the opposite side of the module, roughly half way, you should find a pin called D5; this is the data out pin from the ESP8266-12E module, and will provide data to the Data In pin on the LED ring; connect the blue wire here.
Step 4: Programming Your ESP8266-12E
I am not going to tell you how to install the Arduino software, or how to program the ESP8266-12E processor module, there are plenty of good instructables already written by very talented people; here is one which I quickly located: Programming the ESP8266-12E using Arduino software/IDE
Once you have followed the above instructable; download the Wol_Clock zip file which contains the software required to program your ESP8266-12E module. Unzip this to a location of your choice, navigate to this and open up the Wol_Clock.ino file.
Configure to connect to your WiFi
Initially, to get this working; you will need to set your network SSID and network password in the code; zoom down to lines 55 & 56 and enter the correct information within the quotes " ".
//Set your wifi details so the board can connect and get the time from the internet
const char *ssid = "WiFiSSID"; // your network SSID (name)
const char *password = "WiFiPassword!"; // your network password
Set your timezone
Configure line 52
//Set your timezone in hours difference from GMT
const int hours_Offset_From_GMT = 1;
edit the line hours_Offset_From_GMT to have your time zone offset from GMT.
Working for DST (Daylight Savings)
I have added code which now provides the correct Daylight Savings time (for Europe); this should be easy to edit to correct DST for North America.
Clock goes backwards?
Depending on which LED boards you purchase, some address clockwise, some address anti-clockwise; if your clock is going in the wrong direction; one option is to look at the time in a mirror (which admittedly is not very practical); a better solution exists on line 40. Change the line:
const char ClockGoBackwards = 1; (default)
to
const char ClockGoBackwards = 0;
One last test
Check that everything is working by clicking the "Verify" tick box in the Arduino IDE.
Hopefully the arduino IDE has done the clever work for you; but just in case it has not installed the required libraries to get this working, you will need to do this manually.
From the arduino main menu, Select Sketch -> Include Library -> Manage Libraries to bring up the library manager
In the search box, type NTP and look for an entry in the list called NTPClient; if this is not installed, install it; you should also see an entry called Time, ensure that this is installed as well.
Now change the search box to search for Neopixel, check that the entry called Adafruit NeoPixel is installed.
Hopefully, you should all be set and ready to compile and upload.
Verify that the code is in good shape to compile, and if all is good
Program the ESP8266-12E with your code
click "Upload"
You should have a good working Wol_Clock; I look forward to some of the many customisations.
Christina has already given me her input and requested the dim mode for night time, and the blinking minute hand for easy identification.
Attachments
Step 5: To Finish This Off...
Having got my 3D printer built and working; I have generated some stl files to provide you with a base for the Wol Clock; also.
Please note that I have had to modify the software to make the time 180 degrees out of phase to allow the wires to be hidden in the base; and there seems to be some new changes to the time library which has made the old code no longer compatible.
OK, I won't win any photography awards, but I will hope you appreciate the base mount which hides the wires.
65 Comments
19 days ago on Step 4
hi, everything is connected accordingly added +5:30 in const int hours_Offset_From_GMT = 1; as i m from India, the problem is that the clock is not giving the correct time. can u help me out with the problem i m facing.
thanks in advance
2 years ago
Hi Jon! Taking advantage of the pertinent question from a reader, an alternative would be to add an external RTC, such as the DS3231, for example, so that, when WiFi goes down, time is saved in the RTC. Maybe someone here has already done this and can share the code; hugs everyone
Reply 6 months ago
Yes, I'm actually working on a chicken egg incubator which also uses an ESP8266 and have created code to automatically connect to different networks. When I have time I'll incorporate that into Wol Clock.
9 months ago on Step 4
erro in code:
Compilation error: 'setTime' was not declared in this scope; did you mean 'setitimer'?
Question 10 months ago
witam wszystkich ja tez robie ten zegar ale mam problem swiecom mi sie tylko cwiartki jak by zegar nie mogl sie polaczyc z netem . jestem swiezy w te klocki prosze o pomoc kolegow
Answer 9 months ago
What output do you see in this window?
2 years ago
I have a question that maybe interests others and maybe Jon, author of the project!
I would like the IOT card to automatically connect to multiple WiFi networks. In the current code, if you take the Clock elsewhere (another house, for example), the SSID and WiFi password must be changed. It is possible, somehow, to enter multiple WiFi credentials so that the card automatically tries each password and SSID presets? Thanks
2 years ago
Greetings Jon
Honestly, this is one of the most beautiful Clocks made with RGB LED strip and WiFi that I have seen on the internet.
However, I would like to do it in a different format, that is, in a Linear (Straight) format using 2 separate LED strips, one for the Hours and one for the Minutes / Seconds. I’ve already been modifying your code, adding a second LED strip; it worked but with some dysfunction. For example, the LED strip of Minutes / Seconds, for the time being working correctly, but the strip of Hours is the following: when I turn on the clock, it starts the time correctly, lights up the "quarters" of time and the LED time (which I set to red), it lights up, for example, 7:00 am and when the next time, which is 8:00 am, the 7:00 am LED that has passed, remains on, and so on, the other (punctual) hours that are left behind, remain on.
I will leave some parts of the code that I modified, for you to take a look, please.
***********************************************************
Modified code parts
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(60, 14, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels2 = Adafruit_NeoPixel(60, 12, NEO_GRB + NEO_KHZ800);
**************
void setup() {
pixels.begin(); // Isso inicializa a biblioteca NeoPixel
pixels2.begin(); // Isso inicializa a biblioteca NeoPixel
******************
if (Phase >= 4) {
pixels2.setPixelColor(ClockCorrect(second(t)), pixels2.Color(Second.r, Second.g, Second.b)); // desenhe o ponteiro dos segundos primeiro
if (second() % 2)
pixels2.setPixelColor(ClockCorrect(minute(t)), pixels2.Color(Minute.r, Minute.g, Minute.b)); // para ajudar na identificação, o ponteiro dos minutos pisca entre a intensidade normal e meia intensidade
else
pixels2.setPixelColor(ClockCorrect(minute(t)), pixels2.Color(Minute.r, Minute.g, Minute.b)); // ponteiro dos minutos de menor intensidade
pixels.setPixelColor(ClockCorrect(((hour(t) % 12) * 5)), pixels.Color(Hour.r, Hour.g, Hour.b)); // desenhe o ponteiro das horas por último
}
SetBrightness(t); // Define o brilho do relógio de acordo com a hora
pixels.show(); // mostra todos os pixels
pixels2.show(); // mostra todos os pixels
}
Note: I am using pixels2 for the Minutes / Seconds strip.
My sincere and early thanks
Reply 2 years ago
You may check https://www.instructables.com/12Digit-Clock-With-WS2812B-NeoPixel-LED-and-DS1307/
Reply 2 years ago
Sorry friend, didn't see your answer; I'll take a look at your project, which seems to be interesting; Thank you very much
2 years ago on Step 5
OK, it is now working perfectly, not an issue with the code or instructions at all but when using 2 power supplies, 1-5V and 1-12v as I was using the ground from the 12v power supply must be connected to the GND of the Arduino. I converted to 5v LED strip as it simplified the whole operation having only one power supply.
I am making 4 of these for my granddaughters and have had a suggestion that the background LEDs be off rather than a colour, how does one do that?
2 years ago
First time project, first LED Project and first ESP8266 project. The LED strip I bought is powered by 12v not 5v but hopefully that is not a problem.
I have everything setup and the ESP8266 is connecting to my Wifi.
However the LEDs run around the face at very high speed while changing colours, they have no semblance to time because of the speed.
Obviously I have something wrong but cannot find it myself.
I suspect that I may be missing an Arduino library but have confirmed the ones identified in the Instructables including Time.
Reply 2 years ago
Seems like I have mostly solved the problem, when using 12v LED string the 12v GND needs to be connected to the Arduino GND pin. This slows down the speed to normal. Now I need to get the colours and # of LEDs per hand set the way I want them.
I also ordered a set of 5V LEDs as it will make the whole project easier.
Cheers
5 years ago
Hi
Realy a beautiful project and design, I built it, but I don´t know how to set an offset of
180 ° - has anybody changed the code?
I
have the problem that the connecting cables are in the base of the
support
How do I edit the software for correct time display?
Reply 4 years ago
Did you ever get this figured out? Having the same issue.
Reply 2 years ago
Yes, changed to
https://nerdiy.de/howto-pxlblck-die-pxlblck_ringcl...
Reply 2 years ago
Look for "Clock goes backwards?" in the main page of this instructables.
It talks about your mentioned issue. Also in the code you have to look for "ClockGoBackwards == 1" and play around it.
Hoe this may be helpful
5 years ago on Step 5
How to disable DST ?
Reply 2 years ago
IN the code, look for function "bool IsDst()" and make sure in all conditions it returns false result. This way you can force DAY LIGHT SAVINGS OFF
3 years ago
So i think the ntp pool server drops the connection after these 100 requests.
With the old code new time is request about 100 times every hour in minute 0.
void loop() {