我从同一个地方得到了两个完全相同的Arduino Nano clones (CH340s)和RA-02 LoRa模块。我使用的是来自Esplora库的LoRaReceiver和LoRaSender草图(刚刚将频率改为433)
接收器:‘
#include <SPI.h>
#include <LoRa.h>
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("LoRa Receiver");
if (!LoRa.begin(433E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
Serial.print("Received packet '");
// read packet
while (LoRa.available()) {
Serial.print((char)LoRa.read());
}
// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
}
}“”“
发件人:‘
#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);
// send packet
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(5000);
}“”“

Link to the website with the image
请注意,未使用电位器。在死亡之前,它会接收随机数量的消息。它仍然吸收电流,因此模块必须正常工作(发送时TX约为5 5mA空闲,发送时约130 5mA,而RX始终在5 5mA左右)。这些模块通过2x (3.3V DC2DC 100 RA模块)供电,每个RA-02的总电流为200 RA。这些DC2DC的电源是从5V的arduino,这是通过USB连接到我的桌面。
重新启动后(更改监视器的带宽并将其设置回9600),它会在很短的时间内再次开始接收。在再次冻结之前,平均大约7条消息。
发布于 2021-04-09 22:22:05
在上周与我的一个朋友进行了大量的测试后,我们决定尝试一个更大的板来接收,因为发送不会停止。他建议我使用Arduino Mega,但由于我办公桌上有一个4 4GB的RPi,所以我们决定把它挂上。
它没有问题,所以如果任何人有这种问题,我建议尝试模板(这样你将留下大量的自由空间),如果可能的话,使用更大的电路板。
PI接收了大约一个小时,没有任何问题。
如果使用PI,我还会使用htop查看内存是否有任何问题:]
哦,还有我使用的安装指南:https://circuitdigest.com/microcontroller-projects/raspberry-pi-with-lora-peer-to-peer-communication-with-arduino
我只需要用sudo apt-get install python3-pip或sudo apt-get install python-pip安装pip3 (我用的是python3)。其他所有内容在指南中都是“原样”的。
https://stackoverflow.com/questions/63861160
复制相似问题