Ok, so I wanted to build something to use as a clock in the
office. But I didn’t want to build a conventional one. With some research into
existing designs and different ideas (and being an electronics self-confessed
geek) a Binary clock fitted the bill.
What is a binary clock? Put simply the time is displayed by
lit and unlit LED’s arranged into a Binary configuration. Here's a quick guide to reading the time. It's a 12 hour format as per most wrist watches / office clocks etc as this helps to keep the total number LED's down and is quicker to read.
The example above would read 4:36. Common sense will tell you if this is AM or PM!! |
Using an Arduino nano as the basis for the clock was an easy
choice as I had one to hand, the size is small and it has its own mini B USB port for
easy clock setting / programming and for power. One issue with the Arduino
though is that the internal clock is not very accurate over longer periods of time
and you have to contend with stack overflow plus when power is lost the time is
lost. The best thing to do here is to add a RTC (real time clock) module to the
project to keep accurate time and they come with their own battery back up in
case of power loss. I opted for the DS3231 as its accuracy is around 1 minute
per year. You could also use a DS1307 which is slightly less accurate but still
good enough. Both these modules communicate over the I2C bus and you’ll need to
download the RTC Arduino library from here.
Arduino, Screen, DS3231 & RHT03 |
The LED’s in each column share common power connections
which are connected to digital pins 9, 10 and 11 as these are PWM pins so the
LED brightness can be controlled. The negative side of the LED’s are connected
individually via a 470Ω resistors to the Arduino. (pin outs can be seen in the
circuit diagram). The 470Ω resistor kept the current draw through each LED at
about 5mA so at the worst case 8 LED’s could be lit at the same time, the total
max current draw would be about 40mA form the LED’s. We are both powering the
LED’s and sinking them through the Arduino so the Arduino is handling 80mA
total and 15mA maximum pin draw so well within the Arduino’s capability.
LED Modules ready to install |
I also had a RHT03 (DHT22) temperature / humidity sensor
knocking around and thought it would be nice to add this functionality too.
Using the DHT22 Arduino library it was easy to interface this
with the rest of the clock. Library available here.
The display screen to present the temperature and humidity
readings was a 0.96” (128x64) OLED display module seemed a good choice as the
size is small with good resolution and it also runs on the I2C bus so it
doesn’t need any more pins on the Arduino. I’m using the Adafruit graphics
library for this screen which can be downloaded here.
Setting the clock is done via a dedicated setting Sketch.
The program takes the PC time and date at the point the sketch compiles and
loads it directly to the clock. The sketch is largely the same as the normal
program except it sets the time during the setup routine. With the power still
on to the Arduino you need then need to load the normal clock sketch back into
the device. If the power is turned off between loading the setting program and
the normal running program then the time will be reset when the power comes
back on to the same time the setting program was compiled which will now be
incorrect. Time setting should only be required twice per year when daylight
saving starts and finishes. A future update maybe to add daylight saving an automatic feature?
Circuit Schematic for the Clock |
Next phase was to design the housing. I had about 6
different ideas from a tower to a zigzag but ended up with a cylinder as it was
easier to package the electronics and the screen. It looks pretty good too (I
might be a bit biased). I used DesignSpark Mechanical from RS Components to
complete the 3D model for the housing and base. DesignSpark is a free 3D design
software which can be downloaded from this link. It’s very easy to use and has
most features readily available. You could also use SketchUp which is also free
and widely used with lots of online tutorials. Ultimately you need a .stl 3D
file to send to the printer. I used www.3dhubs.com to do the printing for me as
I don’t want to invest in a 3D printer. 3D Hubs is an online printer sharing
website which will print in various materials at reasonable prices and is
available in lots of countries.
3D printed case. A little bit of cleaning up is required. |
Clock Sketch
Clock Setting Sketch
Main Unit 3D File
Base 3D File
This is purely a blog of what I did to make a Binary Clock. No warranties or gaurantees are given. I hope this inspires others to build unusual clocks but you would do so at your risk.
Clock Setting Sketch
Main Unit 3D File
Base 3D File
Everything fits, but it is tight |