Using 60Hz AC for PIC Clock

Status
Not open for further replies.

bobledoux

Member
I've an application where I'd like to use the 60 cycle AC line for my PIC 16F675 oscillator. According to datasheet table 12.9 the EC type oscillator CLKIN frequency has a lower limit of "DC."

The OSC1 input pin is a Schmitt trigger. There is no specification for the minimum rise time for an EC clock input. For other clocks the minimum is 15 to 50 nanoseconds.

I'd like to feed the 24 volt transformer line through a 5.1 volt zener and then into the clock input line.

Does anyone have any experience with this approach? If there is a rise time issue; how should I solve it? Are there other considerations for using such a low frequency clock?
 
I know using the AC source to control an interrupt is a common method. I just wanted to try this other technique.
 
Both EC mode and RC mode have been used by people in the past to clock PICs from quite slow signals. As you said the input is ST type so it should trigger reliably even from a sloping signal.

Just keep in mind a 16F675 clocked at 60Hz is only going to execute 15 instructions per second.
 
That's almost as fast as auto stepping of the MPLAB simulator.

I'm building a three zone sprinkler controller. Very simple--start time and duration buried in software. A push button to turn the process on/off. No LCD. Driven by 24 volt AC transformer. A single push of the button will reset the clock to 6am. A longer push turns on and off the sprinkler function. To get fancy I might even add a display, an LED, to show whether the sprinkler function is on or off.

On second thought, the 12F675 might be overkill. I think I'll use a 12F508. A two level stack should be sufficient.
 
On second thought, the 12F675 might be overkill. I think I'll use a 12F508. A two level stack should be sufficient.

I love it! Hey, how about a 10F200 (255 words of memory and 16 bytes of RAM)? And why not build in sunrise/sunset calcs based on your lon/lat for selecting those peak watering times (grin)?

Cheerful regards, Mike
 
Last edited:
At 15 instructions per second I should be able to watch the electrons flow.

The 10F200 might be a data pin short.

I thought about adding a light sensor so the sprinklers would run at sunup. That eliminates the need to build in a 24 hour clock. It was that clock that sparked my interest in the 60 hz clockin for the PIC.
 
That takes me back to the 12F675. The light sensor eliminates the need for a precise clock. When light appears the function starts. After it ends the software has a crude timer to prevent a repeat until night fall occurs. That prevents false re-triggers. It makes sunrise the only trigger.

Darn, I was going to use some 12C508 OTP PIC's I have. No comparator on them.
 

never try with OTPs unless you have a tested and frozen software that needs no more mods.
at times programmer error also kills OTPs.

you mighryt well get 12F510 etc
 
A photo transistor can be wired for sharp edge response. But, if it is biased for an analog output you can adjust it for variations in light level. You might find a full moon has sufficient light to trigger the unit, an undesired trigger. Changing a reference voltage, or internal comparator reference value allows control over such variables.
 
If I were building this I would use a PIC with a built in real time clock and provide some sort of power backup so I would not have to reset the time on the controller after a power failure. Or set the unit up to get the time from somewhere on power up.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…