Tuesday, 16 September 2014

Clock Electronics Current

The initial design for the Topsy Turvy Clock had all of the circuits being driven through the regulator on the microcontroller. This is a MIC5219 regulator and is rated at 500mA but also has a very low dropout voltage. The low dropout means I can run the clock from 4 x 1.5v batteries.

I decided to tot up the maximum current draw of each of the components:
  • ATmega32U4 max 200.0mA section 29.1 datasheet
  • ULM2003 Darlington driver chips leakage current = (100uA + 100uA) x 14 = 2.8mA
  • DS1307 Clock chip 1.5mA
  • 28BYJ-48 Motor the datasheet is 92mA but people have reported these taking as much as 250mA.

In my testing I've not noticed any issue but for the clock running for long periods I don't want to be running the regulator at (or over) maximum.

So if we add up the worse case scenario for all of these it comes 704.3mA, a lot more than the 500mA that the regulator can provide.

Luckily the driver board provides a solution, there is a jumper on pins 3 and 4 that can be used as a simple switch for the motors. In the modified circuit pin 3 is left disconnected and pin 4 attached to a second supply, in my case direct to the batteries.


This means that the regulator only has to supply the microcontroller, clock chip and Darlington driver chip which should be less than half the rating of the regulator.

Wednesday, 10 September 2014

Sign-O-Matic

To finish off the Topsy Turvy Clock I wanted to add a tag or sign on the back so that people would know when it was made and by who. I initially thought of a stainless steel or brass metal tag with stamped letters. However, I then spotted some two part plastic signs in a shoe repair shop in a supermarket I thought that would be much better solution. The chap gave me an estimate but I thought I'd see if I could get a better deal on the internet.

I found Sign-O-Matic via google and quickly designed my label on my phone. The website automatically adjusts to your screen size so it was very easy to use even on a tiny phone screen. I did swap to the desktop to create the screenshot below.



Once you've entered your sign details the preview even includes the dimensions so you know how big the result will be. Alternatively you can enter your own size requirements.

There's a wide range of materials to choose, from aluminium to wood so making a professional sign, badge or even vinyl banner. You can even add your own logo such as in my example above.

As you can see my resulting name plate came out fantastically.

Thursday, 4 September 2014

Clock Software

For the software of the Topsy Turvy Clock the natural choice was to use the loader and tools provided by Arduino. This meant the coding would be in C++.

It's been a long time since I last used this language so there has been quite a bit of re-learning. I have also been warned about the limited resources of the Arduino but I've also resisted the temptation to prematurely optimise the code and so far have not had any issues.

When starting out I looked for existing code that would help with my project. I looked at several stepper motor libraries but settled on Igor Campos's CustomStepper as a base to build my new version. I ended up recoding this rather than subclassing as I found it difficult to extend the class without accessing its internals.

So that the clock could automatically adjust for daylight saving I also added Jack Christensen's TimeZone library which in turn used the Time library. The Time library has a nice feature in the form of a periodic call back for syncing with a time provider such as a RTC. This means your clock keeps good time without constantly needing to communicate over the I2C bus. The TimeZone libary seems quite elegant but the Time seems more C like with globally scoped functions. As per a lot of hardware drivers there do seem to be several versions of the RTC code for the DS1307 library.

The Arduino platform does seem to have this consistent conflict with the core team writing in a C style and third party hardware providers wrapping up their code in classes.

I looked at some menu classes and techniques but as my UI is very simple I did not need to use them.

I've tried to stick with a C++ approach and have designed the software around a series of classes. I would normally use unit testing techniques to aid my development but have yet to familiarise myself with how to do that on this platform.



The stepper motor class provides the interface to the motor and optosensors. The clock class encapsulates the RTC and TimeZone classes with methods to set the time and date. The controller class glues everything together and provides the UI in the form of serial commands. The code uses the String object's abilities to parse the commands. Setup and loop don't have much to do, simply repeatedly calling the controller's run method.

As I was often using the serial port to "print" debugging information the Arduino Micro caused me a few headaches. Because the Micro is a single chip solution, when it resets to load new code it also resets the serial port. This causes two problems, sometimes the port changes and sometimes it fails to be detected at all. The first is fixed by simply selecting the updated port in the menu and the later requires the Arduino IDE to be closed and the Micro to be restarted. My work around was to do some of the development on my Arduino Uno before swapping back to the Micro for testing.

This problem could also be resolved by a unit testing approach as it would mean some testing could be done without hardware. Where this would become problematic is when hardware interdependencies came into effect such as the slotted opto sensor and the stepper motors.

The work in progress code can be seen over at Github.

Monday, 1 September 2014

Other wierd and wonderful clocks

Whilst building the Topsy Turvy Clock, I've been on the lookout for other interesting clocks or other interesting clock modifications.

There are quite a few examples of the Weasley Wizard Family Clock which has multiple hands to show the locations of the different wizards in the family. The best example I've seen is Brad Collette's "The Magic Clock" and inspired the mechanism for my own clock.



Over on Tindie Akafugu Corporation have also been looking into fiction for ideas. They have a Vetinari Clock based on a standard clock module with a modified tick.



The Twitwee clock has a LCD display which normally shows the time in the form of an old fashioned cuckoo clock, when it recieves a message from the internet it swaps to display the message.



I can definately recommend googling for "Microcontroller Cuckoo" as there's lots of other interesting modifications in this category such as Joe Meiser's Robotic Vulture.

An example of non linear numbers is this "F-Stop" Watch, however the mechanism runs in a conventional manner.



Over in France back in the late 1700s they altered time completely with the concept of decimal time and a 10 hour day. I believe this is really just the renumbering of the dial and the mechanism and hand movement has not changed. If you know if the inards were changed too, please let me know.



Also worth mentioning is the Bulbdial from Evil Mad Scientist, this uses LEDs to create shadow hands around the dial.

My final find is from Brett Oliver and is more radical in it's thinking and has three analogue volt meters to show the time. Although Brett did not come up with the idea of using volt meters to display the time his clock is very stylish and has a very detailed write up.






Thursday, 21 August 2014

Car wheel removal

I have a small car which means that the spare wheel is hidden away in a hole under the floor of the boot. Down at the botton of this hole is a nut and threaded into this nut is a handle that screws down and holds the tyre in place, just incase it tries to escape when you are driving over a speed bump.

For some reason when it rains the water manages to make it's way into the hole contain holding the spare wheel.

The other day we discovered a slow puncture so I set about swapping out the spare so I could drive around to the tyre shop. As always my first challenge was removing the wheel trim. I'd taken a screw driver for that job so managed it with relative ease i.e. no blood.

When I tried to remove the spare from the boot, the handle would not budge. Because of the location it was difficult to get anything into the hole to help unscrew it. In the end I resorted to gripping it with a pair of pliers and managed to loosen it up. Not surprisingly the nut in the bottom of this hole had rusted to the handle. I cleaned up the thread on the handle with a die and soaked it in WD40.

I then made a simple tool to help unscrew the handle next time we need to remove it.



Finally I plan to get some old tea towels so that any water in the hole is soaked up and does not slosh all over the nut or if appropriate water proof it with some Sugru.

Sunday, 17 August 2014

Clock Numerals

To make the new numbers for the clock I considered a few options.



Firstly I thought about simply chopping up the existing numbers and resoldering them in the new positions. The problem with this is that the numbers have been specially shaped to fit their current locations. In some cases this would mean that I would need to add small pieces to them.

I also thought about etching, unfortunately to have that done commercially has some expensive setup costs so for a one off it would be a few hundred pounds. However it is worth considering if I wanted to make a lot of clocks. I don't really have the experience to try DIY etching, something I'd like to try but on a simpler project.

3D printing was also suggested but I thought it might not be a good match as it is a large flat shape.

Finally I thought that laser cutting might work, I made some enquiries and to have the part cut in metal again would have some high setup costs so would likely be £50 to £100. However I did find a company who could laser cut in cardboard. Given that my numbers will be behind a glass face and would be white to match the originals then this material could work well. The costs for this are a lot lower so I set about drawing it up.

I downloaded some numbers via the MSOffice clip art and arranged them around some concentric rings. This was then swapped to Libre Office which has some good spline editing tools. It took me some time by I'm happy with the results. The dual rings was one of the features I liked about the donor clock and I think it will give the numbers a strong connection with the clock, "as if they were original"



Wednesday, 13 August 2014

Spindles finished

The final piece of mechanical engineering on the clock was the spindles. As previously mentioned I had a couple of different ideas on how these might work. I went with something roughtly like my second spindle design and that's worked out nicely.

I knew that cutting the diameter for the hands to push fit onto would be critical so I turned this first before machining the spindles to length. The inner spindle then only required cutting to length and polishing. The hour hand spindle had to be turned so that it would fit through the "top hat" component, I've since discovered these are called "split nuts" and are often found on hand saws. Once the hour spindle was turned to fit the "top hat" I then turned a section to mount the gear. Finally I sawed this to length and turned it around to faceoff the other end.

It was a bit tricky to film these as I needed an extra hand hence the use of the pliers to hold the top hat whilst I turned the two gears beneath.



The next step is to fit these into the clock and ensure it's all running smoothly before testing with the motors.

Workshop Practice Series