Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Using the LORANGA 2G/3G board

The LORANGA board from "La Fabrica Alegre" company embeds an RFM95W as the LoRa module. This module needs PABOOST so in order to use the module you first have to edit radio.makefile and make sure that PABOOST is enabled:


Then, run the scripts/ to both configure your gateway and compile the lora_gateway program.

If you are using our SD card image then everything is already set up. You just need to plug your Loranga board with a valid SIM card (with no pin configuration) and run:

> cd /home/pi/lora_gateway/3GDongle/loranga
> ./
> sudo reboot

You can also use the web admin interface to enable the Loranga board on boot (System menu, then Cellular tab) and reboot.

Configuring Internet connection

The support of LORANGA board has been realized in collaboration with "La Fabrica Alegre" development team.

They have the following test github to explain the installation of the support of the LORANGA board. Note that the wvdial method explained for 3G USB dongles is currently not working with the LORANGA board.

The script basically creates:

  • /etc/chatscripts folder
  • /etc/ppp/peers folder
  • /etc/chatscripts/quectel-chat-connect script
  • /etc/chatscripts/quectel-chat-disconnect script
  • /etc/ppp/peers/gprs configuration file

We have a slightly modified script for the /etc/chatscripts/quectel-chat-disconnect script. Here are example of what you should obtained after running with 2 arguments. The first one being your provider APN and the second one being the serial port used by the Loranga board which is typically ttyS0 on an RPI3.

> sudo ./ ttyS0

/etc/chatscripts/quectel-chat-connect script:

"" AT
# Insert the APN provided by your network operator, default apn is
OK AT+CGDCONT=1,"IP","\T",,0,0
OK ATD*99#

/etc/chatscripts/quectel-chat-disconnect script:

ABORT           'BUSY'
ABORT           'ERROR'
TIMEOUT         30
''              '+++\c'
SAY             " + sending break"
SAY             "\n + dropping data connection"
OK              'AT+CGATT=0'
SAY             "\n + disconnecting from GPRS"
OK              '\c'
SAY             "\n + disconnected."

/etc/ppp/peers/gprs configuration file:

/dev/ttyS0 115200
# The chat script, customize your APN in this file
connect 'chat -s -v -f /etc/chatscripts/quectel-chat-connect -T'
# The close script
disconnect 'chat -s -v -f /etc/chatscripts/quectel-chat-disconnect'
# Hide password in debug messages
# The phone is not required to authenticate
# Debug info from pppd
# If you want to use the HSDPA link as your gateway
# pppd must not propose any IP address to the peer
# No ppp compression
# For sanity, keep a lock on the serial line
# Hardware flow control
remotename 3gppp
ipparam 3gppp
ipcp-max-failure 30
# Ask the peer for up to 2 DNS server addresses

If you use our latest version of SD card image (from September 2017) then everything is set up to use the LORANGA board. You just have to run:

> cd /home/pi/lora_gateway/3GDongle/loranga
> ./

However, you will probably need to change the APN information for those from your mobile operator. This is done in the /etc/ppp/peers/gprs configuration file

> sudo nano /etc/ppp/peers/gprs

and change by your APN information (for instance SFR uses sl2sfr.

Prior to launch the script, you also need to indicate whether you have the Loranga 2G or the Loranga 3G board. This is done by running if you have the 3G version. The script basically creates the loranga3G.txt file which existence will be checked by to run the appropriate Pythin script to power the Loranga modem.

To start the 2G/3G Internet connection at boot, run:

> ./

This simple script simply creates a file called use_loranga_internet_on_boot.txt.

The script, called at boot time, now checks for this file and will run the script before launching the gateway program and post-processing stage. However, it is safer to test it first in interactive mode to see how the ppp connection is going. Once you are supposed to have Internet, try to ping some remote computers or use the web admin interface to see whether the gateway has Internet or not.

You can provide a parameter to when testing in interactive mode. With no parameters, pppd logs are sent to stdout which is not very convenient. You can use:

> ./ "logfile pppd.log"

To redirect pppd logs to pppd.log (in the /home/pi/lora_gateway/3GDongle/loranga folder). If you don't want any logs, run:

> ./ nolog	

When pppd is started at boot for an operational gateway, is run without any parameters but it is not important because the logs will not appear on stdout. We did not want to have logs in a file because we want to avoid having a log file that can grow quite fast. However, if you want to have the logs saved in a file, you can just edit /home/pi/lora_gateway/scripts/ and add logfile pppd.log after ./

Use to stop the pppd process and power-off the LORANGA board. Also, you can disable the usage of LORANGA on boot with:

> ./

which simply deletes the use_loranga_internet_on_boot.txt file.

Sending SMS

In order to use the LORANGA board for sending SMS with, you just have to edit (or create) in your /home/pi folder the .gammurc file:

device = /dev/ttyS0
name = loranga
connection = at

That should work, even if gammu-detect is not returning anything. If you want to try if SMS support is working, first kill all gateway processes (option K of then edit clouds.json to enable

	"name":"SMS Service",

Then edit to indicate the phone number that will receive the SMS (it is better to disable the SIM card PIN with your mobile phone prior to insert the SIM card in the LORANGA board):


Then start manually the gateway:

> sudo python

And use an end-device (our interactive device for instance) to send \!TC/22.5 to the gateway. You should see something like:

--- rxlora. dst=1 type=0x10 src=6 seq=2 len=9 SNR=6 RSSIpkt=-57 BW=125 CR=4/5 SF=12
2017-09-02T09:47:19.960920> 2017-09-02T09:47:19.960399
2017-09-02T09:47:19.961140> rcv ctrl pkt info (^p): 1,16,6,2,9,6,-57
2017-09-02T09:47:19.961329> splitted in:  [1, 16, 6, 2, 9, 6, -57]
2017-09-02T09:47:19.961516> (dst=1 type=0x10(DATA) src=6 seq=2 len=9 SNR=6 RSSI=-57)
2017-09-02T09:47:19.961701> rcv ctrl radio info (^r): 125,5,12
2017-09-02T09:47:19.961889> splitted in:  [125, 5, 12]
2017-09-02T09:47:19.962099> (BW=125 CR=5 SF=12)
2017-09-02T09:47:19.962445> rcv timestamp (^t): 2017-09-02T09:47:19.959
2017-09-02T09:47:19.962868> got first framing byte
2017-09-02T09:47:19.963050> --> got data prefix
2017-09-02T09:47:19.963252> valid app key: accept data
2017-09-02T09:47:19.963462> number of enabled clouds is 1
2017-09-02T09:47:19.963661> --> cloud[0]
2017-09-02T09:47:19.963860> uploading with python
2017-09-02T09:47:38.567588> rcv msg to send via the SMS Service: SensorData Sensor6 SNR 6 RSSI -57 SN 2 BW 125 CR 5 SF 12 GWID 00000027EBBEDA21 TC 22.5
2017-09-02T09:47:38.567983> Sent to +33xxxxxxxxx successfully!
2017-09-02T09:47:38.568188> Sending SMS done
2017-09-02T09:47:38.579110> python "TC/22.5" "1,16,6,2,9,6,-57" "125,5,12" "2017-09-02T09:47:19.959" "00000027EBBEDA21"
2017-09-02T09:47:38.579381> --> cloud end

However, currently, it is not possible to have Internet connectivity and SMS support at the same time. Therefore, if you want to enable the LORANGA SMS feature at boot time, run:

> ./

This simple script simply creates a file called use_loranga_SMS_on_boot.txt. The script, called at boot time, now also checks for this file and will power on the modem before launching the gateway program and post-processing stage. You can disable the usage of Loranga SMS on boot with:

> ./

which simply deletes the use_loranga_SMS_on_boot.txt file. Note that if you have both use_loranga_Internet_on_boot.txt and use_loranga_SMS_on_boot.txt then the priority is the Internet connection. Remember to use if you want only the SMS features.

Raspberry PI Zero

If you use the latest image, it also works on the new Raspberry Zero W (with the default behavior to act as a WiFi access point so you can easily use ssh pi@ once you are connected to the gateway's WiFi). It can therefore be used to build and even lower-cost and more compact LoRa gateway. Note that regarding the serial port, the Raspberry PI Zero W is similar to the Raspberry PI 3, so /dev/ttyS0 is used, and not /dev/ttyAMA0.

Enjoy, C. Pham

You can’t perform that action at this time.