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. Switching nrf24l01 radio on/off manually

Switching nrf24l01 radio on/off manually

Scheduled Pinned Locked Moved Troubleshooting
4 Posts 3 Posters 1.6k 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.
  • sterlingwS Offline
    sterlingwS Offline
    sterlingw
    wrote on last edited by
    #1

    I am currently using an NRF24L01 radio to build my sensor with an HC-SR04 module. Because the HC-SR04 requires 5v, I am powering the sensor via 3 AAA batteries. I am using a 3.3v linear voltage regulator to supply power to the radio.

    While the sensor is sleeping, I measured a 3mA draw, which is far too much. I've pinpointed my voltage regulator (AMS1117) as the source. I'd like to manually control power to the radio/regulator, but I am unable to since the mysensors library tries to initialize the radio before any other code runs (even setup). This means I never get the chance to supply power to the radio on startup so the radio initialization fails and blocks the rest of my code.

    How can I control power to the radio/regulator? Can I turn it on before the MySensors library starts up? Is there a better way to save power?

    mfalkviddM 1 Reply Last reply
    1
    • sterlingwS sterlingw

      I am currently using an NRF24L01 radio to build my sensor with an HC-SR04 module. Because the HC-SR04 requires 5v, I am powering the sensor via 3 AAA batteries. I am using a 3.3v linear voltage regulator to supply power to the radio.

      While the sensor is sleeping, I measured a 3mA draw, which is far too much. I've pinpointed my voltage regulator (AMS1117) as the source. I'd like to manually control power to the radio/regulator, but I am unable to since the mysensors library tries to initialize the radio before any other code runs (even setup). This means I never get the chance to supply power to the radio on startup so the radio initialization fails and blocks the rest of my code.

      How can I control power to the radio/regulator? Can I turn it on before the MySensors library starts up? Is there a better way to save power?

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

      @sterlingw I am not 100% sure but I think you can put the initialization code in

      void before() 
      

      instead of setup()

      Nca78N 1 Reply Last reply
      1
      • mfalkviddM mfalkvidd

        @sterlingw I am not 100% sure but I think you can put the initialization code in

        void before() 
        

        instead of setup()

        Nca78N Offline
        Nca78N Offline
        Nca78
        Hardware Contributor
        wrote on last edited by
        #3

        This cannot be fixed by software as this is what the AMS1117 consumes when under no load.
        You should change the regulator you use and select one with a low quiescent current, for example XC6206 which will use only a few µA.

        1 Reply Last reply
        1
        • sterlingwS Offline
          sterlingwS Offline
          sterlingw
          wrote on last edited by
          #4

          Just for future reference, I was able to achieve this by calling _begin after waking up from sleep. After cutting power to the radio, it needs to be setup again. So my code looks something like this at the end of my loop:

          powerDownRadio();
          sleep(SLEEP_TIME);
          _begin();
          

          Obviously a draw back is the added overhead of setting up the radio again, but if you're lacking the hardware, then this might be good enough. In the long term, though, I've decided to use 2 1.5v batteries, a DC-DC booster, and level shifter to avoid odd code like this.

          Also, thanks @Nca78 for the regulator recommendations. I've picked up a few low quiescent current regulators to add to my collection.

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


          13

          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