LoRa Ra-02 module failing

When running this code on my arduino mega 2560 it shows starting the lora fails, and I can't understand why. I have also tried with an Uno and another module, same thing. My module is 433Hz and I have it connected to 3.3V, my pin connections are-

MISO - 50
MOSI - 51
SCK - 52
SS - 53
RST - 9
DIO0 - 8

Does anyone know what I'm doing wrong? Thanks in advance

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

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

#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);
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
  counter++;
delay(5000);
}

Oops.

How does that even compile, much less run?

oh lol, sorry about that I must have copied it wrong

Post a link to the radio module.

Unless it has built in 5V to 3.3V logic level shifters, you will destroy it by connecting it to the SPI port of a 5V Arduino.

Also check that the 3.3V output can handle the required transmit current.

So, copy exactly what you have.

The Mega 2560 use 5V logic levels.

The RA-02 using 3.3V logic levels.

You need to use logic level conversion between the Meag 2560 and the RA-02.

Dont connect the Mega 2560 direct to the RA-02, you can destroy the RA-02.

#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);
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
  counter++;
delay(5000);
}

Oh so I need a logic level shifter, thanks everyone.

Hi, @cryotene
Did you just buy the Lora IC, or was it mounted on a PCB module.

If a module can you please post link to data/specs?

If you made a PCB can you post EXPORTED jpg images of the PCB?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

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