As an entrepreneur, I'm always looking for great projects to share. Myself and two other classmates recently put together a project for our Master's of Engineering program in Technical Entrepreneurship, and we're thrilled to share our vision with you. Remember that old Connect 4 game sitting in your basement/closet/chest/Batcave? You've always wanted to upcycle that into a functioning binary clock utilizing the awesome powers of an Arduino, haven't you? Of course you have - well, you're in the right place!
This is a great weekend project that will provide you with a sleek and nostalgic binary clock all at once. We focused on recycling every part of the Connect 4 game to exemplify our "green" standards, and be as creative as possible. The Connect 4 works superbly in displaying a binary clock because it has perfectly rounded holes to showcase the LED-based binary numbering system.
You don't need many supplies to make this binary clock, and it's a great way to utilize an old Connect 4 game if you've lost some of the pieces, or simply want to show off your mad creative skills. And don't worry about the coding - which we struggled against in an epic battle between sanity and madness - we already have it laid out for you! There's not much of a time commitment and a fun result is waiting for you, so let's get started!
Step 1: Materials
Difficulty Range = Moderate
Time = 2-3 hours
Here's what you'll need to build your very own Connect 4 Binary Clock:
- Connect 4 game (the board is most important, if you don't have the chips or box, that's still fine)
- Drill Bits
- Arduino Uno (or equivalent)
- 7 Red LED's
- 6 Super-bright Green/Yellow LED's
- 13 LED Holders
- Soldering Iron
- Electrical Tape
- Wire strippers
- Wire cutters
- Super glue
- 13x 220 Ohm Resistors
- Any blade (though a box cutter works best)
*Note: Keep in mind that red LED's emit a brighter light than all others. Therefore, we need to up the brightness of the other LED's, so that they'll match the brightness of the red ones. This is why we need to buy super-bright LED's to counter the red LED's. We unfortunately made the mistake of not doing this, and the light wasn't bright enough. However, our errors are your knowledge!
Step 2: Explaining Binary
Don't get freaked out - binary isn't as hard as it seems, especially in clock-format. Take a look at the pictures - you'll notice that the clock is formatted into four columns, and four rows. Each row corresponds to an increasing number, doubling from 1 to 2 to 4 to 8. The columns are grouped into two sets - the hours (left two columns), and the minutes (right two). Let's take a look at the minute columns on the right:
The left column corresponds to the first digit in the minute readout (i.e. the "2" in 25 minutes, or the "5" in 51 minutes) - this is why the multiplier of "x10" is noted. The right column depicts the second digit (i.e. the "5" in 25 minutes). When multiple LED's are lit in a column, simply add these numbers together to get the total. For example, in the minutes column, in the "x10" column, if the "2" LED is lit, and in the "x1" column, the "8" and "1" LED's are lit, the resulting digit is 20+8+1 = 29 minutes. The same logic is applied to the hours column (note that there isn't an LED for the "4" row for the hours digit - this is because, even on a 24-hour clock, there's no need to go above the 20's!).
You'll also need to know that this clock is a 24-hour clock, not your typical 12-hour AM/PM clock. The easiest way to decipher this is to subtract 12 from the hours if the clock's additive total is between 13 and 24. More on this later when we start using the Arduino!
Although the explanation is pretty long, it's just simple addition & subtraction. Use that elementary school knowledge and you'll be a whiz in no time! You'll find three examples in this step to help you get the hang of reading a binary clock. Check out the pictures, and quiz yourself. Answers are below (no peeking):
Answer #1: 14:23 -or- 2:23pm
Answer #2: 03:39 -or- 3:39am
Answer #3: Trick question! Though the hour number is correct (it reads "22," which is 10pm), the minute hand is impossible in a binary clock. If we were to sum the numbers, it would read "67 minutes," which of course is greater than 60, and hence impossible.
Step 3: Setting Up & Assembly
How are we going to make this clock stand, you ask? The answer is simple - we're going to utilize every part of the game...including the packaging! Take the Connect 4 game board and place it on its side and set it square to the bottom of the Connect 4 game box (we set the board on its side because that allows us to create a symmetrical face - if you use the board in its original setup, you would have to offset the clock to the left or right because there is an odd number of vertical columns). Ensuring that the game board is squared up to the game box, mark the center of the 13 holes noted in the second image in this step - If you don't understand why we marked the holes in this specific orientation, please refer back to the previous step that explains how to read a binary clock.
You will next want to find a drill bit that most closely matches the threaded part of the LED holder. Keep in mind that you can always re-drill a hole with a larger bit so err on the side of caution.
Now get that drill! Insert the bit and drill holes in the marks you previously made on the Connect 4 box. Make sure you go completely through the box so that the LED holders will have no problem fitting flush to the box.
Step 4: LED Holders
Alright, pick up the LED holder now and put down the LED attached to the rubber stopper. Remember those nice holes that you drilled into the Connect 4 box? It's time to put the LED holder through the holes so that the thread is on the inside part of the box. Hopefully the LED holder fits and you didn't pick a drill bit that was too big! Next tighten down the nut so it is flush with the box.
Now you can take the LED attached to the rubber stopper and place it in the holder. Make sure to push the rubber stopper into the LED holder until it can't go any further.
Before we move on to the next step, let's perform one necessary task that will save us time later - let's test the LED's to ensure that they function. We used a 3.5V battery to test out our LED's - just touch the positive and negative leads to their respective sides on the battery and watch it light up! As long as all the LED's light up, you're ready to move on to the next step!
Step 5: Building the Breadboard
The wiring in this project is actually quite simple, and doesn't require any knowledge of electrical engineering at all! Let's assemble that circuit:
Get your breadboard out (this is going to control all the LED's in our clock), and grab your 220 Ohm resistors. Using the wire snips, we recommend cutting the legs of each resistor down to size (about half). This ensures that none of the resistors snag on any of the other wires, or short the circuit. Push the resistors into the breadboard (we separated the resistors by a single rail in order to make wiring easier, straddling the "valley" in the breadboard. Though this isn't necessary, it allows us to gap that valley and connect both the top and bottom of the breadboard's rails, giving us more space to wire up components later on). Now look on the back - you should see some adhesive taping. Remove the protective film, and attach the breadboard to the Connect 4 box (see picture). Try to center it along the LED's we inserted in the previous steps. In the case that your breadboard does not have an adhesive backing, simply glue it to the board!
Now that the breadboard is attached to the box, get your wire out and start measuring a positive (red) and negative (black) length of wire from each resistor to each LED. You must wire the positive terminal of each LED to one of the 13 resistors in the breadboard. The ground lead of the LED can be wired to the universal ground rail on the breadboard. After the wires are measured, stick one end into the breadboard and twist the other end around the appropriate LED lead.
The way you wire the circuit is extremely important. From the point of view of the back of the box (looking at the side with the LED leads coming out), the left-most resistor (dubbed #1), should be wired to the bottom LED in the left-most column. Resistor #2 should be wired to the 2nd LED up that same column, and so forth. You want to work up and complete wiring each column before moving from left to right.
Step 6: Soldering (optional)
Now that we've wired links from the breadboard to each LED, we want to ensure none of the wiring will shift around or disconnect. To do this we will put a small piece of solder at the base of the twist we made. After applying the solder, it is wise to cut the ends of the wire - trimming about half of the connection with the wire snips will work perfectly. This will avoid poking your eyes or fingers as we work through the rest of the project.
Step 7: Attach the Connect 4 Board
We want to square up the bottom of the box with the Connect 4 board, leaving the feet pointing off to either the left or right (your choice). On most Connect 4 boards, the feet of the board are not flush with the rest. We want to solve that problem so everything looks aesthetically pleasing!
Take a Sharpie and trace around the outside of the feet. Once done, grab any available blade and cut along the trace - don't worry about the cut being perfect - any imperfections are going to be hidden behind the board when we glue it down. This will allow the Connect 4 board to lie flush with the board. Applying a small amount of super glue to the sides of the Connect 4 where it meets the box will ensure it will not move, and make a sturdy base for our binary clock.
Step 8: Programming the Arduino
Now don't be scared - Arduino programming is actually pretty easy, but we've been kind enough to supply you with the code, so you won't have to program a thing. After numerous grueling attempts at creating a code from scratch, and even more abysmal failures later, we found a delightful code courtesy of fellow Instructable member cwik! Head over to his page and check out some pretty neat projects.
Download the code provided in this step, and open it up in as a text file. Open up the Arduino sketch environment, and paste all of that code into a new Arduino sketch. If you don't have the Arduino software, you can download it here. Don't worry, it's free - isn't open-source awesome?
Now here comes the only part where you have to look at the code. Experienced hackers will notice that there's a lot of code that is pretty much unnecessary, as cwik is utilizing potentiometers, analog meters, switches, and other awesome stuff. Don't worry, we're not going to use any of that, and the code will perform perfectly regardless. Scroll down - about 1/4 of the way down the code - until you find the void setup() function. In that function, at the bottom, you'll see the following three lines of code:
// initialize clock variables
m_lastTick = 0;
setTime(0, 0, 0);
This is where we're going to input the current time of day. The last line, "setTime(0,0,0):" is setup so that we can input whatever time we want, in the format of "setTime(Hour, Minute, Second);". Take a look at your computer, watch, sundial or clock and input the time. Keep in mind that this is a 24-hour clock, not a 12-hour, so you'll need to enter it army-style. We've heard many "best ways" to get from army-time to the 12-hour clock, but its really as simple as subtracting 12 from the hour. For example, if the clock reads 18:35, it's 6:35pm (18-12 = 6), or if it's 23:10, its 11:10pm (23-12 = 11). So, do some quick addition/subtraction, and input your time into this field, and upload that code to your Arduino board. Isn't math great?
That wasn't so painful now was it? Once the code has been uploaded, grab your Arduino (unplug it from the computer - don't worry, the code will stay stored in the micro-processor), some wire, and head back to the Connect 4 board. We're back in hardware mode.
Step 9: Hooking Up the Arduino
Cut 14 pieces of wire from your spool, ~6" in length, and strip off about 1/2" on each end of each wire. Take one of the wires and connect the grounding rail on the breadboard to the ground pin (GND) on the Arduino. Take the first 13 wires, and hook one end directly into the digital output pins on the Arduino, from pin #1 to pin #13. Keep the wires nice and neat, because the next step matters!
Take the wire from pin #1, and connect it to the breadboard rail for the bottom-most, left-most LED (we're facing the back of the box here, the side with the breadboard and LED leads). Then take the second wire from pin #2, connect to the rail for the second LED up on the left-most column, then wire from pin #3 for the third up on the left-most column.....and so on, working your way up each column before proceeding from left to right. Although this seems obvious, you must understand that the code we just uploaded specifically designates which LED's are minutes, and which are hours. If you didn't connect the LED's to the breadboard in the same manner we did, we suggest going back and doing so. Otherwise you'll have to redefine the pin outputs in the code, and we don't want you to sift through that nightmare.
Once done, you're almost there! Remember - mind the placement of the wires on the breadboard - sometimes these small electronic parts can be tricky to see, and a wire will be placed in the wrong rail. This is one of the most common mistakes in these hobby projects.
Step 10: Putting It All Together
*Note: This is a little difficult to describe in writing, so if you're having trouble, see the third picture on this step to get a better idea of what we're talking about.
Take a look at your Arduino. Notice that there's the USB port and the power port on the same side (at least, on most Arduino's there is...)? That's pretty important, because you're going to want to drill a hole in the side of the box those ports face. Take a 3/8" drill bit (or a bit close to that size), and drill a hole through the box cover you DIDN'T use to hook up the LED's, in the bottom corner that faces the Arduino power and USB ports. Now, we realized after doing this that you could easily drill through the back of the box as well in order to hide the cord....but hey, you learn something new everyday!
Take your power cord and feed it through that hole, and plug in the Arduino! You should see a few LED's light up on the front face of the box - if nothing happens, there's two possible causes: 1. You missed a soldered connection somewhere on the LED's or the breadboard (it shouldn't be your LED's, because we checked those in step 4, right?) , or 2. there is an error in the code. If you're sure you didn't miss a connection (make sure they're all grounded!), check them again. If you're still sure after that, re-download the code from the previous step and upload it again.
Now, take the two box covers and push them together. However, instead of completely closing the box, only push the top of the back box all the way in, and allow the bottom of that box to hang diagonally back, kind of like a rocking chair. Again, a little difficult to explain in words, so check out the third photo in this step for a visual.
Once you've done that, get your super glue out and run a bead of glue along the edges of the two boxes. It should dry in about 5 minutes, so no worries - we're well on our way. This will give enough support so that the box doesn't fall over once we stand it up. If you had just pushed the box top and bottom together like normal, the weight of the electronics and the Connect 4 board will make the entire setup tip over. This is a simple "hack" in order to avoid that disastrous outcome, and helps us to utilize every single piece of the original game!
Step 11: Finishing Touches
Since we're trying our best to be "green" and recycle as many components of the game as possible, we're going to slide some of those chips into the board. This will create a very nice "warm" glow from the LED's, and disperses the rather direct light from each LED. If you have an older version of the game, you might need to remove the stopper bar (shown in the pictures), and glue the pieces in place to avoid any chips falling out. We went with a tasteful assembly of yellow chips blocking the green LED's, and red chips blocking the red LED's (obviously), with alternating red-yellow for a border around the clock-face. But feel free to try other arrangements!
That's all folks! You've now completed what is a very cool and sleek binary clock to amaze all your friends and family. And we didn't waste a single component of the game! The only downside is that you won't be able to play Connect 4 anymore - but perhaps the future will yield another fruitful endeavor with Arduino based Connect 4, that will both play the game, and act as a clock! Stay tuned to find out...