Hi
Just like the Song Luara can’t yo u see, she doesn’t here lol
I just loaded up code for the Lora to send Hello World to the Reciever … no joy
It appears that it is sending Hello World in the Serial Port
transmitter
#include <SPI.h> #include <LoRa.h> void setup() { Serial.begin(115200); Serial.println("LoRa Sender starting..."); LoRa.setPins(18, 14, 26); // LoRa.setPins(CS, RESET, IRQ); LoRa.setSyncWord(0xF3); if (!LoRa.begin(868E6)) { // Set frequency to 433, 868 or 915MHz Serial.println("Could not find a valid LoRa transceiver, check pins used and wiring!"); delay(1000); } } void loop() { LoRa.beginPacket(); // Start LoRa transceiver LoRa.print("Hello World"); Serial.print("Hello World"); LoRa.endPacket(); // delay(1000); }
Message
rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:928 ho 0 tail 12 room 4 load:0x40078000,len:8424 ho 0 tail 12 room 4 load:0x40080400,len:5868 entry 0x4008069c LoRa Sender starting... Hello WorldHello WorldHello WorldHello World rst:0x1
Receiver
#include <SPI.h> #include <LoRa.h> void setup() { Serial.begin(115200); Serial.println("LoRa Receiver"); LoRa.setPins(18, 14, 26); LoRa.setSyncWord(0xF3); if (!LoRa.begin(866E6)) { Serial.println("Starting LoRa failed!"); while (1); } } void loop() { // try to parse packet String packet = ""; int packetSize = LoRa.parsePacket(); if (packetSize) { // received a packet Serial.print("Received packet "); // read packet while (LoRa.available()) { Serial.print((char)LoRa.read()); // packet = LoRa.readString(); } // Serial.print(packet); // print RSSI of packet Serial.print(" RSSI was: "); Serial.println(LoRa.packetRssi()); } }
Message
(POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:928 ho 0 tail 12 room 4 load:0x40078000,len:8424 ho 0 tail 12 room 4 load:0x40080400,len:5868 entry 0x4008069c LoRa Receiver
I am using this: banggood.com/Wemos-TTGO-2Pcs-ESP32-SX1276-LoRa-868MHz-bluetooth-WI-FI-Lora-Internet-Antenna-Development-Board-For-Arduino-p-1295045.html
Regards
derek
Hi Derek.
You code seems to be fine, but you have the following line commented:
// packet = LoRa.readString();
That’s the line that receives the packet. If it is commented, you won’t receive the message.
Regards,
Sara
Hi Sara,
I did what you said from comment .. still no message received
But I assumed that
Serial.print((char)LoRa.read());
=
packet = LoRa.readString();
Serial.print(packet);
I swap the LoRas around so transmitter is now receiver .. no joy
I also increased the power level
LoRa.setTxPower(txPower); //to 20 ..
recommended on https://github.com/sandeepmistry/arduino-LoRa/issues/146 and change frequencies
LoRa.setSPIFrequency(1E6);
LoRa.setSignalBandwidth(7.8E3); … no message
I am running these LoRa’s with no Headers soldered form this: youtube.com/watch?v=0xP1h1Qx4Ao
Regards
derek
Hi Derek.
I guess you are right, those lines should do the same thing.
Everything seems to be fine with your code and you’re setting the right pins for your boards. So, it should be working.
So, the software shouldn’t be the problem. Can you try removing the syncword in both codes and see if it works?
It can be a power issue, broken antenna, or the board is not working properly. It is very difficult to figure out what can be wrong :/
Regards,
Sara