arduino-LoRa icon indicating copy to clipboard operation
arduino-LoRa copied to clipboard

LORA COMMUNICATION USING NANO

Open Srivardhan06 opened this issue 1 year ago • 35 comments

I'm working on lora communication using nano i m not receving the data and some times i'm receving the garabage values like:???????????? can you help me in this issue

thank you

Srivardhan06 avatar May 18 '24 13:05 Srivardhan06

Huh?

Please tell more about your setup, what are you using. How did you connect everything?

Which code are you using? The sender and receiver samples?

sercero avatar May 19 '24 01:05 sercero

IM USING NANO AND LORA SX1278

SENDER CODE :

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

byte msgCount = 0; // Count of outgoing messages byte localAddress = 0xBB; // Address of this device byte destination = 0xFF; // Destination to send to long lastSendTime = 0; // Last send time int interval = 3000; // Interval between sends

/*

  • Transmitter side Code

Module SX1278 // Arduino UNO/NANO
Vcc -> 3.3V MISO -> D12 MOSI -> D11
SLCK -> D13 Nss -> D10 GND -> GND
*/

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

while (!Serial);
Serial.println("LoRa Sender");

if (!LoRa.begin(433E6)) { // or 915E6, the MHz speed of your module Serial.println("Starting LoRa failed!"); while (1); } }

void loop() { String MyMessage = "Hello World"; LoRa.beginPacket();
LoRa.print(MyMessage); LoRa.endPacket(); delay(300); }

RECEIVER CODE :

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

byte data[50]; byte msgCount = 0; // Count of outgoing messages byte localAddress = 0xFF; // Address of this device byte destination = 0xBB; // Destination to send to long lastSendTime = 0; // Last send time int interval = 300; // Interval between sends

/* *** Receiver Side Code**

#include <SPI.h> #include <LoRa.h>
String inString = ""; // string to hold incoming charaters String MyMessage = ""; // Holds the complete message

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

while (!Serial); Serial.println("LoRa Receiver"); if (!LoRa.begin(433E6)) { // or 915E6 Serial.println("Starting LoRa failed!"); while (1); } }

void loop() {

// try to parse packet int packetSize = LoRa.parsePacket(); if (packetSize) { // read packet
while (LoRa.available()) { int inChar = LoRa.read(); inString += (char)inChar; MyMessage = inString;
} inString = "";
LoRa.packetRssi();
}

Serial.println(MyMessage);

}

Srivardhan06 avatar May 19 '24 04:05 Srivardhan06

I'M Connecting the pins from sx`1278 to nano

and i'm providing the external power supply for lora

Module SX1278 // Arduino NANO Vcc -> 3.3V MISO -> D12 MOSI -> D11 SLCK -> D13 Nss -> D10 GND -> GND DI00 -> D2 RST -> RST

SX1278-Pinout

Srivardhan06 avatar May 19 '24 04:05 Srivardhan06

I'M using nano for both transmitter and receiver side

OUTPUT

Transmitter side :

LoRa Sender

receiver side :

S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn��� S��LNcn���

Srivardhan06 avatar May 19 '24 05:05 Srivardhan06

Tomorrow I'll get those modules 😊

We might have very similar setups...

Can you show a picture of how you connected everything?

Another thing... why don't you print the RSSI of the received packet? That might help...

sercero avatar May 19 '24 13:05 sercero

OK TQ

Srivardhan06 avatar May 19 '24 14:05 Srivardhan06

Connection are same as i said before |

Module SX1278 // Arduino NANO Vcc -> 3.3V MISO -> D12 MOSI -> D11 SLCK -> D13 Nss -> D10 GND -> GND DI00 -> D2 RST -> RST

vcc pin is connected to 3.3v nano board MISO pin is connected to D12 pin

Srivardhan06 avatar May 19 '24 14:05 Srivardhan06

I wanted to see how you did the physical connection in part to help and in part to see how to do it myself because that module I think that the holes do not align with a protoboard.

sercero avatar May 19 '24 15:05 sercero

ok i will share

Srivardhan06 avatar May 20 '24 04:05 Srivardhan06

I have doubt should i use level converters between lora and nano

Srivardhan06 avatar May 20 '24 08:05 Srivardhan06

WhatsApp Image 2024-05-20 at 16 54 52_a698d6e4

Srivardhan06 avatar May 20 '24 11:05 Srivardhan06

Can you take a closer picture of the connections to the module?

From this far away it seems as if the connections are wrong, for example I can't see where you connected the blue cable (GND).

sercero avatar May 20 '24 12:05 sercero

I HAVE GIVEN COMMON GROUND FOR EXTERNAL 3.3 V SUPPLY

Srivardhan06 avatar May 21 '24 03:05 Srivardhan06

the ground from nano is given to the GROUND LINE of the bread board and ground from the external 3.3v is connected to the bread board ground line and lora is also connected to same ground line

Srivardhan06 avatar May 21 '24 04:05 Srivardhan06

Have you checked continuity between the soldered cables?

I soldered cables to that module yesterday and it is a pain in the a**.

Perhaps there is a short circuit somewhere.

sercero avatar May 21 '24 11:05 sercero

Haa the connection are right

I have checked the continuity

Srivardhan06 avatar May 24 '24 03:05 Srivardhan06

Can i know that you are able to receive the data from lora using nano

Srivardhan06 avatar May 24 '24 03:05 Srivardhan06

If it is working can you share the circuit diagram

Srivardhan06 avatar May 24 '24 03:05 Srivardhan06

image

Hello, I was able to make it work.

But I'm using Arduino Pro Mini.

These are the connections:

ARDUINO --------- LoRa Module
GND <- NEGRO ---> GND
VCC <- ROJO ----> 3.3V
10  <- MARRON --> NSS
11  <- AZUL ----> MOSI
12  <- NARANJA -> MISO
13  <- BLANCO --> SCK
9   <- VIOLETA -> RST
2   <- VERDE ---> DIO0

The coil antenna seems to be pretty bad, -80dBm with two modules next to each other.

I get better reception with the modules Ra-02 and a cable as an antenna

sercero avatar May 24 '24 16:05 sercero

can you check with Aduino nano

Srivardhan06 avatar May 25 '24 05:05 Srivardhan06

image

Srivardhan06 avatar May 25 '24 06:05 Srivardhan06

and can you share the outputs and also print rssi value of received packet

Srivardhan06 avatar May 25 '24 06:05 Srivardhan06

Hello, I don't have an Arduino nano so that test is not possible for me...

Is it possible that Arduino nano uses 5V?

You should use 3,3V for the LoRa modules, they might work at 5V but long term they might be damaged by that voltage.

The RSSI I'm getting is -64dBm with the modules next to each other.

sercero avatar May 25 '24 13:05 sercero

Connection are same as i said before |

Module SX1278 // Arduino NANO Vcc -> 3.3V MISO -> D12 MOSI -> D11 SLCK -> D13 Nss -> D10 GND -> GND DI00 -> D2 RST -> RST

vcc pin is connected to 3.3v nano board MISO pin is connected to D12 pin

I see you connected RST -> RST, shouldn't it go to D9?

sercero avatar May 25 '24 13:05 sercero

haa yes rst---> d9

Srivardhan06 avatar May 25 '24 14:05 Srivardhan06

i m using logic level converters between lora and nano but i m getting

LoRa Receiver Starting LoRa failed!

Srivardhan06 avatar May 25 '24 14:05 Srivardhan06

and can you share the code and as well as ouput

Srivardhan06 avatar May 26 '24 10:05 Srivardhan06

I took the code from here: https://iotprojectsideas.com/multiple-lora-nodes-communication-with-master-lora-node/

The output won't tell you much.

sercero avatar May 26 '24 13:05 sercero

can you give me the voltage at every pins of lora at sender and receiver

Srivardhan06 avatar May 27 '24 05:05 Srivardhan06

I think you should better use a module like this: image

So that you don't have issues with the soldering.

Most likely there is something wrong with the solder.

sercero avatar May 27 '24 12:05 sercero