Dual-Chan Gateway with Raspberry PI3 + Dragino Hat v1.4 and Downstream messages

Hi all
I realized a gateway with Raspberry PI3 and Dragino Hat v1.4 in which I verified
the possibility to send downstream message to the node

I summarize all the steps in this topic

Original reference links ( where I took the suggestion :wink: )
forum/t/dragino-problems-and-solutions-topic

After assembling the Dragino Hat in the Raspberry, install the code
/bokse001/dual_chan_pkt_fwd

IMPORTANT NOTE:
This code was developed to use it with a gateway equipped with two RFM85s,
in our case we use only one RFM95 for which it is necessary
to make some modifications to the code after installation

PREREQUISITES
. Installation command git
sudo apt-get install git
. SPI needs to be enabled on the Raspberry Pi
. Installation wiringpi (GPIO access library )
sudo apt-get install wiringpi

INSTALLATION

 cd /home/pi 
 git clone -b dual_chan_pkt_fwd_up_down https://github.com/bokse001/dual_chan_pkt_fwd 
 cd dual_chan_pkt_fwd 

Modify configuration global_conf.json

 Pins for Dragino hat are: 
   "pin_nss": 6, 
   "pin_dio0": 7, 
   "pin_nss_2": 6, 
   "pin_dio0_2": 7, 
   "pin_rst": 3, 

 The other pins can remain untouched. 

Change the LoraModem.c file, comment out line 552

 // Die("Unrecognized transceiver"); 

Complete the installation with command

 make      
 sudo make install  

The last command ,activates the gateway as a service ( start automatically ) each time the Raspberry is started

NOTE:
The global_conf.json file, is read every time the service is started,
after each change it is sufficient to restart the service

For the test I used a sensor with the code ttn-abp.ino taken from the examples folder of matthijskooijman/arduino-lmic subsequently modified, to transmit, only on channel 868100000

The default installation on the raspberry, / bokse001 / dual_chan_pkt_fwd
receive the messages only on channel 868300000, so I modified the global_conf.json file
by inverting the values of the two freq and freq_2 fields

from
{ “freq”: 868100000,
  “freq_2”: 868300000,
   …
to
{ “freq”: 868300000,
  “freq_2”: 868100000,
  …

Finally,
in the sensor code, to receive the DownStream message,
I added the following line of code, inside the setup () function, before do_send (& sendjob);

// Let LMIC offset for +/- 10% clock error

 LMIC_setClockError (MAX_CLOCK_ERROR * 10/100);	

AS I VERIFIED SENDING THE MESAGE TO THE NODE
For the test i used the TTN Console, send bytes message 00 01 02
image

From Application Data Console

image

In the node I received

image

8 Likes

Assuming this will work as well with the 915Mhz bands, will have to do some testing this weekend if I can.

1 Like

So I was able to succesfully install the dual channel package from the repo (thanks for the instructions :slight_smile: ), but I am failing to understand how I forward it to the things network as a gateway. I think I am supposed to input a gateway ID that corresponds to TTN and my RPI with LoraHat, but I cannot find this Gateway ID anywhere on the RPI. The examples that use the (now deprecated) single channel package list the gateway ID as soon as the program starts running: gateway

1 Like

Did you check what is being reported in the log file?

sudo journalctl -f -u dual_chan_pkt_fwd

Since you are running it as a service you don’t see the output like you saw from the Single Channel examples.

gateway2

This is most likely because I have not been able to understand how to configure it in TTN

The stat update information is normal unless you have a node that is running somewhere trying to send data to your gateway. When you bring up the log file like that you aren’t seeing the entire log file, so what you were trying to look for, the Gateways ID, should be listed in the log file time stamped when you started the service. I’m also still a little bit confused as to why you need to see your Gateway ID? It is just going to be your devices MAC address if you are trying to figure out it’s ID from just running the code.

I am trying to register the gateway on the things network so that I can and send receive data from it, similarly to what one would do with the single package forwarder, but I am failing to understand how to do it. I can follow the tutorial perfectly, that is not the problem, but I fail to understand how I can communicate to and from the RPI.

Hi @Nanne118
I did not understand some things …

  1. Did you register the gateway on the TTN server?
  2. Do you have a sensor that transmits data to the gateway?
  3. if answer 2 is positive, have you created an application on the TTN server?
  4. have you installed the gateway service, which will start automatically?

Not receiving packets has nothing to do with the gateway being registered on TTN.

You node just sends data. It does not specifically talk to the RPi. (This is not WIFI where a device talks to one access point) A node broadcasts a packet. A gateway within reach will receive the data and forward it to TTN where you can find it in your application. Just keep the browser open on the application data page for the node that is sending data.

The ID you are looking for is the first 6 numbers/letters from the RPi MAC address, followed by FFFF followed by the remaining 6 characters of the MAC.

Is that just ‘ffff’ to enter, eg ‘b827faffff92fc50’?

Hey @Batigolle

  1. I have not been able to setup my RPI as a gateway in the TTN site yet, as I can / could not get the gateway ID to work for me. @Kersing just informed me that I am apperantly doing it wrong (there’s a first :P) and as such the gateway keeps listing as not connected.

2/3. The idea after this is to use a secondary pi with the LORA hat to transmit data, or use a different LORA capable board to transmit the data: for me to do this I would need to create an application similarly to how I would create the gateway as far as I understand it.

  1. I followed the tutorial / steps above, so AFAIK the gateway service should be installed. I do not think it runs automatically yet on startup (?), but I can remedy that by adding it to the /init.d list

let’s try a rate one step at a time

try to register the gateway on the TTN server, you need the gateway ID.
If you followed my instructions, the gateway service should start automatically when the PI3 starts.
try to stop the service with the command
systemctl stop dual_chan_pkt_fwd
and restart it by hand with the command (run from within the dual_chan_pkt_fwd folder)
sudo ./dual_chan_pkt_fwd

as an ouput, in the first lines, the gateway ID will appear
copy it and use it to register the gateway on the TTN server

1 Like

So I just did that, and now the gateway ID does indeed appear :smiley:
However, the gateway id presents itself as 00:00:00:ff:ff:00:00:00 : I either seem to have received the first device with a MAC address in the world, or something is off here. I ran it again to be sure it was not a fluke and it again comes up with the same MAC address.
gateway3

00:00:00:ff:ff:00:00:00 :scream:
what version of raspberry do you use?
looking in the forum I found …
https://www.thethingsnetwork.org/forum/t/cannot-get-the-correct-eui/6745
try to follow their instructions

Also a reminder to make sure that the interface (eth0 or wlan0) is set correctly in the json file.

Succes!

gateway4

Thanks to all of you for giving me all this help, I really wish I was a bit better at doing this stuff so that it would not churn out all these random errors :frowning:

So I can now do the same thing with my ‘node / client’ device in the applications > devices tab, correct? So that I can send data from one and receive it on the other (or use half duplex on both)?

yes, the next step is to register the sensor in the application

I, too, at the beginning, but even now, I find it difficult to understand the functioning of Lorawan
I suggest you use the forum with the ‘search’ function, many solutions have already been published :+1:

1 Like

I scoured the forums trying to find more information regarding the Dragino GPS + Lora Shield, but I was not able to find too much stuff that I can work with directly. I did try to implement the verification of sending the data via the simulated downlink on the TTN console itself, but I cannot get the Raspberry Pi Gateway to acknowledge the transmission of data (via downlink):

preparing a downlink package

transmission1

downlink package scheduled, but does not want to transmit. I notice that after a while it disappears from the data list despite it not being sent / received on the Rpi.

transmission2

no downlink package received in the raspberry pi itself; it does update periodically, which is nice

transmission3

//////////////////////////////////////////////////////////////////////////

Alternatively, I tried to implement the LMIC method as described on the Dragino wiki, but this also does not bear fruit. Although I can install and alter the necessary files (specifically, alter the Device Address/ Network Key and App Key according to the key(s) from TTN Console) I cannot get the LMIC to succesfully transmit:

lmic2

lmic1

Although it claims that pin 4 cannot be found, this is not referenced in the pin mapping below as I have changed the pin mapping to what is recommended on the Dragino wiki.

lmic3

lmic4

Hi @Nanne118
for downstream message , did you follow my instructions ?