Micro Controller, Mesh-network, Micro-python/ Circuit Python - Page 1
Forum section: electronics / beginners

author: ixiion
author_rank: Unknown
timestamp: January 20, 2020, 09:25:12 am
content: Hello Everyone,this is my first post here in the forum.I wanted to use this post to sketch out some rough ideas and seek help from others who might have build already something similar or are interested in this as well.I'm trying to build a network of micro controllers (ESP32 or NRF528050 etc.) distributed over a compound of about 5 hectare land each of them connected to various sensors to measure values like status of equipment, pumps, batteries, water level in storage tanks. And others with relays todo switching etc. I'm going to feed the information into a server (RPi?) that can show alarms or do initiate tasks like Power load shedding etc. My idea was to use micro python and an esp or similar since i'm not so familiar with programming in C but have some python and Linux experience. To send the data i intend to use Bluethooth LE or Wifi. But since the area is quite large i'm concerned that the range is not enough to send the data back to the local server. So i thought of using a mesh network like ESP-now or something Bluetooth based to make the network resilient and sending data it though without extra repeater stations. Until now i haven't figured out how to build a BLE or ESP-NOW mesh network with micro python and it seems that it's currently not supported yet :/ . So i wanted find out what other ideas that people have to build a similar system or how to use micro python with mesh technology.Thanks

author: forrestc
author_rank: Unknown
timestamp: January 20, 2020, 09:35:20 am
content: Quote from: ixiion on January 20, 2020, 09:25:12 amThe technology you probably really want to use is LoRa. Tends to be a bit more expensive, but the application you're describing is pretty close to the target application for LoRa.A quick look online shows shields are available with various Howto's etc....

author: ixiion
author_rank: Unknown
timestamp: January 20, 2020, 09:55:48 am
content: Thanks for your quick reply. I'm aware of LoRa but actually are not sure if i want to use it. First of all i'm not aware if LoRa is suitable for mesh networks. Then it is more expensive and the data rate seems to be quite low.On the other side:EPS-NOW as well as BLE Mesh claim to work up to a range of 800-1000m meshable and having a higher data-rate.

author: ogden
author_rank: Super Contributor
timestamp: January 20, 2020, 10:28:54 am
content: Quote from: ixiion on January 20, 2020, 09:55:48 amRange of LoRa is so good that you don't need mesh networking - because 5 hectares can be covered with single LoRa base station. Avoiding mesh will greatly reduce complexity meaning Lora in the end will not be that expensive as you say.

author: forrestc
author_rank: Unknown
timestamp: January 21, 2020, 01:02:37 pm
content: Quote from: ogden on January 20, 2020, 10:28:54 amPlus, nothing which was originally described needs more data than a Lora radio can handle.To help clarify, the range for LoRa is around 3km in urban and 7km in rural. With good antennas it can go even farther.As far as the datarate, let's assume you have 20 things you're monitoring, each can be represented in no more than 16 bits. That's 320 bits. Even if everything polls once per second, you've got more than enough bits in Lora to do this.There's a big misunderstanding about how many bits/s are needed. Generally things like you described really don't need to be polled more than once every few minutes, and often once an hour or once a day is fine. If you were to poll those same 320 bits of data over a minute, you only are transmitting around 6 bits per second.Note that there is often some confusion between Lora and LoraWAN. You may or may not need/want the WAN functions. Lora is the data radio, LoraWAN is a protocol layered on top of it.One thing you also should be aware of is that implementing mesh on any protocol degrades the throughput. There are several articles out there that describe the practical throughput of BLE mesh and most end up under 5kb/s, which is in the same realm as Lora.

author: ixiion
author_rank: Unknown
timestamp: March 07, 2020, 03:54:45 am
content: Just in case if someone doesn't want to use Lora etc. i found an interesting esp-now project for micropython.to flash the bin use:esptool write_flash 0x1000 micropython-1.12-14-g9bf5d9b80-espnow.binCode:w.confg(protocol=network.MODE_LR)puts the radios into a low-bitrate mode which is incompatible with normal WiFi but is meant to extend the range a bit.here is an code example.Code:import networkimport timew = network.WLAN(network.AP_IF) # doesn't matter if AP or STAw.active(True)w.config(channel=1) # do make sure all devices are on the same channelprint('my mac addr:', w.config('mac'))def tx(result):mac, sent = resultprint("send: %s - %r" % (mac,sent))def rx(result):mac, msg = resultprint("recv: %s - %s" % (mac,msg))BCAST_MAC = b'\xff\xff\xff\xff\xff\xff'from esp import espnowespnow.init()espnow.on_send(tx)espnow.on_recv(rx)espnow.pmk('0123456789abcdef')espnow.add_peer(BCAST_MAC)counter = 0while True:espnow.send(BCAST_MAC, "%s" % counter)counter += 1time.sleep(1)would be great to get some feedback.