Author Topic: Node RFM69 ID assignment in 500x access point network  (Read 5985 times)

Jasper298

  • Newbie
  • *
  • Posts: 7
Node RFM69 ID assignment in 500x access point network
« on: July 27, 2015, 02:23:36 AM »
Hello,

For a project, I plan to use the Moteino with RFM69 RF transceiver. There is actually one thing I can not find in library or documentation. First of all, I will describe my needs:

For a solarpanel field, I have to develop an easy RF link between 8 robots and 1 access point. These have to operation within a square of 200x200 meter. The problem is, that next to this 200x200 there is another sqaure and so on.... So at the end, there will be approx. 500 squares of 200x200. The problem is that all of these networks, should be independent to each other. But the interference is what me worries. There will be not many data traffic between the RF links.

So I have found other modules which you can "pair" or "learn" that they should only listen to paired/learned modules. Is something like this, also available for the RFM69 module?
I can work with network ID's but I don't know if more than 256 network ID's is suported. Then I can use 500 network IDs and 8 node IDs per network. But with DIP switches it is quite simple to make a mistake....

So if you have some ideas or suggestions, please let me know. Thank you in advance...

« Last Edit: July 28, 2015, 08:27:53 AM by Felix »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6404
  • Country: us
    • LowPowerLab
Re: RFM69 ID assignment
« Reply #1 on: July 27, 2015, 08:38:12 AM »
You can do this separation in many ways.
First look at this thread to see some explanations and the packet structure by default.

First you can use 255 networks independent of each other. A listening node will reject a message that fails to match the SYN header bytes, so it will still do some RX work but it won't receive the whole packet which takes more time.
So the second SYN byte is the Network ID, the first is fixed to 0x2D. You can always change that 0x2D to something else or make a small change in the lib to change it easily during init(). That would give you 65536 possible networks.
To reduce interference I think the best idea is to use different channels. I will use the 915mhz band, this actually goes from 902 to 928mhz. So if you divide that 26mhz in multiple channels you can get as many channels as you want, you are only limited by the bandwidth of the radios. So if the RXBW is 125khz (RFM69 lib default) then you can have more than 200 channels. You can make the bandwidth narrower to gain more channels, but the caveat with narrower bandwidth is it has greater change of frequency drift because of temperature changes - it's a complex subject and there are techniques to compensate for that, some discussed in this forum.
See page 26 of the datasheet for more on RXBW.

You can change the channel by specifying a different frequency with the setFrequency(hz) method. So to set your network to 914,8mhz you would call setFrequency(914800000) on all the nodes on that channel. Then you can split those into different networks etc.

So, without a lot of effort you can combine the above methods and obtain a wide range of independent channels.

How you determine each node what frequency(channel) and what network ID and node ID it will have - that's a whole different topic. You can do that in many ways as well. Keeping it as simple as possible is always best. Perhaps you can pre-set the channel before you deploy and have the node ask for the ID when it starts up... and your main node will do a type of DHCP. It would also have to keep track of all the nodes...

Also see this great resource for a better understanding of RF theory etc.

TomWS

  • Hero Member
  • *****
  • Posts: 1925
Re: RFM69 ID assignment
« Reply #2 on: July 27, 2015, 08:46:22 AM »
Hello,

For a project, I plan to use the Moteino with RFM69 RF transceiver. There is actually one thing I can not find in library or documentation. First of all, I will describe my needs:

For a solarpanel field, I have to develop an easy RF link between 8 robots and 1 access point. These have to operation within a square of 200x200 meter. The problem is, that next to this 200x200 there is another sqaure and so on.... So at the end, there will be approx. 500 squares of 200x200. The problem is that all of these networks, should be independent to each other. But the interference is what me worries. There will be not many data traffic between the RF links.

So I have found other modules which you can "pair" or "learn" that they should only listen to paired/learned modules. Is something like this, also available for the RFM69 module?
I can work with network ID's but I don't know if more than 256 network ID's is suported. Then I can use 500 network IDs and 8 node IDs per network. But with DIP switches it is quite simple to make a mistake....

So if you have some ideas or suggestions, please let me know. Thank you in advance...
That's quite an establishment!  Sounds like fun!

I have a couple of questions:
1. Are the 'access points' networked to each other in any way or does each 'square' operate autonomously?
2. When you deploy a 'square' does everything come online at once or do you plan to deploy one 'robot' at a time (after its corresponding access point)?

Since the Moteino network is so simple, you have control of many variables that will help isolate each square:
1. Network ID - these are filtered by the radio so that any node within a matching Network ID does not 'see' traffic from other networks (the radio waves on the same frequency, however do interfere - less of an issue if traffic is truly low).
2. Encryption Key - one tends to think of this as a 'security' device but it does serve a similar purpose as Network Id, effectively scrambling messages so that only those with the same key will 'see' them - again, frequency overlap occurs.
3. Node Id - this is filtered in software so that each radio receives all traffic with matching network id and encryption key, but the device code doesn't 'see' it as the low level code blocks traffic addressed to a different node.
4. Finally, frequency.  You can adjust the frequency to adjacent bands.  Others have done this, I haven't needed to but there probably is enough variability here that you could shift adjacent squares.

Regarding 'learning', this could be easily implemented in code in your nodes, there isn't a standard model however.  In my networks, each new node that is deployed, starts off with a nodeId of 250 and, as soon as they come online, they broadcast a message saying "I'm looking for a gateway."  All nearby Gateways that see the message reply with their descriptors.  The node, on receiving each descriptor chooses the gateway with the best RSSI and then asks for a permanent node ID.   I manage IDs centrally in my home server, but you could easily manage these at your APs.  Another way would be to use a technique operationally similar to WiFi WPA.  You press a button on the new node AND on the AP.  The new node uses a well known combination of network, etc, to bind to the AP.  Again, the AP could manage the permanent IDs in this case.  I save assigned IDs, etc, in EEPROM so that these are now permanently assigned to each node.

I hope this gives you some ideas.  It's tough to beat the range, low cost, simplicity, low power, and flexibility of a Moteino network.

Tom

Jasper298

  • Newbie
  • *
  • Posts: 7
Re: RFM69 ID assignment
« Reply #3 on: July 28, 2015, 02:13:51 AM »
Felix and TomWS, Thank you for your helpful replies. I'm quite new into the RF modules, so good ideas are welcome.

unfortunately, 915MHz I cannot use. I'm living in Europe and the project is also for an European country... 2.4 was another option with the 100MHz bandwith...
For that, I choose the RFD21735 modules from RF Digital, but they will not respond to any email/question. So I will not take one of those...

Extending the Network ID to get in total 65k of network ID's sounds good to me. so it is easy to arrange more than 4k addresses. What I was thinking is using 2x 8 dipswitches on the gateway to set the network ID. And send the network ID with a "pair" algorithm to the nodes. All nodes get an eeprom or flash device, so I can use the ID of the eeprom or flash for unique node/gateway ID. Or use diswitches again :)
Then I also can use some channels to avoid any interference. But the interference should be quite low because the only interference you probably will have, is that from grid x+1 and grid x-1.
Quote
How you determine each node what frequency(channel) and what network ID and node ID it will have - that's a whole different topic.
to determine the frequency, I can use the lsb or maybe the least nibble of the network ID, 16 channels should be sufficient.
Node/gateway ID can be the ID of the flash device.
And during "learn" use all predefined values and during the learning exchange each other unique ID...


@TomWS
It does not only sounds like fun, it is...  :D
1. No, every AP with 8 nodes is an independent network. And none of the AP's will comunicate together.
2. They will probably will not come online at once. When you power up the first time, you'll have to "learn" one by one and after that, they are going to "work" and report once in a few minutes.

Below, You'll see how the network should look like

* is a Robot
-- is the robot track
AP is accesspoint

* - - - - - - - - | * - - - - - - - -|--
- * - - - - - - - | - * - - - - - - -|--
- - * - - - - - - | - - * - - - - - -|--
- - - * - - - - - | - - - * - - - - -|--
       AP1 <200m> AP2    <200m> AP3    ...... and so on ...... AP500
- - - - - - * - - | - - - - - - * - -|--
- - - - - * - - - | - - - - - * - - -|--
- - - - * - - - - | - - - - * - - - -|--
- - - - - - - - * | - - - - - - - - *|--
« Last Edit: July 28, 2015, 02:18:53 AM by Jasper298 »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6404
  • Country: us
    • LowPowerLab
Re: RFM69 ID assignment
« Reply #4 on: July 28, 2015, 08:24:44 AM »
Interesting project overall. I would suggest keeping them on different channels as much as possible. That means the frequencies don't interfere and less overhead for the receivers. So radios in RX mode won't start to modulate packets from other frequencies. On the same frequency this will happen because as soon as the radio RX module senses a packet is coming in (it listens for a preamble) it will start to modulate that signal in, until it will detect the SYN/network bytes are different and stop the receiving of that packet. That takes some small amount of time but the receiver needs to recycle etc. The more time you can keep your receivers clear of any overhead the lesser chance for collisions. You could define zones or logical numbering of zones where you can use different channels, then different SYN/network values.

The preamble is also another set of bytes (it's a single byte that varies in length) you can change the byte signature or length of the preamble to also reduce the RX overhead of packets from foreign networks.

Also I need to add that all Moteinos have the option of the FLASH MEM chip which has a unique factory hardware MAC 8byte address which can be used for addressing purposes. See the uint8_t* readUniqueId(); function for that in the SPIFlash lib.

Please keep us posted how your pilot project goes.

Jasper298

  • Newbie
  • *
  • Posts: 7
Re: Node RFM69 ID assignment in 500x access point network
« Reply #5 on: July 28, 2015, 10:18:16 AM »
Hi Felix,

Yes it is very interesting and challenging as well  :)

What I will plan to do is use up to 16 different channels (if possible on 868MHz) using 4 dipswitches??? Due to the minimalistic design, and ease of use for the person who has to maintain/install the system it would be better to do it in automatically I think. but just 4 dipswitches is not that difficult. (or use a 16 pos. rotary encoder)
Then it is easy to set different channels to adjacent grids. I don't need 200+ channels. grid x+2 or x+3 is already out of range.

For ID, by pressing button, the learn mode will start and all will start with predefined ID (for node and for gateway). A flash will be used to store the list of known addresses, and during learning, exchange the ID (Flash ID) of gateway and node. Or use address 0 for gateway, and for each node which connects to the gateway, increment the address with 1....

The only part I do not know how to solve is the Network ID. How can I set up to 500 network ID's without using 9 dipswitched on the Gateway. The network ID is only necessary on the gateway, during learn process, it will be send to the node. Or use a terminal/configuration program to set up the IDs with serial port :)

I will keep you posted with my progress for sure.




TomWS

  • Hero Member
  • *****
  • Posts: 1925
Re: Node RFM69 ID assignment in 500x access point network
« Reply #6 on: July 28, 2015, 11:45:00 AM »
<snip>
The only part I do not know how to solve is the Network ID. How can I set up to 500 network ID's without using 9 dipswitched on the Gateway. The network ID is only necessary on the gateway, during learn process, it will be send to the node. Or use a terminal/configuration program to set up the IDs with serial port :)
If you're configuring for up to 16 different channels then you only need 32 unique network ids to cover 500 unique permutations.  You could also send the channel number with the assigned network ID and node id during the learn mode.  That should make everything fairly manageable on deployment and reduce the hardware required at the robot.

What additional hardware do you need at the robots & APs?   You might want to look into using the Moteino Mega for the APs simply because of the additional data memory and I/O.

Tom

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6404
  • Country: us
    • LowPowerLab
Re: Node RFM69 ID assignment in 500x access point network
« Reply #7 on: July 28, 2015, 07:07:15 PM »
I think it's pretty easy to setup a mechanism for setting the network ID in the field, and there are many ways you can do it.
It really depends on 3 things and you must pick only 2:
- how cheap
- how easy to use
- how easy to implement

Jasper298

  • Newbie
  • *
  • Posts: 7
Re: Node RFM69 ID assignment in 500x access point network
« Reply #8 on: July 29, 2015, 01:55:32 AM »
Felix, Tom,

First of all, it must be easy to use. When the operator has to install 500 networks and have to set all the ID's manual, it is not what I want.
The second is probably easy to implement.

To answer the question of Tom about the additional HW. This is very limited. for every node, just an opto isolator to isolate the 24vdc industrial I/O and a Relay.
The gateway get 8 opto isolators and 8 relays...
So the design is very easy and therefore, cost is not an issue.

So, 500 network IDs is preferable, and just 16 channels should be sufficient.

It is possible to "scan" neighbour networks, and increase the network ID with 1, and also choose another channel. But this is not so easy to use I think. And there will be no much traffic on the networks, so hard to discover which channel the network is using and which network ID it is using.

I think that with a serial interface, I can setup just the gateway with network ID and channel. This will be send to the nodes during the learn.

Moteino Mega is an option, but a Mega 328 should be sufficient. I'm plan to use it without bootloader and program it directly with JTAG or SWD or something like that...
« Last Edit: July 29, 2015, 02:43:16 AM by Jasper298 »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6404
  • Country: us
    • LowPowerLab
Re: Node RFM69 ID assignment in 500x access point network
« Reply #9 on: July 29, 2015, 08:37:17 AM »
Are the nodes battery operated?
And what is the hardware configuration? Is it a custom atmega328 board with the radio added onto it? Or are you planning to use Moteino on a base board/shield?
I can think of ways to make an "interface" for configuration purposes (buttons/ LEDs, dip switches etc). But this all depends on the design constraints/requirements/power available etc. You can make it as fancy as you want. But again we go back to the 2 out of 3 picks. Sounds like cost is the last one. If power is an issue then that limits the options a lot also. But if the integrator person understands a few basic principles, we can design a very basic interface that allows many options based on some presets. Ie your code has all the possible presets of channels and IDs. Then with a few buttons/dip switches and perhaps some LEDs tha blink or have different colors you can make an interface that goes through different states and sets different settings.

Jasper298

  • Newbie
  • *
  • Posts: 7
Re: Node RFM69 ID assignment in 500x access point network
« Reply #10 on: July 29, 2015, 08:52:42 AM »
No, Nodes are not battery powered. I have 24 volts available.

Probably for prototype, I will use Moteino boards, the final product should have a custom board with atmega328 and radio added onto it.

Then I will stick to the dipswitch option. And read them via some I2C I/O expander. In that way I can keep a small uC.
It is only necessary on the gateway, so cost will be limited for that but it is the least important part. easy use and easy implementation is more important  :D

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6404
  • Country: us
    • LowPowerLab
Re: Node RFM69 ID assignment in 500x access point network
« Reply #11 on: July 29, 2015, 10:59:06 AM »
Is that 24VAC or DC?

There are some really interesting switches available that could make your setup easy, they come in DIP/SMD packages.
Here's one http://www.digikey.com/product-detail/en/SH-7070TA/563-1214-2-ND/2057873 :

Two or three of these are very cheap and give you a wide range of settings. Each uses 4 GPIO to give a real hex representation. If you need more than 1 you'd put them on a shift register or i2c IO expander.

Or this traditional dip http://www.digikey.com/product-detail/en/1825057-9/1825057-9-ND/1021554 :
« Last Edit: July 29, 2015, 11:07:09 AM by Felix »

Jasper298

  • Newbie
  • *
  • Posts: 7
Re: Node RFM69 ID assignment in 500x access point network
« Reply #12 on: July 30, 2015, 02:48:23 AM »
Hello Felix,

That is exactly what I would like to use. The small SMD rotary dip switch. When I put 3 or 4 on my board, I am very flexible in ID assignment. Then I will use I2C I/O expanders...

I will draw it in my schematic....

luisr320

  • Sr. Member
  • ****
  • Posts: 255
  • Country: pt
Re: Node RFM69 ID assignment in 500x access point network
« Reply #13 on: August 07, 2015, 04:14:48 AM »
This is a very interesting project. Please post some pics of the developments.
If the cost is not an issue, you should consider buying some more moteinos directly from Felix. They are test proven to be 100% reliable and reliability must be a consideration when you are dealing with so many devices. And you would be supporting his efforts to make yours easy  :)

luisr320

  • Sr. Member
  • ****
  • Posts: 255
  • Country: pt
Re: Node RFM69 ID assignment in 500x access point network
« Reply #14 on: August 18, 2015, 09:36:34 PM »
Uau... I was just kidding. Please come back  ???