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 CCS Technical Support

RMS Value Calculation Using 12 bit ADC
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 20063

View user's profile Send private message

PostPosted: Sun Sep 07, 2014 11:50 am     Reply with quote

I must admit, I assumed he was using a precision half wave rectifier. Otherwise as you say the asymmetry would give ludicrous results....

This is why there is such a price difference for proper 'true RMS' meters etc..
VernonAMiller



Joined: 11 Sep 2014
Posts: 25
Location: Contoocook, NH

View user's profile Send private message

PostPosted: Wed Oct 15, 2014 9:32 pm     Reply with quote

Another option is to use a true RMS-to-DC converter chip, then just use the PIC ADC to read the DC output. The Analog Devices AD636 is a sweet one. A bit pricey at $30 a pop (for the 1% accuracy version) but if you want high accuracy over a wide frequency range (like if you are designing a piece of audio test equipment) for complex waveforms, it's worth considering.

VAM
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sat Oct 18, 2014 2:16 pm     Reply with quote

If you want to spend money on an amazing external RMS detector,
consider the AD630 synchronous demodulator ic.

When equipped with a suitable integrating capacitor, and the comparator input tied to the input signal- then it is capable of being a fine RMS detector.

But when the comparator is fed with an appropriate reference signal instead, it is then also able to offer phase sensitive detection, ideally suited for RMS true
( REAL) power detection as well - ala the watt meter and determining power factor of the load.
VernonAMiller



Joined: 11 Sep 2014
Posts: 25
Location: Contoocook, NH

View user's profile Send private message

PostPosted: Sat Oct 18, 2014 6:50 pm     Reply with quote

asmboy wrote:
If you want to spend money on an amazing external RMS detector,
consider the AD630 synchronous demodulator ic.

When equipped with a suitable integrating capacitor, and the comparator input tied to the input signal- then it is capable of being a fine RMS detector.

But when the comparator is fed with an appropriate reference signal instead, it is then also able to offer phase sensitive detection, ideally suited for RMS true
( REAL) power detection as well - ala the watt meter and determining power factor of the load.


WOW. Cool chip! Thanks for the tip.

I'm like a kid in a candy store when it comes to this stuff - I see something cool like this and I want to go out and get one just to play with it. I have the same problem with PICs. But there are only so many hours in a day Smile

VAM
SuperDave



Joined: 22 May 2008
Posts: 63
Location: Madison, TN

View user's profile Send private message Visit poster's website

PostPosted: Thu Oct 23, 2014 2:13 pm     Reply with quote

In case anyone else reads this thread there's an area that I didn't see covered and is critical. That is the combination of sample rate, signal frequency and sample size.

Under most conditions you must sample at more than (hopefully much more than) twice the highest frequency in the signal that is greater than the LSB of the A/D. And, you should get lots of cycles otherwise the stop/start points that result in partial cycles will make the reading noisy (same as inaccurate). Some silly examples:

1. A 100Hz sine wave is sampled every millisecond for 10 samples. The result will be perfect every time. A 110Hz sine wave won't be.

2. A 100Hz sine wave is sampled every 10 milliseconds for 100 samples. The result will vary randomly across every value from 0 to full scale! (You are getting exactly one sample every cycle and there is nothing to prevent those samples from occurring when the sine wave is a zero or any other value.)

3. A 100Hz sine wave is sampled every millisecond for 256 samples will see 25.6 cycles with the .6 making the result look noisy. (This produces real garbage if you try a Fourier transform.)

This is the wonderful world of aliasing which is often useful and often catastrophic and about as often not understood. A/D users beware.

Also, assuming the A/D has a stable mid point reference and the output is twos complement there should not be a need for a precision rectifier. That's handled by the squaring function.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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