By continuing to use this site, you agree to our use of cookies. Find out more
Forum sponsored by:
Forum sponsored by Allendale Jan 24th

Another Arduino-controlled pendulum clock

All Topics | Latest Posts

Search for:  in Thread Title in  
SillyOldDuffer06/12/2020 11:51:18
Moderator
6866 forum posts
1539 photos
Posted by Michael Gilligan on 06/12/2020 00:37:51:

I can’t immediately think of a practical way of using this information, but you clever Arduino chaps might:

Prime factors of 9192631770 = 2 × 3 × 3 × 5 × 7 × 7 × 47 × 44351

MichaelG.

Yikes, 9192631770 had me going! Re-read the thread in case I'd missed something. Seemed familiar, but why? Got there in the end, but it took a lot longer than a second!

Dave

PS Although the earlier link to Captain Kater is broken, the paper is easily found by a search. Another interesting read: I don't know how you find this stuff. Thanks!

Michael Gilligan06/12/2020 12:24:50
avatar
17299 forum posts
778 photos

Sorry the Kater link didn’t work for you, Dave ... I believe that checked it when posting blush

The 9192631770 factors interested me because 44351 seems a manageable figure for what I might call a Tixel

If we are using a Caesium Clock as our ultimate reference, and using decimal arithmetic ... I posit that calculations may somehow prove more convenient and less ‘noisy’ than attempting to work with microseconds or nanoseconds.

Way out of my depth ... Which is why I just chucked it into the pot

MichaelG.

.

Edit: Looks like I must have linked the downloaded document instead of the referencing page blush

This should work : https://royalsocietypublishing.org/doi/10.1098/rstl.1818.0006

Edited By Michael Gilligan on 06/12/2020 12:31:41

SillyOldDuffer06/12/2020 14:43:38
Moderator
6866 forum posts
1539 photos
Posted by Michael Gilligan on 06/12/2020 12:24:50:

Sorry the Kater link didn’t work for you, Dave ... I believe that checked it when posting blush

The 9192631770 factors interested me because 44351 seems a manageable figure for what I might call a Tixel

...

I've done what I should have done in the first place which is to fix the link using my moderator super-powers!

Tixel is genius. No instant use for 44351 but in my ongoing Arduino Pendulum project I have various base tick values; 156.25nS, 100nS, 62.5nS, and 50nS. In your honour I shall start calling them tixels! If we both try hard, we can get it into the OED.

Dave

Michael Gilligan06/12/2020 15:09:05
avatar
17299 forum posts
778 photos

yes laugh

John Haine07/12/2020 10:22:07
3647 forum posts
197 photos
Posted by Michael Gilligan on 04/12/2020 17:38:50:

Looking good, John

... any idea what caused those two anomalous bumps ?

MichaelG.

Another cause I should have mentioned is the corrections applied by the Arduino, which nominally allow the clock to get a second ahead and then skip a second. The photos are taken asynchronously to this so it introduces another apparent observation error. My goal is to have the clock being within a second or two of real time without adjustments over a long period.

Peter Bell05/01/2021 12:58:33
339 forum posts
155 photos

Inspired by John's clock I eventually got round to trying the simple Arduino based driver which is described earlier in the other thread on a simple pendulum left hanging from a previous failed compound pendulum experiment. It has a an ironless wound core and the pendulum rod swinging over it has a small powerful magnet attached to the end. Pic below shows it swinging, nothing connected all as per the pic in the original article.

jw-1 4-1-21.jpg

I used the sketch intact from the link and the pendulum worked first time, swinging away nicley, very pleasing. However after leaving it for a while when I went passed I could hear knocking with the pendulum swinging wildly. The knocking turned out to be the top suspension rod hitting the suspension bracket, not good.

Put the scope on again and I could see multiple actuations from the coil. The pulse width was set at 30ms but I could see 5 x 30ms = 150ms, no wonder it was going a bit wild.

simple -3 5-1-21.jpg

Tried various settings on the sketch also playing with the limiting resistor which improved things. I realised that the multiple pulses were caused by the threshold voltage being seen on the rising part of all the cycle so modified the sketch slightly and its now on got one 30ms pulse and seems very happy. The pendulum duration is around 3/4 secs.

Peter

simple -1 5-1-21.jpg

John Haine05/01/2021 14:46:46
3647 forum posts
197 photos

Peter, in order to prevent spurious impulses, after the "proper" impulse I keep the driving output from the Arduino low until just before the next zero crossing, then switch it to an input. This means that all inputs from the coil are suppressed when there shouldn't be any. I also have amplitude control.

Peter Bell05/01/2021 15:49:12
339 forum posts
155 photos

John, Yes I have a similar arrangement but also enabled pin 13 on and off to flash as the Arduino is remote from the pendulum, can see its working---very much work in progress! I thought of simple amplitude adjustment by using selective resistor if needed. The original sketch is a very neat arrangement, would have liked to sample something to give amplititude control as on my other clock but cannot think of a way at the moment without adding another sensor which I dont want to do.

I deliberatly left the rod length short for a 1 sec beat as I was going to use the compound part to adjust it to 1 sec or more, think its about 0.75 secs now but needs reworking to make a double suspension spring arrangement to give it enough stability .

John Haine08/01/2021 10:19:36
3647 forum posts
197 photos

Latest timekeeping results.

clock_8january21.jpg

This shows readings over the past 10 days since setting the two correction counters to 132 and 92. One odd thing I've seen is that every time I upload new software with changed counters, even though the clock doesn't actually stop swinging it takes quite a long time (days) to settle down. In the plot above the blue error curve was steadily increasing but the rate of increase seeming to flatten off, so 3 days ago I reset the seconds hand (just using the control switch which inhibits dial impulsing, removing 24 seconds of accumulated error. Since then the error has built up to 2 sec, but this includes some due to my accidentally jogging my desk (the clock sits on the desk in my study). The clock has a "half-second" pendulum so the SW divides by two to drive the dial, and normally you see the dial advance on the same half-swing each time, in this case it was L->R. But then I stood up yesterday and accidentally jogged the desk since when it has been incrementing on R->L, so I think there's been at least a half-second extra input to the displayed time and possibly more as the pendulum settled down. I also display the temperature at the time of the reading, I'm not convinced that there is any obvious correlation but haven't yet done a regression analysis. Ignore the grey line. Anyway, I think the regulation is getting there, and I already rely on the clock when I just want to quickly know the time.

John Haine08/01/2021 10:26:11
3647 forum posts
197 photos

jh5_schematic.jpg

In case anyone is interested here is the schematic.

SillyOldDuffer08/01/2021 13:57:47
Moderator
6866 forum posts
1539 photos
Posted by John Haine on 08/01/2021 10:19:36:

Latest timekeeping results.

... One odd thing I've seen is that every time I upload new software with changed counters, even though the clock doesn't actually stop swinging it takes quite a long time (days) to settle down.

... this includes some due to my accidentally jogging my desk (the clock sits on the desk in my study). ...

I've got both problems too. My pendulum is very sensitive to jogging, and, after a restart, it misbehaves for at least 4 hours. Some evidence in the longer runs that it becomes more stable after a couple of days but I've not had mine running long enough yet to prove the pendulum settles. Or gets worse! MichaelG suggests my carbon-fibre rod will develop fatigue cracks at the suspension point, and I think he's right.

Dave

Alan Wood 408/01/2021 14:36:50
184 forum posts
8 photos

I have converted my William Smith Gearless Gravity Arm clock from mechanical reset to electronic reset.

I have a HED clocked at mid swing from a small magnet on the pendulum. After a programmable number of swing counts a solenoid repels a second larger magnet on the pendulum (at right angles to the swing magnet) to give the pendulum a kick. If left to its own devices the swing amplitude would incrementally increase so a second HED detects an overswing situation and inhibits the swing counter until the swing diminishes. Control is battery powered via an Arduino Mini where I can program swing counts between resets and solenoid reset pulse duration and pulse / pendulum synchronisation.

Pendulum kicks occur around once per minute otherwise the pendulum is left to its own devices and free swings. Monitoring the timekeeping on my Microset Timer suggests a few seconds per day accuracy which is more than enough as a display device. It is also much quieter than the anti social clunk of the old mechanical gravity arm reset.

Bill would not have been impressed but even his wife said she hated the design because of the noise it made. As a result it was forever forbidden from running anywhere in the house but Bill's workshop wall. My wife echoed Judy's sentiments and the modifications have granted a reprieve.

John Haine08/01/2021 17:14:24
3647 forum posts
197 photos

Alan, that's very interesting that you're using the Mini - what batteries do you use and how long does it run please?

Alan Wood 408/01/2021 22:48:37
184 forum posts
8 photos

Hi John

I am using the Pro MIni on a 3V3 supply (it is a 3v3/8MHz version) which is derived from a MCP1703-3302 LDO regulator. The Mini on board LEDs have been disabled. The board overall is supplied with 12V from a Super Polymer Lithium 5AHr battery and this is stabilised at 10V in a LM29371 LDO to feed the solenoid. This stabilises the solenoid pulse and this is the main battery consumption. I am getting something like 6 months battery life.

I have LEDs to indicate swing, overswing, pulse delay and pulse status but these can all be disabled via the Mini to save current. The Mini provides a low battery signal via one of its analogue ports.

Since getting this modification to the clock up and running the Seeeduino Xiao has appeared on the scene which is smaller than the Mini and alleges less current consumption. It claims lots of ports but they are multi use so the net number of pins is limited. If I did away with my status LEDs I could probably use it instead.

The Xiao uses the Arduino IDE for programming but we have had problems talking to it with Win 7 but Win10 is fine. This related to the USB driver and we seem to have sorted this now. Seeed were not very supportive hiding behind the 'Win 7 is no longer supported' banner. This seemed a bit short sighted given that most experimenters use 'that old laptop under the bench' that is still on Win7.

The Xiao is very low cost ! Have a look at DroneBot's Youtube or his .COM blog site if you want a quick overview.

I can send you more details of my board if it is of interest.

Alan

Peter Bell11/01/2021 19:19:03
339 forum posts
155 photos

My pendulum seems to be happily running and its coming out at around 0.8 sec/ swing.

Not sure if I should be asking this but here goes! Its a mild steel rod and bob in free air.

If I wanted to get some simple data from it s rate would it need to beat seconds?

What would equipment would I need to do this?

Dont have a PC in the workshop.

Peter

John Haine12/01/2021 16:25:48
3647 forum posts
197 photos

Peter, you can get an approximate idea by using the Arduino itself. You can record the time of a "tick", for example when you detect the pulse from the coil using the "micros()" function and remember it until the next "tick" when you subtract the new time from the previous one and remember the new. The difference will give you the period (or semi period) measured in 4 us increments with an accuracy somewhat limited by small changes in software execution time and of course the Arduino clock. You'll have to output the data somehow, the easiest is to use the Arduino serial monitor. That needs a PC or at least something like a Pi in the workshop. One approach could be to use a Pi without a display of keyboard, running the Arduino IDE (version available for the Pi), and controlled using VNC from your PC via your Wi-Fi. The Pi comes with VNC server and the client is free from the web. No need for your pendulum to beat seconds.

SillyOldDuffer12/01/2021 18:17:54
Moderator
6866 forum posts
1539 photos

Posted by Peter Bell on 11/01/2021 19:19:03:

...

If I wanted to get some simple data from it s rate would it need to beat seconds?

What would equipment would I need to do this?

Dont have a PC in the workshop.

Peter

I do it with a Serial USB connection to a headless RaspberryPi as described by John, but I'm familiar with Linux which might be too much for just data collection.

An alternative would be an SD Card Reader module, many other examples available, about £6.

Easy to wire and there's a library. Rather than send character data to the Serial Port, or as well as, the Arduino opens a file on an SD Card and writes lines of data to it.

When needed, the card is ejected and plugged into a PC. It should be recognised automatically and can then be opened with a spreadsheet. Most spreadsheets will recognise each line as a row of numbers, and import them as rows and columns. Then the spreadsheet can do the usual maths and graphs etc.

Probably only necessary to capture one number per tick - the time in microseconds since the previous tick. But it's easy to add info from other sensors:

At tick:

  • set tickTime = Now
  • period = tickTime -previousTime
  • previousTime = tickTime
  • get temperature
  • Serial.print( period )
  • Serial.print( "," )
  • Serial.println( temperature )

Very similar for the SD card.

In setup:

File dataFile = SD.open("datalog.txt", FILE_WRITE);

In loop():

String dataString = String(period) + "," + String( temperature);

if (dataFile) {
dataFile.println(dataString);
}

Peter Bell12/01/2021 19:52:38
339 forum posts
155 photos

Thanks for the advice.

Think it may be easier/quicker with my limited knowledge to go down the SD card route so I've ordered them also some extra nano's--seem to have run out

Any reccomendations on temp? Got some DS18B20 but think I remember reading they were very slow, also got some TC74 to hand?

Perhaps I can use the if statement where the pulse is generated as the tick after the threshold is reached?

Peter

#define THRESHOLD 10
#define PUSH_TIME 30
#define A_PIN A0

int led = 13;


void setup() {
pinMode(A_PIN,INPUT);
analogReference(INTERNAL);
pinMode (13,OUTPUT);

}

void loop() {
if (analogRead(A_PIN) > THRESHOLD) {
pinMode(A_PIN,OUTPUT);
digitalWrite(13, HIGH);
digitalWrite(A_PIN,HIGH);
delay(PUSH_TIME);
digitalWrite(13, LOW);
pinMode(A_PIN,INPUT);
delay (300);
}

}

duncan webster25/01/2021 19:30:08
avatar
3054 forum posts
36 photos

The time has come to replace the steel pendulum in my clock with carbon fibre. It occurs to me that the suspension spring and top pendulum fitting are metallic and so will still expand, so should I have the fixing of the bob below centre so that it expands upwards to compensate? I now it won't make a lot of difference s I'm only talking a handful of mm rather tan the full length of the pendulum, but it would be easy to arrange.

John Haine26/01/2021 07:56:36
3647 forum posts
197 photos

Worth trying surely, if you have the necessary data. I must admit though that I haven't bothered!

All Topics | Latest Posts

Please login to post a reply.

Magazine Locator

Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!

Find Model Engineer & Model Engineers' Workshop

Support Our Partners
JD Metals
emcomachinetools
ChesterUK
Eccentric July 5 2018
cowells
Warco
Eccentric Engineering
Subscription Offer

Latest "For Sale" Ads
Latest "Wanted" Ads
Get In Touch!

Do you want to contact the Model Engineer and Model Engineers' Workshop team?

You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.

Click THIS LINK for full contact details.

For subscription issues please see THIS LINK.

Digital Back Issues

Social Media online

'Like' us on Facebook
Follow us on Facebook

Follow us on Twitter
 Twitter Logo

Pin us on Pinterest