0
\$\begingroup\$

I am using INA138 current sensor with 100Hz, PWM duty 5%, 8-bit resolution signal load is a resistor,

I getting zero readings while actual current readings also appear,

edited -

zero current sense output - this means when the current sensor detects OFF DUTY of duty cycle it gives zero volts on the output., the load is an LED, controlling led brightness with a feedback loop,

I need to remove this zero by adding a low pass filter to the output of the current sensor

my sampling rate 255, cycles per second,

I need continuous measurement without going to zero, to make fast feedback control loop, I get actual current reading 5-10 times per second while other readings are zero.

reading - 4.2,0,0,0,0,4.2,0,0,0,0,....

I have doubt,

What if I add an RC low pass filter on the output of current sensor?

I made small stimulation 100Hz 3.3V square applied to 50Hz low filter, (not 5% duty) enter image description here I see output voltage has averaged to 1.8V

enter image description here

how to avoid reducing voltage while low pass filtering?

\$\endgroup\$
10
  • \$\begingroup\$ Try reading the data only when the PWM is in the ON condition. If the current sensor is being read by the same micro controller that generates the PWM, synchronising the current sensor read to the PWM ON should be possible. \$\endgroup\$ – AJN Jul 8 '20 at 5:26
  • \$\begingroup\$ "I need continuous measurement without going to zero, to make fast feed back control loop". Once your readings are synchronised to read only when PWM is ON, It might not make sense to have a control loop operating at the same periodicity as the PWM. The control loop should run 5 or 10 times slower than the PWM frequency. \$\endgroup\$ – AJN Jul 8 '20 at 5:27
  • \$\begingroup\$ Can you give more information about your PWM+load setup and what parameter exactly the control system is controlling. \$\endgroup\$ – AJN Jul 8 '20 at 5:30
  • \$\begingroup\$ "how to avoid reducing of voltage?" What do you mean by that? The figure has a wave form which looks to be 3.5V peak and roughly 50% duty cycle. The output is expected to be around 1.7V. \$\endgroup\$ – AJN Jul 8 '20 at 5:31
  • \$\begingroup\$ @AJN i am using esp32 to generate pwm 100Hz and uses inbuilt adc at 255 adc sampling cycles, how to synchronize these two? \$\endgroup\$ – kobi89 Jul 8 '20 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.