LowPowerLab Forum

Hardware support => RF - Range - Antennas - RFM69 library => Topic started by: martin321 on June 17, 2022, 06:12:04 AM

Title: Possible to sniff band before sending?
Post by: martin321 on June 17, 2022, 06:12:04 AM
Hi,

Im using several RFM69 communicating in pairs at a rate of 20Hz.
The user controls when a node and gateway gets connected.
All pair’s use different networkID.

I would like to make sure that no pair’s send at the exact same time.
Is it possible to get a node that’s about to start sending to confirm that there is no other node sending, ie. check if there is a signal on 433MHz.
If there is I would add a send delay to the node starting up and continue doing this until there is no signal on 433MHZ

Title: Re: Possible to sniff band before sending?
Post by: Felix on June 17, 2022, 01:05:16 PM
You can read RSSI. The library already does this for you actually if you use packet mode, in RFM69::canSend() (https://github.com/LowPowerLab/RFM69/blob/master/RFM69.cpp#L296).
Title: Re: Possible to sniff band before sending?
Post by: martin321 on June 21, 2022, 01:31:34 PM
Hi Felix, thanks for the quick reply.

I've tested both reading RSSI and .canSend().
.canSend() is always false, even when I try to read it just before I use the same radio to send and no other sender is active.

RSSI reads only 0. When reading RSSI there is a delay so that it should eventually sync with another sender.

Title: Re: Possible to sniff band before sending?
Post by: Felix on June 21, 2022, 02:57:17 PM
That is quite expected unless you have another board with TX set to ON, or can catch a board transmitting a packet right during transmission, which is very hard given that it takes a few ms to transmit a packet.
Just turn on the carrier on another transmitter:

setMode(RF69_MODE_TX)

Then turn it OFF:
setMode(RF69_MODE_STANDBY)

Make sure it has an antenna. That should give you a strong RSSI reading.
Title: Re: Possible to sniff band before sending?
Post by: martin321 on June 25, 2022, 03:31:34 AM
Hi Felix,

so I should check RSSI when starting a node and if this reads 0 it should be safe to start transmitting?

Title: Re: Possible to sniff band before sending?
Post by: Felix on June 27, 2022, 10:32:27 AM
Yes, but like I said, the library already does that for you before sending a packet.
Title: Re: Possible to sniff band before sending?
Post by: martin321 on July 01, 2022, 07:46:25 AM
Hi Felix,

I found that now, thanks. Set up a test with multiple senders and this caused issues.
The delay if there is another sender is 1000ms, this is to long as the sending is supposed to go at 20Hz.
I've lowered it down to 15 but there are still "crashes".

Would like to create a while loop that checks rssi and put a delay of 2ms if another node is transmitting.

When trying to read in a while loop the rssi never updates, when using .readRSSI()

Is there something else that needs to be called to the radio, so that the rssi register is updated?
Title: Re: Possible to sniff band before sending?
Post by: Felix on July 01, 2022, 09:52:59 AM
Look at the library how it does this procedure, check out the send() and canSend() functions.