I have built a couple of Nixie Tube clocks previously, using an Arduino Nixie Shield I bought on ebay here:
These boards come with a RTC (Real Time Clock) built in and make it very straightforward to get a simple nixie clock up and running. It's just a matter of attaching the shield to your arduino (either uno or mega) and uploading the code supplied with the board (here on github for the latest version: https://github.com/afch/NixeTubesShieldNCS314/ ) and you're good to go. But, I had an idea! Could I set up a system where I could use a pendulum to mark the time and somehow measure this and display it on the nixie tubes? Well, it turns out I could, and so can you. If you're interested then read on!
Step 1: The Idea
I had a few problems to overcome to get this started. 1. How could I keep the pendulum swinging continuously without using a clockwork mechanism, 2. How could I read when the pendulum passed a given point and pass this information to the arduino and 3. I would have to modify the code which came with the nixie shield so that it would ignore the RTC and read the information passed from the pendulum.
I thought that if I could find a pendulum which was made of iron I could use an electromagnet to pull the pendulum towards it and then turn off the electromagnet to let it swing back. I also had a few small lasers and laser sensors in my kit of arduino sensors and so far hadn't used these and figured it would be a good time to set these up and see if I could use the pendulum passing through a laser beam to trigger the electromagnet (via a mosfet transistor). Then I realised this would also be the perfect way to count the swings of the pendulum and pass this information to the arduino.
Step 2: The Pendulum
I decided the best way to go about this was to try and build the pendulum set up with the lasers and the electromagnet first, before even going to the expense of buying another nixie tube shield.
As can be seen in the photograph, I attached the pendulum, laser receivers and electromagnet to a small plywood stand I made, and built a platform for the laser transmitters out of circuit board standoffs and a lollypop stick. I found that a 5mm hole drilled in the plywood is an ideal size for the standoffs to sit in firmly and will allow a small amount of movement to adjust their vertical position. On the other side of the plywood is the power board and mosfet transistor.
I wrote a short arduino sketch (laser-clock.ino attached) which allows the testing of this set up. THIS SKETCH IS NOT NEEDED for the completed project and was only used to test that I could make the pendulum swing continuously using the electromagnet which was triggered by the two laser beams, and to count the swings and convert this number into seconds.
As the pendulum passes through the beam on the left, four things happen simultaneously.
1. The laser on the left is switched off
2. The electromagnet is switched on
3. The laser on the right is switched on
4. The counter for the number of swings is increased by 1
As the pendulum passes through the beam on the right, three things happen simultaneously.
1. The laser on the right is switched off
2. The electromagnet is switched off
3. The laser on the left is switched on
When this is running the arduino will also display on the serial monitor, Hours, Minutes, Seconds and Counter (number of pendulum swings)
In this sketch you will see line 58
realseconds = (counter * 0.7386);
This is to convert the number of pendulum swings to the number of seconds actually passed and was arrived at by trial and error and will depend upon the length of pendulum used in your project and will need to be adjusted accordingly
Step 3: The Nixie Shield
As mentioned earlier, I have bought a few of these nixie shields from ebay for various projects but when the one for this project arrived I discovered that it was a newer model (Version 2.2) and now includes a built in thermometer. The firmware has also been updated and I was a bit disappointed when I realised that the old firmware will not work with the new style board, so the code in my previous projects will need to be modified if a new V2.2 board is used to build one (I'm referring directly to the nixie clock with westminster chimes I added a couple of months ago).
Anyway, once you have a working pendulum which will keep swinging as in the previous step,you can add your nixie shield to the arduino mega. I have attached the firmware files which came with the shield which I have modified. This retains most of the original functionality of the shield and allows you to set the date, time etc with the buttons on the shield. The RTC will still run and will keep the date and time stored when the clock is switched off so that when you switch it back on it will not need to be set again, but while it is on the display will only show the time increase as the pendulum swings.
Step 4: Find a Cabinet
I used an old 1950s Pye television cabinet to house this one in but of course you can use any type of cabinet to house this in to suit your own tastes.
Step 5: Parts List
1. Arduino Nixie Tube Shield, around $90 from ebay
2. Arduino Mega 2560, around $20 from ebay
3. Stackable header pins, around $2 from ebay
4. 90 degree header pins, around $1 from ebay
5. Two laser transmitter modules for arduino, around $4 from ebay
6. Two laser receiver modules for arduino, around $4 from ebay.
7. Electromagnet 12VDC, around $3 from ebay
8. Mosfet transistor for arduino, around $2 from ebay
9. Pendulum from an old clock (must be ferrous so that the magnet will attract this)
10. 1PC DC-DC 12V To 3.3V 5V Buck Step down Power Supply Module For Arduino, around $3 from ebay
11. Various jumper wires, board standoffs and a cabinet to house everything in