Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. INA219 current sensor with PWM Ruideng 3W LED driver

INA219 current sensor with PWM Ruideng 3W LED driver

Scheduled Pinned Locked Moved Hardware
10 Posts 4 Posters 2.0k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PeterE
    wrote on last edited by
    #1

    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.

    monteM mfalkviddM 2 Replies Last reply
    0
    • P PeterE

      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.

      monteM Offline
      monteM Offline
      monte
      wrote on last edited by monte
      #2

      @petere said in INA219 current sensor with PWM Ruideng 3W LED driver:

      PWM Ruideng

      Your dimmer is apparently just a N-channel mosfet, it switches ground on and of to dim led. So when you connect led's ground to arduino's ground mofet switching is basically disabled. Try to connect ground not to LED- but to IN-. That should work.

      P 1 Reply Last reply
      0
      • monteM monte

        @petere said in INA219 current sensor with PWM Ruideng 3W LED driver:

        PWM Ruideng

        Your dimmer is apparently just a N-channel mosfet, it switches ground on and of to dim led. So when you connect led's ground to arduino's ground mofet switching is basically disabled. Try to connect ground not to LED- but to IN-. That should work.

        P Offline
        P Offline
        PeterE
        wrote on last edited by PeterE
        #3

        @monte said in INA219 current sensor with PWM Ruideng 3W LED driver:

        N-channel mosfet

        Thank you monte,
        I tried connecting the GND directly to IN- but, although the Load voltage on the INA219 is pretty stable at 9.4 V , the current is still jumping from -1.4 up to 160mA.

        monteM 2 Replies Last reply
        0
        • P PeterE

          @monte said in INA219 current sensor with PWM Ruideng 3W LED driver:

          N-channel mosfet

          Thank you monte,
          I tried connecting the GND directly to IN- but, although the Load voltage on the INA219 is pretty stable at 9.4 V , the current is still jumping from -1.4 up to 160mA.

          monteM Offline
          monteM Offline
          monte
          wrote on last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • P PeterE

            @monte said in INA219 current sensor with PWM Ruideng 3W LED driver:

            N-channel mosfet

            Thank you monte,
            I tried connecting the GND directly to IN- but, although the Load voltage on the INA219 is pretty stable at 9.4 V , the current is still jumping from -1.4 up to 160mA.

            monteM Offline
            monteM Offline
            monte
            wrote on last edited by
            #5

            @petere Can you describe your connection scheme? It will help to find a solution.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              adfx
              wrote on last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • A Offline
                A Offline
                adfx
                wrote on last edited by
                #7
                This post is deleted!
                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  adfx
                  wrote on last edited by
                  #8
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    adfx
                    wrote on last edited by
                    #9

                    Without knowing the circuitry I assume that INA's readings interfere with your PWM. As soon as you're in an off-state current for sure is 0mA in an on-state it is like you said160mA.
                    You should buffer the readings of your INA with a elec-cap to smooth the voltage over your shunt. But as said this is an assumption. We need your circuit to understand what the cause is.
                    Hope that helps.

                    1 Reply Last reply
                    0
                    • P PeterE

                      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.

                      mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by mfalkvidd
                      #10

                      @petere the INA219 readings are erratic because the current is erratic. When the PWM pulse is off, there will be roughly 0 current (but negative right after the cutoff). When the pulse is on, the current will be the same as if you didn't use PWM.
                      This will change about 500 times per second (on a normal Arduino PWM, not sure if the Ruideng uses a different frequency), so INA219 will read different current at different times.

                      See if setting a longer sample time helps. Not sure which library you are using but the Adafruit library defaults to 532us sample time. The longest sample time for INA219 is 69ms which should give you readings that are stable enough.

                      EDIT: I see now that you already got a similar (but slightly less detailed) answer 5 days ago at http://forum.arduino.cc/index.php?topic=564517.msg3846445#msg3846445

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      15

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular