Introduction: Desktop NeoPixel Clock
A couple of weeks ago, I noticed the hole in my monitor stand at work is almost exacly the same diameter as a ring of 24 NeoPixels that I had lying around. The back of the monitor faces several coworkers, so I decided to put the ring and another, smaller one to good use to make a functional clock using that space.
As I'm also a huge fan of Autodesk Circuits (truth be told, I'm one of the developers). I decided to create the entire project there and get everything working before ever touching the physical electronics. Here's the virtual circuit that I created (Press "Start Simulation" to try it out):
The outer ring represents the minutes. Since there are only 24 pixels, a three-pixel wide "window" is used, with the brightest part in the direction of the current minute. The inner ring shows the hour, and cycles once-per second. The 7-segment LED in the center shows AM/PM.
The clock uses a WiFi module to periodically synchronize the clock from the internet (using San Francisco time) . Once I was satisfied that everything worked, I got the parts to put it together and make the real thing. I have access to a laser cutter, so I used that to make the clock housing out of a few layers of 1/8" (3 mm) thick plywood. At some point in the future, I intend to consolidate the microcontroller (Arduino) and WiFi portions to use a single module like Adafruit's Huzzah module. For now, I decided to build the display as a stand-alone unit, and to breadboard the rest.
- NeoPixel ring - 24 (Adafruit.com)
- NeoPixel ring - 12 (Adafruit.com)
- Arduino Uno (Sparkfun)
- ESP8266 WiFi module (Sparkfun)
- Common-anode 7-segment LED (Jameco)
- 51Ω ¼W resistor (Jameco)
- 10kΩ ¼W resistor (Jameco)
- 20kΩ ¼W resistor (Jameco)
- Solid-core hookup wire (Jameco)
- 6-pin female header (Jameco)
- LD1086V33 voltage regulator (Jameco)
- 470µF 25V electrolytic capacitor (Jameco)
- 10µF 25V electrolytic capacitor (Jameco)
- 0.1µF ceramic capacitor (Jameco)
- Solderless breadboard (Jameco)
- 9V power adapter (Jameco)
- 1/8" plywood
- 4 20mm-long M3 machine screws
- 4 M3 nuts
- Laser cutter
- Needle nosed pliers
- Wire cutters
- Wire strippers
- Soldering iron
Step 1: The Clock Housing
The housing for the display portion of the clock is made by laser cutting five layers of 1/8" thick plywood and sandwiching them together in a particular order. The DXF file that I used as a design source is on this page. I used a 75 Watt Epilog Laser Cutter to do the cutting and etching. There are plenty of tutorials on how to use a laser cutter on this site, so I'm going to skip forward to assembling the clock pieces.
Step 2: Joining the First Two Layers
Start by placing the wooden clock face layer number side down on a surface. Fit the 7-segment display face-down in the rectangular hole as well. It acts as a guide to position the next layer. The next layer is the other one with the rectangular hole in the middle. It is positioned such that the three slots around the edge align to point at three of the holes at the outer edge of the face piece. Apply a thin layer of wood glue to the joining side of this layer, careful not to get too close to the holes/slots. Carefully put it in place, using the 7-segment display for alignment and clamp in place. Use a couple of binder clips around paper (or whatever else you have that works) to hold it while it dries.
Step 3: Joining the Next Two Layers
Once the first two layers are joined and the glue is dry, prepare three pieces of solid-core insulated wire to fit through the edge holes of the front face, run down the slot and bend up at the end of each slot as in the first picture. Each wire should be around 3 inches (80mm) in length. When in doubt, longer is better.
These wires provide power and data signals to the 24-NeoPixel ring. Although not entirely necessary, I chose to use wires with different colored insulation to help me keep track of which wire is which. I used black for ground, red for power, and white for data-in.
Strip most of the insulation off of each wire, leaving a section in the middle of each wire that is a little bit shorter than the distance from the outer hole to the inner end of the slot. Bend the wire at right angles in two places using needle-nosed pliers as in the picture such that the wire will fit through the hole, run down the slot, and bend straight up at the end of the slot.
Put these three wires in place, and remove the 7-segment LED. Find the next layer, which is the one with the two rows of 5 small holes in the center. Fit the pins of the 7-segment LED through these holes as in the picture above. You will notice three pairs of slightly larger holes elsewhere on this piece. You have the 7-segment LED positioned correctly if one of the pairs of holes is near the corner of the 7-segment with the circle.
Carefully apply glue to the remaining area of this piece, careful not to get too close to the holes, or the 7-segment LED. Align the piece so that the three wires go through the appropriate holes (see picture above), and press together, again using the 7-segment LED as a guide.
Here, you can either clamp it in place and let it dry, or save time and add the next layer and clamp both at the same time. The next layer is the C-shaped piece. It is symmetric, so apply glue to one of the sides, and put it in place, using the 4 larger holes as a guide. The open side of the "C" is in the direction of the number "9" on the front face of the clock. Clamp and allow to dry.
Step 4: Internal Wiring
Fit the 6-pin female header in place on the open side of the "C" with the exposed pins facing in. If the header is too wide, use a file to carefully file down the sides so that it fits. If your header pins are long, bend them with needle-nosed pliers as in the pictures. This will help spread them out and make soldering them easier. Bend the white (data-in) wire and the red (power) wire to overlap the outer two pins of the header. Trim them with wire cutters such that there's some overlap with these header pins, but the wires fit entirely in the "C".
Remove the 7-segment LED and cut the center pin at the top of the "8." entirely off. It is not needed, and removing it makes the soldering easier since the rest of the 4 pins in that row will be soldered together with another wire.
Put the 7-segment LED back in place in the wood. Prepare a 2" (50mm) piece of solid wire with all but 1/4" (6mm) removed. Bend the wire into an "L" shape and put it in place as in the picture above. This wire connects the top row (the one now with 4 pins) of the 7-segment LED with bottom-right pin of the LED and the third pin from the top of the header. The insulation keeps it from coming into contact with the other header pin (the fourth one from the top).
Trim the wire to length and solder it to the five LED pins and the header pin. Solder the power and data-in wires you prepared earlier to the header. This wire will be used to turn on the 5 LED segments to illuminate the letter "P", for PM.
Step 5: More Internal Wiring
Add three 3" (80mm) wires through the remaining small holes. These are the ground, power, and data-in signals for the smaller, 12 NeoPixel ring. Fortunately, they are aligned with the other ring, so the ground wires for the two rings can be joined, and the power wires can also be joined.
Start with the data-in wire (the one with the blue insulation in the pictures above). Leave enough insulation on the wire so that the metal doesn't come into contact with the existing wiring. Trim and older it to the header pin next to the data-in for the other ring (second from the right in the pictures above)
Do the same for the ground wire (the one with black insulation in the pictures above), soldering it to the header pin next to the power (second from the left in the pictures above). Bend and trim the existing ground wire for the larger ring that was added earlier so that it comes into contact with the nearby exposed portion of this wire and solder it in place.
Use a piece of wire with no insulation for the power signal. Bend and trim so that it comes into contact with the power wire from the larger ring. Solder it in place.
Add a short wire (the one with green insulation in the pictures above) to join the LED pin in the picture with the remaining header pin. This wire will later be used to illuminate the last LED segment to turn the "P" into an "A".
Trim the leads of the 51Ω resistor and solder them between the power wire and the middle pin of the 7-segment LED on the left as pictured above.
Step 6: Add the NeoPixel Rings
Flip the display over so that the side with the numbers is visible. There should now be 6 bare wires sticking out of this side. Align the 12 NeoPixel ring on the three wires closest to the center of the display, making sure that the one nearest the "12" on the clock face pases through the hole labelled, "IN". The other two wires will pass through the "PWR" and "GND" holes. Note that the hole labelled "OUT" is not used.
Do the same for the larger ring, making sure that the hole labelled, "IN" is on the outer wire nearest the "12" on the clock face. The other two wires will pass through one of the "PWR" and one of the "GND" holes.
Using needle-nosed pliers, pull up and to the side on each of these wires to hold the rings firmly in place (see second picture, above). Solder them to the rings, and trim the excess wire with wire cutters.
Step 7: Mounting the Clock
This step only applies if you happen to be mounting the clock in the open hole on the back of the stand of an Apple Thunderbolt display.
Fit the clock through the hole with the proper orientation. Put the remaining piece of cut plywood on the back so that the text is oriented properly and the holes line up. Feed the 4 bolts through the holes and secure them in place with the nuts.
Finally, connect 6 long hookup wires to the header. It's best to use different colors for each of the wires, if available.
Step 8: Wire Up the WiFi Module
As I stated at the beginning, I chose to have the Arduino and WiFi modules connected up with a solderless breadboard. At some point in the future, I expect to replace them with a single small WiFi module (like the Adafruit Huzzah) attached to the back of the clock.
I consulted this page in determining how to power the ESP8266 reliably.
Connect the all of the components up as pictured in the diagram above. Below is a short description of what each part does. The ESP8266 WiFi module operates at 3.3V. It can easily be damaged if the power voltage or data communication voltage is greater than that.
The orange wire from the Arduino is the power coming from the 9V power supply. This is fed to the input of a 3.3V regulator (LD1086V33). The regulator converts the input voltage down to the 3.3V that is needed (the red wires). The capacitors are there to ensure that the power is consistent, even when the WiFi is active and drawing a large current.
The black wires are the negative power signal (ground), that is shared by all of the electronics.
The yellow wires are the data transmit signal from the Arduino to the ESP8266 WiFi module. It is at 5V, which is too high for the ESP8266. The two resistors are used to drop this voltage down below 3.3V to make it safe for the ESP8266.
The green wire is the data coming from the ESP8266 back to the Arduino. Since the Arduino can handle the lower voltage signal, this is directly connected between the two.
Step 9: Connect the Display
Place the Arduino + ESP8266 WiFi module on the base of the monitor stand. You will need to insulate the electronics from the aluminum base in order to avoid a short-circuit. For testing, I used the bag that the 24-NeoPixel ring came in. Connect the display to the Arduino as follows:
- Arduino 5V → clock PWR
- Arduino GND → clock GND
- Arduino pin 2 → clock IN-24
- Arduino pin 3 → clock IN-12
- Arduino pin 4 → clock A
- Arduino pin 5 → clock P
Step 10: Program the Arduino
Temporarily disconnect the wire connecting to Arduino RX (pin 0). It will interfere with programming the Arduino. Connect the USB programming cable to your computer and program. Open the Arduino sketch contained on this page in the Arduino IDE on your computer. If you haven't done so already, you will need to install the Adafruit NeoPixel library. Open the Arduino project on this page in the Arduino IDE. You will need to make two changes to the program to get it to work with your WiFi. Find the lines in the program:
String ssid = ""; // TODO: Add your WiFi router name
String password = ""; // TODO: Add your WiFi password
Put your router name and router password inside the quotes "".
If you are in a time zone other than PST, you will need to make one more alteration to the program to get it to display the proper time for you. Find the line in the program:
String uri = "/actualtime.cgi?lzbc=1462518000000000";
Replace the number at the end with the number in the table below for your time zone. Here's a list of GMT time offsets around the world.
Compile and upload the program as usual.
If you have never programmed an Arduino before, you can consult this page.
Once the Arduino is programmed, reconnect the Arduino RX (pin 0) wire. The USB cable is no longer needed and can be removed.
Step 11: Try It Out
Power the Arduino using the 9V power adapter to try things out. The clock will initially power on with the center ring illuminated blue. This is displayed when the Arduino is trying to get the current time from the internet. If everything works, you should see the proper time displayed. If the the time shows up as 12:00 AM, and it is currently not 12:00 AM (What are you doing up so late?), then the time synchronization failed. Make sure that the WiFi name and password are correct, and then everything is wired correctly.
Soon, I will expand this instructable to replace the untidy Arduino and ESP8266 WiFi modules with the tidy, compact Adafruit Huzzah (which is also an ESP8266 module, but with built in power regulation).
2 People Made This Project!
We have a be nice policy.
Please be positive and constructive.