LoRaWan experimentation with Kerlink gateway

kerlink LoRa gateway

kerlink LoRa gateway

Until the reality of a LoRa public network in France, to test this technology the best way is to have its own LoRaWAN getway. This is a thing done with the kerlink gateway.

This post will detail the first steps to install it and start to communicate.



Package content

The kerlink LoRaWan gateway is a autonomous system, it is powered over PowerOnEthernet with the given PoE power supply and connected to Internet using an Ethernet Cable or a GSM modem.

kerlnk PoE

kerlnk PoE

Package contends the PoE power supply. What is missing is the Ethernet cable to connect from this PoE power supply to the gateway. So you have to use and sacrify  any of your Ethernet cable.






LoRa antenne

LoRa antenne

The LoRa antenna is provided with a 1 meter cable.







inside the kerlink gateway

inside the kerlink gateway

The main part is the kerlink gateway. On the bottom of the picture you can see the Ethernet / PoE connector where you have to screw the 8 nets of your cable.

The red connector is a serial console we can use for debug. To use it you need to order the debug board witch is basically a ftdi ft232bl … so if you have a ftdi cable I assume you can do the same. You will have to provide your own usb cable for using the debug board.

Two buttons are accessible : reset and test. Test activate the leds and report the status of the different components.

On the top right, you have the sim container to used GPRS connectivity.




After attaching antenna, Ethernet and serial debug cable, add the Sim Card and power it ! that’s it to getting it starting.

By reviewing debug console, you will see the gateway is running a Linux kernel running on ARM926 cpu.

Once connected to Ethernet the system will get an IP over DHCP and you can check this by getting “Hello World” string if you try the Ip on a browser. To find the station on your network, it is registered as Wirgrid_xxxxxxxx where xxxxxxxx is the end of the mac address. You can also access the gateway over ssh on port 22. root password is root… nothing so complex !

To continue the installation, you need to access the Kerlink wiki documentation. They had the good idea you add a one paper to indicate you, you need to request a login & password to the support. Eventually if they had the idea to provide the login and password with the order it would have saved a day to install it !!

In fact you have two different source of information with two different login and password, do not forget to ask both at start because without these information you could have bad experiences as I had.

The source of documentation are :

  • http://wikikerlink.fr/lora-station/doku.php?id=lorahome
  • http://wikikerlink.fr/lora-iot-station-spn/doku.php?id=lorahome

Once you have the access, the given documentation is good and detailed. The first step is to load the firmware in the gateway. Basically when delivered the gateway does not contains the LoRaWAN software, that is why the http server gives “Hello World”.

The software needs a license key given by support. It is a text file to store on an usb drive and plug on the gateway during software install. On the same usb drive we add the SPN (Small Private Network) firmware obtained from the documentation link. Once connected to the gateway, the firmware upgrade is automatically done. You can review it over the serial console. A reboot will conclude the installation. At this step, https server, database, ftpd… are configured. Then you can access the configuration panel using https://ip_of_the_gateway/


With default settings you can start to play with the gateway. You just need to add a fleet of device you want to activate.


The gateway have two radio transceiver (SX1257) each of them can have a different central frequency and manage 1,2Mhz spectrum slot. An Sx1301 chip manage the channels so you can activate up-to 8 MultiSF channels each of them uses a relative frequency from on of the two radio. MultiSF mean that the channel support different Spread Factor from SF7 to SF12 – 300bps (SF12) to 6Kbps (SF7). The channel Bw is 125Khz.

You also have a MonoSF channel you can set as you want. The default is for a “high speed” communication channel with 250KHz and SF7 to obtain 11Kbps.

All the channels must not overlap. The default configuration is the following:

Radio 0 : center – 867,500Mhz

  • Channel 3 (-400KHz) : 867,100 +- 62,25KHz
  • Channel 4 (-200KHz) : 867,300 +- 62,25KHz
  • Channel 5 (-0KHz) : 867,500 +- 62,25KHz
  • Channel 6 (+200KHz) : 867,700 +- 62,25KHz
  • Channel 7 (+400KHz) : 867,900 +- 62,25KHz
  • Channel 8 (+100KHz) : 867,600 +- 125Khz (apparently this one is overlapping with Ch5 and Ch8 and should be moved to radio1)

Radio 1 : center – 868,500Mhz

  • Channel 0 (-400KHz) : 868,100 +- 62,25KHz
  • Channel 1 (-200KHz) : 868,300 +- 62,25KHz
  • Channel 2 ( -0KHz) : 868,500 +- 62,25KHz

According to the SX1257 radio frontend bandwidth the maximum relative frequency is -+( 600KHz – channel size ) basically +-537,75KHz for multiSF channels.

Add device to the network

There are two methods to configure a device into the network : Over The Air Activation (OTAA) and Activation By Personalization (ABP). Basically OTAA needs a device number to be authorized for an application number and an application key.

To get the device uniq number you can do on device serial port :

sys get hweui

This number is reported to the kerlink gateway fleet screen dev EUI field. The application Uniq number (AppEUI) and Application key (AppKey) will be set randomly for this test. Both have to be the same on device side and gateway side.

on device side :

mac set appeui FEDCBA9876543210
mac set deveui 0004a30b001a7a39 
mac set appkey AFBECD56473829100192837465FAEBDC 
mac save 

Now we can join the network

mac join otaa

In this mode I got many problem to join the network and got a lot of access denied. I’ll investigate later on this. So for the test, we can choose ABP mode, in this case the setting can be :

mac set devaddr 00000001
mac set appskey AFBECD56473829100192837465FAEBDC
mac set nwkskey AFBECD56473829100192837465FAEBDC
mac save

The same information have to be registered on the fleet panel in the kerlink gateway configuration. Then we can connect

mac join abp

Now we can transmit data from the device (confirmed):

mac tx cnf 1 1234567890

And check what is received on the gateway:

kerlink_received_messagesWe can also have bi-directional transmission. In the kerlink interface you can indicate a payload to transmit to a specific device. Then, on next device tx order it will get the message :

mac tx cnf 1 1234567890
mac_rx 2 12345987

Now the gateway is able to communicate with the configured devices. I’m ready for more test.


When the device request to join the network, it will get from the gateway the channel configuration attached to one of the radio front. I mean, if my object is attached by the station to the radio_0, it will get from the gateway the configuration of the channels corresponding to this radio. It seems as a consequence that an object do not have access to all the possible channels.

The datarate configuration is also given by the gateway and in my test, the default DR is 5 corresponding to SF7BW125 (6Kbsp). We can change this to emit at lower rate like 300Bps for longer distance :

mac set dr 0
mac tx cnf 1 1234567890

gives a rx packet with : SF12BW125

DataRate are :

  • 0 –  SF12/125KHz – 250bps
  • 1 – SF11/125KHz – 440bps
  • 2 – SF10/125KHz – 980bps
  • 3 – SF9/125KHz – 1760bps
  • 4 – SF8 / 125KHz – 3125bps
  • 5 – SF7 / 125KHz – 5470bps
  • 6 – SF7 / 250KHz – 11Kbps
  • 7 – FSK – 50 Kbps

Connect to a backend service

Now we have the message received on the gateway. The next step is to have them accessible from a server. For this TheThingNetwork initiative provides a lot of tools. You can directly connect the kerlink BS this open crowd network but you have to flash a specific firmware (I assume I’ll try it, but later). Unfortunately the protocol they are using is not compatible with Kerlink default one (Kerlink should add the support, it would be great !!) So … Let’s make our own quick & dirty backend…

# UDP Kerlink basic LoRa message decoder
# (c) disk91.com 2016
# License : BSD

# meessage format
# {"rx": {"moteeui": "01", "userdata": {"seqno": 2, "port": 1, "payload": "MTIzNDU2Nzg5MA==", "motetx": {"freq": 868500000, "modu": "LoRa", "datr": "SF7BW125", "codr": "4/5"}}, "gwrx": [{"eui": "0000000000000000", "time": "2016-03-11 19:47:57", "chan": 2, "rfch": 1, "rssi": -31, "lsnr": "6.5"}]}}
  while read ; do
    moteeui=`echo $REPLY | tr ',' '\n' | grep "moteeui" | cut -d ':' -f 3 | tr '"' ' ' | tr -d ' ' `
    payload=`echo $REPLY | tr ',' '\n' | grep "payload" | cut -d ':' -f 2 | tr '"' ' ' | tr -d ' ' | base64 --decode`
    message=`echo $REPLY | sed -e 's/\(payload": "\)[^"]\+\(",\)/\1'${payload}'\2/'`
    echo $message >> /var/www/html/data/lora-${moteeui}.json


while true ; do
   nc -l -u -o /tmp/udpOut 1700 --sh-exec 'date >/dev/null'
   cat /tmp/udpOut | sed -u -e 's/\]}}/\]}}\n/g' | proceedMessage
   rm /tmp/udpOut

This script can be launched as a background process it will get the data packet and create a json file in the apache default directory. This Json can be consumed by any application to demonstrate LoRa

The main difficulty with this script was to manage a json message with no \n … as everything is buffered on line on unix … it was a mess ! By-the-way.. it works !

Data can be accessed using an url like : http://my.web.site/data/lora-nodeeuid.json

Activate 3G data transfer

The data will be transferred over the GSM access once you will have select it on the WAN menu. From the backend, a way to obtain the IP address of the gateway over GSM network is to use tcpdump to get the IP of the next coming message:

# tcpdump -i eth0 udp port 1700
11:06:05.157221 IP > vpsxxxx.ovh.net.mps-raft: UDP, length 29

The web interface seems not to be accessible (it can also be due to my 3G internet access – point to clarify) so a fleet have to be configured before cutting the LAN interface 😉

3 thoughts on “LoRaWan experimentation with Kerlink gateway

  1. Hi there.
    Nice article. ! We are trying to setup such a getway.
    I have got a ftdi cable but was wondering where to get the debug connector pinout ?
    Thank you for any informations
    Best regards,

  2. Hi Paul,

    I have set up Kerlink SPN station based on your description, but it does not communicate with LoRa mote.
    It able to joins network using ABP.
    I sends command
    mac tx cnf 1 0102030405060708090A0B0C0D0E0F
    But it does not appear at fleet RX data.
    Do you have any idea how can I debug the Kerlink station?
    When the Kerlink SPN station is transmitting/receiving data, will LED lights up to show the data is transmitting or receiving?
    For my case, other than PWR is light up, WAN STATION LED is always lighting up.
    Could you please advise on this?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.