Hi!
I am trying to use a PWM signal to the base of a transistor to regulate current flowing through. I measure the current by measuring the voltage drop over a 15 Ohm resistor in series with the transistor.
However I can't seem to measure the current properly. I think this is because of the PWM, since it's sometimes high and sometimes low. What's happening is that I'm sometimes getting (what I think is) reasonable numbers, like 40-60mA, but most of the time it just shows 0. If I set the base to HIGH I get 68mA constantly.
So I'm wondering if there's an easy way to even out this, so that the analogRead gives me more of an average reading?