loading

I've been looking at Binary clocks for some time for my office desk, however they're quite expensive and / or don't have a huge amount of features. So I decided I would make one instead. One point to consider when making a clock, Arduino / Atmega328 isn't very accurate over larger periods of time (some people have seen more than 5 minutes of error in 24 hours) so for this project we'll use an RTC (Real Time Clock) Module to keep the time. These also have an added bonus that they have their own back up battery so the time won't be lost in case of power failure. I opted for the DS3231 module as its acurate to 1 minute per year but you could also use a DS1307 but its not as accurate. Obviously you don't need to use all these features, you could just make the basic binary clock and save maybe £10 - to £12 in the process. I went for a 12 hour clock format to keep the size down and to reduced LED counts and it's easier to read too. (Common sense is all you usually need to work out if its AM or PM!!)

I used:

1 x Arduino Nano (one of the cheap ebay one's) - Approx £3

1 x RTC Module (i2C) - Approx £3

1x RHT03 Temperature / humidity sensor - Approx £4

1x 0.96" OLED Screen Module (i2C) - Approx £5

11 x Blue straw hat LED's - Approx £2

11 x 470Ohm resistor - Approx £1

1 x 10KOhm Resistor - Approx £0.30

1 x 3D printed housing - Approx £12

plus a small amount of strip board and solder

Total Build cost = £30

Step 1: Build the LED Modules

The LED modules are made up of 3 or 4 LED's which have the positive legs connected together and the negative legs connected to a 470Ohm resistor. This resistor limits the current through LED to about 5mA. The maximum number of LED's that can be on at any time is 8, so the maximum current draw on the Arduino is about 40mA in and 40mA out so 80mA total - well within the comfort region of the arduino.

Fly leads are then soldered on and the resistors covered with heat shrink tubes.

Step 2: Binary Clock CIrcuit

The hub of this project is the Arduino Nano. We're going to use most of it's pins here. The RTC module and Screen are both on the i2C bus so they can share all connections. Simple connect the 5v, 0v, SDA and SCL connections to both modules (I daisy chained mine to keep the wiring down). SDA is then connected to pin A4 on the arduino and SCL is connected to Pin A5.

Next connect the RHT03 (DHT22). again this was daisy chained for 5v and 0v connections but pin 2 was directly connected back to the Arduino pin D12. Don't forget to add the 10KOhm resistor between 5V and the signal connection as shown in the diagram.

Next connect the LED modules. The power for each module is connected to Pins 9, 10 or 11 (It doesn't matter which as they are only providing a PWM signal to adjust LED brightness).

Connect the negative side of each LED to the corresponding pins in the diagram.

Step 3: Design and Print the Housing

First of all measure all of your modules so that you have mounting positions and opening sizes worked out.

I used DesignSpark Mechanical 3D CAD software to create my clock and base but you could also use any good 3D software. DesignSpark Mechanical is free to download and use and there are lots of tutorials on how to do things. Another free 3D software is SketchUp, again it has lots of online tutorials so pretty much every task is covered.

In the end you need to have an output file which is in the .STL format so that it can be printed. I've include my files for ease.

If you're not lucky enough to own a 3D printer then you can get 3D prints done via the internet. There are quite a few online printers available with very reasonable rates. I used a website called 3Dhubs and it cost just under £15 to get both parts printed.

I had both parts printed in technical ABS as the shrinkage rate is very small compared to other materials.

Once back from the printers you'll need to clean the parts up and a light sanding maybe required. I also gave mine a light coat of spray paint, but I wanted to keep the "printed" look, so I didn't go too hard on the sanding.

Step 4: Assembly

Simply fit all the modules / circuit into the cleaned up printed housing. A small amount of glue is required to bond them in place onto the internal locator pins. A small amount of glue was also used to bond the LED modules in place. (yes that is blue tack you can see in the picture. I used it hold the modules whilst the glue was setting)

Don't forget to fit the battery onto the RTC module during fitting

Then push the Arduino into position so that the mini USB port is just poking through the back of the clock.

Finally fit the base and screw into position (Make sure to have good hole sizes for the screws so they don't bite into the plastic too much as it will fracture easily)

Step 5: Power Up and Setting the Time

Before powering up you'll need to get hold of some Arduino libraries to make this work.

You'll need:

RTClib

DHT22 Library

OLED Screen Library (you may also need the adafruit GFX library)

you can find lots of online tutorials on how to add these libraries so I won't go into it here.

The clock takes its power from the Mini USB port on the back. Simply connect this to your computer and open the Arduino Sketch 'Binary_Clock_Set.ino'

This sketch will take the current date and time set on the PC at the time the sketch compiles and load it to the clock in the setup loop. Upload this to the clock and the time will be set. Without disconnecting the clock (so the setup loop isn't started again), open the other Arduino sketch 'Binary_Clock.ino' and load it to the clock. This is the normal running sketch

If the power (usb) is lost between these 2 steps then you'll need to repeat both as the time will be incorrect.

The sketch 'Binary_Clock_Set.ino' is now only required if the clock needs to be set again i.e Daylight saving etc

<p>Thank you MattW213!!!</p><p>https://www.youtube.com/watch?v=2NfBaVEvXV4</p>
<p>Great to see you made one. looks great</p>
I designed an enclosure using 123D Design, but wasn't happy with the printed version. Before adjusting the design, my wife and I had the idea of mounting the clock in one of her mixed media art pieces - very happy with the outcome.
Looks great, I'm glad you made it so well. I've altered the time loading program slightly as I discovered there was about a 30 delay in reading the computer clock and the time finally shown by the binary clock once it was running the final code. It seems to take about 15-18 seconds to compile and load each program. The adjusted version has taken into account this 35ish seconds. You'd need to run the serial monitor to check if the delay exists or not on your version. If it does use the new time loading code and adjust the delay amount to match your actual.<br>Again great build - really pleased this inspired you.
<p>Amazing Design. I am thinking about doing this with some high school students.</p><p>I am new to 3D design and PVC printing. Is there any way to share your design files so I can import them into SketchUp to hack around with them?</p>
<p>Hi ronkasper,</p><p>The 3D files are in the instructable in step 3. You can directly download them from there. If you decide to make something keep us posted, it would be good to see other ideas / versions. </p>
<p>My binary clock (which I've owned for years) has six columns of LEDs. That means it can count seconds and display hours in 24h (0-23) format.</p><p>With your clock you really need an extra AM/PM indicator since it only has a single BCD column for the hour.</p>
<p>I thought about this for some time when designing this. I wanted it to be quick and easy to read and I would have needed to create an LED matrix to ensure I had enough pins on the Arduino to run all of the LED's. And the power consumption would have been too high as well. I decided to omit the AM/PM indicator as its only really needed if you want to set an alarm, otherwise you generally know if its am or pm. Most wrist watches (non digital) don't indicate AM or PM either and it keeps things simpler. </p>
Fair point.<br><br>When I bothered with a digital wrist watch I always had it on military time so didn't need an AM/PM anyway. I'm from the generation that thought digital watches were a neat new idea.
<p>Nice ible. Thanks for publishing. One suggestion: do you know the &quot;one wire&quot; RGB LED Strips? You could feed all the LEDs with just one wire, you could change colors (based on Temp? Humi? Daytime? ) and would have a lot less resistors and wires inside... Probably also not too much more expensive. http://www.ebay.com/itm/WS2812B-5050-RGB-LED-Strip-5M-150-300-Leds-144-30LED-M-Individual-Addressable-5V-/322058431958?var=&amp;hash=item4afc2dadd6:m:mh5wcqoaZysJUIMArGeSHSg or https://www.adafruit.com/search?q=ws2812&amp;b=1</p>
It's a good suggestion, I considered this early on and nearly used them. It could be a good alternative to basic single colour LED's and as you say the colours could be changed depending on temperature etc or a different colour for each column maybe. One thing to consider with these single Wire RGB LED's is the power consumption. A single LED showing a White colour could draw around 60mA (I'm sure there are lower power versions). At certain times 8 LED's could be on and this would draw 480mA. Add that to the current draw of the other modules and you're around 550mA (max). Not a huge problem for the Arduino but some outlets (including computer ports) have a maximum 500mA output. It would cause problems though if we wanted to run it from an alternative power supply as the Arduino's 5v regulator maybe over stressed and damaged.
<p>Nicely done. I would mention for those who are new to Arduino to make sure they buy the Arduino Nano, not the Nano Pro Mini. The Pro Mini is cheaper, but does not have the USB connector on the board which makes it more difficult to upload the software. Also, the LED dropping resistors can be almost any value between 220-750 ohms, but it's a good idea to use the same values so the brightness is the same.</p>
<p>You are right the resistors could be different values to the ones I used. It would really depend on the forward voltage of the LED's used. Red / Amber LED's generally have lower forward voltages so would use higher resistors. Just be aware of the total current draw on the Arduino and the maximum on each pin. In my case I'm also reducing the brightness further with a PWM signal from Pins 9, 10 &amp; 11. In the above photo the LED's are set at 15 when the maximum brightness would be 255.</p>
<p>Nice job. A couple of suggestions; since you have to reload the code to set the clock, quick power interruptions would be a pain. Is there room to add a small backup battery? Several of the small arduino boards support onboard lipo batteries, some even maintain their charge. Secondly, to avoid the DST hassle how about adding a small toggle switch that would just change the hours variable (+-1)? You've got a couple of open pins, and the code change would be minimal. Thanks for posting.</p>
Hi, Thanks. The RTC module already has a back up battery - a CR2032 which will last about 4 to 5 years. When the power is lost the screen and the LED's go out but the clock is still ticking. When the power is returned the clock shows the correct time. The only time when this doesn't work is when only the setting program has been loaded. If the clock is using the 'normal' sketch then power interuptions have no effect on the clock. The switch for the DST change is a great idea. I didn't think of that. There's even room for it in the base of the clock. Might be adding that soon. Thanks
<p>Nice</p>
<p>Nice design</p>
<p>I love your design :)</p>
<p>Thank you</p>

About This Instructable

25,773views

171favorites

License:

More by MattW213:LED Pit Board Arduino Binary Clock - 3D Printed 
Add instructable to: