PDA

View Full Version : Sampling A/C with battery backup.



Dwayne
- 14th April 2004, 17:22
Hello Folks,

I am working on a Timber Clock situation. Since our AC is 60 hz, I am wanting to use this as a timer. If this 60hz should fail, I would like to apply a nine volt battery for backup. What would be the best way to do this?

My idea was the following:

The AC is about 24 volts.


1. Put a bridge on the AC to make pulsating DC
2. Throw the DC through a 7805 to. "Capacitate" the pulsating DC from 120 pulses to straightline.
3. Somehow measure the pulses off the AC (before the 7805), and if they disappear, apply the 9 volt battery backup.


The Capacitor will have enough juice to keep the chip going to turn on the 9 volt battery.

My biggest problem lies in checking to see if the AC is present or not. What is the best way to do this kind of job, using just one pin and very few components?

Thank you very much in advance.

Dwayne

ivancho
- 14th April 2004, 21:03
Check google for zero crossing detector, etc.
This one if the many out there.


Here's a design (from the 27 May 1981 EDN) that I have built and have used in operational hardware; it works well:

<b>{check attached image}</b>


I trust this is reasonably clear, including the terminal names on the semiconductors... The 2N5062 is a small SCR; my notes say that a TIC47 is an approximate equivalent. The 4N27 is, of course, an optoisolator.
The combination of the 68k resistor and the capacitor provides a phase-shifted version of the AC input, so there is still 30-40V across the capacitor when the AC line goes through zero. When the downward zero crossing does occur, the 2N3904 turns off, the SCR's gate goes positive, and the SCR fires, dumping the capacitor's charge through the 4N27's LED and pulling the output down to ground. The output pulse has a fairly fast fall but a slow rise, and even the fall is slow by digital-logic standards; I used a Schmitt trigger to clean it up.

The great virtue of this approach is that it is virtually immune to noise. The one-shot nature of the charge dumping ensures only one output pulse per downward zero crossing. If you want a stable 60Hz source with no phase jitter, you probably want to use a phase-locked loop with a slow response to clean things up further -- that's what I did, for a complex dimmer circuit that had to be phase-locked to the AC -- but if all you want to do is count zero crossings, it's perfect as is.

Melanie
- 15th April 2004, 01:13
You can reduce your circuit to just a handfull of cheap components as per my appended circuit...

D2 Rectifies the incoming AC from the transformer. It could be full-wave rectification here (rather than the half-wave example), but remember if you have full-wave then you'll get 120Hz and not 60Hz at the juction of D3 and R1.

With 24V input from the Transformer, and 9V from the Battery, D1 is biased-OFF and Battery consumption is zero. If the AC Power fails, D1 immediately biases ON and supplies power without any need for the PIC to get involved.

R1/R2 form a potential divider so that the PIC's AC fail detect pin never gets more than +5v. Chose a PIC pin with Schmit input (which is pretty much most of them). PIC detects AC fail when 60Hz (120Hz) pulses stop arriving at it's chosen pin.

As per your requirement... using just one PIC pin and very few components... If anyone can figure something simpler/cheaper, I'd like to see it...

Melanie

Dwayne
- 15th April 2004, 20:39
Thank you so very Much Melanie, I appreciate it.


Also thank you ivancho.


Dwayne