3d Printable LED Binary Clock

by ctbaker71 in Circuits > Clocks

1431 Views, 11 Favorites, 0 Comments

3d Printable LED Binary Clock

binary_clock.jpg
BinaryClock.PNG

I took inspiration from this Binary Clock instructables post on creating a binary clock and made one of my own design. When the LEDs are off, the face just looks like a solid sheet of black and only when they light up do you see them.

For my build, I designed a housing and face plate that is fully 3d-printable. It is the same size as a 5x7 picture frame and I used a piece of glass from a dollar store frame. I also used four buttons on the side the cycle through the colors for the LEDs displaying hours, minutes and seconds as well as to adjust the brightness of the LEDs and adjust the time by one hour for daylight savings time.

This clock uses an ESP8266 ESP-12E board to connect to the internet and get the time so you don't have a RTC clock with battery to deal with or have to adjust the time due to the RTC running a little fast or slow.

Supplies

  1. ESP8266 ESP-12E board amazon
  2. WS2812B Black 60LED + IP30 not waterproof + 1m (12mm LED spacing and 10mm strip width) [24 LEDs needed in 4 strips of 6 LEDs] aliexpress
  3. Four tactile switches (push buttons) ebay
  4. Through-Hole Resistor - 470 ohm 5% 1/4W
  5. 4700uF 10v Electrolytic Capacitor
  6. 3-pin JST SM Plug (plug into LEDs that came with one end of plug) aliexpress
  7. Power adapter barrel jack to screw terminal aliexpress
  8. 5x7 glass plate (took mine from $1 picture frame on clearance)
  9. 5V 2A power supply for the board and LEDs
  10. Misc supplies like wire, solder, glue, soldering iron, flux, etc.

Print the Clock Face Plate

faceplatetest.JPG
faceplate.JPG

First print the face plate test print to make sure the spacing for the LEDs is correct and the width of the trough that that LED strip sits in is wide enough. This would only be a problem if you use a different spec LED that I used for the build. The Fusion 360 file is supplied so you can make adjustments if so inclined.

Once you have confirmed everything is good with the test print, you can go ahead and print the entire face plate. It is designed to be printed in two colors and requires you to swap filament color after each color prints for each layer. So for three 0.2 mm layers, you are starting with white and then swapping in black and then for layer 2 you are swapping back in for white and so on until you have printed both colors for each layer. Once the letters and numbers have completed printing, you print the rest of the face plate in one color so no more filament swapping is required.

This will result in a solid monolithic face plate. There is only one layer covering the LEDs so light isn't being dimmed too much.

Wire Everything Up

ledlayout.JPG
wiring.JPG

Wiring on ESP-12E:

  1. Wire one side of hour push button to GPIO PIN 14 (D5) and the other side to GND
  2. Wire one side of minute push button to GPIO PIN 12 (D6) and the other side to GND
  3. Wire one side of second push botton to GPIO PIN 13 (D7) and the other side to GND
  4. Wire one side of DST push button to GPIO PIN 5 (D1) and the other side to GND
  5. Wire the LED data connection to the 470 ohm resistor and then to GPIO PIN 4 (D2)
  6. Wire power and ground lines from the barrel jack screw terminal to Vin and GND on the ESP-12E and wire the capacitor across the 5V and GND lines at the barrel jack screw terminal as well
  7. Wire power and ground lines from the barrel jack screw terminal to 5V and GND on the LED strip (LEDs are powered directly from the power supply and not by the ESP-12E)

Wiring the LED strips:

Cut the LED strips into four sections of 6 LEDs. Wire the 5V, GND and Data lines from section to section while paying attention to the data flow arrows on the strips. The LED data flow should match the numbering on the table shown in the graphic (goes right to left on bottom row, then left to right on the next row up and so on). I placed the LED strips in the face plate and used that as the guide for how long to make each wire connecting one strip to the next.

The first LED sits at lower right corner of the face plate when you are
looking at it when running (e.g., the right column, bottom LED of the SEC display).

NOTE: I used a three wire plug between the ESP-12E data and the POWER lines to the LED such that I can disconnect the LEDs when connecting the ESP-12E to the computer USB port for programming.

Load the Software

UPDATE: Alternative version of software is now available at this link. This version should auto adjust for DST and changes the function of the DST/Brightness Adjustment button to only adjust the brightness.


Using VSCode or similar, you can load the software from my github repository to the ESP-12E. Before writing the code to the ESP-12E, you will need to define your wifi connection and potentially adjust some of the settings described below.

Libraries that you'll need (button.h is included in the repo)

  • ESP2866WiFi.h
  • FastLED.h (version 3.1 or newer)
  • time.h

Settings to adjust in the code:

#define NIGHT_MODE 1 //Set night mode where 0 is off and 1 is on (Night mode turns the clock off at night)

#define WEEKEND_MODE 0 //Set weekend mode where 0 is off and 1 is on (Weekend mode turns the clock off on the weekends)

#define NIGHT_OFF_TIME 22 //Time that clock turns off when night mode is active

#define NIGHT_ON_TIME 7 //Time that clock turns on when night mode is active

#define MILITARY_MODE 0 //Set 24HR mode where hour is shown as 1-23 rather than 1-12 where 0 = 1-12 mode and 1 = 1-23 mode

//Your time zone

int timezone = -8 * 3600; //UTC offset * 3600

Set SSID to your wifi network name

Set PASSWORD to your wifi network password

What the four buttons do:

DST Button (DUAL MODE) = (1) press to adjust brightness and (2) hold for 5 seconds to adjust hour forward and back by one hour for daylight savings time. Brightness can only be adjusted every 7 seconds to make the dual mode work. When holding down for 5 seconds to adjust DST, the brightness will be adjusted once but will adjust back to the prior setting when the DST is changed so don't worry if LEDs go off, they'll come back on when DST adjustment triggers.

HOUR Button = cycle through six colors of the hour LEDs

MIN Button = cycle through six colors of the minute LEDs

SEC Button = cycle through six colors of the second LEDs

Attach LEDs to the Face Plate

Now that everything is wired up, you can place all of the LEDs back into the channels in the back side of the face plate. Each square LED has a corresponding "socket" they go into. There is a little bit of clearance built into the design so you can get the LED strip slightly off the left or right if you are not careful. You can power up the clock at this point to check LED placement.

When you are happy with the placement of each LED strip, secure it to the back of the face plate. Please note that I used hot glue to do this and it was a big mistake! The glue is too hot for PLA and caused warping of the face plate so you are going to want to use something else like adhesive tape, caulking, etc. but nothing too liquid as it might "leak" through the PLA and ruin the front of the clock.

Print the Housing and Back Plate

Now that you have everything set, you can go ahead and print the housing. It is designed to hold a 5x7 piece of glass and then have the face plate set in after that (again, securing the face plate to the housing using whatever solution you used to hold in the LEDs). I used hot glue here and didn't appear to run into the issue of warping because the housing is not so thin (face plate is only 0.6 mm thick). The housing has provisions for the four push buttons on the side with the thickness being 2.0 mm so the push button itself will need to be a little longer than that.

The back plate is made to have an interference fit with the housing.

The housing has a provision so you can hang the clock on the wall using a nail or similar and the housing and back plate have cut outs for routing wiring straight down or out the back depending on if it is on a desk or hanging on the wall.

Final Assembly

Lay the housing face down and check the fitment of your 5x7 glass plate. There is some slop in the sizes and it took me two tries to get one to fit correctly. Then place the fact plate with all the LEDs already wired etc and secure the face plate using hot glue or other adhesive.

Place the four buttons into their corresponding holes (DST on top and the then HR, MIN and SEC buttons in that order and hot glue them into place.

Snap on the back plate and plug the clock in, you're done!