Reputation: 1
I have two LoRa modules, the transmitter is an E32-900T20D (with ESP32 DevKitC V4) and the receiver is a LoRa32U4. The problem is that the receiver is not receiving anything from the transmitter. Here is the code for the transmitter:
#include "Arduino.h"
#include "LoRa_E32.h"
LoRa_E32 e32ttl100(&Serial2,UART_BPS_RATE_9600 );
void setup() {
Serial.begin(9600);
delay(500);
// Startup all pins and UART
e32ttl100.begin();
Serial.println("Hi, I'm going to send messages every second!");
// Send first message
ResponseStatus rs = e32ttl100.sendMessage("Hello, world?");
// Check if message was sent successfully
if (rs.code == 1) {
Serial.println("Message sent successfully");
} else {
Serial.println("Failed to send message");
}
}
void loop() {
delay(2000);
// Send message
ResponseStatus rs = e32ttl100.sendMessage("Hello, world?");
// Check if message was sent successfully
if (rs.code == 1) {
Serial.println("Message sent successfully");
} else {
Serial.println("Failed to send message");
}
}
Here is the result of the transmitter:
Hi, I'm going to send messages every second! Message sent successfully Message sent successfully Message sent successfully
Here is the code for the receiver:
#include <SPI.h>
#include <LoRa.h>
#define ss 8
#define reset 4
#define dio0 7
void setup() {
Serial.begin(9600);
LoRa.setPins(ss, reset, dio0);
if (!LoRa.begin(868E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
// Set signal bandwidth to 125kHz
LoRa.setSignalBandwidth(125E3);
// Set TX power to 20dBm
LoRa.setTxPower(20);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
}
void loop() {
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
Serial.print("Received packet with RSSI ");
Serial.print(LoRa.packetRssi());
Serial.print(": ");
while (LoRa.available()) {
Serial.write(LoRa.read());
}
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}
}
Knowing that both are configured for 868 Mhz, what is the problem? Any help please?
Upvotes: 0
Views: 440
Reputation: 6213
Ebyte modules that are UART-managed are not really LoRa devices. Their settings do not match that of regular LoRa modules. I have long suspected that they use FSK transmission instead of LoRa. Stay entirely within the Ebyte ecosystem, or out. Do not mix non-Ebyte and Ebyte modules, because if you do, all you will ensure is misery.
Upvotes: 2