LoPy4 lora range test
-
Does anybody have some lora range test code that would let me check the max range I can get between a LoPy4 transmitter & a walk test LoPy4 receiver? A lazy request I know but I don't want to spend ages developing LoPy4 code if the lora range in this cluttered urban environment is not up to task.
-
@robert-hh I guess that's why it's pushing half a watt of RF & claiming -20dBm? Any idea where I could find out the best bandwidth/coding-rate/preamble values to use with sf=12 in raw mode?
-
@kjm The sensitivity of the devices is good. But do not trust too much to the numbers. They are not calibrated.
-
@robert-hh Sadly I have yet to master roll-your-own firmware. Excellent RF results for raw lora from the lopy4 though. I've been tinkering with spread spectrum since the 1990s (when the proxim XRs first appeared) never seen successful data at this signal level on 915MHz.
rssi -143 snr -18.0 sf 12
-
@kjm You'll get an older version of the firmware without the pybytes code both in the firmware and frozen bytecode. You get the same when you build your own firmware with the build option "VARIANT=BASE", which is the default. That's what I do. The other variant is "VARIANT=PYBYTES"
-
@robert-hh So do you know what the deal is with 'legacy' in the Firmware updater? What do I get when I choose that?
-
@kjm There is a pybytes_on_boot() method of the pycom module.
pycom.pybytes_on_boot(False)
Will disable pybytes. That one is in the code, but not documented.
-
@robert-hh I chose 'legacy' for the upgrade to try to avoid pybytes & got release 1.20.0.rc13. Was that a bad choice? If I go with 'pybytes' what command do I need to disable pybytes?
-
@kjm I cannot tell when the bootmgr() method included the file system. The actual version 1.20.2 of the firmware does. So may you should update first. The Pycom images will include pybytes, which can be disabled if not required, and is then only wasted flash memory.
-
@robert-hh I got a raw lora Tx running.
from network import LoRa import socket, time, pycom red=0x7f0000; orange=0xff5100; yellow=0x7f5100; green=0x007f00; cyan=0x007f7f; blue=0x00007f; magenta=0x7f007f; off=0x000000; white=0x7f7f7f lora = LoRa(mode=LoRa.LORA, region=LoRa.AU915) s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) s.setblocking(False); lora.sf(12); pycom.heartbeat(False) while 1: pycom.rgbled(green); s.send('Ping'); time.sleep(1); pycom.rgbled(off); time.sleep(9)
It's showing 0.5w on my Bird RF wattmeter (I thought 20dBm was supposed to be 0.1watt ?) but anyway at least it's pushing some RF out the correct antenna socket.
Less luck with an Rx
from network import LoRa import socket, time, pycom red=0x7f0000; orange=0xff5100; yellow=0x7f5100; green=0x007f00; cyan=0x007f7f; blue=0x00007f; magenta=0x7f007f; off=0x000000; white=0x7f7f7f lora = LoRa(mode=LoRa.LORA, region=LoRa.AU915) s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) s.setblocking(False); lora.sf(12); pycom.heartbeat(False) while 1: if s.recv(64)==b'Ping': print(lora.stats()) pycom.rgbled(green) else: time.sleep(1)
which crashed with
E (392) esp_image: Checksum failed. Calculated 0x83 read 0xc3
This looks serious so I decided to check the lopy4 with the Tx software to see the image details so I could maybe rebuild the failed receiver
>>> import os;os.uname() (sysname='LoPy4', nodename='LoPy4', release='1.18.2.r1', version='v1.8.6-849-e0fb68e on 2018-11-26', machine='LoPy4 with ESP32', lorawan='1.0.2', sigfox='1.0.1') >>> import pycom; pycom.bootmgr() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'bootmgr'
Do you know why bootmgr won't tell me what file system the lopy4 is using?
-
@kjm with raw lora, you can set the SF and BW values themselves using lora methods. With lorawan you can set the data rate with socket calls, which in turn changes sf and bw. DR0 results in SF12BW125 in the EU region.
-
@kjm ˋLoRa.stats` is what you are looking for.
-
@jcaron Tnx that ping-pong looks like a good starting point. I'd like to mod that example you suggested to pulse the rgb with a colour that indicates received signal strength. Is there a doc that shows how to get lora RF signal strength on a lopy4? Also where to do I find out how to set things like spreading factor etc.
-
I have been using ttnmapper to map my Lorawan reception , it works pretty well but you need to be using Lorawan on the TTN (The Things Network). Also I saw this nice writeup by Mark Zackmann on how he did a Lora only range tests https://medium.com/home-wireless/what-is-the-range-of-a-lora-radio-411261e35f46
-
@kjm You could use the Lopy-to-Lopy ping-pong example from the docs: https://docs.pycom.io/tutorials/networks/lora/module-module/
It’s pretty basic, but you can easily see if data goes both ways.
You may want to add a trace on the mobile node to tell you when a packet is sent, and possibly a packet counter.
You’ll probably need to carry a laptop or some one device with a screen to see the results as you move the mobile node, though.
Note that this is of course a simplistic approach, if you want to do a very accurate site survey you would need to test various data rates and possibly channels.