Hello again! This is my second instructable. If you like to see more interesting Arduino projects have a look at my Bio to see my other projects.
I've seen a lot of cool clocks on here including Voltmeter clocks. Having been inspired by some similar work I thought I'd have a go at making my own. Although the idea isn't new, all of the work here is my own, and most of the following is a relatively easy weekend project if you want to give it a try :-)
The clock is 3 panel voltmeters to represent Hours, Minutes, & Seconds, with two push buttons to set minutes and hours in a small form factor that looks OK on a self or desk. This is much less technical then my last instructable and will be more art and design based
Step 1: Parts List
The parts I used are as listed below. You don't need all of them unless you plan to make yours look identical to mine, and chances are (if you are a tinkerer) you probably have most of the little bits-n-bobs left over from something or lying in a cupboard.
- Arduino Pro-mini 168, 5V 16Hz, Microcontroller
- Pro-mini RS232 adapter (for programming)
- DS3231 Real time clock breakout
- x3, 5V panel voltmeters
- x2, momentary push-switches
- x2 transistors
- x4, 1k resistors
- x2, 10uF electrolytic capacitors
- Female pin header strips
- Custom printed vinyl stickers
- Assorted bunch of Dupont/jumper wires
- Stripboard / Veroboard
- Hot glue
- Some left over ridgid PVC from another old project
- An old 12V DC power supply from an old broadband router
- Red ring terminal crimps
- Heat shrink
- Brass effect spray paint
- 60 x 60mm x 5mm white PVC drain pipe
- 60mm Black box section end plugs
- x6 Yellow LED's
- x6 1k Resistors
Step 2: Electronics
I tend to build most of my projects in sections, so if I make a mistake and brick that part of the project then the module can be replaced rather than bricking the whole thing and starting from scratch. Once I had a working design soldered the components onto veroboard and used hot-glue to adhere the modules to ridgid PVC
Momentary push buttons have an undesired effect called "bouncing" which happens on release of the push button. It is a property of the button's mechanical nature. When the user pushes in the button and releases, the spring inside the button rapidly oscillates causing the mechanical contacts to rapidly transition between open and closed states. These extra signals can be interpreted by a micro controller as multiple button presses when actually the button was only pressed once. The button therefore has to be "debounced" either using a software fix in the code, or a hardware fix. I opted for a hardware fix because it's easier for me to understand and more fun to make :-)
I made two circuits using the above diagram for each of the push buttons, Vout is between the top of Q1 and common ground with the Arduino. The signal pins need to go to pin 2 and 4.
Pins 3,5, and 6 are PWM outputs for the Hours, Minutes and Seconds. PWM stands for pulse width modulation and allows the Arduino to generate suedo analogue outputs. Connect pin 3, to positive input of the Hours indicator, pin 5 to positive input of the minutes, pin 6 to the positive input to the seconds, and connect all negative inputs of the voltmeters to common ground on the Arduino.
For this project I am using a 12V DC power supply, but you could power the whole thing off batteries if you desired. In any case make sure the external power source is connected to the arduino via the "RAW" input pin and "GND". I used a 5.5mm DC barrel jack as the termination for the power input.
Real time clock
This communicates with the Arduino using the I2C bus. Connect the SPI and SDA lines to A4 and A5 of the Arduino
I placed yellow LED's behind the transparencies of the voltmeters by drilling two 5mm holes in the plastic. The only technical part is choosing the resistor needed to limit the current to the diode, which is easily found using Ohm's law R = V / I. Since we know the supply voltage (12V) and the max rated current for LED's is usually 20mA depending on the colour. Therefore R = 12 / 0.02 = 600 Ohms, however I used what I had to hand and used 1k Ohm. Also slightly dimmer LED's will add to the steampunk-ish look! Each resistor was soldered to the positive leg (the longest) of the LED, and then terminated with jumper wires directly to the barrel connector.
Step 3: Design Faceplate
The following is more of a summary of the method for placing the increments on the dials if you want to make your own dials. The designs were done in Inkscape, if you're not familiar with it, I'd highly recommend it, but you could just as easily use Gimp or another vector manipulation package. If you're lazy like me, you can simply download the attached PDF and print it out but please check the dimensions using the above drawings to see if they match your Voltmeter.
First thing you will notice about the clock faces is that unlike some similar clocks on Instructables the faces all begin at "0" instead of "1". This is due to the way the output voltage from the Arduino is configured (I'll explain more about this later).
It is important to get the design of the face plate correct as you need the indicator to point to the correct number or increment on your clock. The easiest thing to do is to remove the existing base plate and scan it into a graphics program. I used Inkscape as it's a very powerful graphics package for vector artwork (and it's free). Once it's scanned in, measure the dimensions of the plate and scale the scanned image to match the dimensions of the base plate. This will allow you to place vertical, horizontal, and diagonal guidelines to accurately place the increments and numerals.
There are different styles of analogue voltmeters, this one is in the "V" style where at 2.5V the indicator points straight upwards which we'll consider this 0 Degrees. In respect of that, -45 Deg will be 0V and +45 Deg will be 5V. With the vertical and diagonal guidelines placed over the image, the three blue lines will intersect just below the plate. This will be the centre of a circle which when drawn proportionally will provide the curve which the increments will be placed on.
Next, the increments need placing. From -45 to +45 Deg is 90 Deg in total. Dividing 12 by 90 will give the amount of degrees between each hour. In inscape, you type the first number "0" and rotate that -45 Deg, then every concecutive number can be rotated by 0.13 degrees for each hour until you reach +45 Deg which will be 12. The same method can be used for the minutes and seconds.
Once you have the basics nailed down you can start choosing font's and styles to make your design look stunning! I chose a rusty graphic and steampunk style font. Once complete I asked a local signmakers to print the design onto self-adhesive vinyl to adhere to the existing base plate, but I suppose you could print this on photo paper and glue onto ridgid card. If you don't fancy the steampunk look I've attached some plain looking one's. They are 1:1 scale so depending on your printer you should be able to directly edit and print.
Step 4: Assemble Enclosure
I am always making these projects on a budget, and enclosures always end up being a large portion of the total project cost in comparison to the rest of the components. Although there was no projects enclosures which I felt were small or discreet enough to house a clock which would look good on a desktop. I eventually settled on using 60mm x 60mm PVC square section drain-pipe, which actually houses all the components quite nicely.
Based on the measurements taken from the drawings in the previous step, I used inkscape to make a cutting template to cut out the holes for the clock faces, and drilled holes for the push buttons. To finish off the case, and close off the ends, I purchased 60mm box section end caps.which push fit into the open ends. They do occasionally need filing slightly to make a snug fit.
Once your happy everything fits, remove everything so you can paint the empty shell of the enclosure. I used some brass/bronze spray paint and decorated with old nylon gears (ripped out of old VHS players and printers) sprayed with gold highlights
Step 5: Programming
Upload the following code to the arduino. If you are using the pro-mini like me then you will need to make sure you have purchased and setup the RS232 adapter in the above picture. I'd recommend using a genuine FTDI module rather than a CH340G. This is because I experienced difficulty finding the drivers online and loading the drivers for Windows, then after all that the cheap Chinese module failed following a few successful uploads!
The design of each module depends on where you get it from but they are also available as full cables. I'd suggest getting a module with the pinouts clearly labelled in the PCB ident so you know you are connecting up the Arduino correctly. Full cables don't often have the pinouts clearly labelled and the colours of the jumpers vary between suppliers.
The code creates voltage pulses on the PWM outputs of the arduino. 5 volts is represented with integers in the range 0-255 (0 meaning 0V and 255 meaning 5V). Therefore to represent hours 255 divided by 12 is 21.25, so for every hour the PWM output add's 21.25 to the output. Similarly the minutes and hours are 255 / 60 = 4.25. The Arduino communicates with the real time clock over i2C and fetches the time and updates the PWM outputs accordingly.
Step 6: Decorate and Enjoy!
I used brass / chocolate coloured spray paint to spray the main body of the clock. It was still missing something, so I decided on adding some gears and sprockets to the clock. In the UK Hobbycraft supply Tim Hortz steampunk gears, which I sprayed using gold coloured spray paint. They are then easily glued on with small dabs of superglue.
Comments? Questions? Feedback?
If you have anything you would like to add or you think I might of missed, be nice and please make a constructive comment below. Happy making! :-)