Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] Concept of Sampling AC to use for alternating current calculations using PIC 16F877A

Status
Not open for further replies.

RafayAli

Newbie level 5
Newbie level 5
Joined
Jun 28, 2012
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,340
Hello,
I am a making a monitoring unit which will take in input from a user (current) and will sample it and will give me the output.

Now I searched the internet and I understand the part where I will have to decrease the voltage value so I did using a voltage divider circuit and I getting a 5V peak to peak and I've added an offset as well but what I don't get is that what will I detect or write in my code?

Can someone please help me just with the pseudocode so that I can get a direction. I know I will have to sample it but how or what the concept will be be behind it. Please help.
 

Hi,

for sampling AC there are some points to consider.

* What is it for?
(just to display the value? or to make realtime signal analysis... and a lot of inbetween)
* only one channel?
* How often do you need an output value?
(for a display you need it about three times a second. For an electricity meter mabe every 15 minutes is enough..)
* What precision do you need?
( lets say for a mains voltage meter with a range of 300V +/-1% is sufficient, this means +/- 3V)
* What resolution do you need?
(example: for a full range three digit 7 segment display you need a resolution of 1:1000)
* is the input signal a known waveform?
(sine, square, triangle or unknown?)
* is the AC input DC-free?
(for most loads connected to mains this is true)
* is the AC frequency and it´s stability known?

***************
For most measurement (you speak of monitoring) equipment you are on the safe side with (AC-coupled input and) RMS calculation.
On the other side here is a lot to care of....
* selecting the right sampling frequency (calculate an appropriate analog anti alias filter, oversampling, undersampling...)
* interrupt driven sampling (for fixed timing and low processor load)
* signal conditioning (overrange detection, offset and gain correction)
* squaring the value
* filtering the value
* dividing the value
* calculate the square root

And ... there are a lot of ways to do this.

Hope this helps so far.
Klaus
 

Thank you very much, very informative and the dividing the value and calculating it's square root worked.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top