Skip to main content
Visitor II
March 9, 2025
Question

High frequency resonant current measurement using STM32G4 MCU

  • March 9, 2025
  • 2 replies
  • 493 views

Hello,

We are working on an induction heater design using an STM32G4 MCU, where we need to measure the coil current via the ADC. The system operates with a half-bridge switching frequency of 30kHz.

At lower frequencies, the current waveform is triangular, while near the resonant frequency, it becomes sine-shaped.
We attempted to calculate the RMS current by finding the peak from ADC readings and applying the formula
but it's not giving consistent results due to waveform shape variations as well as ADC sampling is synchronized with the PWM cycle, and  we're still facing inconsistencies in RMS measurement.
Questions:

What is the best method to accurately calculate RMS current from ADC samples for both triangular and sinusoidal waveforms?

Any recommendations for ADC configuration or data processing techniques to improve measurement accuracy?
Any guidance or code references would be greatly appreciated!

Thank you.

    This topic has been closed for replies.

    2 replies

    Explorer
    March 9, 2025

    RMS is "Integral value", so the more points in data pull over specified period of time - the better. Run ADC as fast as possible, calculate sum over period of measured freq. Oversampling inside ADC is a good feature to save uCPU workload

    Super User
    March 10, 2025

    Unless you know how the waveform looks beforehand, best approach is to sample as fast as you can and calculate. Oversampling or averaging will make the measurement worse in this case compared to operating on each sample.