Timing accuracy

Void

New Member
Hey all
I've never touched a PICAXE or anything similar before, but I've got a project I'd like to try that I think one would be perfect for.
I've poked around here for a bit and seen it mentioned that the PICAXE's timing is not "too accurate"... Can someone tell me how un-accurate it is? I'd like to make an intervalometer of sorts to turn on and trigger a digital camera every 12 or 24 hours. What kind of results could I expect running something like that? A few seconds fast or slow every 24 hours? A few minutes? Hours?
I'm assuming that any inaccuracy over the few seconds that the camera will need to turn on, warm up, take and save it's picture is next to nothing, but it's the long periods of waiting between shots I'm wondering about.
Any advice is appreciated... Complete newbie to this stuff, but I've been interested in it for a while and now that I have a project I could use it for I guess it's time to start learning.
Thanks!
 

MORA99

Senior Member
It will probaly be seconds to a minute over 24hours, if you need more precise you can use a RTC.
Although if you use nap/sleep it will be more inacuate and you need an RTC unless you want to calibrate the timing, but if the system is powered the powersave from letting the picaxe sleep is very low.
 

Tom2000

Senior Member
It depends upon your required accuracy.

Rather than worry about loop timing with a Picaxe (which you'd have to adjust empirically), I'd recommend that you look at the Dallas/Maxim DS1307 chip as your timebase/real time clock.

The chip is cheap, available in an 8-pin DIP package, and uses a tiny 32.768 kHz watch crystal. You can add a 3.6 volt coin cell for battery backup for perpetual timekeeping when your unit is turned off.

Even better, these chips are very easy to handle with a Picaxe via the I2C interface. There's lots of code hidden here in the forum which shows you how to apply this chip.

I usually don't advocate adding a chip that you don't really need, but in this case, a 1307 will save you no end of hassle and tinkering. It's well worth your consideration.

(I recently completed a digicam intervalometer project that incorporates a very similar chip, the DS1302. I went with the 1302 rather than a 1307 solely because I wanted to back the chip with a supercap instead of a coin cell, and the 1302 handles a supercap well.)

Good luck with your project!

Tom
 

hippy

Senior Member
A PICAXE based system can be as accuarte as you want to make it.

With an inbuilt RC oscillator and not taking account of instruction times and inaccuracies in Pause commands you could see considerable drift.

You can add external time reference clocks so you'd be as accurate as they are and you can even add a watch crystal to some PICAXE's ( the 08M, 18A ad 18X are known to work, the 14M should ) and use that as a timer reference. Not sure how that holds up if you want to also use low-power modes. That would be as accurate as most watches are.

You can take a low voltage feed from an AC wallwart PSU and use that which will be as accuarte as the mains cycle is. That drifts slightly but should be fairly accurate over the long term / day. This is probably the simplest solution ( and safe as you are not using direct mains ), just needs a suitable voltage AC wallwart and the right value resistor, everything else is then just software. As a side-benefit, that AC can be rectified and used via a regulator to power the PICAXE.
 

Tom2000

Senior Member
Hippy, I just happen to have a sketch of a line-derived timebase circuit.

It didn't resize very well. It uses a 10 k resistor and a 5.1 volt zener diode. The Picaxe uses a "toggling interrupt" routine to read the timebase.

Tom
 

Attachments

KMoffett

Senior Member
Another cheap (ie Goodwill) source of a "fairly accurate" clock to feed to into a PICAXE (I used it on an 08M) is a hacked battery powered wall/desk clock. These will put out pulses every 1 second (diode OR'ed) or 2 seconds, that can be counted by the PICAXE. These clocks are pretty accurate over long periods,...from my experience. 43200 counts (for a pulse every 2 seconds for 24 hours) per day and reset to start another day. From a MAKE magazine article:
http://www.josepino.com/circuits/index?one_second_timebase.jpc

Ken
 

Tom2000

Senior Member
That's a good idea! I haven't seen one lately, but those little stickon quartz "watches" used to be available, all over, for about a dollar.

(oops... just looked at your link. The gizmo I was referring to was a little digital clock with a tiny LCD. I thought it might be possible, with a little microsurgery, to pull the 1-sec signal off one of the LCD drive lines, and use a level shifter to get the logic level up to Picaxe standards. Your way looks much easier!)

Tom
 
Last edited:

hippy

Senior Member
@ Tom2000 : For some reason neither Firefox nor IE will show your attachment when clicked on, but in miniature it looks a little overly complicated. I'd use non centre-tapped and tie one side of the secondary to 0V and feed the other through a large R and wouldn't worry about the zener ( but it does no harm ).
 

Void

New Member
Thanks for all the info and ideas everyone. I've got a lot to look into now. I think I may even have a few of those cheap little clocks laying around in a box somewhere and I've seen them for sale somewhere cheap... Maybe a craft store.
MORA99, am I reading your post correctly that the sleep mode dose not save much power? I want to leave the camera unattended in remote areas (caves, mountain tops, etc..) so I'd be using batteries and changing them maybe once every month or two depending how long a set lasts.
 

MORA99

Senior Member
nap does save alot compared to running it constantly.
I meant if your picaxe is wall plugged then the amount it saves will be very small compared to what else is using power in the house.
On batteries the more you can turn off the better ofcause.

If using batteries, I would make the picaxe nap for a few minutes then read the rtc and nap again, until it gets close to the time where it needs to take a picture, and then go back to nap when done.
Then only the RTC will drag power, and that could even be from a backup batt, so it only keeps time.
 

Tom2000

Senior Member
The DS1307 draws so little power when it's running that it's feasible to drive its Vcc input from a Picaxe output line. Run the RTC from the backup coin cell as the Picaxe sleeps, then have the Picaxe power up the clock chip only when it needs to read the time.

Real micropower.

Tom
 

KMoffett

Senior Member
Tom,

Your "draws so little power" comment made me wonder how much current my hacked-wall-clock 1-second pulse module draws. I hooked it's Vcc up to +5v, thru a resistance substitution box. The outputs were dioded OR'ed with two 1N4148's to a 08M input. I kept increasing the series resistance until output pulse's were so small that the 08M no longer saw them. I got reliable triggering with a 1Meg series resistance. Measured current to the module was about 2uA.

Ken
 

gengis

New Member
Great information

Thanks for the clock hack Moffet/Tom. Delicious, cheap, and lets someone else worry about the drudgery of component selection, wiring, layout, etc..

Probably should start a topic called "Girls Locker Room Cams." I'm using my picaxe for time elapsed photos with a nearly disposable camera for spying on our "public servants," among other things. I use the "sleep" command and have had excellent repeatability with it - that is to say, I can't predict what the timing will be except in coarse increments, but the thing will maintain "spot-on" repeatability (interval is constant) with each shot.

I took a cheap $2 analog quartz clock and put in a dummy battery (1/2" wood dowel with brass screws connected to wires). One of the "unused" outputs turns on the clock and I aim the camera at the clock to take a picture before and after the time delay to calibrate it - but have been wondering how to make it a little more elegant - like actually predict the time delay with point one percent accuracy.

Then - or instead - how to time stamp the camera files? Ideally it would be nice to use a beam splitter to get the clock (wristwatch) into a picture just like the "red light cameras."

Regards,
bob
 
Top