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. Troubleshooting
  3. LED Dimmer: quickly restore the last-set brightness

LED Dimmer: quickly restore the last-set brightness

Scheduled Pinned Locked Moved Troubleshooting
8 Posts 3 Posters 1.5k Views 3 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.
  • solaS Offline
    solaS Offline
    sola
    wrote on last edited by sola
    #1

    Hi fellow MySensorists,

    I have put together an LED dimming prototype board using the instructions on the relevant Build page and the NodeManager documentation.

    Everything seems to be working but I have trouble implementing one crucial feature which is important for my application.

    My dimming application is a retrofit for a ceiling LED fixture which has no built-in dimming capability. My plan is to simply add my Mysensors based dimming board between the fixture's built-in 12V power-supply and the LED strips installed in the fixture. Thus, my Arduino would get the power from the fixture's power supply, same as the LED strips.

    In this setup, my Arduino powers up every time when the light gets switched on and powers down when the light gets switched off.

    I would like to switch the LEDs ON as soon as possible when the user flips the light-switch ON to have a good user experience. A long delay between flipping the switch and getting light is annoying (I also have some LED fixtures with slow PSUs and I hate them).

    Currently, I try to restore the brightness in the before() method but this still results in a 2s delay between getting power and the LEDs start emitting in the fixture. This is probably because long bootup time of the Arduino and the initialization of the radio.

    How could I get this delay down? (Ideally below 300-500ms)

    Is there a method which runs immediately after the Arduino powerup (before any kind of MySensors activity around the radio)?

    If the Arduino boot sequence is the main culprit for the slowness, how can I make it faster?

    Any insight is appreciated,
    Andras

    mfalkviddM 1 Reply Last reply
    0
    • solaS sola

      Hi fellow MySensorists,

      I have put together an LED dimming prototype board using the instructions on the relevant Build page and the NodeManager documentation.

      Everything seems to be working but I have trouble implementing one crucial feature which is important for my application.

      My dimming application is a retrofit for a ceiling LED fixture which has no built-in dimming capability. My plan is to simply add my Mysensors based dimming board between the fixture's built-in 12V power-supply and the LED strips installed in the fixture. Thus, my Arduino would get the power from the fixture's power supply, same as the LED strips.

      In this setup, my Arduino powers up every time when the light gets switched on and powers down when the light gets switched off.

      I would like to switch the LEDs ON as soon as possible when the user flips the light-switch ON to have a good user experience. A long delay between flipping the switch and getting light is annoying (I also have some LED fixtures with slow PSUs and I hate them).

      Currently, I try to restore the brightness in the before() method but this still results in a 2s delay between getting power and the LEDs start emitting in the fixture. This is probably because long bootup time of the Arduino and the initialization of the radio.

      How could I get this delay down? (Ideally below 300-500ms)

      Is there a method which runs immediately after the Arduino powerup (before any kind of MySensors activity around the radio)?

      If the Arduino boot sequence is the main culprit for the slowness, how can I make it faster?

      Any insight is appreciated,
      Andras

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

      @sola the main delay is caused by the bootloader. You can remove the bootloader (but then you need a programming device because the bootloader is needed for the Arduino IDE's upload feature). Or you can upload a bootloader with a shorter startup time (but there will still need to be a delay). See https://forum.arduino.cc/index.php?topic=501575.0 for more information.

      1 Reply Last reply
      1
      • solaS Offline
        solaS Offline
        sola
        wrote on last edited by
        #3

        @mfalkvidd
        Thanks for the help.

        If I use a programmer (like USBtinyISP) and thus remove the bootloader: How fast will it get? Will it completely eliminate the current boot time.

        It seems that the part of the Mysensors radio init which is happening before the before() method is very fast since I have also tried the Nano with a plain Arduino sketch and it is still ~2s before it starts executing.

        mfalkviddM 1 Reply Last reply
        0
        • solaS sola

          @mfalkvidd
          Thanks for the help.

          If I use a programmer (like USBtinyISP) and thus remove the bootloader: How fast will it get? Will it completely eliminate the current boot time.

          It seems that the part of the Mysensors radio init which is happening before the before() method is very fast since I have also tried the Nano with a plain Arduino sketch and it is still ~2s before it starts executing.

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

          @sola yes the init should be very fast. But you can put your code in preHwInit() instead to make it run even earlier.

          I think the default bootloader delay is 2 seconds.

          1 Reply Last reply
          0
          • solaS Offline
            solaS Offline
            sola
            wrote on last edited by
            #5

            I have managed to upload with a home made programmer (my Uno as an AVR ISP) and test the behaviour without the bootloader.

            It seems to be very fast now even in the setup(), so I think this solves the problem for me perfectly. I guess it is now below 500ms, maybe even less.

            Many thanks for the help.

            mfalkviddM 1 Reply Last reply
            1
            • solaS sola

              I have managed to upload with a home made programmer (my Uno as an AVR ISP) and test the behaviour without the bootloader.

              It seems to be very fast now even in the setup(), so I think this solves the problem for me perfectly. I guess it is now below 500ms, maybe even less.

              Many thanks for the help.

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

              @sola great! Thanks for reporting back.

              1 Reply Last reply
              0
              • rozpruwaczR Offline
                rozpruwaczR Offline
                rozpruwacz
                wrote on last edited by
                #7

                add a li-ion battery backup and charging circuit so the node will never go down :D

                solaS 1 Reply Last reply
                0
                • rozpruwaczR rozpruwacz

                  add a li-ion battery backup and charging circuit so the node will never go down :D

                  solaS Offline
                  solaS Offline
                  sola
                  wrote on last edited by
                  #8

                  @rozpruwacz
                  :)
                  Actually, I considered that as the fallback solution but I do not want to increase complexity if there is a robust, simple solution.

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


                  28

                  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