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. Startup time of arduino pro mini with mysensors 2.2 - took 10 sec (guess its the radio), can I execute some code immediately (<1sec)?

Startup time of arduino pro mini with mysensors 2.2 - took 10 sec (guess its the radio), can I execute some code immediately (<1sec)?

Scheduled Pinned Locked Moved Troubleshooting
22 Posts 4 Posters 3.6k Views 5 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.
  • rozpruwaczR Offline
    rozpruwaczR Offline
    rozpruwacz
    wrote on last edited by
    #7

    and why You choosed that design ? you are not able to switch on the lights remotely.

    A 1 Reply Last reply
    0
    • rozpruwaczR rozpruwacz

      and why You choosed that design ? you are not able to switch on the lights remotely.

      A Offline
      A Offline
      alterfritz
      wrote on last edited by
      #8

      @rozpruwacz This is the way it was constructed. I plan to leave them on all time, maybe remove / replace them in the future - however if somebody uses the switches the lights should go on instantly, basically by set analogWrite( LED_PIN,255); like a normal switch.

      Any way to do so?

      rejoe2R 1 Reply Last reply
      0
      • A alterfritz

        @rozpruwacz This is the way it was constructed. I plan to leave them on all time, maybe remove / replace them in the future - however if somebody uses the switches the lights should go on instantly, basically by set analogWrite( LED_PIN,255); like a normal switch.

        Any way to do so?

        rejoe2R Offline
        rejoe2R Offline
        rejoe2
        wrote on last edited by
        #9

        @alterfritz
        Try to add the "on" command not in setup() (this requires presetation() to be already passed) and use a before()-routine instead.

        Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

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

          So I would rather make it in hardware. pull-up resistor on the switching transistor will make it on at the powerup. and I would store the last dimm value into eeprom to not wait for the gateway response because you will not make it response in less that 1s - the protocol just not allow for that.

          rejoe2R 1 Reply Last reply
          0
          • rozpruwaczR rozpruwacz

            So I would rather make it in hardware. pull-up resistor on the switching transistor will make it on at the powerup. and I would store the last dimm value into eeprom to not wait for the gateway response because you will not make it response in less that 1s - the protocol just not allow for that.

            rejoe2R Offline
            rejoe2R Offline
            rejoe2
            wrote on last edited by
            #11

            @rozpruwacz Exactly. This is why the "on" should be issued in before() (or something like hwInit()).
            "before()" is executed before any MySensors-specific communication....

            Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

            1 Reply Last reply
            0
            • M Offline
              M Offline
              manutremo
              wrote on last edited by
              #12

              In addition to the other advices you're already receiving, and following your suspicion that the delay might be related to the radio, you could try adding the following defines to your sketch:

              #define MY_PARENT_NODE_ID 0
              #define MY_PARENT_NODE_IS_STATIC
              #define MY_TRANSPORT_MAX_TX_FAILURES 3
              

              The first two avoid the node from having to search for it.

              The last one might help you determine if the problem is the radio not starting correctly if the time is reduced after you add it.

              Let us know how it goes.

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

                yes, so in the before() function read the eeprom value and set it in analogWrite. hardware pull-up is optional because the delay between switching power on and before function call will be short enough, bit if You use the pull-up the delay will be even shorter.

                1 Reply Last reply
                0
                • rejoe2R rejoe2

                  @alterfritz
                  Try to add the "on" command not in setup() (this requires presetation() to be already passed) and use a before()-routine instead.

                  A Offline
                  A Offline
                  alterfritz
                  wrote on last edited by
                  #14

                  @rejoe2 like this... btw - this forum is fanastic... responses more or less in real time... :-)

                  ...
                  void presentation()
                  {
                  analogWrite( LED_PIN,255);

                  }
                  ....

                  A 1 Reply Last reply
                  0
                  • A alterfritz

                    @rejoe2 like this... btw - this forum is fanastic... responses more or less in real time... :-)

                    ...
                    void presentation()
                    {
                    analogWrite( LED_PIN,255);

                    }
                    ....

                    A Offline
                    A Offline
                    alterfritz
                    wrote on last edited by
                    #15

                    @alterfritz

                    sorry ... mean before ...like this

                    void before()
                    {
                    analogWrite( LED_PIN,255);

                    }

                    This seems to have done the trick... LED switch on immediately! Thanks!

                    Btw... I also try the mysbootloader. This wirless update is great, however - does this bootloader slows down bootup time?

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

                      yes, because the code that will run in the node must be first uploaded to it. the bootup time will be dependent on the code size.

                      1 Reply Last reply
                      0
                      • rejoe2R Offline
                        rejoe2R Offline
                        rejoe2
                        wrote on last edited by rejoe2
                        #17

                        @alterfritz Yes, update-bootloader tries to connect to GW for updates first seconds (around 20). So it is not dependend on code size...
                        Additional note: Waiting for RF connection to be established can also be prevented by using

                        #define MY_TRANSPORT_WAIT_READY_MS ...
                        

                        Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

                        A 1 Reply Last reply
                        0
                        • rejoe2R rejoe2

                          @alterfritz Yes, update-bootloader tries to connect to GW for updates first seconds (around 20). So it is not dependend on code size...
                          Additional note: Waiting for RF connection to be established can also be prevented by using

                          #define MY_TRANSPORT_WAIT_READY_MS ...
                          
                          A Offline
                          A Offline
                          alterfritz
                          wrote on last edited by
                          #18

                          @rejoe2

                          So
                          #define MY_TRANSPORT_WAIT_READY_MS 1000
                          Will wait for 1 sec?

                          rejoe2R 1 Reply Last reply
                          0
                          • A alterfritz

                            @rejoe2

                            So
                            #define MY_TRANSPORT_WAIT_READY_MS 1000
                            Will wait for 1 sec?

                            rejoe2R Offline
                            rejoe2R Offline
                            rejoe2
                            wrote on last edited by
                            #19

                            @alterfritz Exactly. After trying to connect to the controller for 1 sec., the node will execute normal code like any other "just-arduino".
                            Pls note: as there is no connection to the controller, the node may miss relevant info typically provided by the controller. Things like myControllerConfig, last values for counters etc... If you use this, you should make sure, these are set correctly later on.

                            Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              alterfritz
                              wrote on last edited by
                              #20

                              So - thanks for all your help. Great forum. Let me summarize what I understand so far:

                              1.) by using the before() procedbure I can execute immediately. Quickly tested. Seems perfect for me... however... :-)
                              2.) I really like this mysbootloader. But by using this it always takes up around 20 sec to boot up. There is NO way to switch on my LED directly when I power it up...

                              Correct?

                              rejoe2R 1 Reply Last reply
                              0
                              • A alterfritz

                                So - thanks for all your help. Great forum. Let me summarize what I understand so far:

                                1.) by using the before() procedbure I can execute immediately. Quickly tested. Seems perfect for me... however... :-)
                                2.) I really like this mysbootloader. But by using this it always takes up around 20 sec to boot up. There is NO way to switch on my LED directly when I power it up...

                                Correct?

                                rejoe2R Offline
                                rejoe2R Offline
                                rejoe2
                                wrote on last edited by
                                #21

                                @alterfritz Speaking about software: Not exactly, there is one thing you could still do: Compile the bootloader yourself with light switched on... :grinning:

                                Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

                                A 1 Reply Last reply
                                0
                                • rejoe2R rejoe2

                                  @alterfritz Speaking about software: Not exactly, there is one thing you could still do: Compile the bootloader yourself with light switched on... :grinning:

                                  A Offline
                                  A Offline
                                  alterfritz
                                  wrote on last edited by
                                  #22

                                  @rejoe2 Right... :-) I may look into this. For now I will try to get a stable version and load it without bootloader directly via usbasp...

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


                                  19

                                  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