As first instructable of the year I managed to finally complete my age-long nixie clock project.
Nixies are neon valve tubes, where ten cathodes have shape of digits and are lighted up by plasma when high voltage flows through them. I love these old era displays, which have been employed in last century before I was born.
In last year I've been slowly collecting components and knowledge to build some nixie clocks as Max Pierson's beautiful creation, I like the old style, the roundness of glass tubes, the rough wood case, the simplicity of the design. That clock has definitely inspired my project. Even though I really love vertical digits arrangement I keep that original feature for my next clock.

Therefore this first born is a six digits horizontal wood desk clock, with six big round Russian IN-4 nixie tubes, no dots, no visible buttons, no LED illumination, only a big massive rosewood block and the power of plasma ;-)
I have to explain you what the title means:

simple because it can be entirely built with common tools and from common components, you only have to order six IN-4 nixies and one nixie driver

user-adjustable because it's predisposed for many external sensors and additional features (as neon dots between digits, alarm, etc.)

DIY since you neither have to buy external shields or to pay for pcb manufacturing, just follow my instructable ;-)

WARNING: this circuit raises the voltage to deadly 300V so you must avoid to touch contacts while working, I'm not kidding, please BE CAREFUL!

Step 1: The Schematic and Working Principle

Lately, after some research and a fast designing, I attained this functional high voltage power source circuit. Since there is a full step to step guide about the hv power source section of my clock, I will pass over that explanation. There is only something to say about the input voltage for the clock: to increase the universality of the project I decided to give the possibility to power the clock with a voltage from 9 to 35V. The best solution (in terms of efficiency and thermal dissipation) is to connect a 9V DC PSU (500 mA or more), but if you want to power the device with a voltage from 12 to 35V you only have to shift the voltage switch in direction of the ON-OFF switch (which has a center ON position between two OFF ones).
With the pot you have to set the voltage (read next step for high voltage pins) to the about 190V needed to power the IN-4 nixies (in multiplexing displays is better to use a bit more than the 180V needed to light a single nixie tube). You can of course set up the proper voltage for any other nixie tube.

The other section is the logic circuit, where a cheap Atmega8 IC (but you can also use an Atmega168 or Atmega 328), through a nixie driver and some high voltage transistors, controls the digits.
The nixie driver is a K155ID1 which is the Russian equivalent of the 74141N, and it spares you to use 20 more high voltage transistors. This driver is not very expensive, but it's not longer manufactured, so with time it will be more difficult to find, for this reason I wanted to use only one in my project (while there are many nixie clock projects which uses one driver for each digit).
This has been possible thanks to some references I found in the web
neon1.net, threeneurons.wordpress.com)
but mainly thanks to Jeremy Howa and Brad Lewis for their Arduinix project, which enlightened me about multiplexing power and from where I took the original code.

My schematic is drawn in Diptrace, a simple pcb design software, I divided it into two pats so to show it better, read notes on the image to understand circuit parts.

Step 2: The Board Design

Diptrace lets you to autoroute the traces, but in my case I had to route them manually since I wanted to keep the board as small as possible.
The clock is composed by two different boards: the bottom part contains all the power source and logic sections, and the top board is to connect the tubes, each one with a proper resistor. Indeed since different tubes could need different resistor values, I decided to leave 10K resistors on the clock board and add a second resistor for each tube on the tube shield, so that you can easily transfer the same main board from a clock to another. To calculate the total value or resistors I referred to Threeneuron's great explanation.

To set the right voltage set the right position of the 9V / 12-35V switch depending on your PSU, then plug the jack and connect your multimeter to a GND pin and to the "+180(TEST)" pin. Calibrating the potentiometer you will see voltage varying from about 140 to 300V, set it to 190V.

Actually the pcb you see here is an new version of my clock board, since I improved the component arrangement and I still have to etch the new board, so maybe you will note some minor differences.
If you look the "top silk" pdf file you'll see that I marked on the board top surface all the info to place components, such as name and polarity, so you should be able to solder them easily with the help of the b.o.m. 
Furthermore in the other documents you find the traces ready to print and to transfer on the copper board, for both clock circuit and tubes shield. Top-silks are mirrored for this purpose.

Step 3: B.o.m.

The bill of material is the longest I've ever needed for one of my electronic projects. I know it's far from to be professional and there should be many imperfections, but I tried to be more exhaustive I could.

You must add to the list: 66 sockets for tube pins, two male pin header strips for tube shield (1X10 and 1X6), the case, the IN-4 tubes and the PSU.
Please note that where you read 15K resistors you have to interpret 10K on the main circuit plus 4.7K (or 3.3K) on the shield pcb.
I've used a buzzer taken from a Nokia phone since it's great to play multi-tone sounds for alarm, but you can change it with any 5V buzzer, or you can remove it, as some more components (resistors for neon dots, 9V voltage regulator, reset button, etc.).

L1 is a fixed radial inductor (avoid toroidal chokes) 100 uH 1A. On the board you can find space to place a stocky or slender inductor, just ignore the hole you don't need. R17 and R18 should be 1% accuracy metal film resistors, to achieve a better voltage stability. D1 has to be a ultra-fast 400V diode, as BAV21, UF4004, UF4007, MUR140, or MUR160.

Step 4: The Code

The code I used in this clock version is taken from the open source material available on Arduinix website, and I really suggest you to go looking Brad Lewis "Sloth Furnace" impressive projects (he's an instructables member too).

I modified the code to use only one nixie driver instead of two, since I don't need to run more than 6 digits, and I prefer to save drivers. There is a parameter which you can change if you have problem with your displays, it's the delay, but 2 ms works fine for me. You can try 3 or 4 ms but more will flicker the digits, since software has to go through all digits before lighting a digit again.

To burn the code to the Atmega IC I used Arduino. Just remove the Arduino chip, insert your Atmega8 (or better), change board and serial port under "tools" menu, paste my code and upload it. Take out the IC and insert in the socket on the clock board. Please notice that your Atmega IC could need to be burn with bootloader before you upload the code, you can find instruction on this page. I used a USBtinyISP programmer, but you can buy IC already burned with the bootloader.

Step 5: Toner Transfer

Ok guys, you're certainly happy that theory section is ended and we can now see something concrete.
As I usually do I've etched two boards at the same time, so to reduce the chance to make a faulty pcb.

First thing to do is to polish the copper surface with a sponge (the one for dished on the scratching surface) and then clean it with a strong soap. After that step absolutely avoid to touch the surface or to dry it with a dirty towel, toner has to find a perfectly degreased surface to adhere at 100%.

Now join printed paper and copper board and keep them together with paper tape pieces, put them with paper up under a clean towel, set your iron at maximum temperature and pass over the paper to make the toner adhere on the copper surface. Now pour into water, wait some minutes and when paper is all wet remove it with the help of a soft brush (maybe a toothbrush).

This is a pretty damn process and the success mostly depends by the type of paper, in this case I've tried a cheap inkjet photographic paper. I definitely need to switch to photoresist method.

Step 6: Etching

When you're absolutely sure there is no remain of paper between tracks, and after retouching every interrupted track with permanent marker, you can pour the board into ferric chloride solution for about 40-50 minutes (it depends by many factors as the percentage of solution, the temperature, how much often you agitate the basin, etc.). You see in the picture that I always use the pcb holder I built. I suggest to shake gently the container every 10 minutes and check the traces every 5 minutes when 30 minutes or more has passed. When you see there is no more copper on areal clean from toner you can wipe the board with a paper towel and wash it in abundant water. Dispose of the exhaust acid in proper centre.

Step 7: Finishing the Main Pcb

To remove the toner from the copper traces use a metal sponge or sand paper. If you're not sure about the electrical conductivity of some traces you have to check them with the multimeter and fix any mistake soldering a bit of tin.
Then make holes where needed using 0.8 mm drill bit and a precise column drill (if you want to build one look here).

Step 8: Etching the Tubes Shield

To build the tubes shield the process is the same as the main circuit. Also in this case I made two boards at the same time. Both came out well, except near the edges where I had to fix some toner lack with the permanent marker.
As before, remove toner after etching and drill holes for components.

Step 9: Top Silk

If you wish you can transfer the top silk on the board with the toner transfer method. This helps you placing the components and also adds useful information to connect external sensors and to act on the switches.
Then you can begin to solder the main components on the board. 

Step 10: Solder

Solder also the pins sockets on the tubes shield, together with resistors and jumpers. To solder the connection pins headers between main circuit and shield follow the suggestions in the next step.

Step 11: Pin Rows

Since the pin male headers are on the same side of the copper, the process to solder them in place is a bit more complexed compared to all the components on the opposite side.
I suggest you to push the pin heads hard into the holes (0.8 mm is the better size in my opinion) and solder them on the pads. As in first picture you have now the rows upside down. Remove the plastic holder with little pliers, flip it and insert again with the groove toward the copper, then with your nails or the pliers push the plastic against the tin, that will cover pads and any soldering sign.

Step 12: Find the Right Case

I've been lucky and I found a case almost perfect to fit my circuit. Obviously it's much better to design the pcb referring to the exact measures of an existing case, so go looking for it at once ;-)
The same instant I've seen this box I loved it. I bought it a the Christmas Fair in my city and it was last piece, made in India from a single rosewood block. I chose the rougher side to become the front of the clock, since I like the irregular edge on the front top edge.

Step 13: Drill Holes

I had to drill the 3 cm diameter holes for the six digits, with the right drill bit and a medium column drill the process was long but not difficult. Try to not warm too much the bit.
You can mark the center of the holes with a ruler or to attanch a print of the circuit top side on the wood, then mark the dots with an awl.

Step 14: Perfect the Case

To drill the holes avoiding wood cracks formation, push a wood block on the inside surface of the board, and try keeping it pressed with shims or clamps, then drill the holes until you reach it. Also try to leave at least a pair of millimeters of space between holes. My first shield was too short, and I had to make a little longer shield to match the holes.

Step 15: Fix the Lacks

Since new shield was longer than the inside space I had to enlarge it on a corner. To do that I drilled some thin holes and I removed the wood pieces with the aid of a chisel. As you see now holes and pin sockets are perfectly aligned.

Step 16: Straighten the Sockets

to straighten the pin sockets so to simplify the insertion of the tubes, I suggest to insert all the tubes one time and remove them. That will help you a lot, since you can handy straighten up them with small pliers.

Step 17: Test the Circuit

This will have also a second advantage, i.e. testing the circuit before assembling the clock.
... suspence...
If everything works you can continue with the assembling.

Step 18: Assembling Nixies

Place the shield inside the case and insert back the tubes into it. Pay attention to not let any pin going out from his socket, you can look from the inside to check them.
You see that you can connect the main circuit to the tube shield with no trouble. This is very useful since you are now able to build a new clock and test it with the original clock circuit.

Step 19: Find Cool Case Stands

I had four rubber tips, to arrange four nice old style stands I decided to use them upside down glued to screws' heads.
With some gimlets drill the four holes, paying attention to not crack the wood. To be sure begin with a small gimlet and then pass to a bigger one, until you reach the desired hole diameter.

Step 20: Adjust Them

These stands are very handy because you can screw them until they're perfectly aligned with a planar surface, and the wood box will have a very precise support, although it's very rough.
Glue the rubber tips with cyanoacrylate glue in the exact centre of the screw heads. Now you'll note that there is enough space to keep the power plug inserted under the clock and let the wire coming out from the rear.

Step 21: Build a Bottom

We need to add a cover to the bottom of the clock to prevent children touching the circuit, since it's very dangerous and could be lethal. To cut it from a thin wood board I marked the edges of the hole with a paper sheet and a pencil, then with a screwdriver I transferred the shape onto the wood surface. Then I cut the perimeter with a jig saw.
I also drilled holes for on-off switch, power plug, and time buttons. At the end I polished the cover with dark wax to give it a better color. Now the led is no more visible, but since the cover is snap-fit I can remove it or add another hole under the light.

Step 22: Extend Buttons

I know that some push-buttons have a long cylinder, to protrude out of the case. I also have many of them, and they are a good choice. Anyway in this case I forgot to solder that button type, so instead of desoldering and changing them with two long ones, I added a different style of extension.
I found some plastic supports for shelves with a brown cylindrical part, so I cut it and glued to the buttons. I also had to glue a washer so that some space remained between bottom cover and buttons body.

Step 23: Connect the Clock

Assembling is finally completed, you can connect your clock and admire your work!
There is enough space behind the pcb inside the case to keep a 9V power source, maybe 6 AA alkaline batteries or a Li-ion rechargeable battery-pack. I have to design a circuit to charge it via the power plug. I will add to the improvements list ;-)

Step 24: Place It

The top viewed nixie displays as these beautiful IN-4 have usually a narrow angle of view. It means that if you place your clock on a low table or cupboard you'll hardly see the digits. I suggest to keep it on a shelf or near the TV so you can see it when seated.
You can also decide to insert tubes deeper in the case, so that only the half sphere glass surface protrudes, but consider that one of the best features of a nixie display is that digits lie on different planes, and you can see them much better from the side of a tube.

Step 25: Improvements List

This is not the end of the project, since there are some features to add to this new clock, maybe you can suggest more improvements:

  1. add a RTC (Real Time Clock) module so that the clock keeps the time also when PSU is disconnected
  2. add a cathode poisoning prevention routine to extend tubes life
  3. add a sensor to only turn the clock when you are near (sound sensor, ultrasonic proximity sensor...) and save tubes life
  4. add an alarm function using the multi-tone speaker
  5. substitute the push-button with a rotary encoder, to simplify surfing among the new functions
  6. remove in some way the wood knurl that seems a push-button on the lower left of the case ;-)
  7. add an internal 9V battery to keep the clock running wit no power-cord done, looking the pdf files you will see two pads marked to that purpose!
  8. add a bottom to protect the circuit and maybe cover the led light, or bend the led if light is annoying done!
  9. test the new crossfade code from Arduinix done!
  10. polish with dark wax the inside surface of the holes.
  11. as well explained on Threeneuron's page, multiplexing needs blanking intervals to avoid ghosting, and when I'll go deepen in the code I'll examine this function
  12. in my next version the third position of the ON/OFF switch will set the sleep function, so to turn off the displays leaving the controller working done, attached pdf files are updated!
I hope you liked my bigger electronic project so far, stay tuned for more features and clock models! And tell me if I forgot some detail.

<p>Hello! Nice project! Can I have a copy of your dip trace file? I will be very grateful for the files!</p>
<p>Could you redesign this for a 4-tube design instead of 6? And also for a QS30-1 tube instead of the size you have? I would be eternally grateful. I'd love for it to have all the new features you list, as well.</p>
<p>Can I please have a copy of your dip trace file? Im ready to make the PCB but Im not going to etch it myself, I'm going to have it made by a company that knows what they are doing. </p><p>thank you!</p>
I don't understand howthe 74141 works. Isn't 4 input 9 output meaning 1 per nixie clock? On many other nixie project people use 6 drivers.. Can you explain?
<p>from what i understand:</p><p>with 6 drivers:</p><p>all anodes are connected to power and each driver connects specified cathode for a number you need lit on a lamp.</p><p>with 1 driver:</p><p>corresponding cathodes in all lamps are connected to each other, so all 1s to other 1s, 2s with 2s etc. </p><p>groups of cathodes are connected to driver.</p><p>anodes are connected to power with transistors and they are connected toother driver like arduino or something.</p><p>that setting can work like a simple matrix, for example you connect cathodes number 1 by their driver and chose which anode is connected in that moment so the number 1 is lit on corresponding lamp. with all anodes connected at the same time, lamps would display the same number, the one you'd choose with driver connected to cathodes. </p><p>when you want to light different numbers on each lamp, for example you want 4 lamps to display 2 3 5 7 you have to switch on anode 1 and cathode 2, turn off, set anode 2 and cathode 3, turn off, anode 3 with cathode 5 and so on. they would have to be lit on and off very fast so the eye would not notice the flickering of lights.</p><p>it's a bit more complicated way but with this you can use less components</p>
I bought like 24 of them on ebay for my nixie tube Clock, Indeed this is a bit more complicated but at the same time it is very smart on your end to thought about that!<br><br>Thanks for the info, but I will stick with my simple model 1 Driver / tube ;)
<p>is there any chance to get your diptrace files for this project? i finally managed to get the power supply to work after few approaches and making the clock is the next step</p>
<p>This is nice! I'm on a shoestring budget, though, so I can only afford <em>four</em> IN-14 tubes. What changes should I make to your design for the adaptation?</p>
<p>Hi! No changes! Just don't connect the two digits for seconds.. And you also can save some transistor... but leave space so you can add seconds later!</p>
<p>I've built two of these now, using your circuit design and modified code by ruizgerman, worked back to fit your schematic.</p><p>Used IN-18 tubes, and running from a 9v power supply.</p><p>I did discover that a 12v power supply will cause a massive heat problem, you would need a substantial heatsink on the voltage regulators to use a 12-35v supply, and the higher the supply voltage the worse it gets. I would STRONGLY recommend using a maximum 9vDC supply voltage.</p><p>I am currently working on my own schematic based on yours, eliminating a few things I don't need like the sensor inputs and the voltage regulators - I will be using a self-contained AC-DC transformer to do most of the work, and allow me to have a direct mains supply without a huge power block.</p><p>The purple one was built for a friend, the wooden based one is my own one, the last digit is awaiting a replacement from the ebay seller as the tube was DOA. The silver cased clock was a kit I was given last July as a birthday gift and got me hooked on nixies in the first place.</p><p>The one i am planning will hopefully make use of a self contained switchmode supply similar to http://uk.rs-online.com/web/p/switch-mode-power-supply-smps-transformers/7924379/</p>
heating problem will be probably due to a mistake in making PCB, since I can power my nixies also with 24V or more with no heating. <br>anyway it's good you simplify my circuit and use only the 9V supply, with no sensors input, that will be smaller and simpler to built. <br>I'm very glad you too love nixies and you could make your own clocks, I know that's very satisfactory! have a nice holiday :)
<p>Yeah, I'm not sure what's causing the heat issue. The 9v supply connects through the same regulators (I didn't bother with changing the connection from 12-35 to 9v when I put the new power supply in), and the heating issue drops away. Exact same circuit, but 3 volts lower and there are no temperature problems whatsoever. This is common to the two completed clocks and the test board I built, 9v is fine but more than that and significant heating issues appear. Dropping 3v through the regulator shouldn't cause it, and the 5v regulator, which rally has more work to do, doesn't suffer the same issue dropping the 4v it has to handle so it's a bit odd.</p><p>Hopefully when I complete my design I can figure it out a bit more clearly, I'd honestly prefer a switch-mode supply for efficiency anyway.</p>
IN-18 are AWESOME!
<p>For Andrea Biffi:</p><p>Could you help me to find a solution for:</p><p>Add neon bulbs between hours/minutes and between minutes/seconds with will blink with a delay of 1 second?</p><p>Add under every Nixie a RGB LED.</p><p>Thank you very much.</p>
search on internet, there are some projects like this you're looking for!
<p>Super helpful post! I've been looking through everything trying to understand it all and comparing your circuit to Threenueuron's. You use a 74141N to drive the Nixies while he uses individual HV transistors. Will you code work for his style of circuit as long as its connected to the same pins on in ATmega? Thanks!</p>
<p>Hey Andrea, this is a very nice tutorial, and a very nice clock indeed! I've already ordered 6 IN-4 tubes to start building. :)<br>One thing i don't understand is, why do we need an additional HV board, when all the components of that HV board are present on the main board?</p>
Indeed, you don't :-)
<p>Hallo, followed your steps, but I got an issue, code is running reset button resetting, but it doesn't generates 180 V, I can see only 7.8 volts. Honestly I don't get where is a problem. Can you give me please some advice.</p>
I have the same problem. It only shows about 8 volts. Have you found a fix for the probslm?
<p>How did you solved this issue?</p>
<p>I solved it by making a new high voltage board and connecting it to the existing one. The schematic is the same as this one and it works, here's a link:</p><p><a href="https://www.instructables.com/id/High-Voltage-Power-Supply-for-Nixie-and-Valve-Tube/" rel="nofollow">https://www.instructables.com/id/High-Voltage-Power...</a></p><p>As far as what the problem in the original one is, I have no idea but i suspect it might be a non working element, although I couldn't detect which one.</p>
<p>But if I have already done this PCB, how can I connect the high voltage board that you used to the main board?</p>
<p>Sorry I can't upload an image of my board because I put it in a case and it will be a pain in the *** to take it out. I will try to show you on the board template:</p><p>The red line is the high voltage. You have to connect the HV output to it (the easiest way is just to connect it to the +180 V test pin)</p><p>you will also need to connect the HV board to GND and +9V VCC, but that should be easy.</p><p>Hope I've helped you :)</p>
<p>The high voltage supply works perfectly, thank you very much!</p><p>Last question: which code and tubes did you used? Did you included RTC module?</p><p>Thank you again Svetko</p>
I've used IN-12 nixies and the code is the one written by the author of this innstructable.<br>It doesn't have RTC function. <br>I have tried using a code by another user - ruizgerman ( you can find it in the comments below) which has a RTC and anti ghosting program, but it did not work for me.<br>Another thing you should be aware of is that you have to use an Arduino to flash the microcontroller. I tried using an AVR programmer but it didn't work, the fuse bits and oscillator frequencies were all messed up. I think it might be possible, but I don't know enough about these things.
<p>Thank you very much Svetko, I will try this solution in the next days!</p>
<p>hello!</p><p>nice clock </p><p>i am planning to build one with IN-8 tube </p><p>do this code contain anti-cathode poisoning ? like random number for every 5 seconds</p>
no, it doesn't, I had no time to improve the code lately
<p>Hello!</p><p>It's done. I can push that &quot;I Made It&quot; button.</p><p>This is my version of your nixie clock, it's not as fancy as yours, but that was never my intention, so I'm very happy with it.</p><p>Custom pcb, custom case, programmed it myself ( with your code as base).</p><p>In the video you can see its anti-cathode poisoning routine and the leds are like pew pew pew.</p><p>I've made the leds to change color randomly each hour.</p><p>Last summer I didn't know how to design a pcb, or even how to program a uC, so you can bet I'm proud of what I made :)</p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/f01A36BqwSw" width="500"></iframe></p>
<p>Hello,</p><p>I have a question for you: did you used the same tubes shield of this instructable of did you found/made it? I love the LEDs under the Nixies and I'll be glad if you will answer me.</p>
<p>I made the shield myself using Eagle CAD.</p><p>The bad news is that my laptop died and I lost the Eagle file.<br>The good-ish news is that I uploaded a screenshot of the diagrams here on the comments, so it can be recreated.</p><p>To save space I made to shields, one on top of the other, the main electronics on the bottom, the nixies connections, leds and resistors on top, and some cables...</p>
<p>Thank you very much ruizgerman, beatiful clock ;)</p>
can you please help us with anti-cathode-poisoning program? would you like to share your code? thanks!
<p>I've already done it in a previous comment, but here it is anyway:</p><p><a href="https://github.com/ruizgerman/ruizgerman-Nixie-Clock" rel="nofollow">https://github.com/ruizgerman/ruizgerman-Nixie-Clo...</a></p><p>And as I also said, the code is written in a &quot;non-professional&quot; way, so it's not the most efficent code I could come up with, but hey, it works ;) </p>
thanks again and sorry for I didn't realize it's you! good work!
woow! that's really beautiful! I love the rgb effect!
<p>Hello! awesome instructable! Only I ran into a small problem with the tube pcb. The PCB files for the tubes that you made do not fit the in-4 tubes that I purchased. The pictures of the etched tube boards that you made have the right holes, however the actual files that you provided are different from the etched ones that are pictured. Could you email me the files for the boards that are pictured in step 8?? </p>
probably you are not printing them with 100% zoom... try to check it
The boards that you have etched in the pictures have the right holes. However, the files that you shared have different holes.
look te PDF files I uploaded in the third Nixie clock, they're the last ones and better ones
<p>I checked in the third clock and the holes still do not match the holes for the IN-4 nixie tubes that I bought.</p>
that's really strange... PDF files are right, and in-4 nixies are all with same pin geometry...
<p>Hmmmm... thats weird. Maybe I just bought a weird type of IN-4. Because on mine all the pins are evenly spaced with 1 space where the two pins are more spread out forming a gap. In the board that you used however it has 3 spaces where the pins are more spread out. If you look at the image below you can see that gap. </p>
<p>I looked at the pins and the board and now I realized that the gaps in the pcb correspond with the pins that are not used on the nixie tube. </p>
<p>Can someone point me to Bounce.h, event.h and stream.h.<br><br>I cant find them in my standard libraries or in the downloads :(</p>
<p>hai</p><p>** depends whether you wish to build electronics or code computers .</p><p>** those many years ago when my ill-spent youth constructing electronics and studying instead of chasing girls </p><p>Nixie tubes IN-14 - 7441 - driver - preceeded 74141 , with the MAINS frequency (50 Hz as the clock ) . This is surpisingly accurate as loading shifts the mains frequency so generator plants increase rotation frequency when no load so that 08;00 its the exact frequency day to day . Saves electronics </p><p>At the time the 7492 was available ( divide by 2 and 6 ) . Thus a simple matter </p><p>Add in a few resets to sets , thus as preceeded the glut of dig ital clocks which then added radios - added my own detector circuit - code set to turn on and thus the code out hour later . As stated ill-spent youth - wisdom of age - and cynicism - chasing the young ladies - would have been better uise of the time </p>
<p>Hi andrea,<br>I'm doing a similar project using this instructable as a template, and I have a question about the arduino code.<br>I noticed that you are using the function millis() as a reference for the current time. However, after doing some research, I found that the value returned by this function overflows and resets to zero approximately every 50 days. Does your code account for this and is the performance of the clock affected by it? <br>Thanks a lot!<br></p>
actually the best solution is to use a real time clock module, but I still didn't improve my code to use it...
<p>Not necessarily, all you need to do is <br>count the overflows, and then add the maximum value to your time <br>variable. Here's an example of what I'm talking about:</p><p>int overflowCount = 0;<br><br>unsigned long millisMax = 0b11111111111111111111111111111111;<br><br>unsigned long prevTime = 0;</p><p><br>void loop()</p><p>unsigned long runTime = millis();<br><br> if(runTime &lt; prevTime)<br> {<br> overflowCount++; //count the overflows in millis()<br> }<br> prevTime = millis();<br><br> unsigned long time = (runTime/1000) + ((millisMax*overflowCount)/1000); </p><p>With<br> this modification, the code should be unaffected for at least 50,000 <br>days, or 137 years. No need to spend extra money on an RTC module or <br>modify the PCB :)</p>

About This Instructable




Bio: I'm an Italian freelance structural engineer, graphic designer and photographer. I'm also investigating electronics, robotics and science in general. I enjoy hacking and ... More »
More by andrea biffi:Safe Clasps for Bike Pannier Bags revived CD rack as vintage box A Folding and Steady Work Bench 
Add instructable to: