Hello, I'm trying to set up my LoRa receiver device to display an alarm integer value to blynk when connection is lost between LoRa sender and receiver.
However if the transmitter sends a packet and on receipt of the packet the receiver send back an acknowledge, which the transmitter does not receive, then the transmitter knows there is a problem.
My biggest concern is losing power on the transmitter side. Could an alarm be set up if the receiver fails to receive a packet from the transmitter within a certain time?
I'm trying to monitor temperature of a well about 3/4 mile from my house. The LoRa transmitter is at the well and the receiver is near my house within wifi range. The LoRa transmitter sends a packet every 10 seconds so I was thinking an alarm after a minute or two of the receiver receiving no packets would be good.
yes, that's a sound approach. You would basically take the LoRa transmitter's packet as a heartbeat. If you stop hearing it for sometime, then you've a problem
Since you are not likely to power both devices at the same time, you need to allow for the initial conditions of not getting an acknowledgement and for not getting a message at the receiver. A simple Boolean set to false will allow your transmission test to be ignored for perhaps, 10 minutes, to allow you to get power to both devices.
So I think I found a solution. I added a timer that gets reset every time a packet is received. The timer goes off at 20 seconds and will set the LoRaData variable to an error number.
void loop() {
static unsigned long Timer = millis();
int packetSize = LoRa.parsePacket();
if (packetSize) {
while (LoRa.available()) {
LoRaData = LoRa.read();
Serial.print(LoRaData);
Serial.print(" ");
}
Serial.print("RSSI: ");
Serial.println(LoRa.packetRssi());
Timer = millis();
}
if (millis() - Timer > 20000) {
LoRaData = 50;
}
Blynk.run();
timer.run();
}
The well house is not the problem. ALL wells must breathe! An extremely cold high pressure weather will force the frigid air into the well house and into the well, freezing the top of the water pipe in the well casing. Has happened to me several times and the previous owner had it happen while they were away for an expended period. That allows the pump to run for ever because the water cannot get to the pressure tank and regulating switch, etc. The pump motor eventually burned out and all had to be replaced in the frigid weather.
I really need to do something similar to my well, but are seldom away from home and can keep track of what is happening to the well and water system. We also have a space heater in the well house, the pipe to the storage tank in the garage also has heat tape and all is wrapped with several inches on insulation. The space heater has died several time.