K
K
Kalombyr2019-05-22 14:52:22
Arduino
Kalombyr, 2019-05-22 14:52:22

How to measure current with PWM?

Greetings! Again I am with my PWM and amperage, only with a more complex version.
As usual, I measure using the INA219 (the principle is the voltage drop across the shunt).
Let's say you can't interfere with PWM (change the frequency to a higher one, etc.), you can't hang filters and you can't do
anything at all, except for connecting a bare INA219 with datasheet strapping into the gap on the low side (into the minus gap).
The signal shape is unknown (I burned the oscilloscope with previous tests, I'm waiting for a new one).
So, after starting the measurements for a few seconds, the following measurements turned out:
there should be 28mA
mA, the amount
is 38.4 - 1362
25.6 - 2293
12.8 - 2338
, there should be 38mA
mA, the amount
is 38.4 - 34
25.6 - 5927
12.8 - 0
should be 37mA
mA number
38.4 - 2243
25.6 - 4045
12.8 - 0
should be 32mA
mA number
38.4 - 1479
25.6 - 3722
12.8 - 1166
How the process went - set different values ​​of certain characteristics on the control device and started the measurements.
How much mA should be measured on a pointer milliammeter, the amount is how many times this value was encountered during measurements using the INA219, there were no other values ​​\u200b\u200bat all.
I see a certain pattern of how to get the proper value from the INA219 readings, but I cannot express this algorithm with a formula. Tell me please =)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Gusev, 2019-05-22
@Kalombyr

Seems like there was a question like this just recently. Have you tried filtering by means of a microcircuit for 128 samples?
Or take a high-speed ADC, which will be guaranteed to measure points for a PWM period of 20 points, and then integrate them.

X
xDimus, 2019-05-22
@xDimus

logically reasoning
(38.4 * 1362 + 25.6 * 2293 + 12.8 * 2338) / (1362 + 2293 + 2338) = 23.5
but the measurement at 38 mA clearly does not fit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question