After spending some time reading and writing about LoRa it was a good time to make some real test of this technology.
As actually there is no network for LoRa, as much as I know, in my town, I expected to start a simple LoRa test (point to point and not as part of a WAN). I just bought some RN2483 LoRa module from Microchip online and also get some from Avnet (thank you Guillaume)
The module is easy to solder on a prototype board and get its command over a serial port. I choose to make two modules :
- The first one is connected to a FTDI cable and will stay at home as a basestation
- The second one is connected to an Arduino and will be a mobile device for my test
Create the test board
The RN2483 module have a lot of pins but most of them are GPIOs and power supply. To make my board simple, I decide to not connect all the GND and it sounds to work as expected, so at the end my schema looked like this.
The FTDI cable provides 5V so you have to add an LDO regulator to get 3,3V as module power supply. I just plug RX/TX from FTDI to the module and that is all what you need. The RF antenna I use is a half wave antenna centered on 868 Mhz. Once soldered, the test board are looking like :
Make the first communication ready for LoRa
For communicating with the module, the default serial port setting is 57600 bps. Once set on your terminal, you can communicate with the module. The list of available command can be retrieved here.
There are 3 level of commands :
- sys for system command
- mac for LoRaWan protocol related command
- radio for low level radio transmission
The command sys get ver returns the firmware version, it is a good way to ensure the circuit works.
sys get ver
RN2483 0.9.5 Mar 24 2015 14:15:33
Then to get a communication between the two device, based on a point to point LoRa link, you must start pausing the mac level. The mac level is managing the LoRaWAN protocol we do not want to use at that point.
So you have to run on each of the board: It returns a long pause duration when you do not specify your expected duration.
mac pause
4294967245
Now we are ready for communicating, we can check the default configuration : this document from Semtech is a great help to understand these parameters.
radio get mod lora radio get freq 868100000
These 2 first command indicates that the module is configured as LoRa device by default with a rx/tx frequency of 868.1Mhz
radio get sf
sf12
The spread factor parameters defines the sensitivity of the reception, with a such value (sf12 is the more sensitive) the SNR can be up to -20dB. This also impacts the duration of the transmission that becomes longer.
radio get bw
125
The used bandwidth determine time on air and sensitivity. With 125KHz the sensitivity is better but time on air is longer. Chip is capable from 125KHz to 500KHz. The time on air is doubled from 125KHz to 250KHz.
With a 125kHz bandwidth and a spread factor of 12, the time on air duration is about 1 second
radio get cr
4/5
The CR (Coding rate) parameter determines an error correction mechanism by adding some information to the message. 4/5 is the best correction mechanism especially when the signal is low.
radio get prlen
8
The prlen gives the preamble length in symbol.
radio get pwr
1
Power level gives the power in dB of the transmitter ; values are from -3db to 15dB
With these setting, you can get the all the information about sensitivity and bitrate from the LoRaCalculator. With the default configuration we have the following configuration:
- bitrate : 292 bps
- time on air for 12 byte : 991ms
- link budget : 138dB
- power consumption : 23mA/h
Now we can change the power to 14dB to get more power and better link budget (this will consume 44mA/h and get 151dB as link budget)
radio set pwr 14 ok radio get pwr 14
Any change to the radio level can’t be saved, so you have to reconfigure it on every reboot.
Let’s send the first message over LoRa
Now we can send a message over the air. The first thing to do is to configure one of the device for reception : the parameter 0 indicates that reception is blocking until getting a message.
mac pause
4294967245
radio rx 0
ok
On the second device we can now sent a message :
mac pause 4294967245 radio set pwr 14 ok radio tx 123456789012 ok radio_tx_ok
On the receiver we get :
radio rx 0 ok radio_rx 123456789012
Now let’s make a keyapp testing device
The next step will be to test LoRa performance in real environment (even if my RF design is not really nice regarding my soldering stuff !! By the way, let’s make something. The system will be based on a transmitter always sending a message every 30 seconds and a receiver making a led blinking every time the message is received. (Ok this is not respectful of the duty cycle … so let’s say 100 seconds instead of 30)
#!/bin/bash # LoRa loop send a message in loop over LoRa medium at default frequency # module is connected to /dev/ttyUSB0 device dev=$1 startRet() { (if read -t 3 ret < $dev; then echo $ret ; return 0 ; else return 1 ; fi) & wf=$! } checkRet() { wait $wf return $? } stty -F ${dev} 57600 cs8 -cstopb -parenb -echo startRet ; echo "sys get ver" > $dev if checkRet ; then startRet ; echo "mac pause" > $dev if checkRet ; then startRet; echo "radio set pwr 14" > $dev if checkRet ; then i=0 while true ; do echo emiting $i startRet ; echo "radio tx 123456789AB" > $dev sleep 100 i=$(( $i + 1 )) done else echo "error setting power" fi else echo "error setting mac in pause" fi else echo "cant establish communication" fi
Now, on receiver, we simply want to wait for a message, check if the message is the expected one, then blink a led a couple of time to indicate a message has been received. This is based on Arduino.
String str; void setup() { Serial1.begin(57600); while (!Serial1); pinMode(3,OUTPUT); digitalWrite(3,HIGH); // reset the module pinMode(2,OUTPUT); digitalWrite(2,LOW); delay(500); digitalWrite(2,HIGH); delay(2000); Serial1.setTimeout(2000); str = Serial1.readStringUntil('\n'); Serial1.println("radio set wdt 105000"); str = Serial1.readStringUntil('\n'); Serial1.println("mac pause"); str = Serial1.readStringUntil('\n'); digitalWrite(3,LOW); } void loop() { // switch recieve mode Serial1.println("radio rx 0"); str = Serial1.readStringUntil('\n'); if ( str.indexOf("ok") == 0 ) { int ok=0; while ( ok == 0 ) { str = Serial1.readStringUntil('\n'); if ( str.length() > 1 ) { if ( str.indexOf("radio_rx") >= 0 ) { if ( str.indexOf("0123456789AB") >= 0 ) { int j; for ( j = 0 ; j < 10 ; j++) { digitalWrite(3,HIGH); delay(100); digitalWrite(3,LOW); delay(100); } } ok = 1; } } } }
Some little modification compared to initial schema :
Pin2 is connected to RN2483 reset PIN and Pin3 is connected to a LED for showing result : blinking 10 times when the message is received.
The command radio set wdt 105000 set a reception timeout to 105s to ensure being in the expected transmission windows.
Make the test, get the map
With this solution done, I did some tests driving in my city. The result is not a really good benchmark for many reason, the first one is that the emitter was on my roof but not on top of it, so part of my roof was hiding the western part of the city what can can easily see on the graph below. The blue point from where the arrow are starting is the emitter position.
The emitter was in the city downtown and the 1,3Km is really going on a city environment with a lot of building. The longest distance have about 2km of city and 2km of country side. The part on the top left of the map is a mountain that is limiting the coverage in this area.
On the map, the red part are location where I did a test and get nothing. The blue one the location where I did the test and it was working well, the uncolored parts are where I did no tests.
By the way, I’m very impressed by these results as my emitter is really not optimized for transmission : standard internal antenna, connected as you can see on the photo… The transmitter was limited to 14dB on the 15dB available to keep an acceptable power consumption.
Next step will be to put an emitter on top of our mountains to make a better test !
Very interesting “first step”! But I think when you write “The blue one the location where I did the test and it was not working” you actually mean “and it *was* working” – correct?
you right, thank you
Hi,
Could you detailed how you connected the antenna to the board to match the 50Ohm ?
Did you simply connected the antenna+ground pins to a SMA connector ?
Thanks,
Pierre
Simply connected the antenna + ground pins to a SMA connector … as I said … not good but good enought
Thanks a lot for this!
Could you please upload a better diagram? It’s hard to read the one you posted, especially the pin numbers.
Hi,
First of all, this is an interesting post, thank you for that!
However, I’m a bit confused because of your statement regarding the Coding Rate: As far as I understood Semtech’s LoRa Design Guide, coding rate 4/5 is the lowest and 4/8 is the highest value, since:
4/5 means 4 bytes payload = 5 bytes transmitted => 1 extra “spare” byte containing error correction data
4/8 means 4 bytes payload = 8 bytes transmitted => 4 extra “spare” bytes
Please correct me if I’m wrong. Currently, I’m searching for the “best” operating parameters and any help / hint is welcome!
Thanks, Philipp
Hi!, thanks a lot for the information!
I think you’ve made a mistake on the coding rate selection (or explanation). The stronger code should be 4/8 which is more redundante. It reduces the effective bit rate and it increases the time on air but you get better link margin.
Thanks for the info & testing experiences with these RN2483 LoRa™ modules ! I ‘ve done a lot with Chinese HopeRF & Dorji LoRa™ modules to good effect (as outlined in my popular Instructable), & also have explained the Lora™ config. terms. Hope this helps ! Stan. in New Zealand
Hi, Thanks a lot for sharing!
Could you plese share which terminal program you are using (Putty)? I can connect to the module and send “sys get ver”, but no feedback. Also, for the FTDI, are you using USB-to-TTL or USB-to-Serial (RS-232/UART)?
Thanks
I’m using putty and some other terminal tool equivalent. Did you check if hardware flow control has been disable, it is better if it is disable.
Hi Paul ,
Your post is very helpful to me,but i have one question .
How can i make the “radio rx 0” free after once it was used.
when i am using “radio rx 0” in infinite loop few times only i am getting data ,mostly i am getting “busy” sate so if you know any alternate way to make “radio rx 0” command is free after once it was used.
Thanks in Advance.
Hi Paul,
Greetings from India.
It is a nice detailed post. Got an idea of the range capability and interfacing complexity of the modules, Now can think of using this in my next projects. Was suspecting whether these modules really give such long range as advertised. Your post cleared my doubts.
Also i see that you disabled the WAN/MAC part, does it mean that anything that we send from the modules it will be received by any modules listening in the area like a broadcast?
Regards,
Ravi
The LoRaWan stack require to have a LoRa baseStation. For my first test, I only had devices so I bypassed the WAN stack. In point to point connectivity any device can hear any other device like a broadcast.
Hi Paul ,
Your post is helping me so much…..
but i have one question ?
when i am receiving data i need to skip the “ok” status just i need to receive the what data i received..how is it possible ..if u know please help me…
for example i send data like “radio tx 12345”
Actual result is in receiver side:
*****************************
ok
radio_rx 12345
But i need:
********
radio_rx 12345 (is it possible,i need skip ok)
you have to code a little … use grep or 5-10 lines of C. I can’t help you an a such question
Hi Paul,
I’m Riccardo from Italy, I have a question, RN2483 works at 3,3 V, and it’s ok that you put a ams1117 for the regulation of 5v from FTDI cable, but RX pin of RN2483 can have 5v input from TX pin of FTDI cable without a voltage divider?
No I did not do any voltage adaptation for RX and TX. Worked well to me as in many cases.
Thank you, for this step, I’ve make some test and create a DIY breakout board for RN2843.
Work very well, now we have to do some test to verify coverage area.. You can find here our experience..
http://www.smartcityzen.it/iniziano-i-test-di-portata-per-il-lora-network-di-brescia/?lang=en
Great article, thanks for that.
I bought two Lora Mote RN2483. Following these istructions it was very easy do a communication between the devices.
But i have a little problem, there is a way for creating a continuous communication between the 2 modules, without that every time the receiver ask for a sending?
Great article, sure helps with first steps.
Still wonder why the 433MHz antenna is not used. Is it because of the firmware version that does not use it or ???
not sure performance is as good as 868 and both are possible in Europe. 433 is the only solution for APAC. Any other idea ?
Thnx for your comment paul.
I thought that the module automatic switches between 433 and 868.
Is the 868 the only freq being used in your app?
yes
I think you have been lucky and that you actually should also make sure the power of the RX an TX datalines equals the power supply of the RN2483. I followed your instructions and fried a RN2483: the TX line is not working anymore. So to everybody who wants to repeat these steps: without properly adjusting the voltage on RX and TX with (for example) a voltage divider, you may destroy your RN2483!
Sounds like I’m a lucky guy !
For sure you should always match the expected Voltage !
Paul,
thanks fo sharing this article, I’m also testing these modules but I did not wanted to have a serial connection for my testing and wanted to be able to talk with them other Wifi and web interface.
For this I created a WeMos (small ESP8266 board) shield and a WebSocket2Serial proxy sketch based on WebSocket
Works fine for those are interested, all design (soft and hard) is located on github here
https://github.com/hallard/WeMos-RN2483
Thanks again for sharing
thank for sharing
Hi Paul,
Thanks for this great article !
I was wondering if you had had trouble with the RN2483 sometimes not responding after Arduino sketch upload, and needing a reset to work again.
It happens to me sometimes, is that the reason why you added a connection to the reset pin in your full setup and code ?
Best,
For sure RN2483 serial communication is a mess … I experienced a lot of problem and a lot of de synchronization. For this reason in some code I had to manage command re-execution to ensure the cmd is well executed (sometime you get K instead of OK…) Another way is make it more stable is to reduce the bitrate (56Kbps does not have any interest in many case) this can be done following the procedure documented in the manual after a hard reboot.
i currently on working on lora rn2483.. its working fine for me, but i want set parameters for coverage of
3 to 4 km…will any one help me in setting those parameters…thanks in advance
Not sure to understand if you want to reduce coverage or get higher coverage …
To reduce you can reduce power transmission, read the doc, it is well described
To get higher coverage, use a 180bits/s transmission 125KHz_SF12, or tune your antenna.
Basically you should reach more than this distance with an antenna correctly installed.
Nice post. Do you mind if I translate it to Korean language and post it in my blog?
Not a problem if your are indicating, linking the source and introduce your post to present it as a translation.
Hi Paul,
Like many others have said, great post. Definitely helped me a lot.
However, i face an issue with range. I have now tested a few different RN2483 modules with different SMA connectors and even swapping different antennae. But i dont get more than a few hundred metres range. Any thoughts on what i might be doing wrong? Any help is much appreciated.
The only change i have done to the default module setting is increasing the radio power to 15 and disabling the wdt by setting it to 0, which i think is inline with what you have done.
Thanks!
Are you sure you have enough power provided to your module ? I see no reason for this.
Hi Paul, I recently started a new project and need to communicate two arduinos and your post really helped me to get started. At this time I am sending data between them but the problem is that the arduino that works as receiver gets blocked after a while, ¿Do you know what can be happening?.
no idea, i need more information for giving you help
Same happens to me. Did you find why does it happen?
Hi,
Lora normally designed for star network include gateways, modems. In all documents about Lora, the technology does not used for p2p communication. However, I want to use Lora for p2p communication for two devices such as Rx device and Tx device. Is it right? or is it illegal for Lora definition?
No, you can, many are doing it. You can also use other network stack than LoRaWan on LoRa
Nice post and great effort. However what i understood is that the packet is broadcast to the channel so every other lora device on the same channel will be receiving it. How to ensure that be specific about one node using LORA not LORAWAN. device addressing possible in LORA ? I know it is in LORAWAN but what if i am using LORA only
Nothing prevent this if receiver does not filter on emitter address. That is why LoRaWan implements encryption to ensure only expected receiver can understand the message. You can do the same on LoRa and for sure your receiver must manage message reception from non expected device (you may receive noise and be able to process it correctly)
i need to know about how you transmitted data to a specific receiver using LoraWAN…
.thankyou.
Not sure to understand correctly your question. As you write it on a post about LoRa and not about LoRaWan I assume a part of the answer is here. Basically LoRaWAN is a network and the communication is Sensor to Network only, not sensor to sensor. LoRa is a Radio protocol so basically you can do both.
Hi, very nice post you made. I try to increase the range. I set all parameters to optimal values. I use RN2483 (868MHz), Power 15dBm, SF12, Lora BW (125), RX BW(2.6), BR (50000), Error Coding (4/8), I use LoRa Evaluation kit.
But, the maximum range is 1km if I put RN Module and Gateway in front each other in a direct road without any obstacle. Can you help me to increase this range?
Looks strange, with standard configuration, device to device in LoRa mode I was able to reach 4km, no tuning.
I assume you have a lot of noise on your receiver location or you antenna can be really poor.
i used the same config. I got around 400-500m coverage. Can you please specify which antenna I should use for maximum coverage? It would be great if y0u could give the exact part number. Thanks!
The antenna in one thing, the location of the antenna is another thing and the choice of an antenna also depends on the location and the zone to be covered. As a conclusion, people are writing books on antenna choice and basically it is not possible to give you a good answer with the little information you provided.
Hi Paul, a very helpful post you made. I tried the same with arduino mega ,that is perfectly working with all standard parameters. But how can I use RN2483 in full duplex mode or continuous communication between modules?
I don’t know, by the way, if you find the way, take a look to regulation and my post here : https://www.disk91.com/2017/technology/internet-of-things-technology/all-what-you-need-to-know-about-regulation-on-rf-868mhz-for-lpwan/. basically I assume you can create a channel on the right frequency with 10mW power and 0% duty cycle for this.
Really Nice post, with this I was able to test the RX and Tx part with the LoRa modulation. I also found out that it is possible to do FSK modulation with RN2483. I got the device setup but I was not able to transmit and receive.
I wonder but do you have used FSK with the RN2483 and if yes can you help me with this. I will really appreciate it .
Thanks.
Hi Paul…….Im using LoRa module RN2483 for point to point communication .Here Im transmitting the Latitude and longitude data using LoRa with the help of arduino Mega.But Im not able to receive the data its showing me “busy”always.I don’t why,Please say me the solution.
Hi Paul…. Im using LoRa RN2483 for point to point communication.
I don’t have an antenna right now.
Can I use these modules without antenna for small distance applications ?
Where will i get this antenna?
Can you share me some link or something with exact specifications?
For sure you need an antenna. You have a lot of 868 antennas on mouser / radiospares / ebay …
Hi Paul………Im interfacing LoRa RN2483 and GPS with Arduino Mega,it transmit the Latitude and Longitude values but in the receiver end Im receiving only “busy” all the time no data is received.Could u say me the reason and give me the solution also………
looks strange but I’ve no idea right now 🙁
Hello,
Thank you so much, your article allows me to save a big amount of time ! Very helpful !
Hi Paul,
We are Working on LoRa RN2483 with Gate way ,we are getting only 300 meters Range communication.
Please help me to Increase the Range of LoRa RN2483 up to 2km.
sounds like you should work on you antenna choice or antenna location.
hi paul what antenna we should use fro rn2483 lora
check my post about antennas. LoRa antenna and Sigfox are the same.the answers depends on the volume you have the price your target and the loss you accept.. there is no universal answer. You can eventually try the 42 one 😉
Hi Sir,
I am using Microchip Lorawan Kit 800.
I am able to see the MOTE RN2483 temperature and Light sensor reading at MoTE display.
How can I fetch the temp. and light sensor data from MOTE RN2483 from an PC.
How can I keep send the light and temp. sensor data at particular time interval.
Thanks ,
S.Jayaram
Hi Paul,
I bought microchip Lora development kit 800 for exploration of LoRa technology.
One RN2483 MOTE (which have USB connect with PC), Gateway (Have USB and Etehrnet to PC) and Server.
I checked all LORA MOTE values like
sys get ver, radio and mac commands using their java gui tool.
But I need to get temp. sensor value (GPIO13 PIN in RN2483) at regular time interval.
How to enable rn2483 mote to send sensor reading at particular time interval to PC via serial USB connection.
Any code example or suggestion on this.
Thank you,
Jayarams
No I’m sorry
Great posting .. I was so inspired I purchased two RN2903 ( 915 Mhz ) modules
and breakout boards. My units have newer firmware
sys get ver
RN2903 0.9.8 Feb 14 2017 20:17:03
I tried your test program but don’t seem to get real range. I set one module to
transmit and one to receive. The work fine, but when I move the receiving unit
more than about 100 meters away , it no longer receives anything.
I’m using the same code you have here. I have a simple whip antenna on each
board cut to 78 mm for 1/4 wave 915 Mhz.
Not sure why I can’t get any range greater than 100 meters or so. I am using
the same commands as you had here… and it works fine up to about 100m
Perhaps something has changed in the firmware to limit peer-to-peer usage ?
distance is all about antenna usually…
I sounds like your saying two RN2903 devices configured with
1/4 wave dipole only getting a max range of 100 meters in normal ?
This is less range than what I’m getting with two 2.4Ghz WIFI
cards. I believe I’ve found the issue.
On the off chance there was something wrong with one or both of the cards, I measured the impedance of the connections to the breakout boards. On one of the RN2903, the impedance between the Pin 23 (RF) and gnd was about 40 ohms, on the other it is zero ohms.
I’m believe the radio with zero ohm ( direct short of its RF pin to ground) is the problem. I’ve since checked this against a new chip and it is suspect.
Hi Paul, many thanks for sharing your test !
I have briefly read about RN2483 and LORA, and get the idea to communicate/interface with it through serial interface (COM/USB) ports. Now, im wondering if there is a possibility to interface with SPI/UART to the RN2483 ? If so… do i serially send the required ASCII letters to do so ?
I mean, i have an MRF24J40MA WAN going on at home, and interface with it through USB via Python GUI/HMI (via PIC16/MCP2200).
But… i really would like to be able to interface with RN2483 through my Python GUI/HMI, is this possible at all ? Please give some hint on this (even though im sure it must be possible to tx/rx through SPI… but where are the commands ?!)
RN2483, as mush as I know is UART, not SPI.
Great detail, I had a question about your connection, did you limit the connection of the RX and TX to 3.3V, or did you use the Arduino virtual UART directly in 5V?
If I remember well I directly used Arduino 5v. I do not recommend to do this : the best way is to use a level shifter.
What software do you use to make and load this code?
# LoRa loop send a message in loop over LoRa medium at default frequency
# module is connected to /dev/ttyUSB0 device
dev=$1
startRet() {
(if read -t 3 ret < $dev; then echo $ret ; return 0 ; else return 1 ; fi) &
wf=$!
Linux bash shell