Plroblem with receving data from arduino uno+E220-900 ebyte

Hi everyone, I'm trying to test some antennas and I'm using the ebyte lora module to do this. The problem is that I can't receive data continuously, that is, the receiver only receives data (1 string in this case) when I disconnect the RX cable (Arduino's RX, which is a TX cable from the module) and then the Arduino prints / receives the string expected from the receiver module. So if I want to print the data I have to connect and disconnect the rx cable all the time.
I did the same test using an FTDI on the Arduino IDE's Serial Monitor and I don't have this problem (data is printed continuously without the need to plug and unplug the cable). Does anyone know what the problem is?
The receiver code used on arduino is below.

]#include <SoftwareSerial.h> 
SoftwareSerial loraSerial(2, 3); // TX, RX just usin a RX pin.
void setup() {
  pinMode(8, OUTPUT);
  Serial.begin(57600);
  loraSerial.begin(57600);  
}
void loop() { 
static double tim=0;
 if(millis()-tim>100){
   digitalWrite(8, LOW);
   String input = loraSerial.readString();
   if(input=="oi")
   digitalWrite(LED1, HIGH);
   Serial.println(input);  
 tim=millis();}
}  ```

Don't use the String class on AVR Arduinos.

That reads until a NULL byte is received. Do you send such a byte?

have a look at thread E220 problems
when I used the E220-900 the host micro was a ESP32 which has hardware serial ports - you problems may be due to using softwareserial which has major limitations - in particular baudrates over 38400baud can cause problems on low power micros

If I dont should use String, what do you recommend me to do?
Yes, Im sending a world "oi" from transmitter module.
'''
void setup() {
Serial.begin(57600);
}
void loop() {
Serial.println("oi");
delay(100);
}
'''

I dont think so, because i also tried to only use "Serial.Read()", but I have the same problem. furthermore, after you said me that I changed the baudrate to 19200 and doesnt work, I have the same problem. I will take a time to read the link you send me.

That sends "oi" and then a carriage return and a newline but no null byte. So the recipient is waiting for a long time to receive that null byte but you don't send it.

But I do. SoftwareSerial is a resource hog and actually isn't very reliable above 19200 baud. If you use a tolerant counterpart you may be able to go higher but don't count on it.

I'm a little confused, you mean I need to send a NULL bit after "oi +\n"? I don't actually need to send a string/word, I just need to send and then receive the "message", so do you have any idea how I can solve this? I've tried sending an INT but without success.

But if the "softwareserial" is the problem, when I don't use that, it shouldn't have the same problem, should it?

No, until a timeout, IIRC.

ran this program on a pair of ESP32 micros which were connected to E220-900T22D modules using a hardware serial port

// ESP32  Serial1 to  E220-900T22D LoRa module in transparent mode
// run same program on two ESP32
//   text entered on one E220 appear on the other

// E220 pin 1 M0  to ESP32 GND
// E220 pin 2 M1  to ESP32 GND
// E220 pin 3 RXD to ESP32 GPIO16 pullup to 3.3V
// E220 pin 4 TXD to ESP32 GPIO15 pullup to 3.3V
// E220 pin 5 AUX no connection
// E220 pin 6 VCC to ESP32 3.3V
// E220 pin 7 GND to ESP32 GND

#define RXD1 16
#define TXD1 17

void setup() {
  pinMode(19, OUTPUT);    // set M0 low
  digitalWrite(19, LOW);
  pinMode(21, OUTPUT);    // set M1 low
  digitalWrite(21, LOW);
  // initialize  serial port:
  Serial.begin(115200);
  Serial1.begin(9600, SERIAL_8N1, RXD1, TXD1);
  Serial.println();
  Serial.println("\n\nESP32 serial1 to  E220-900T22D LoRa module ");
}

void loop() {
  // read from port 1 (E220), send to port 0:
  if (Serial1.available()) {
    int inByte = Serial1.read();
    Serial.write(inByte);
  }

  // read from port 0, send to port 1 (E220):
  if (Serial.available()) {
    int inByte = Serial.read();
    //Serial.write(inByte);
    Serial1.write(inByte);
  }
}

text enter on serial monitor of one ESP32 was transmitted using the E220 to the other where it was displayed
e.g. ESP32 on COM6 displays

hello COM6 from COM4
COM4 sending 0987654321
COM4 sending abdeftretuyiu

ESP32 on COM4 displays

hello COM4 from COM6
COM6 sending 123456789000000
COM6 sending ABCDEF

Edit: are you sure the E220 baudrate is 57600 - the default appears to be 9600baud

have you tried the EByte_LoRa_E220_Series_Library
e.g. running File>Examples>Ebyte LoRa E2200 Library>01_getConfiguration displays

Success
1
----------------------------------------
HEAD : C1 0 8
 
AddH : 0
AddL : 0
 
Chan : 15 -> 425MHz
 
SpeedParityBit     : 0 -> 8N1 (Default)
SpeedUARTDatte     : 11 -> 9600bps (default)
SpeedAirDataRate   : 10 -> 2.4kbps (default)
 
OptionSubPacketSett: 0 -> 200bytes (default)
OptionTranPower    : 0 -> 22dBm (Default)
OptionRSSIAmbientNo: 0 -> Disabled (default)
 
TransModeWORPeriod : 11 -> 2000ms (default)
TransModeEnableLBT : 0 -> Disabled (default)
TransModeEnableRSSI: 0 -> Disabled (default)
TransModeFixedTrans: 0 -> Transparent transmission (default)
----------------------------------------
Success
1
----------------------------------------
HEAD: C1 8 3
Model no.: 20
Version  : B
Features : 16
----------------------------------------

I guess you meant byte instead of bit, a byte is 8 bit. No, usually the terminating NULL byte isn't sent. The null byte at the end is a C convention and a byte stream isn't always a string that is sent.
How about using readStringUntil() instead?

It's an additional problem, the one I described above is also still there and both should be resolved.

Yes, if not byte is received for some time (1 second by default).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.