Imitating a LoRaWAN(R) with ESP8266/ESP32 and MySensors
-
Re: Gateways
Re: Gateways
I got interested in LoRaWAN(R). It actually looks much like MySensors, with long range radios. In fact, MySensors supports the rfm95 radio that is identical (?) to the LoRa radio.
So I built a MySensors Gateway with an rfm95 radio running on an ESP-12F (Arduino board Generic ESP8266 Module) and a MySensors relay node running on an ESP32 WR-32 Development Board (Arduino board DOIT ESP32 DEVKIT V1). I included Over-the-Air (OTA) code, which is quite handy when it works. I was pretty impressed with a range of 25m through five walls...the WiFi didn't go that far!
Here's the challenge, though. The ESP-12F does not have a lot of storage. Every "node" connecting to it will take a bit of that. How many nodes can attach to this gateway?
I don't think a MySensors rfm95 sensor network could compete with a LoRaWan(R) network on specs. But when a LoRa humidity/temperature sensor goes for € 44, I think a DiY'er could justify a few compromises.
-
Re: Gateways
Re: Gateways
I got interested in LoRaWAN(R). It actually looks much like MySensors, with long range radios. In fact, MySensors supports the rfm95 radio that is identical (?) to the LoRa radio.
So I built a MySensors Gateway with an rfm95 radio running on an ESP-12F (Arduino board Generic ESP8266 Module) and a MySensors relay node running on an ESP32 WR-32 Development Board (Arduino board DOIT ESP32 DEVKIT V1). I included Over-the-Air (OTA) code, which is quite handy when it works. I was pretty impressed with a range of 25m through five walls...the WiFi didn't go that far!
Here's the challenge, though. The ESP-12F does not have a lot of storage. Every "node" connecting to it will take a bit of that. How many nodes can attach to this gateway?
I don't think a MySensors rfm95 sensor network could compete with a LoRaWan(R) network on specs. But when a LoRa humidity/temperature sensor goes for € 44, I think a DiY'er could justify a few compromises.
-
@OldSurferDude the max number of nodes is 253, as with any MySensors gateway.
The esp-12f has a lot more resources than an atmega328.
@mfalkvidd Yes, I understand that 253 is the software limit. I was wondering about the hardware limit.
For example, my Asus router has a software limit of 253 devices. But when I get 20-25 WiFi devices trying to connect, the network goes haywire. (pun intended ;) ) I am quite convinced that this is a hardware limitation of the router because the router has to carry some information about each connection.
If the gateway is dumb, that is, carries no information about any connection, then it could truly have 253 connections. After a bit of contemplation, I realize that the name, gateway, implies this.
If that is the case, it is good news for the DiY'er in that this very inexpensive and cheap hardware could stand in for a LoRaWAN, again, with a number of compromises.
-
Here, you're combining two rather distinct models, which is where WiFi router intuition fails.
In contrast to a LoRaWAN gateway, a MySensors gateway with rfm95 is essentially stateless. It doesn't keep track of downlink windows, keys, queues, per-node sessions, or anything like. Messages are simply forwarded up and down. Therefore, unlike a WiFi AP, an ESP8266/ESP32 does not have a growing "connection table." Because of this, the 253 node limit is mostly a protocol decision rather than a RAM/storage limitation.
The actual hardware limitations are shown elsewhere:
airtime. The modulation of LoRa is sluggish. Collisions and duty cycle constraints will catch up to you far before RAM does when there are a lot of nodes.
buffers and sketch size. rfm95 + Small packet buffers are used by MySensors; the number of nodes does not linearly increase memory use.
bursts in CPU burden. If several nodes communicate at once, the ESP8266 may choke, however this is a temporal issue rather than a storage one.
ADR, security, scalability, and multi-gateway roaming are among the issues that LoRaWAN resolves. With long-range radios, MySensors over rfm95 is more akin to a basic star network. less expensive, easier, but with less assurances.
Therefore, an ESP-12F gateway can "handle" hundreds of nodes with ease from a hardware standpoint—as long as they communicate seldom. It will shut down before flash or RAM ever do if you attempt to make it act like a dense LoRaWAN deployment due to airtime and physics.
-
Here, you're combining two rather distinct models, which is where WiFi router intuition fails.
In contrast to a LoRaWAN gateway, a MySensors gateway with rfm95 is essentially stateless. It doesn't keep track of downlink windows, keys, queues, per-node sessions, or anything like. Messages are simply forwarded up and down. Therefore, unlike a WiFi AP, an ESP8266/ESP32 does not have a growing "connection table." Because of this, the 253 node limit is mostly a protocol decision rather than a RAM/storage limitation.
The actual hardware limitations are shown elsewhere:
airtime. The modulation of LoRa is sluggish. Collisions and duty cycle constraints will catch up to you far before RAM does when there are a lot of nodes.
buffers and sketch size. rfm95 + Small packet buffers are used by MySensors; the number of nodes does not linearly increase memory use.
bursts in CPU burden. If several nodes communicate at once, the ESP8266 may choke, however this is a temporal issue rather than a storage one.
ADR, security, scalability, and multi-gateway roaming are among the issues that LoRaWAN resolves. With long-range radios, MySensors over rfm95 is more akin to a basic star network. less expensive, easier, but with less assurances.
Therefore, an ESP-12F gateway can "handle" hundreds of nodes with ease from a hardware standpoint—as long as they communicate seldom. It will shut down before flash or RAM ever do if you attempt to make it act like a dense LoRaWAN deployment due to airtime and physics.
@Eliza-Collins Thank you for a more knowledgeable explanation! When I wrote:
said in Imitating a LoRaWAN(R) with ESP8266/ESP32 and MySensors:
with a number of compromises
You filled in some of my nebulus's with:
@Eliza-Collins said in Imitating a LoRaWAN(R) with ESP8266/ESP32 and MySensors:
ADR, security, scalability, and multi-gateway roaming are among the issues that LoRaWAN resolves.
Thanks for pointing these out