Site icon Renzo Mischianti

Getting Started with LoRa E32 and Arduino

Hello. I am working on a personal project using the LoRa module E32-TTL-100. My setup is composed of two Arduinos and two E32 modules. I am basically connecting each Arduino to each E32 module, and my aim is to successfully set a communication between these two pairs using LoRa. For the connection between Arduino and E32 I am using the following circuit. For the code, I am using the one in Ebyte LoRa E32 device for Arduino, esp32 or esp8266: fixed transmission – 4.
/*
 * LoRa E32-TTL-100
 * Write on serial to transfer a message to other device
 * http://mischianti.org
 *
 * E32-TTL-100----- Arduino UNO
 * M0         ----- GND
 * M1         ----- GND
 * TX         ----- PIN 2 (PullUP)
 * RX         ----- PIN 3 (PullUP & Voltage divider)
 * AUX        ----- Not connected
 * VCC        ----- 3.3v/5v
 * GND        ----- GND
 *
 */
#include "Arduino.h"
#include "LoRa_E32.h"
 
LoRa_E32 e32ttl100(2, 3); // e32 TX e32 RX
 
void setup() {
  Serial.begin(9600);
  delay(500);
 
  Serial.println("Hi, I'm going to send message!");
 
  // Startup all pins and UART
  e32ttl100.begin();
 
  // Send message
  ResponseStatus rs = e32ttl100.sendMessage("Hello, world?");
  // Check If there is some problem of successfully send
  Serial.println(rs.getResponseDescription());
}
 
void loop() {
    // If something available
  if (e32ttl100.available()>1) {
      // read the String message
    ResponseContainer rc = e32ttl100.receiveMessage();
    // Is something goes wrong print error
    if (rc.status.code!=1){
        rc.status.getResponseDescription();
    }else{
        // Print the data received
        Serial.println(rc.data);
    }
  }
  if (Serial.available()) {
      String input = Serial.readString();
      e32ttl100.sendMessage(input);
  }
}
I have uploaded this same code to both Arduinos and then opened the Serial consoles to monitor if the communication was happening as expected. However, I only get the prints saying that the message was sent succesfully on the sender's end, but never see the receiving end printing the received message. Am I doing something wrong? I am totally new to LoRa, so I am also very lost in this and kinda burned out, since I've being trying to get it to work for days now. I wonder if I am skipping some configuratin step I was supposed to be doing before this. Thanks in advance for any help.
Exit mobile version