Friday 18 April 2014

Pendulum Controlled Arduino Clock With Alarm




Introduction

Years ago when I was around 11 or 12 my grandfather gave me a clock box he made. My grandfather was a church carpenter so he made furniture and decorations for churches.
The box he gave me is made from teak wood as far as I remember, it has a nice domed front window for the clock face and plain glass for the lower pendulum part. My grand farther made the box in 1944 so 70+ years ago.
The clock box has moved around with me for years, but I never really got to use it for anything sensible. For some years I used it as a small alcohol cabinet (I'm not a big drinker), but for the most of the time it has been hidden away in the basement.
One day I watched a video from AndyDavisByTheSea creating an pendulum clock. Here is a link to the 1st video in the series.
The videos inspired me to start experimenting with my own pendulum. I didn't want to go pure mechanical as Andy, but wanted the pendulum to be the main time keeper and then use an Arduino board for the display. I also decided that I did not want to spend any money on the project. Everything had to be made from stuff I had lying around anyway.

Construction

The pendulum weight and the chime bell are both disks from an old hard drive. The pendulum rod is a ø6mm aluminium tube. The rocker is a piece of hard springy metal from a CD-drive.
At the end of the pendulum rod is a small strong magnet.

I was not really sure how to make the pendulum adjustable. As I only had one aluminium rod in house, and I did not want to go buy a new one, I had to be careful not to cut it too short while experimenting with the pendulum length. So after some drawing and experimenting I came up with a quite simple solution allowing me to make both coarse and fine adjustments.

Sketch of the pendulum length adjustment.

The first version of the pendulum adjustment. This construction allows me to do a coarse adjustment with the two pine wood mounts and do fine adjustment with the round top nut. 
The two aluminium angles are mounted on the wrong side of the disc on this photo. 
They are supposed to sit on the back of the disc so they don't block the disc.

Coils

I tried using different home wound coils, but soon realized that the power needed to drive the pendulum was so minute that the small coil from an old electrical toothbrush was enough. This coil also uses much less current than my home wound coils.

A couple of my initial coils. One with core and one without.


This is the coil from the electrical tooth brush I decided to work with.

The rocker mechanism

It has been quite a challenge to create a rocker that was stable, smooth and frictionless. My first attempts used a couple of small ball bearings. This worked quite good, but because the ball bearings are very sturdy in the axial direction, they also required the clock to be placed very accurately. (I live in an old Amsterdam flat, so neither walls nor floors are straight.) The construction was also to clumsy for my taste. So I decided to use a ‘knife’ construction for the pendulum.
This gives a very low friction, and it is quite insensitive to the placement of the clock itself as I could quite easily create an adjustable rocker assembly.
The rocker interrupts the light from an old light barrier, I think I got that from an old HP printer.

The spring loaded rocker assembly. The distance screws at the back are fixed, the two in the front can be adjusted to make sure the rocker is perfectly horizontal.

The height of the light barrier can be adjusted with a small screw. This adjustment determines when the coil ‘fires’. 

Close-up of the rocker and the adjustable light barrier. As can easily be seen here, everything is made from old scrap.

The placement of the coil is very critical to how the pendulum works. It is very important that the coil is directly in line with the pendulum movement. Else the pendulum will jitter. Also the offset of the coil is very important for the swing of the pendulum. And the distance from the pendulum tip (magnet) to the coil also influences the pendulum swing greatly.
On top of that comes the current through the coil and the length of the pulse. The coil is only supposed to give the pendulum a very small kick and the pulse cannot be so long that is attracts the coil after it has swung by the coil.

Here experimenting with the trigger time and pulse length using long exposure on the camera.

The strength and the length of the coil pulse is easily adjusted with the circuit, but the mechanical adjustment was quite a challenge. I needed to adjust in tree directions. For the X and Y position I came up with the design shown below.

The elongated holes allows me to adjust the coil position in the X and Y direction.

The X and Y position of the coil can be adjusted sliding the coil left, right, backwards and forwards. The height adjustment I still need to figure out.

Close-up of the chime mechanism. The “bell” is made from a disc from an old hard drive just like the pendulum. The disc has a nice crisp sound when hit with the little wooden hammer. The two rubber suspensions come from an old CD-drive.

The chime will sound X times every hour, two short at a quarter past and a quarter to the hole hour and three short chimes at half past the hour.

I don’t expect the clock to be highly accurate. Temperature and humidity will probably have quite an influence on the precision because I use ordinary MDF or pine wood for construction. But for home use I think it should be more than good enough. Anyway the pendulum will be driving an Arduino for the clock display, so I can always do some compensation there if needed.
Currently I just use a LCD display, but it is my intention to create a clock face with a ring of LEDs like the one I build back in the 80’s. Though in this version I want to be able to see through the centre of the display so the rocker mechanism will be visible.

My old LED clock I build in the 80’s. It is using all 40xx parts on a single sided circuit board, hence the large number of top wires. Time keeper is taken from the 50 Hz net frequency.

 
Just a peek inside while ticking away.


 
The chime sounds a little harsh here, mainly because I used a small metal screw in the hammer head, but also because of my old but trusty camera. In the current version I have removed the screw. That gives a softer sound. Also the chime sound is dimmed when the lid is closed.

Electronics

The electronics driving the pendulum is very simple, just one 4093 quad Schmitt trigger Nand gate. I have seen even more simple analogue circuits, but I decided to take the more digital route. 
Block diagram of the pendulum driver.


The small circuit reads the pulse from the light barrier, creates a short pulse using a mono stable flip-flop and a small driver transistor for the coil. At the bottom right is the chime driver.


Very simple circuit board for the pendulum driver. I’ll probably redesign this later when I start to implement the ring shaped clock display.


The second pulse from this circuit triggers one of the interrupt pins on the Arduino.
The Arduino program is in this first version very simple. It simply counts the second pulses, and converts them to minutes and hours. The result is displayed on a 4 x 20 character LCD display. 

Control application

To adjust and measure the accuracy of the pendulum clock, I have created a small control application that prints a graph over time, showing the time variations. I used my function generator to generate a 1 Hz pulse to calibrate the readout.
The application also enables me to get and set the time of the clock, set the alarm time plus a few test functions.

Screen shot of the control application for the pendulum clock. It graphs the time variations in micro seconds compared to a 1 Hz signal from my function generator. The red graph is the current pulse time. The blue is averaged over the last 5 minutes.

Update: 12-05-2014

Ring display and new control board

I have finally finished ring display, this is the first time I have used a large amount of SMD components, so I have spend quite some time on designing the circuit board. This is also the first time I work with through hole rivets. I did practice on a few 'failed' boards so I didn't mess up the final board and the result is actually quite good. The through hole rivets I used are ø0.6 * ø0.4, so it was quite fiddly, but using one of those dentist 'pokers', the handling of the small rivets went smoothly.
I managed to fit the whole display on two pieces of 100 * 160 mm double sided board by splitting the ring up in 4 equal pieces.

Each of the ring display parts are soldered together on both top and bottom side at the edge. This makes the display quite sturdy.


The assembled ring display. Next to it the dental 'poker' I used for handling the through hole rivets. Unfortunately you can't see the pointy end on this photo.
It' alive. Well the photo is a little blurry (no flash and no tripod)
 
Well it is Saturday morning - Nigella Lawson is cooking away in the background. 
So time for a quick look on the display powered up with some test code. The flickering comes from the camera.
Close up of the ø0,6 * ø0,4 through hole rivets.


Ring display mounted for the first testing. I wanted to be very careful when mounting the ring. It has to be spot on center and I did not want to drill any 'faulty' holes in the box my grand farther made more than 70 years ago.

New Control board

The new control board contains both the driver for the ring display and the pendulum control from the old board. This board is also double sided, but only contains through hole components. This is mainly because I already had all the components in house. On this circuit board I also used through hole rivets, but I used a little larger rivets, ø0.8 * ø0.6 to match the pin size of the IC sockets.
The new controller board. Upper part is the pendulum driver, the lower part is the display driver.






The updated circuit board. Upper circuit is unchanged from the first version. The lower circuit is the display driver using four 74HC595 Shift registers. 
I use 1k current limiting resistors. This gives more than adequate light both in daylight and at night. As an experiment, I have added a photo resistor (LDR) together with a 10k series resistor, and feed the divider voltage to one of the analogue inputs of the Arduino. With that I can adjust the intensity of the Leds. I probably build that on to a small shield as I'm not sure I want to create a new version of the driver board just for two components, one of which will have to be mounted off board anyway.

Here are a few new pictures of the latest development.
Arduino Shield for the Real Time Clock module, menu buttons (from an old HP Ink Jet printer) and connectors for the main board. The spun wire goes to an LDR so I can adjust the brightness levels for day and night.
The painted chime. The copper wire at the bottom limits the hammers bounce back swing.

Everything is mounted, more or less. The wiring is still a little bit of a mess though.
While testing I mounted my LCD display on the ring display as can be seen here. But I have decided to keep it, maybe replace it with a 2 row version. I do need a display when setting the clock and alarms and luckily it is out of view when the door is closed. As a unplanned extra the Led on the back of the LCD display casts a faint red light on the main board mounted on the backwall of the clock.