Skip to content
  • 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. Troubleshooting
  3. lm2596 + LED + Arduino PWM
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

lm2596 + LED + Arduino PWM

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 2 Posters 3.6k Views 2 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.
  • pansenP Offline
    pansenP Offline
    pansen
    wrote on last edited by
    #1

    Hi,

    this is more a generic question: I unsoldered the on/off pin of the lm2596 on a module I bought from China. This one then got connected to pin 6 (timer 0 PWM) of an Arduino nano.

    The brightness control (via analogWrite) is working, however, the apparent brightness does not change much for duty cycles higher than 50/255...So I set 0,1...16 and then it is basically already at max brightness.

    • Are there any tricks/formulas to put the apparent brightness between 0-100% for usage directly with a V_DIMMER?
    • Does the lm2596 have a startup time which might affect the PWM?
    • Could I use timer 1 to have a 16-bit PWM or do I scree up MySensors then?

    Cheers,
    pansen

    Orange Pi Plus 2e connected to nrf24 PA via SPI running git-development MySensors gateway, OpenHAB2, mosquitto and MySQL persistence.

    mfalkviddM 1 Reply Last reply
    0
    • pansenP pansen

      Hi,

      this is more a generic question: I unsoldered the on/off pin of the lm2596 on a module I bought from China. This one then got connected to pin 6 (timer 0 PWM) of an Arduino nano.

      The brightness control (via analogWrite) is working, however, the apparent brightness does not change much for duty cycles higher than 50/255...So I set 0,1...16 and then it is basically already at max brightness.

      • Are there any tricks/formulas to put the apparent brightness between 0-100% for usage directly with a V_DIMMER?
      • Does the lm2596 have a startup time which might affect the PWM?
      • Could I use timer 1 to have a 16-bit PWM or do I scree up MySensors then?

      Cheers,
      pansen

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

      @pansen said in lm2596 + LED + Arduino PWM:

      • Are there any tricks/formulas to put the apparent brightness between 0-100% for usage directly with a V_DIMMER?

      Thr FastLED library has functions for creating linear apparent brightness for several types of leds. Maybe you can use the library directly, or take inspiration from how they do it?

      • Does the lm2596 have a startup time which might affect the PWM?

      It switches at 150kHz so I think you should be fine, but the output capacitor will definitely affect the output. What capacitor are you using for Cout? (check the lm2596 datasheet section 9.1.3 for more details)

      pansenP 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        @pansen said in lm2596 + LED + Arduino PWM:

        • Are there any tricks/formulas to put the apparent brightness between 0-100% for usage directly with a V_DIMMER?

        Thr FastLED library has functions for creating linear apparent brightness for several types of leds. Maybe you can use the library directly, or take inspiration from how they do it?

        • Does the lm2596 have a startup time which might affect the PWM?

        It switches at 150kHz so I think you should be fine, but the output capacitor will definitely affect the output. What capacitor are you using for Cout? (check the lm2596 datasheet section 9.1.3 for more details)

        pansenP Offline
        pansenP Offline
        pansen
        wrote on last edited by pansen
        #3

        @mfalkvidd Good idea with FastLED, I will use it directly since there is enough space left.

        I use this module, looks like it has a 220uF output cap. Doing some back of the envelope calculations, the time constant (i.e 67% charge point) is about 220us, Arduino PWM frequency is 62.5kHz which yields a resolution of 16us and a total period of 4080us...that's less than 20 times the time constant of the cap.

        So this might actually be the problem! I'll try to lower the PWM frequency and see what happens. In the datasheet they mention you should use a low ESR cap to for a low output ripple, but I don't really care about that in this application, so in the worst case I just switch the output cap with an off the shelf cap with lower capacitance.

        Thanks for your input.

        Orange Pi Plus 2e connected to nrf24 PA via SPI running git-development MySensors gateway, OpenHAB2, mosquitto and MySQL persistence.

        mfalkviddM 1 Reply Last reply
        0
        • pansenP pansen

          @mfalkvidd Good idea with FastLED, I will use it directly since there is enough space left.

          I use this module, looks like it has a 220uF output cap. Doing some back of the envelope calculations, the time constant (i.e 67% charge point) is about 220us, Arduino PWM frequency is 62.5kHz which yields a resolution of 16us and a total period of 4080us...that's less than 20 times the time constant of the cap.

          So this might actually be the problem! I'll try to lower the PWM frequency and see what happens. In the datasheet they mention you should use a low ESR cap to for a low output ripple, but I don't really care about that in this application, so in the worst case I just switch the output cap with an off the shelf cap with lower capacitance.

          Thanks for your input.

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

          @pansen you've piqued my curiosity. I haven't seen a voltage regulator driven by PWM before. Would you mind sharing what you're building?

          1 Reply Last reply
          0
          • pansenP Offline
            pansenP Offline
            pansen
            wrote on last edited by
            #5

            @mfalkvidd: I just finished version 2 of a prototype, when It is working like I want I will present it in the "Projects" subforum :+1:

            Orange Pi Plus 2e connected to nrf24 PA via SPI running git-development MySensors gateway, OpenHAB2, mosquitto and MySQL persistence.

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


            5

            Online

            11.7k

            Users

            11.2k

            Topics

            113.0k

            Posts


            Copyright 2019 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
            • OpenHardware.io
            • Categories
            • Recent
            • Tags
            • Popular