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:
#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.
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 .
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?