Re-initialize radio after shutdown and restart



  • My node is battery operated and as such I allow the micro controller to shut off power to all of the peripherals including the radio before it goes to sleep. Then when it wakes up it powers up the radio and sends its data before repeating the whole process from the beginning. As such I need to initialize the radio again after I power it back up. I saw that 2.0 has a feature like this but unfortunately I'm using the PiSerialGateway which doesn't support 2.0 so I am using 1.5.4. How can I manually re-initialize the radios upon each wake cycle? I've tried doing mysensors.begin but that does the entire presentation of the node to the gateway and controller. All I want to do is initialize the radio. Below is my current loop testing this out.

    void loop()
    {
         sensor_node.send(msg.set(20));
    
         digitalWrite(PER, HIGH);    //turn off peripherals including radio
         delay(5000); // Wait 5 seconds
         digitalWrite(PER, LOW);  //turn on peripherals including radio
         
         sensor_node.begin(NULL, MY_NODE_ID);  //this doesn't work...actually does too much
    
         
    }```

  • Hero Member

    @jerseyguy1996 is it an option to leave the radio power on? It takes so little power that, unless you have a power hungry supply, there is no real reason to shut it down.



  • It is, I was going for maximum battery life so I was going to turn off everything while the micro controller was asleep. I'll try just using the built in sleep functionality.


Log in to reply
 

Suggested Topics

  • 3
  • 6
  • 5
  • 2

14
Online

11.4k
Users

11.1k
Topics

112.7k
Posts