LoRa with Nano and ESP32 problem

Hi, i am making a project using LoRa Ra-02 SX1278. The transmitter is using Arduino Nano with LoRa and the receiver is ESP32 Devkit V1 with LoRa. The transmitter sends packet up until 5 packets only then stops. But sometimes it can send packets continuously without stopping. As for the receiver, it seems to be working as the output shown on the serial monitor shows that LoRa is initialized which means it is alright but it did not receive any packets at all. My connections are as follows:

LoRa Transmitter
LoRa - Nano
3.3V - External 3.3V supply
GND - GND of external supply
RST - D9
DIO0 - D2
NSS - D10
MOSI - D11
MISO - D12
SCK - D13

LoRa receiver
LoRa - ESP32
3.3V - 3.3V
GND - GND
RST - D14
DIO0 - D2
NSS - D5
MOSI - D23
MISO - D19
SCK - D18

Transmitter code

#include <SPI.h>
#include <LoRa.h>

int counter = 0;

void setup() {
  Serial.begin(115200); 
  while (!Serial);
  Serial.println("LoRa Sender");
  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
  //LoRa.setSyncWord(0xF3);
  LoRa.setTxPower(18);
}


void loop() {
  Serial.print("Sending packet: ");
  Serial.println(counter);
  // send packet
  LoRa.beginPacket();
  LoRa.print("hello ");
  LoRa.print(counter);
  LoRa.endPacket();
  counter++;
  delay(5000);
}

Receiver code

#include <SPI.h>
#include <LoRa.h>

//define the pins used by the transceiver module
#define ss 5
#define rst 14
#define dio0 2

void setup() {
  //initialize Serial Monitor
  Serial.begin(115200);
  while (!Serial);
  Serial.println("LoRa Receiver");

  //setup LoRa transceiver module
  LoRa.setPins(ss, rst, dio0);
  
  //replace the LoRa.begin(---E-) argument with your location's frequency 
  //433E6 for Asia
  //866E6 for Europe
  //915E6 for North America
  while (!LoRa.begin(433E6)) {
    Serial.println(".");
    delay(500);
  }
   // Change sync word (0xF3) to match the receiver
  // The sync word assures you don't get LoRa messages from other LoRa transceivers
  // ranges from 0-0xFF
  //LoRa.setSyncWord(0xF3);
  Serial.println("LoRa Initializing OK!");
}

void loop() {
  // try to parse packet
  int packetSize = LoRa.parsePacket();
  if (packetSize) {
    // received a packet
    Serial.print("Received packet '");

    // read packet
    while (LoRa.available()) {
      String LoRaData = LoRa.readString();
      Serial.print(LoRaData); 
    }

    // print RSSI of packet
    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());
  }
}

I am still connecting the transmitter and receiver to the PC to observe the output on the serial monitor.
I am still a novice in the world of electronics so a help will be appreciated.
If additional information regarding the project is required, I will try to provide it. Thank you.

The Arduino Nano is a 5V logic level device and the LoRa RA-02 uses 3.3V logic levels.

So what logic level conversion components are you using on the connections between the Nano and the RA-02 ?

The connections are direct between the Nano and the LoRa except for the 3.3V pin which is connected to an external 3.3V supply.

You need to use logic level conversion circuits for the connections, the LoRa device can be damadged by direct connection of 5V logic levels.

Blockquote

I see.
But does every pin need to use logic level converters or only certain pins?

UPDATE
I've used logic converters in this project just like you asked. The transmitter seems to be working on it's first try. It can send packets continuously without a problem. However the receiver is still not receiving anything although it mentions "LoRa Initializing Successful" in the serial monitor on the receiver side.
Could there be any problem with the receiver?

UPDATE
It seems to have work right now after several troubleshooting. I thought that I might change to an arduino pro micro as it already uses a 3.3v logic level but the nano works.
So what I did is I also used the logic converters just like you asked but I did not know which pins to be connected to the logic converter. So first i connected all the nano pins except 3.3v and ground to the logic converter then to the lora module. It seems like it was working as it was continuously sending packets but the receiver was not receiving anything.
So I checked this page and learnt that the MOSI, MISO and SCK pin are not like digital pins (correct me if I'm wrong) so these 3 pins are directly connected to the nano while the others through the logic converter.
And to my surprise, it worked!! The receiver receives the package and displays it on the serial monitor. Already 400+ packets were sent and received so I assumed everything is working.
Thank you for your help @srnet .

You are wrong.

MOSI, MISO and SCK are digital pins like any other and need to be connected via logic level converters when used with a Nano.

If you dont use logic level converters on the MOSI, MISO and SCK pins your LoRa device might not last very long.

Every I/O pin, otherwise you will end up destroying your equipment.

It is much simpler and safer to use 3.3V Arduinos, as 95% of all sensors, radios, etc. are 3.3V devices.

When I connect all of them to the logic converter, it fails to initialize LoRa. But with my mentioned method above, it works without a problem?

Oh, one more thing I forgot to mention is I am using a 4 channel bi directional logic level converter picture

So if I want to connect all the pins to the converter, I need two of these level converter. So there are 6 pins that are connected to the logic converter. Could the problem be these 2 pieces of converters where i need to power each of them that might reduce the power of the nano? Should I use a 8 channel logic converter instead?

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