Jumbled digits on clockface, but hands still point to the correct digits
Arduino software, final version
- 4.81 kB - 12/28/2019 at 18:36
Setting the clock up properly made the clockchip loose its setting, ie produce random time. Was it the stepper making too much electrical noise/power dips? Measuuring it revelaed that the ArduinoPro was a 3,3V version ie the clockchip didnt get the 5v it needed.
New 5V versions of the ArduinoMiniPro, and some new smaller stepper (the ubiquitous 28BYJ-48) ordered.
The software acted strange - but the new stepper has gear and thus 2000 steps/revolution so there was (another) overflow in intermediate calculations. Easily fixed by changing the constant 2000 to 2000L ie. the long datatype, and the compiler thus made all integer calculations in long. Still something was not quite matching - how many steps are there for a full rotation?
Turns out it may be 2048 or 2047.something depending on the precise manuafacture. (google for "48byj-48 gear" and see all the ugly details). I opened my stepper, counted the teeth and was happy to notice mine is exactly 2048 step/revolution.
Another lucky break is the output shaft is the same size so I just need to drill new mount fittings.
Early tests with the new steper shows it much smoother/quieter.
Had to supress for the minute hand to nudge the hour hand every minute (as the stepper resolutin now is so high) so it only does it on even 5 minutes.
Another visual improvement will be for hour hand not be 100% accuratly positioned, but scaled closer to hour digit so it easier to see what it points to. It is hard to see at 25 to 35 minutes past where it is right in between.
For now I take the 5V external (USB) supply jumpwire it to Vcc and the Clock-VCC, bypassing the 3.3V regulator, but of course will be done proper on the next one.
Also need the button mounted for (re)setting the clock and clockchip - and write some code.
Two videos showing it with a normal clock face and a jumbled clockface
Gallery pictures updated. Here is the back, showing the circuit. Still needs a backplate to set it firm and fit a button for time adjusment (f.ex. summer/winter time)
Clockchip breakout board, Arduino Nano (no USB, just serial), ULN2001 driver.
Electronics (one directly connected UL2001 with Darlington transistors - no more or less) now works.
Shows the basic principle (and a messy work bench, but such are creative people :-) )
When I mounted the drive on a clockface, I noticed the minute hand seems further off than the +/-½ tooth.. Minor problem with the math (truncate vs. rounding) so I do not stop at the nearest tooth but the floor(nearest).
It seems to be one minute off. Although I can not test it at the moment, I reason it is caused by the stepper motor/circuit/count logic. I simply start with the first coil (of the 4 it has), but it may not be the coil that is aligned with the vertical. One minute is 3⅓ steps. I just need to twist the clock dial or add a start offset in the code.
The rounding error was tricky, the calculation became complex as all factors needed taking into account
Before MinuteNxt = Jumble[((Minute+2)/5)%12]*Full/12 + (( T>2 )?T-5:T)*Full /60; HourNxt = Jumble[Hour+(Minute>29?1:0)]*Full/12+(Minute>29?-(60-Minute):Minute) /12 ; After #define Round(Num, Den) ((Num)+(Den)/2)/(Den) #define Positiv(Val,Wrap) ((Val)<0?((Val)+(Wrap)):(Val)) MinuteNxt = Positiv( Round( ( Jumble[((Minute+2)%60)/5]*5 + ((T>2)?T-5:T) )*Full , 60), Full); HourNxt = Positiv( Round( ( Jumble[Hour+(Minute>29?1:0)]*60L + (Minute>29?-(60-Minute):Minute) )*Full , 60L*12), Full) ;
The offset is simply solved by powering on the stepper, jiggling it a little and then manualy turn the hands to the start position (they are only pressfit, so they can be turned while the motor is still)
The program has been written and the logic for when to nudge the hour hand has been debugged with plenty of Serial.print(). It is missing the clock stuff, as I still need to find a clockchip in my stuff or buy one.
A simple circuit with a ULN2001 to drive a simple 4 coil stepper has been created, and yes, the motor moves as it is supposed to.
Didn't need the the "Stepper" library, I just drive the 4 pins. With only full steps, the program logic is trivial. Turned off when stationary.
Having some difficulty with the stepper choice, both mechanical and electrical. I have a good stepper but it is large and heavy, but it runs at 5V with 200 steps/revolution. I have a smaller stepper which is better, but has only 50 steps/revolution, which is too coarse. OK, so a simple large gear on the hands being driven by the stepper would do it. I only need 4:1 or better. The lighter stepper wants 24V - but that is for full power, I can drive it at anything 10V-24V, the torque is still more than enough to move the hands. Which means two power rails (5V and something >10V), either two walwarts or a stepdown converter
Whilst I use a normal Arduino for development work, I want it on a dedicated board at the end.
I'll go with the heavy 5V motor, to get a "beta"-version constructed. Pro: No gears, simple 5V supply, Con: heavy/bulky behind clockface.
The design is to use a single stepper motor that drives the minute hand. The hour hand is stationary, but can be moved by the minute hand via a small protrusion when they are above each other. The idea is to rotate the minute hand (clockwise) until it has positioned the hour hand, and then move (anticlockwise) back to its correct position. The minute hand will then move normally for a few minutes, and then it will nudge the hour hand forward by the same manuever.
The hour hand will be positioned exactly like a "normal" hour hand, ie. it will be slightly before, on, and after the correct hour. At half past it will be shifted the large amount to match to the next digit (which will not be adjacent)
The minute hand does the same; it normally would be close to the hourdigit as on a normal clock., i.e. as it hovers around the "3"-digit it means 13 to 17 minutes past the hour (where the "3" is in some other position)
Before applying power one can manually move the hands to 12 o'clock (wherever that number is placed). Future version wil have some small optical sensor to sense that position so restart is fully automtic (assuming the chip has kept time).
To set the chip time a single button is used to advance the hands until they point correct.
A stepper with 200 steps, 1.8°/step, 0.3 minute/step has sufficient resolution so no gearing or halfstep is needed. It can be assumed that it's permamnet magnets will hold position even with the motor turned off. Thus we only need a short current puls to advance it by one step.
3 short pulses/minute ... might tempt to use a battery, but there are 100's of steps needed to move the hour hand every 5 minute. Quick calculation: need 3*60 for minute advance + 200*(60/5) for nudging hour hand = 2400 steps. A step needs ...ehrm... 200mA for 0.2second? = 40mAmpSecond = 0.11 mAh/step ? That means260mAh/per hour = 6000mAh/24hour plus what the microcontroller needs. Mains it must be. (comments to the calculation welcome)
I am still trying to find the original YouTube that inspired me - to give credit where credit is due. I saw it many years ago (2015?) but the idea stuck in my mind.
It showed a handrawn clockface, where the hour positions had been mixed up. At the back there was some motor(s) that moved the hands. It was a very thrown-together project. Precisly how the hands moved and pointed to the digits I can not remember.
What I will "borrow" from that vague memory of the video, is a clockface where the hour position/digits are jumbled, but still evenly spaced around the circle, and of course still be able to work out what time it shows.
Got a comment from Dave, which enabled me to find a swiss designer/clockmaker that had a similar idea - at least the clockface part. That webpage gives no indication of if the hands actually move different to an ordinary movement. I think it only is a nice and fancy case.