CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Monitoring AC voltage signal

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
delesan



Joined: 23 Jun 2010
Posts: 19

View user's profile Send private message

Monitoring AC voltage signal
PostPosted: Mon Jul 05, 2010 1:46 am     Reply with quote

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

View user's profile Send private message Send e-mail

RE
PostPosted: Tue Jul 06, 2010 10:00 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jul 07, 2010 5:58 am     Reply with quote

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

View user's profile Send private message

Monitoring AC voltage signal
PostPosted: Wed Jul 07, 2010 8:00 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group