View previous topic :: View next topic |
Author |
Message |
delesan
Joined: 23 Jun 2010 Posts: 19
|
Monitoring AC voltage signal |
Posted: Mon Jul 05, 2010 1:46 am |
|
|
Hi everyone,
Progressing further with learning to use the 12F683 analogue comparator function, would appreciate suggestions on how I can use this to monitor an input AC voltage signal ~ 4V peak-to-peak without resorting to ADC. Am interested in the positive-going part of the input signal. The comparator will be set to A1 and Vref using VDD = 5V.
Regards. |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE |
Posted: Tue Jul 06, 2010 10:00 pm |
|
|
I am not sure I understood the question.
You can use a opto-isolator to convert the AC pulsing to digital pulsing.
Connect two 33E 1/2W resistances to the anode and cathode of an opto-isolator such as MCT2E http://www.datasheetcatalog.org/datasheets/90/424848_DS.pdf
The collector pulled up to +5 V through a 4.7K resistance and the emitter to ground of +5V supply.
When the resistances are connected to the 230 VAC source pulses are generated on the collector, connect a PIC input port to the collector.
As the pulses are quite fast you could use an interrupt or simply poll the input,
I hope this is what you wanted ...
thanks
arunb |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Jul 07, 2010 5:58 am |
|
|
If you want to use the comparator to test the amplitude of the AC signal here are a couple of ways, all assume the AC ground is common to the PIC GND:
1) Use a voltage divider to scale the AC down to the comparator threshold. Monitor the comparator frequently, many times per AC cycle, or use an interrupt to see if it triggers. If it does trigger the duration of the trigger gives an estimate of the excess AC amplitude.
2) Peak detect the AC signal with a diode and cap, and use a pair of resistors to scale the resulting signal to the comparator level. Now you don't have to check the comparator so often as the cap will store the peak value for a while.
3) Add a low pass filter before the peak detector, maybe 90Hz for 60Hz AC. This will stop line transients and switching supply spikes from giving false AC amplitude signals. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
delesan
Joined: 23 Jun 2010 Posts: 19
|
Monitoring AC voltage signal |
Posted: Wed Jul 07, 2010 8:00 am |
|
|
Thanks.
Tried the second option using the voltage divider and the peak detector. As you rightly stated, I encoountered spikes from the ac signal.
Will now include a low pass filter before the peak detector to remove the spikes to get a clean comparator output.
Appreciate all your suggestions. |
|
|
|