By continuing to use this site, you agree to our use of cookies. Find out more
Forum sponsored by:
Forum sponsored by Forum House Ad Zone

Arduino Pendulum Clock Design - Comments Welcome

All Topics | Latest Posts

Search for:  in Thread Title in  
duncan webster19/09/2020 13:13:13
5307 forum posts
83 photos

If you could manage without the 'after waiting y miiliseconds' this tells you how to do it

**LINK**

SillyOldDuffer19/09/2020 21:56:40
10668 forum posts
2415 photos
Posted by duncan webster on 19/09/2020 13:13:13:

If you could manage without the 'after waiting y miiliseconds' ...

It's the 'after waiting' bit I'm struggling with, or at least doing it neatly. Using timers could be the answer, though. Set a timer that sets a second timer maybe...

Got some code ready to test tomorrow. Don't bet the farm on it!

Dave

SillyOldDuffer20/09/2020 14:54:02
10668 forum posts
2415 photos

Progress!

This code maintains the pendulum:

clockwkg1.jpg

When a tick is detected due to the beam being interrupted, waits 240mS for the bob to approach the electromagnet and then emits a 15mS impulse. magnet is an object of class pulser, which contains the code needed to manage delayed pulses. Calls for new pulses are ignored until the active pulse finishes.

Waveforms. Bob detect in yellow, and delayed magnet impulses in blue:

15-240.jpg

Impulses are much shorter than pendulum period in hope of reducing bob disturbance. Watching the bob swing for 10 minutes shows 15mS impulses are too powerful because the magnet visibly gains energy. The impulse time delay is a rough guess. Testing temporarily with the Mk1 dual electromagnet holder which due to a design error doesn't allow a magnet to be positioned BDC, so the impulse attracts at the end of each swing, effectively reducing gravity. Slightly sensitive to bright sunshine, and very sensitive to bumping the table.

Going to leave the bob swinging with 10mS impulses. While it runs, off to make an end-cap and connector to see how much vacuum I can apply to a foot of Mr Marley's Best 68mm PVC Drain Pipe. Will it collapse? Will the joints leak. How do I make a reliable vacuum valve. Failure beckons...

Dave

SillyOldDuffer21/09/2020 14:18:27
10668 forum posts
2415 photos

Leaving the bob swinging didn't go well so whilst waiting for super-glue to set I investigated why the Arduino was intermittently measuring half bob times and impulsing on FALLING edges when told to register only on RISING edges. Suspecting a faulty Arduino, I connected it to a Function Generator and it worked perfectly, RISING, FALLING and CHANGE.

Although the waveform coming out of the Infra-red proximity module looks OK, it's not. Zooming in shows zero to be a small positive voltage anywhere between 320mV and 730mV. And it's noisy too, this sample showing 176mV of noise between the floor at 392mV and spikes up to 568mV:

noisefloor.jpg

The dirty signal causes the Arduino to trigger incorrectly. Adding a diode helps, but the beam break electronics need a rethink.

The proximity detector module is normally connected to an analogue input, and a pot adjusted to set the range. Connected to an analogue input, the sensor's zero being above zero and a bit noisy doesn't matter. But it does when connected to a digital pin. Me assuming the sensor output signal is between ground and 5V was a mistake... Wasted most of the morning on this.

On the plus side I wrote the 'gear train' code, which successfully converts ticks into elapsed hh:mm:ss since power on and displays it. Almost a clock!

Back to making a cylinder to test the vacuum side of the project. An honest lathe and mill job, not pesky electronics.

Dave

John Haine21/09/2020 16:28:44
5563 forum posts
322 photos

Dave, when I started with my Synchronome I was using an opto module that had a standard opto slotted switch on a little board with an LM392 (?) comparator - 10 in a bag from China via eBay for not lot of money. I found they were terrible, the active edge had loads of spurious oscillations that gave false triggering. I know you're using a proximity switch, but I found that the **LINK**, which is the Sharp GP1A57HRJ00F is vastly superior. It has an integrated Schmidt trigger and gives very clean, fast edges. They are £1.88 each from RS, and you can get little PCBs to mount them on (can't remember where but Google should help - may be Adafruit?).

I do use one of the other optos, sensing the other edge which is clean, for the homing routine on the stepper which lifts the gravity arm.

duncan webster21/09/2020 18:44:54
5307 forum posts
83 photos

John's link claims to be a through hole reflective sensor, but if you read the datasheet it is a beam interrupt device with built in Schmidt, these are what I used on my clock, only difference mine were Omron

SillyOldDuffer22/09/2020 14:26:22
10668 forum posts
2415 photos

Thanks to John & Duncan for the pointer to the Sharp device: I'll order some. (John Haine is costing me a fortune, what with books and all!)

Slow progress due to constant interruptions today, but I've made end-plates for 250mm of 68mm PVC drainpipe and am about to make a vacuum valve.

Completely out of my depth with the design, so I hoping a ball-bearing and o-ring will hold the seal until the valve entry is blocked by a bolt & pipe thread sealant.

I have an untested low pressure vacuum pump and a length of 10mm i/d heavy rubber hose. The valve design, inspired by LBSC boilers:

valvedwg.jpg

Not shown, an internal screw-in sleeve to stop the ball-bearing coming out, or the bolt used to close the valve after the hose is removed. Ideally the assembly will take close to a full vacuum without collapsing and hold it for several years. (Fat chance, but it keeps me amused.)

Idea rejected: valve made of 30mm of silicone rubber sleeving arranged such that air pressure crushes it flat and forms a seal. Not convinced it will crush flat! Also, the seal would progressively weaken as vacuum was lost, whereas I hope leaks through the ball bearing and bolt will slow down as the pressure equalises.

Occurred to me too late the pressure test could have been modelled with Fusion360 quicker than I can make one! My spin doctor advises to tell you all it was built for real in order to test the valve and the vacuum pump. Yeah, right! I hope everyone has forgotten I'm supposed to be measuring Q, not playing with pumps. There is a bit of logic behind the diversions: the design needs to be revised, but I'm taking the opportunity to squeeze more info out of the experience.

Dave

PS Sorry about the heavy handed drawing. Caused by converting PDF to JPG for the Album. The original is fine.

 

Edited By SillyOldDuffer on 22/09/2020 14:27:40

SillyOldDuffer29/09/2020 16:30:59
10668 forum posts
2415 photos

Back to the clock! My vacuum pump is working well enough to proceed. Pumping out the clock shield doesn't cause it to collapse, or even to bend noticeably, which fits in with Fusion360's FEA which said my drain pipe concoction has a 15X safety factor.

Despite the awful noise the pump makes I could hear shield hissing due to leaks. Looking at the ends of the pipe showed my band-saw hadn't done a marvellous job; cut not quite square, visible tooth-marks, and a bump where the pipe separated.

The obvious way to square and polish it off was in the lathe:

dsc06318.jpg

One end is poorly supported by the chuck and the other is in mid-air. All the red lights are flashing. Worth a try with soft plastic and a sharp cutter, I thought. Silly me. It's a Widow Maker! One touch with the cutter and the pipe ejected violently, nearly jambing between the jaws and the bed before bouncing off and landing on my foot. A metal pipe could do a lot of damage.

Still trying to think of a quick simple way of supporting the pipe, but I tied the ends up with a set-square, file, and sand-paper. Considerable improvement: with the pump running I was unable to pull the end-cap off bull-worker style The area of the end-cap is about 6 square inches, so I guess the vacuum was at least 10psi below atmospheric (ie about 60lbs holding the cap on.)

Next step, my vacuum valve:

dsc06319.jpg

Nothing special, the ball bearing keeps the valve sealed under atmospheric pressure and the brass thingy stops the ball bearing from coming out. After a sharp tap with a hammer seals fairly well, but the O-ring makes leaks worse. I think this is because the O-ring should squidge into a squared corner, whereas mine sits in a cone. Any o-ring experts out there?

At the moment the vacuum holds for only about 8 seconds after the pump is switched off, which is poor. The leaks need more attention. The pipe ends need polishing. Maybe thread sealant?

Meanwhile the electronics and software have been improved by adding a display and a Real Time Clock module. The RTC is a diagnostic aid - it lets me compare pendulum time with an accurate clock for debugging purposes.

dsc06323.jpg

For example, the RTC confirms the clock runs for about 75 minutes before the pendulum becomes unstable, and also that pendulum seconds and real seconds are similar. Tuning the impulse has the clock running on 2mS pulses. The timing isn't quite correct, so smaller pulses should be possible. At the moment the pendulum gradually builds momentum until it bumps a pillar and crashes. (Design intent is a swing under 5°!)  Not difficult to tweak the code to make pulses with microsecond resolution.

A second fault is due to the electromagnet being glued in off centre. If the pendulum doesn't get a clean start, it takes a diagonal course, which tends to go elliptical, and eventually the bob bumps into a side cheek and crashes. The thin carbon fibre rod does nothing to stop this. I'll upgrade the 3D printed magnet holder by adding a couple of locating rails so the magnet has to sit straight. As can be seen below there are only a few millimetres clearance between bob and cheeks. As the beam breaker is vulnerable to sunlight might be worth printing the holder in black plastic.

dsc06320.jpg

Another embarrassment: there's no way of leading the wires outside the shield. The shield can't be put on the base, let alone pumped out.

Hours of fun ahead...

Dave

 

 

 

 

 

Edited By SillyOldDuffer on 29/09/2020 16:35:00

John Haine29/09/2020 17:39:12
5563 forum posts
322 photos

Dave, progress! Have you measured the diameters of the CF rod in two orthogonal axes? If it is not perfectly circular I think it will tend to swing elliptically anyway.

img_20200929_173004256.jpg

This is my current clock project transferred to my study to connect up the Arduino. There's a neodymium bar magnet jammed in the end of the rod, sensed by the coil just below. To the right is a Hall sensor for amplitude control. Backboard is MDF salvaged from beneath the bench. It's bolted to my largest angle plate weighed down with three bits of 4x4x1" BMS. Wikipedia beer mat is for levelling

Bob currently too high - target is for period to be very slightly less than one second.

SillyOldDuffer29/09/2020 22:26:31
10668 forum posts
2415 photos

Assumed it was round, maybe not! I'll check out the rod tomorrow.

Still not measured Q yet. My impression is it's low but I've not set the bob going and cut the power to see how long it takes to decay. Bad news if Q is poor, because then the vacuum enclosure isn't worth the trouble.

Working inside a 68mm tripod is cramped, and there being nothing to stop elliptical bob swings is worrying too. Makes me appreciate the merits of your clock - a good stiff backboard, plenty of room, and a solid suspension. I'm not sure about a super magnet on the bob - does swinging it in the earth's magnetic field effect the bob?

Watching a fine carbon fibre rod when my pendulum is mis-impulsed is interesting. It vibrates visibly, even when the impulse doesn't appear to upset the bob much. When the timing is correct the fibre stays straight - though I suppose it's likely still twanging at the micro level.

I also need to analyse the period figures being collected by the Arduino for consistency. All in milliseconds at the moment, but changing to microseconds should be more revealing. Too early to be entirely sure, but it appears the pendulum time isn't locking to the Arduino's timed impulse; having the electromagnet on or off doesn't obviously alter the period.

Dave

Martin Kyte29/09/2020 22:38:30
avatar
3445 forum posts
62 photos

Assumed it was round, maybe not! I'll check out the rod tomorrow.

Now there is a thought. With an elliptical cross section and presumably therefor two stiffness factors in the major and minor axis you would think that would lead to 2 resonant frequencies and so rather than moving in a constant ellipse as has been suggested would the excentricity vary at the beat frequency of the difference.

regards Martin

John Haine30/09/2020 09:47:50
5563 forum posts
322 photos
Posted by Martin Kyte on 29/09/2020 22:38:30:

Assumed it was round, maybe not! I'll check out the rod tomorrow.

Now there is a thought. With an elliptical cross section and presumably therefor two stiffness factors in the major and minor axis you would think that would lead to 2 resonant frequencies and so rather than moving in a constant ellipse as has been suggested would the excentricity vary at the beat frequency of the difference.

regards Martin

In general yes, I think you're right. Rather like that clock in HJ a few years back that used a single pendulum suspended by knife edges in a gimbal to keep mean seconds in one direction and sidereal in the orthogonal one. If you could impulse on exactly one axis perhaps ellipticity could be avoided.

"I'm not sure about a super magnet on the bob - does swinging it in the earth's magnetic field effect the bob?"

Hmm. Immediate feeling is no, will have to check if there is any change in behaviour with orientation once it's ticking. But there are other clocks with magnets in the rod and I have never seen any reference to this. More of an issue I think is keeping any ferrous material away from the magnet.

SillyOldDuffer01/10/2020 14:07:52
10668 forum posts
2415 photos

Measured my Carbon Fibres and they're round. (As far as my 0.01mm micrometer can tell.)

This morning's failure. Several 'improvements': re-arranged the clock, fixed a software bug exposed by upgrading pulses to work in micro rather than milliseconds, added logging detail so the RTC and pendulum times can be compared directly, and tidied up the electronics. Now the clock isn't running properly! Trouble with changing several things at once is I'm not sure what upset the apple cart. Bright sunshine is causing false triggering making it very difficult to work out what's wrong. (The Sharp hasn't arrived yet.)

I'm going to play cast-iron instead. Saws and lathes aren't so finicky!

Dave

John Haine01/10/2020 20:09:32
5563 forum posts
322 photos

Glad the rod is round - that removes one uncertainty. Optos and sunlight don't mix in my experience. You need a sunshade! Once it's in the shield the problem will go away.

My pendulum is now ticking, maintained by the Arduino. It gets a 30ms pulse of about 15 mA just after BDC of each swing, and that happily drives the pendulum up to the amplitude where the end of the rod touches the header that connects to the Hall effect sensor on each swing. Next step is to get the sensor controlling the amplitude. I can feel an interrupt coming.

Peter Bell01/10/2020 21:06:35
399 forum posts
167 photos

My high friction clock with the pulse length sensing for amplitude control appears to have lost under1 minute since I reported it on this thread on 9th Sept so all things considered I'm quite pleased with that.

On another project I had light interference problems with the slotted switches so I made my own using OP 231 leds and OP800 as the phototransistor, think they are matched to 890nm from memory. Also had great success with AH1801 unipole magnetic sensors which are surface mount. Had some boards made, they are fairly sensitive and only around 20p each--probably discontinued now!

Peter

Peter Cook 601/10/2020 22:11:49
462 forum posts
113 photos

I have followed this with interest. I have a couple of Eureka clocks which have electronic controllers. The controllers deliver a square wave signal at the frequency needed to keep the clock accurate (45 bpm). Because the period of the balance wheel varies a little with the amplitude (larger amplitude = longer period) the clock locks accurately to the electronic signal.

It's the non linearity of the relationship between amplitude and frequency that ensures the lock.

duncan webster01/10/2020 23:48:59
5307 forum posts
83 photos

SODs transistor driver circuit is the one shown in fig 9B of **LINK**

Interestingly this guy had to increase the swing of his pendulum so that the impulse period was much less than the swing period to get it to keep good time, the opposite of the usual keeping amplitude low

John Haine02/10/2020 10:49:50
5563 forum posts
322 photos

That's probably a sign that the impulsing is generating significant escapement deviation because it is lagging pendulum BDC. This tends to slow the pendulum, so if the amplitude increases the degree of slowing decreases - i.e. the pendulum speeds up. That is opposite to circular deviation which increases period as amplitude increases. Interesting article that Duncan, his PIC circuit effectively works in the same way as the Arduino one, using a pin as both analogue input to sense the coil but then a digital output to drive it.

My amplitude control is now working and I'm no longer battering the header on the hall sensor pcb. I found it worked better if I actually reduced the impulse period to 15 ms. Next step, get it to drive a modified quartz movement.

(And now working with a 10 ms impulse...)

Edited By John Haine on 02/10/2020 10:50:41

John Haine02/10/2020 20:51:16
5563 forum posts
322 photos

Now have the clock driving a modified quartz dial, moved bob down to calculated position for 1 Hz, let's see how the timekeeping goes. Have spent a couple of hours trying to get the digital rating system going, something odd going on, time to knock off for the day I think.

SillyOldDuffer02/10/2020 21:25:34
10668 forum posts
2415 photos

Everyone is doing better than me!

Today I modified the tripod to stiffen it and allow space underneath for wires to leave the vacuum. Not too bad apart going out into the storm to buy bits, and forgot the important one - super-glue. Also, no studding.

Wouldn't have mattered except I broke the pendulum rod reassembling the clock...

Spent this evening blowing my mind trying to solve the following problem. Given the period of a pendulum, and it's amplitude, how long does it take the bob to travel to BDC from a beam breaker offset by 'n' millimetres. (Time side to side, 833mS, amplitude 5°, offset 5mm, rod about 240mm.)

Dave

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

Sign up to our Newsletter

Sign up to our newsletter and get a free digital issue.

You can unsubscribe at anytime. View our privacy policy at www.mortons.co.uk/privacy

Latest Forum Posts
Support Our Partners
cowells
Sarik
MERIDIENNE EXHIBITIONS LTD
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

 

Donate

donate