Arduino Pendulum Clock Design – Comments Welcome

Advert

Arduino Pendulum Clock Design – Comments Welcome

Home Forums Clocks and Scientific Instruments Arduino Pendulum Clock Design – Comments Welcome

Viewing 25 posts - 76 through 100 (of 307 total)
  • Author
    Posts
  • #495993
    Peter Bell
    Participant
      @peterbell11509

      John,

      Lots of good debate today! I meant a swinging error caused by the doughnut shaped magnetic field pushing my magnet on the bottom of the pendulum, perhaps thats ellipticity? I'm assuming it will affect the time keeping as I am switching the drive off for some swings to prevent excessive travel. I'm assuming the pendulum will then take a slightly different line as there is nothing to deflect it on these swings.

      The sensor which monitors the lenght of the pulse also fires the drive coil, previously I had a end of travel sensor like Duncan to prevent excessive travel.

      Thanks also for the Arduino driver, ingenious and looks very simple with a nice description but I dont think it has provision to prevent excessive amplitude.

      Michael, copied your code and it complies so should be ok.

      Peter

      Advert
      #496017
      John Haine
      Participant
        @johnhaine32865

        Yes, that's exactly the code Michael.

        I'm planning to use something like that code but adding a Hall sensor for amplitude.

        #496018
        Michael Gilligan
        Participant
          @michaelgilligan61133

          Thanks, John and Peter yes

          MichaelG.

          Edited By Michael Gilligan on 15/09/2020 20:54:35

          #496340
          SillyOldDuffer
          Moderator
            @sillyoldduffer

            Frustration galore.

            Something strange going on with my code, swings should take about 800mS, but every so often I get an odd reading. Checking with an oscilloscope shows pulses are being detected correctly (except see below!), it's as if millis() and micros() are seizing up. Bit odd, I've written similar code many times before without any bother. May have been overconfident and slapdash!

            Ignoring software issues, I connected the magnet and found the transistor didn't work. Turned out to be connected back to front because a P2N2222A has a different lead-out to the PN2222A. I looked up the wrong one and connected cbe instead of emitter-base-collector. Still no joy, until I noticed the coil was connected to ground instead of +5v. Fixing that I got the magnet diodes the wrong way round. Air turned blue.

            Now the magnet is pulsing, but as I've made no attempt to get the impulse timing right it can't possibly work. To my surprise the clock started while I was thinking about how to fix it. Yer wot?

            Celebrations were premature. Looking at the Arduino report showed measured pendulum period to be all over the place (last column) in milliseconds:

            wrongperiods.jpg

            All lies, but the oscilloscope confirmed bad behaviour:

            wrongpulses.jpg

            Yellow trace is pendulum swings detected by the beam breaker. Blue trace is the impulse. Yellow shows 'tick tick pause tick tick' – wrong. Blue shows the impulse mostly fires correctly when the beam is broken but sometimes on the falling edge too, which is wrong. Also the blue pulses should all be the same width and they aren't. Hmmm.

            Turns out the clock started due to bright sunshine on the bob. The extra shadows and reflections accidentally produced extra impulses at just the right time to swing the pendulum. Able to prove it by drawing and undrawing a curtain. Fairly sure the 'tick tick pause tick tick' effect is due to my genuine but incorrectly timed impulses braking the bob rather than letting the sun do all the work! Clock doesn't run now the sun has moved round.

            Ho hum,

            Dave

            #496405
            Peter Bell
            Participant
              @peterbell11509

              Not sure I dare try and do timings on my pendulum Dave!

              Seeing your pics I couldnt resist looking at what mine looks like.

              This one has the output from the sensor which is triggering the Arduino on theblue top line with the yellow energising coil on the bottom. The input pulse is quite long as the pendulum is jus swinging a small amout and gaining speed. The output pulse length is the yellow line and the energising coil is driven directly by the arduino.

              long pulse.jpg

              The swing has increased and the pulse length has reduced to 21ms, the energising pulse is also reducing with less power being given to the pendulum.

              short pulse.jpg

              Finally its got up to speed and the energising pulse is being switched off as the input goes under 21ms, the pendulum slows slightly input length increases and its energising again. Tried fiddling with the energising strength but with my high friction clock train it didnt make much difference.

              Peter

              missing pulse.jpg

              #496681
              SillyOldDuffer
              Moderator
                @sillyoldduffer
                Posted by Peter Bell on 17/09/2020 21:43:28:

                Not sure I dare try and do timings on my pendulum Dave!

                Seeing your pics I couldnt resist looking at what mine looks like.

                … up to speed and the energising pulse is being switched off as the input goes under 21ms, the pendulum slows slightly input length increases and its energising again. Tried fiddling with the energising strength but with my high friction clock train it didnt make much difference.

                Peter

                missing pulse.jpg

                Good stuff Peter, you're well ahead of me at the moment. I like the missing impulse technology!

                Can I encourage you to cursor your pendulum pulses? Measuring their consistency, or lack of, might be food for thought. My early Clock Analyser tests showed that my lash-up pendulum's period was subject to small variations that mostly cancelled out over time. Be interesting if your clock has the same characteristic.

                I'm making slow progress with software, constant distractions, but I'm also attempting something a little advanced. It's a fire and forget single pulse function that doesn't stop other processing by waiting for delay(). Pseudo code:

                if ( pendulumDetected ) sendImpulse( xMilliSecondsLong, afterWaitingyMilliSeconds );

                afterWait allows impulses to be applied to the pendulum anywhere during it's swing, so the mechanical position of the electromagnet and beam break detector aren't critical. xLong allows the strength the impulse to be controlled from zero up, hopefully allowing a later version of the code to maintain the clock with minimum energy.

                Bit like a car engine management unit using knock detection to dynamically optimise when the spark is applied.

                Another age thing I'm sure. Used to write software in noisy open plan offices and was able to concentrate whatever the racket. Now almost anything puts me off. Need to unhook the phone, lock the cat out and put 'Do Not Disturb' on the door. And now it's lunchtime…

                Dave

                #496685
                duncan webster 1
                Participant
                  @duncanwebster1

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

                  **LINK**

                  #496802
                  SillyOldDuffer
                  Moderator
                    @sillyoldduffer
                    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

                    #496904
                    SillyOldDuffer
                    Moderator
                      @sillyoldduffer

                      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

                      #497049
                      SillyOldDuffer
                      Moderator
                        @sillyoldduffer

                        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

                        #497068
                        John Haine
                        Participant
                          @johnhaine32865

                          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.

                          #497093
                          duncan webster 1
                          Participant
                            @duncanwebster1

                            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

                            #497225
                            SillyOldDuffer
                            Moderator
                              @sillyoldduffer

                              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

                              #498487
                              SillyOldDuffer
                              Moderator
                                @sillyoldduffer

                                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

                                #498502
                                John Haine
                                Participant
                                  @johnhaine32865

                                  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.

                                  #498550
                                  SillyOldDuffer
                                  Moderator
                                    @sillyoldduffer

                                    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

                                    #498551
                                    Martin Kyte
                                    Participant
                                      @martinkyte99762

                                      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

                                      #498600
                                      John Haine
                                      Participant
                                        @johnhaine32865
                                        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.

                                        #498869
                                        SillyOldDuffer
                                        Moderator
                                          @sillyoldduffer

                                          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

                                          #498954
                                          John Haine
                                          Participant
                                            @johnhaine32865

                                            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.

                                            #498973
                                            Peter Bell
                                            Participant
                                              @peterbell11509

                                              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

                                              #498993
                                              Peter Cook 6
                                              Participant
                                                @petercook6

                                                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.

                                                #499007
                                                duncan webster 1
                                                Participant
                                                  @duncanwebster1

                                                  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

                                                  #499056
                                                  John Haine
                                                  Participant
                                                    @johnhaine32865

                                                    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

                                                    #499188
                                                    John Haine
                                                    Participant
                                                      @johnhaine32865

                                                      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.

                                                    Viewing 25 posts - 76 through 100 (of 307 total)
                                                    • Please log in to reply to this topic. Registering is free and easy using the links on the menu at the top of this page.

                                                    Advert

                                                    Latest Replies

                                                    Viewing 25 topics - 1 through 25 (of 25 total)
                                                    Viewing 25 topics - 1 through 25 (of 25 total)

                                                    View full reply list.

                                                    Advert

                                                    Newsletter Sign-up