Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

accurate 30second period for a clock

Status
Not open for further replies.

mab2

Member
hello folks, I've recently aquired an old factory clock which is operated by pulsing its solenoid every 30 seconds, so I'm seeking advice on how to provide the pulses with suffcient accuracy to allow it to keep time. I'd like something simple and low powered if possible.

Ideas I've had:-
555 timer - simple but probably not accurate/stable enough.

a spare picaxe 08m2 - simple (basically the old flashing an led program with a 30sec period) but I don't think it will accept an external crystal so probably not accurate again.

Pic with external crystal - accurate enough, probably, but I've not played with pics (or my pickit2) for a number of years and was never really proficient even then, so probably not simple to get up to speed just for this.

crystal osc and divider cct like cd4060 - simple if divide by 2 to the desired frequency can be achieved - but I can't work out how to get to 0.033333333Hz. I did find another thread on here about using a 4059 divide by n counter, but will need to read it again with my brain engaged in low gear to figure out how to set it up - could be challenging.

At the moment the last option is my favourite, but I thought it worth asking in case there's a better way of doing it that I haven't thought of (quite likely).
 
Use a 23768 clock crystal.
Two CD4060 to get a output of 0.5hz.
Use a divide by 15 counter (4 bit)
 
Are you pushing a pendulum every 30 seconds via the solenoid?
 
One simple way would be to buy a $1 rtc module (DS1307) of ebay and use the one second out pin divided by 30. You will have to enable the output via i2c but this only needs doing once.

Mike.
 
Are you pushing a pendulum every 30 seconds via the solenoid?
A lot of old factory clock systems would have one master pendulum for many slave clocks. The pendulum was in a system designed to create a pulse every 30 s (although on the ones I saw it was every minute). I think that the OP wants to run one of the slave clocks.

The system is described at https://en.wikipedia.org/wiki/Clock_network in the "History" section.
 
A lot of old factory clock systems would have one master pendulum for many slave clocks. The pendulum was in a system designed to create a pulse every 30 s (although on the ones I saw it was every minute). I think that the OP wants to run one of the slave clocks.

The system is described at https://en.wikipedia.org/wiki/Clock_network in the "History" section.

It makes sense.

In vessels built some 40 years ago in Japan, the master clock (in the bridge) sent a periodic signal to all the slaves. By acting on that master, you were also able to advance or set them back to change the ship's time while crossing the different time zones (20 minutes every four hours - night watch periods) made the trick. IIRC the standard brand was SEIKO. The control panel was bulky.
 
A 32768Hz crystal + a CD4060 + a CD4059 should do the job.
 
a spare picaxe 08m2 - simple (basically the old flashing an led program with a 30sec period) but I don't think it will accept an external crystal so probably not accurate again.

As you already have the picaxe you may as well connect it up and see how it does, even using it's internal oscillator it's going to be a LOT more accurate than a 555 timer, and probably just as good (or better) than the original mechanical pulse generator. It'll only take a couple of minutes to do - so a LOT faster than ordering crystals and chips.

Once you've got the process proved and working, you can then worry about making something more accurate - if you need to?.
 
Thanks for the replies folks!

Nigel - really? I'll give it a go then - as you say, a lot faster than ordering chips & crystals.

Pommie - In theory the picaxe does I2C so that may well be my next option..

Yes I think it was one of those slave clocks - though there was no sign of any others, let alone a master clock in the factory when I was there - I did consider building a pendulum/solenoid assembly the run the clock - but that really is a slow option for me.

Alec & ron - as it happens, my favourite option in my OP was to use an existing board in my spares box - part of a MSW inverter I'd build in the 1980's which was based on a 32768 crystal and a 4060 - i just needed to divide by 750 to go from its 25Hz to 0.0333 - but annoyingly I've just fished it out of the box to find that the crystal has snapped off its legs, so I'll need to buy another crystal anyway, as well as the 4059. I also note that they don't seem to make the 4059 in through hole packages any more - though there are still some on ebay.
 
If the internal oscillator isn't good enough for you, you could use Swordfish Basic, a PIC 18F-series chip and a crystal. It would be a quick program to write in Swordfish and the free SE edition will easily handle the task. You'd need to get a < $10 PICkit 2 clone from ebay to program the chip with the code.

If you're familiar with PICAXE, Swordfish will be pretty simple to use.

Swordfish Basic Website
 
Thanks - I've heard of swordfish - is it easier than mplab? and will it work with a pickit2 (i've already got one of those)?

well a quick prog of the picaxe:-

main:
high clockpulsepin
pause 200 ; 200ms
low clockpulsepin
pause 29800 ; balance to 30secs
goto main

seems to work over a few mins - though I would need to leave it running for a while to judge accuracy.

curiously this prog didn't work:-

main:
for b1 = 1 to 29 ; 29secs
pause 950 ;pause 950ms
gosub flash ; 50ms
next b1
high clockpulsepin
pause 200 ; 200ms
low clockpulsepin
pause 800 ; balance to 30secs
goto main

flash: pulsout ledpin,500 ; 0.5ms
pauseus 49500 ; wait 49.5ms
return
end

The led did flash ~1Hz, but the clockpulse was more like 40 seconds. I assumed some time would be lost in extra instructions, but I didn't think it would loose that much - or have i done something stupid that i cannot see?
 
Swordfish is Basic, so pretty similar to PICAXE code. In Swordfish, you could set a timer event for 30 seconds (I believe that's in its range) and be highly accurate.

Use the PICkit 2 GUI, and all you have to do is to select the compiled Swordfish hex file to load it.

Something like an 18F2420 would work great. The 18F k series chips are a little cheaper, but there are sometimes some hoops to jump through to get started with those.
 
well a quick prog of the picaxe:-

main:
high clockpulsepin
pause 200 ; 200ms
low clockpulsepin
pause 29800 ; balance to 30secs
goto main

seems to work over a few mins - though I would need to leave it running for a while to judge accuracy.

You can easily tweak the 29800 figure to adjust the time keeping, obvious it won't stop temperature drift etc, but it should allow you to make a pretty decent clock.

So leave it running, and see how far out it is in 24 hours - I presume it will probably be losing time rather than gaining?, in which case you would need to reduce the 29800 - based on how much time it's lost (or gained) over 24 hours you should be able to calculate the change of number required with a little maths.
 
Actually it's gaining ATM - about 1 sec per 1/2 hr. I've added 500us to the loop and set it off again.

one more question re:- swordfish - what operating systems does it support (haven't found anything on their website yet)? my most up to date system is running ubuntu 14.something - other than that it'll be something really old.
 
Swordfish only runs on Windows - I've used it on XP, 8.1 and 10 without any trouble.

I had troubles with the PICkit 2 GUI on a Win10 computer, but a user on the Swordfish forum solved that problem with a recompiled version that supports both the PICkit 2 and PICkit 3. There's a post in the microcontroller section about that.
 
There's a link on the Swordfish web page for the "special edition" - this is the free version with some very generous limits on the size of programs that cam be compiled. Many people never run into this limit.
 
Do you know the characteristics of the pulse required to operate the clock solenoid?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top