I have problems connecting my Ra-02 SX1278 module with the Arduino Nano ESP32 and with the Arduino Nano Every. I have lookt at my connections multiple time and with the Arduino Nano Every I use a logic converter. All I get is "Starting LoRa Failed.
In the schematic below I show my connections. It is the connections for the Arduino Nano Every and the same for Arduino Nano ESP32 except for the ss pin, That is connected to pin 10. (dio0 is connected to D2, apperently not on schematic)
This is the code I use.
code sender:
#include <SPI.h>
#include <LoRa.h>
int counter = 0;
#define ss 8
#define rst 9
#define dio0 2
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("LoRa Sender");
LoRa.setPins(ss, rst, dio0);
if (!LoRa.begin(433E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
// send packet
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(5000);
}
code receiver:
#include <SPI.h>
#include <LoRa.h>
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("LoRa Receiver");
if (!LoRa.begin(433E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
Serial.print("Received packet '");
// read packet
while (LoRa.available()) {
Serial.print((char)LoRa.read());
}
// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
}
}
1 post - 1 participant