RMS-to-DC Conversion using PSoC devices

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable
        Is anyone aware of a straightforward approach to perform RMS-to-DC Conversion using a PSoC device?   
0 Likes
14 Replies
MR_41
Employee
Employee
First like received
        This method was used in the power meter design that was done a few years back using PSoC for a 50 to 60Hz input AC.   
   
1. Use ADCINCVR at 8 bits and set the sampling rate to 32 samples in a cycle.   
2. Using MAC find the square of the instantaneous signal   
3. When multiplication is performed, the result is accumulated in the 32 bit accumulator   
4. After 32 samples, read from the accumulator and extract the square root.   
   
For this method to work, there should be exactly 32 readings every cycle. For this, use a Zero crossing detector and count the number of ADCINCVR results between each ZCD event. If the number of samples is greater than 32, increase the CalcTime parameter incrementally till the number of samples becomes 32. If the number of samples is less than 32, decrease the CalcTime parameter incrementally to bring the number of samples to 32.   
   
I wouldn't call this method to be a simple one, but this works very well. The other way that I can think is to use an RMS converter and use PsoC to measure the output of the RMS converter. But this will be an expensive solution.   
0 Likes
Anonymous
Not applicable

I am currently working on the method you have mentioned on CY8CKIT-001. However, I am stuck on one problem: to make ADCINCVR sample 32 times on one cycle. Maximum I can do is 5 measurements.

   

Do have any recommendations on that?

   

I guess it should be done by clock setting and calctime but I could not figured out the best values.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I know for sure that there are the required formulas in the ADCINCVR datasheet. Have a look at pages 4 and 5.

   

You need 1024 DataClock cycles for the integrate-time and you may specify a calc-time to expand the total sampletime to your needs.

   

 

   

Bob 

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given
0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I found a reference to this as being the fastest RMS calculation using shifts and adds.

   

 

   

April 1996 issue......

   

In 1996, an article in Dr Dobbs journal presented a square root algorithm that uses only shifts and adds--no multiplies and certainly no divides. It can be found here:     www.ddj.com/documents/s=962/ddj9604l/ (requires registration).

   

I've been using this in every job and every project ever since--it's by far the fastest integer square root around, and I'm amazed that it's still so little known.

   

Try it out--you'll never look back!

   

- Paul Hills
Landis+Gyr Ltd
United Kingdom

   

 

   

 

   

Then this sub reference -

   

 

   

http://collaboration.cmc.ec.gc.ca/science/rpn/biblio/ddj/Website/articles/DDJ/1996/9604/9604l/9604l....

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

I haven't analyzed it well yet, but certainly going to do. Thank you for your recommendation. It looks quite interesting.

0 Likes
Anonymous
Not applicable

For high CPU clock frequency and low data clock, I could increased the sampke rate. And now I can calculate RMS values very well. In that implementation I am using a sampling counter to get the mean of squares. However, the implementation graa introduced interests me in which the sample count over a period is constant, but in order to make it contant time interval of each sampling may vary. Now I am considering to make that implementation. However, I am stuck on assigning calctime parameter on code.

   

When I want to read PWM16_MSB & PWM16_LSB I get the result as zero. The datasheet states it can be read/set by device editor or PWM16 API. But I did not understand how to use PWM16 API on ADCINCVR. I assume I need to use the functions of a PWM16 with base addresses of ADC's PWM registers. But I do not know how to.

0 Likes
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I think this is the controlling desciption, in the TRM, of why you can't

   

read the PWM counter registers - attached.

   

 

   

See the notes at very bottom. Looks like those counters are not muxed

   

to a buss so they can be read.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Unless someone else has a better understanding you might filke a tech case at

   

https://secure.cypress.com/myaccount/?id=25&techSupport=1&source=headers&CFID=1189928&CFTOKEN=463326...

   

 

   

Regards, Dana.

0 Likes
AzGa_264406
Level 3
Level 3

 But why "RMS-to-DC..."?

   

"Sin-to-DC..." would be correct, is not it?

0 Likes
AzGa_264406
Level 3
Level 3

 "Sine-to-DC..." , sorry.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Not sure what you are asking, but "true" RMS generally specifies crest

   

factor to account for non-sinusoidal input signal RMS measurements.

   

RMS is used to compute power or signal energy.

   

 

   

So no, normally one thinks of RMS to DC conversion, which implies handling

   

of non-sinusoiudal (or distorted sine) signals as well for power measurements.

   

 

   

http://www.yokogawa.com/ymi/tutorial/tm-tutorial_wt_08.htm

   

http://cnx.org/content/m10055/latest/

   

 

   

Regards, Dana.

0 Likes
AzGa_264406
Level 3
Level 3

To measure non-sinusoidal voltage, RMS of the voltage is required to measure and calculate.

   

So "RMS measuring and calculating" is required, instead of "RMS-to-DC conversion", isn't it ?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You are measuring the area under the periodic signal curve. Or instantaneous power

   

for a non-periodic signal.

   

 

   

Both statements are correct, in that you are doing calculations, trying to

   

get to the RMS value, which has a DC equivalent.

   

 

   

Semantics getting in the way.

   

 

   

Regards, Dana.

0 Likes