KrisKasprzak / EBYTE

Libraries to program and use UART-based EBYTE wireless data transceivers
239 stars 75 forks source link

Ebyte Lora for Sleep Mode and Working Mode Need help. #82

Closed krishank652 closed 4 months ago

krishank652 commented 4 months ago

Dear @KrisKasprzak Sir,

I'm using the E220-400T22S LoRa device powered by AA batteries. To save power, I want the LoRa device to be in working mode only when it needs to transmit a signal. Otherwise, I want it to be in sleep mode.

Sir, could you please assist me in answering the following four questions?

Question: 1

#define AUX   1
#define M0    2
#define M1    3

LoRa_E220 e220ttl(&Serial2, AUX, M0, M1);

pinMode(AUX, INPUT);
pinMode(M0, OUTPUT);
pinMode(M1, OUTPUT);
void sleep()
{
  digitalWrite(M0, HIGH);
  digitalWrite(M1, HIGH);
}

void wakeup()
{
    digitalWrite(M0, LOW);
    digitalWrite(M1, LOW);

}

When I need for transmission I run wakeup() and when I complete the transmission then I run sleep()

Is this correct way?

If not please help me to set the simple way of sleep mode, and working mode.

Question: 2

the below is correct and Safe way for module?

  Transceiver.SetMode( MODE_WAKEUP );
  Transceiver.SendStruct(&data, sizeof(data));
  Transceiver.SetMode( MODE_POWERDOWN );

Note: Above code is executing in every 10 mins ( most of the time its excecuting in the 10 minutes and in sometimes its executing in 5 minuts , it is a rare condition and coming 5-6 times in a day)

Question: 3

Can I do Like Below. Is this correct and Safe way? I am using MCU that have less pins and I required its pin for another work in the project. Can I save pin configuration in this?

Example:

#define AUX   1
#define M0    -1      // Can I put invalid pin because this pin will always LOW. Can I Ground it always?
#define M1    2

LoRa_E220 e220ttl(&Serial2, AUX, M0, M1);
  Transceiver.SetMode( MODE_NORMAL );
  Transceiver.SendStruct(&data, sizeof(data));
  Transceiver.SetMode( MODE_POWERDOWN );

Question: 4

Can I save one more pin by use a Invalid pin to AUX?

#define AUX   -1     // Can I put invalid pin and open this pin in hardware?
#define M0    -1      // Can I put invalid pin because this pin will always LOW. Can I Ground it always?
#define M1    1

LoRa_E220 e220ttl(&Serial2, AUX, M0, M1);
KrisKasprzak commented 4 months ago

question 1. the library as a way to make the module wake up and sleep. Not sure why you are duplicating this capability.

I've never put a module to sleep, not sure if you need to run MODE_POWERDOWN first, then run MODE_WAKEUP before MODE_NORMAL

See what the data sheet says

Question 2 I've never put a module to sleep, not sure if you need to run MODE_WAKEUP then MODE_NORMAL See what the data sheet says

question 3 sure not.... if you want to put module into sleep and wake it up, you must have ability to set M0 and M1 in both states

question 4 you can set aux to -1 but not M0 and M1