Author Topic: RMS Voltage calculation usin PIC16F877A with C-code  (Read 26755 times)

0 Members and 1 Guest are viewing this topic.

Offline mariush

  • Super Contributor
  • ***
  • Posts: 4979
  • Country: ro
  • .
Re: RMS Voltage calculation usin PIC16F877A with C-code
« Reply #25 on: February 26, 2013, 01:17:55 pm »
I saw this IC on internet: http://www.linear.com/product/LTC1966

it says that it needs 1Vpeak! now how can I properly convert 350v peak to 1v peak?

It says how right there in the datasheet! There's even an example circuit there.  Why don't you bother to read the datasheets?

There's plenty of ICs that do this trueRMS  stuff but I thought you had a school project or something to do it by yourself, not to use some ready made stuff.

If you can use pre-existing chips, you might as well use something like AD736, which is what a lot of multimeters use :

http://www.analog.com/static/imported-files/data_sheets/AD736.pdf

But if you plan to use it, read the datasheet carefully, it's easier to use than that ltc1966 but you still can't just give it 350v and call it a day
 

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 7547
  • Country: 00
  • +++ ATH1
Re: RMS Voltage calculation usin PIC16F877A with C-code
« Reply #26 on: February 26, 2013, 01:24:42 pm »
Agree with Marius, don't be lazy, just download and "read" the datasheet and especially the "app note", there is an example interfacing with high voltage like mains measuring.

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: RMS Voltage calculation usin PIC16F877A with C-code
« Reply #27 on: February 26, 2013, 07:26:51 pm »
I tried the AD736 IC in Proteus ISIS and made a circuit according to the data sheet... photos in the attachments both data sheet circuit and my circuit.

And it still give me 0v output... I had no luck with LTC1966 one as it still gives me 0v.

What do you think I need to do?

I will use a voltage divider to trim the 350vp to 5vp (or 1 as the IC requires) to feed the IC input. But this DC/AC coupling stuff I have a problem with.

thanks.

Offline JVR

  • Regular Contributor
  • *
  • Posts: 201
  • Country: be
Re: RMS Voltage calculation usin PIC16F877A with C-code
« Reply #28 on: March 11, 2013, 09:06:29 am »
Jeez, you gents like to sukkel.

Set the ADC to convert at 1kSPS, then make two buffers of 32 values at 16 bits.
Now get the ADC interrupt (since you don't have DMA) to push a sample into the buffer at each int.
When the buffer fills, you simply switch to buffer 2, and start processing buffer 1.
Run through and check for zero-crosses, isolate the points in the buffer, and you should have 20 points for a 50Hz signal.
Run RMS algorithm on the buffer.

Tune the code above, and its good for <1% accuracy.  I've built a power monitoring system that does 17 channels at once, 16 RMS currents, and one RMS voltage.  Total accuracy was at 0.3%
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf