LoRa communication between 2 esp32 using a LoRa module

jeancaire3
Posts: 1
Joined: Thu Dec 06, 2018 1:56 pm

LoRa communication between 2 esp32 using a LoRa module

Postby jeancaire3 » Thu Dec 06, 2018 6:54 pm

Hello !

I am trying to communicate between 2 esp32 (TTGO V2 epaper) using UART by LoRa. I am using this LoRa module : http://www.ebyte.com/en/product-view-ne ... ItNmko-Cxo


According to the circuit : https://ibb.co/xJkh8rS Rx and Tx use HS2


Here is the code of the emettor :
  1. HardwareSerial ss(2);  
  2.  
  3. uint8_t buff[16];
  4. int compt=0;
  5. int len=0,ret=0;;
  6.  
  7. union
  8. {
  9.   uint8_t buff[16];
  10.   char tamp[16];
  11. } frame;
  12.  
  13.  
  14. void setup() {
  15.   Serial.begin(9600);
  16.   ss.begin(9600);
  17. }
  18.  
  19. void loop() {
  20.   compt++;
  21.   sprintf(frame.tamp,"Packet:%d", compt);
  22.   len=strlen(frame.tamp);
  23.   Serial.println(len);Serial.println(frame.tamp);
  24.   ret=ss.write(frame.buff,strlen(frame.tamp));
  25.   Serial.println(ret);
  26.   delay(3000);  
  27.  
  28. }
The serial monitor displays this : https://ibb.co/0Yp7h5F
It shows that the emitter is working correctly.

And here is the code of the receiver :

Code: Select all

HardwareSerial ss(2);   

char buff[16];
int i=0;

void setup() {
  Serial.begin(9600);
  Serial.println("begin");
  ss.begin(9600);
}

void loop() 
{
  i=0;
  //Serial.println(ss.available());
   if(ss.available() > 1){//Read from UM402 and send to serial monitor
    String input = ss.readString();
   Serial.println(input); 
   }
  delay(20);
}
The emitter seems to be working but the receiver doesn't receive anything.

Does someone have any idea of where it may come from ?

Who is online

Users browsing this forum: No registered users and 2 guests