I have set up an INA219 to measure current draw and voltage on 3 X1W LEDs connected in parallel. I set up exactly as the INA219 instructions and it seems to be working fine. I also added a PWM dimmer to the power supply and using a pot I can alter the brightness from 0 to full brightness. Now the problems occur when I try to use the INA219 to measure the current between the LEDs and the PWM Ruideng dimmer. If I don't run a ground lead from the power supply back to my Arduino Nano, the LEDs dim like they should but the INA219 readings are erratic and only occasionally show readings that I believe are correct. So I run a ground lead from the negative of the power supply - as it leaves the PWM Ruideng module -back to my Arduino. That makes the readings from the INA219 look good and are very stable, however, I lose all the dimming of my PWM Ruideng module and the pot doesn't make any difference and power to the LEDs jumps to full.
So how did you connect it all up.
You could post a diagram and/or picture.
Is the LED driver powered from a 12volt supply, with three LEDs in series (not parallel).
Did you connect the screw terminals of the INA219 in series with the + wire to the LED driver.
You might not be able to measure a PWM-ed load correctly.
The current sensor takes snapshots, and might take a sample when the LED is off or 100% on, resulting in random current values.
Not sure why you want to measure that LED current.
The PWM value sent to the LED driver is a (x/256) ratio of average LED current draw.
Same question posted (and answered) at https://forum.mysensors.org/topic/9635/ina219-current-sensor-with-pwm-ruideng-3w-led-driver (https://forum.mysensors.org/topic/9635/ina219-current-sensor-with-pwm-ruideng-3w-led-driver)