Arduino Nano ESP32 with LoRa Ra-02

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;

void setup() {
  Serial.begin(9600);
  while (!Serial);

  Serial.println("LoRa Sender");
  
  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());
  }
}

Nice picture but it is missing a lot of information, it may be a wiring diagram but it is not a schematic. The port pin cannot drive that many LEDs. Where is the logic converter you mention? How is it powered, the battery looks nice but is not connected to anything. What is the voltage range of the power source, can the components operate properly over that voltage range? The language of electronics gives a lot more information, it is called an annotated schematic not a frizzy. Posting links to technical information on the modules you use helps, as there are many different things using the same name.

Nano ESP32 SPI (D11 MOSI; D12 MISO; D13 CS)

Hello, the LoRa module on your schematic shows Rx Tx. Are you sure this module works on SPI? Could it be a UART module? If so, the LoRa.h library would not work.

what is the problem? do you get the "Starting LoRa failed!" message or does the send/receive fail?

for receiving lora.h usually requires DIO0 connected and the setpins() method called

void setPins(int ss = LORA_DEFAULT_SS_PIN, int reset = LORA_DEFAULT_RESET_PIN, int dio0 = LORA_DEFAULT_DIO0_PIN);

maybe worth running the following program to identify the default SPI pins

/*
  Rui Santos
  Complete project details at https://RandomNerdTutorials.com/esp32-spi-communication-arduino/
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files.
  
  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.
*/

//Find the default SPI pins for your board
//Make sure you have the right board selected in Tools > Boards
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  delay(3000);
  Serial.print("MOSI: ");
  Serial.println(MOSI);
  Serial.print("MISO: ");
  Serial.println(MISO);
  Serial.print("SCK: ");
  Serial.println(SCK);
  Serial.print("SS: ");
  Serial.println(SS);  
  Serial.print("SDA: ");
  Serial.println(SDA);  
  Serial.print("SCL: ");
  Serial.println(SCL);  
}

void loop() {
  // put your main code here, to run repeatedly:
}


if I run it on my ESP32-S3-DevKitC-1 with Board set to ESP32S3 Dev Module I get

MOSI: 11
MISO: 13
SCK: 12
SS: 10
SDA: 8
SCL: 9

when I connected a RA-02 to the ESP32-S3-DevKitC-1 I used the following connections

// ESP32_S3_DevKit_1 connections
// ESP32_S3 SCK pin GPIO12  to RA-02_pin SCK
// ESP32_S3 MISO pin GPIO13  to RA-02_pin MISO
// ESP32_S3 MOSI pin GPIO11  to RA-02_pin MOSI
// ESP32_S3 SS  pin GPIO 10   to RA-02 SS
// ESP32_S3 pin GPIO16   to RA-02 Reset
// ESP32_S3 pin GPIO17 to RA-02 DIO0

with

LoRa.setPins(10, 16, 17);  // for ESP32_S3

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