Is anyone aware of a straightforward approach to perform RMS-to-DC Conversion using a PSoC device?
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 signal3. When multiplication is performed, the result is accumulated in the 32 bit accumulator4. 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.
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.
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.
I haven't analyzed it well yet, but certainly going to do. Thank you for your recommendation. It looks quite interesting.
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.
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.
Unless someone else has a better understanding you might filke a tech case at
But why "RMS-to-DC..."?
"Sin-to-DC..." would be correct, is not it?
"Sine-to-DC..." , sorry.
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.