What is the perfect way to connect between RAK3172 and ESP32

Hello all,

I am trying to make a project with Rak3172 and ESP32 (WROOM-32D).

ESP32 has 1 UART (RX-TX) and it uses it to communicate with computer.

I tried to bypass ESP32 and connected Rak3172 RX to ESP32 RX - RAK3172 TX to ESP32 TX ; and it worked really good. But when i try to communicate with SoftwareSerial pins of esp32 and RAK3172, i cant send any data or receive anything. So, can you tell me why is that for? Or could you please send me a connection scheme?

#include <SoftwareSerial.h>

SoftwareSerial mySerial(18,19);
void sendCommand(String atComm){
String response = "";
Serial1.print(atComm);
  while(Serial1.available()){
    char ch = Serial1.read();
    response += ch;
  }
  Serial.println(response);
}
void setup()
{
mySerial.begin(9600); // the GPRS baud rate
Serial.begin(9600); // the GPRS baud rate
}

void loop()
{
sendCommand("AT+");
delay(1000);


}


Welcome to RAK forum @tortudereli :slight_smile:

I checked your code and in your sendCommand function, you use Serial1 instead of mySerial. Can you try to replace it using mySerial which is your softwareserial implementation. Also use Serial.println so that the AT command will be sent.

For the pins, try to interchange 18 and 19, you might have overlooked your connection.

Btw, ESP32 has extra HW UART. Why not use it?

1 Like

Hi,

I have been using the both and I would also recommend using another UART. ESP32 has three UART controllers (UART0 - 2). I have been using another UART for the radio module without any difficulties.

By the way, it seems that you are using Arduino libraries to implement the software. I have noticed that ESP-IDF is far more reliable and it is not that difficult to learn. Here is a simple tutorial how to use UART with ESP32 and ESP-IDF:

ESP32 (26) – UART – lucadentella.it

The same author has published almost 40 different tutorials which are very useful. You might want to try that tutorial to make sure that your connections are valid.

2 Likes