jpmeijers / RN2483-Arduino-Library

Arduino C++ code to communicate with a Microchip RN2483 module
Apache License 2.0
84 stars 60 forks source link

Module wakup clarification #15

Closed majid701 closed 7 years ago

majid701 commented 7 years ago

As we all know lora is a low power consuming technology and for the most of the time each node should remain in sleep mode consuming less power as possible. I saw that the library has the sleep function. But my question is after putting the device in sleep mode for 10 seconds. After that time the device wakes up automatically or i have to do that manually? I found on the internet the following function to wake up:

void wakeUP_RN2483() {
    Serial1.end();
    pinMode(PIN_SERIAL1_TX, OUTPUT);
    digitalWrite(PIN_SERIAL1_TX, LOW);
    delay(5);
    digitalWrite(PIN_SERIAL1_TX, HIGH);
    Serial1.begin(57600);
    Serial1.write(0x55);
}

Thanks

jpmeijers commented 7 years ago

When you call the sleep function you have to give a time in milliseconds for how long the radio should sleep. After that amount of time the radio will automatically wake up. Only when you want to wake up the radio before the timeout has expired you have to use the function as you posted.

It might be an idea to add the wake up function to the library, but the problem is that the library does not know about the pin numbers used for the serial. Only which stream is used.

Another option could be to use the autobaud() function to wake up the radio.