Page 1 of 1

Measure PWM Current with a Modified Moving Average

Posted: Sat Jul 20, 2024 3:40 am
by viktor_au
Hi
I need to use the Acs712 to measure the current of 220v ( PWM).
I have crossed this article:
https://www.baldengineer.com/measure-pwm-current.html
This tutorial explains how to measure PWM current and voltage, using a Modified Moving Average (MMA) algorithm.
----------------------
Has anybody implemented this method?
Thanks

Re: Measure PWM Current with a Modified Moving Average

Posted: Tue Jul 23, 2024 11:31 am
by BenR
Hello,

There is a running average component in Flowcode 10 already, You may need to do a full library update to get these if you don't have them already.

It's not quite the same as MMA in that it takes a percentage of the filtered value and a percentage of the new sensor value. e.g. 90% old + 10% new. I tend to use this a lot in the various applications I put together.

I'll see if we can also add a MMA filter for you as that would also be handy.

Re: Measure PWM Current with a Modified Moving Average

Posted: Tue Jul 23, 2024 12:59 pm
by BenR
I've now added a floating point version of the MMA filter, let us know how you get on with using it.

I'll try and find some time later today to also do an integer version. Edit - this is now there too.

Re: Measure PWM Current with a Modified Moving Average

Posted: Tue Jul 23, 2024 11:27 pm
by viktor_au
Thank you Ben.
The integer is my goal.