https://wei48221.blogspot.com/2020/02/how-to-setup-rtl-sdr-dongle-to-work.html
Sender Code (running on ESP8266)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | /********* Modified from the examples of the Arduino LoRa library More resources: https://randomnerdtutorials.com *********/ #include <SPI.h> #include <LoRa.h> //define the pins used by the transceiver module //#define ss 5 //#define rst 14 //#define dio0 2 // GO of the Adafruit RFM9x breakout module #define ss 15 #define rst 0 #define dio0 16 // GO of the Adafruit RFM9x breakout module int counter = 0; void setup() { //initialize Serial Monitor Serial.begin(115200); while (!Serial); Serial.println("LoRa Sender"); //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(866E6)) { Serial.println("."); delay(500); } */ 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() { Serial.print("Sending packet: "); Serial.println(counter); //Send LoRa packet to receiver LoRa.beginPacket(); LoRa.print("hello "); LoRa.print(counter); LoRa.endPacket(); counter++; delay(10000); } |
Receiver Code (running on ESP32)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | /********* Modified from the examples of the Arduino LoRa library More resources: https://randomnerdtutorials.com *********/ #include <SPI.h> #include <LoRa.h> //define the pins used by the transceiver module //#define ss 5 //#define rst 14 //#define dio0 2 #define ss 21 // GPIO21 of ESP32 #define rst 17 // GPIO17 of ESP32 #define dio0 16 // Connect to G0 of the Adafruit RFM9x breakout module 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(866E6)) { Serial.println("."); delay(500); } */ 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()); } } |
Serial Output
SDR# Display (Youtube Video)
The pulse at 433MHz is the signal sent by the sender.
Reference:
QUICK START GUIDE
https://www.rtl-sdr.com/rtl-sdr-quick-start-guide/
Airspy
https://airspy.com/
No comments:
Post a Comment