2016-05-10 06:21 AM
I have to measure current and voltage rms as well as frequency for three phase sinusoidal.
Is there an application note about measuring rms and/or frequency with the stm32f4 series? I 'm checking the specification and for example for PB0 is written alternate function TIM3_CH3 and additional function ADC12_IN8. Is it possible to use the ADC12_IN18 with combination with the TIM3_CH3 to measure the frequency with the timer and at the same time the rms with the ADC?2016-05-10 08:28 AM
I suspect the ADC would work in combination, you'd have to experiment.
You'd want to sample the signal across the cycle and do the math on the data, not sure I have seen an app note, but it doesn't look to be an unduly complicated task.2016-05-11 05:18 AM
Hi,
If you need fairly accurate measurement (i.e metering), then would suggest to have a separate zero-cross detector circuit feeding into a separate TIMx_CHx pin. This way you can measure the frequency fairly accurately over a few cycles. Using input capture / oneshot or PWM input (depending if sensing + & - etc).If you can afford to wait longer for the result, you could just do a software zero cross detect in software over a large number of cycles (perhaps seconds) and integrate the result. Depends on accuracy vs time needed for a result.For the measurement of RMS (sqrt(sum(I*I)). There are a few ways you can do this. Collect samples over a period of time (window) and post-process. Or you can keep a running accumulator, so every time a sample comes in you could initially scale, then multiply by itself, and use a boxcar averaging mechanism to keep the values up to date. Then only square root when result needed. However which method depends on how quickly you need an RMS result. Just have to be aware of RMS window sizes etc.For your application it sounds like you need 6 channels of analog input, 3 for ZC det if using external circuitry (and measuring all 3 voltage channels).