Low Cost LoRa GW Step by Step PDF
Low Cost LoRa GW Step by Step PDF
Low Cost LoRa GW Step by Step PDF
a step-by-step tutorial
2
Assembling the hardware
3
Get the Raspberry
GND
CS
I
MOS
O
MIS
CLK
VCC
If you go for the inAir9 from Modtronix, then the header pins can come fully assembled.
Take the 6mm header pins to have enough length to connect F/F breadboard cables
(left). Connect the SPI pins with the F/F cables. Try to use different colors. I use the
following colors: MOSI (blue), MISO (green), CS (white), CLK (orange). Then connect
also the VCC (red) and the GND (black or any other dark color) of the radio board.
5
Now the radio module (2)
GND
MIS
O
MOS
I
CLK
CS
VCC
6
Connecting the radio
module (1)
GND
CS
MOSI
MISO
CLK
VCC
Depending on the model, you can have the « short » or the « long » GPIO interface. However,
the SPI pins are at the same location therefore it does not change the way you connect the
radio module if you take pin 1 as the reference. Connect the SPI pins (MOSI, MISO, CLK, CS)
of the radio to the corresponding pins on the RPI. Note that CS goes to CE0_N on the RPI.
7
Connecting the radio
module (2)
GND
CS
RT
It is strongly advised
to also connect the
RESET pin (RT) to
the RPI's #11 pin
I
MOS
O
MIS
CLK
VCC (GPIO17)
8
Put it in a box
You can have a more integrated version, with a box for outdoor usage and PoE
splitter to power the Raspberry with the Ethernet cable. See how we also use a
DC-DC converter to get the 5V for the RPI.
9
Antennas for gateway
10
Simple ¼ wave ground
plane antenna
12
Flashing the OS
http://cpham.perso.univ-pau.fr/LORA/WAZIUP/raspberrypi-jessie-WAZIUP-demo.dmg.zip
15
Using Android
smartphone or tablet
16
Gateway's simple
command interface
q Once logged on the
gateway, you may directly
enter in a simple command
interface
q This command interface
consists in a cmd.sh shell
script
q In image versions after May
2017, this script is launched
when you log into the
gateway with ssh
q If this happens, select Q and
RETURN to quit this interface
q You should be in the
lora_gateway folder
17
Full update of GW
software from github
The software should be installed in a lora_gateway folder. Delete any previous folder.
> rm -rf lora_gateway
then
> mkdir lora_gateway
> git clone https://github.com/CongducPham/LowCostLoRaGw.git
> cp -r LowCostLoRaGw/gw_full_latest/* lora_gateway/
or
> svn checkout https://github.com/CongducPham/LowCostLoRaGw/trunk/gw_full_latest lora_gateway
18
… and compiling the GW
software
> cd lora_gateway
> make lora_gateway
g++ -DRASPBERRY -DIS_RCV_GATEWAY -c lora_gateway.cpp -o lora_gateway.o
g++ -c arduPi.cpp -o arduPi.o
g++ -c SX1272.cpp -o SX1272.o
g++ -lrt -lpthread lora_gateway.o arduPi.o SX1272.o -o lora_gateway
19
Use a script to update
the gateway
20
Updating the gateway
software
21
Configuring the gateway
(1)
22
Configuring the gateway
(2)
********************************************
*** compile lora_gateway executable Y/N *** Enter Y
********************************************
********************************************************
*** create log symb link to ~/Dropbox/LoRa-test Y/N *** Enter Y
********************************************************
***********************************
*** configure hostapd.conf Y/N *** Enter Y
***********************************
****************************************************************
*** configure a newly installed hostapd/dnsmasq package Y/N *** Enter N
****************************************************************
*********************************************
*** configure bluetooth network name Y/N *** Enter N
*********************************************
**********************************
*** install DHT22 support Y/N *** Enter Y
**********************************
23
Configuring the gateway
(3)
***************************************
*** edit gateway_conf.json now? Y/N *** Enter N
***************************************
*************************************
*** activate DHT22 MongoDB Y/N/Q *** Enter Q
*************************************
*********************************************************
*** edit LoRa data MongoDB local storage option? Y/N *** Enter N
*********************************************************
*******************************
*** run gateway at boot Y/N *** Enter Y
*******************************
**********************************************
*** check configuration (recommended) Y/N *** Enter N
**********************************************
*******************
*** reboot Y/N *** Enter N
*******************
24
Start the command
interface
> ./cmd.sh
25
Periodic update
procedure
q The latest command
interface has built-in
update procedure
q You can use option U to
update from repository
and still keep all your
configuration files:
gateway_conf.json,
clouds.json and key*
q You can also install a single
file with option V that will
prompt for a URL
q You can enter a URL that
has been provided by
some administrator
q Example in the next slide
26
Download and install a
file (1)
27
Download and install a
file (2)
28
Download and install a
file (3)
high-level lang.
application specific processing specific
as possible
e.g. python
logics is done here!
We provide some
basic features, up to lora_gateway program
you to enhance them
stdout stdout
radio post
bridge processing Long-range radio lib
program stdin
Raspbian
30
Post-processing block
stdout stdout
radio post
bridge processing
program stdin
post-processing
Handle AES
LoRaWAN
encryption
downlink decryption
interoperability
data
Incoming data
Monitor
parsing block
user/app-specific
T/23
> sudo ./lora_gateway
Node 10
Power ON: state 0
Default sync word: 0x12
LoRa mode: 1
Setting mode: state 0 Node 3
Channel CH_10_868: state 0
Set LoRa Power to M: state 0
Get Preamble Length: state 0
Preamble Length: 8
LoRa addr 1 : state 0
SX1272/76 configured as LR-BS. Waiting RF input for transparent RF-serial bridge
--- rxlora. dst=1 type=0x10 src=10 seq=0 len=4 SNR=9 RSSIpkt=-54
^p1,16,10,0,4,9,-54
^r125,5,12
^t2016-02-25T01:51:11.058
T/23
--- rxlora. dst=1 type=0x10 src=3 seq=0 len=4 SNR=8 RSSIpkt=-54
^p1,16,3,0,4,8,-54
^r125,5,12
^t2016-02-25T01:53:13.067
H/85
32
Post-processing
received data
> sudo ./lora_gateway | python ./post_processing_gw.py
Power ON: state 0
Default sync word: 0x12 All lines that are not prefixed by specific
LoRa mode: 1 character sequence are displayed
Setting mode: state 0 unchanged
Channel CH_10_868: state 0
Set LoRa Power to M: state 0
Get Preamble Length: state 0 ^p provides information on the last received
Preamble Length: 8 packet: dst, type, src, seq, len, SNR & RSSI
LoRa addr 1 : state 0
SX1272/76 configured as LR-BS. Waiting RF input for transparent RF-serial bridge
--- rxlora. dst=1 type=0x10(DATA) src=10 seq=0 len=4 SNR=9 RSSIpkt=-54
Rcv ctrl packet info 1,16,10,0,4,9,-54
(dst=1 type=0x10 src=10 seq=0 len=4 SNR=9 RSSI=-54) ^r provides radio information on the last
rcv ctrl radio info (^r): 125,5,12 received packet: bw, cr & sf
splitted in: [125, 5, 12]
(BW=500 CR=5 SF=12)
rcv timestamp (^t): 2016-02-25T01:53:13.067
^t provides timestamp information on
got first framing byte
the last received packet
--> got data prefix
T/23
Pre-defined sequences inserted by the gateway or the end-device allow for information
exchanged between the gateway and the post-processing program
33
Gateway to cloud
Data received at the gateway can be pushed to IoT clouds. We provide python script examples
for many IoT cloud platforms. Most of clouds with REST API can be easily integrated.
34
Log received messages
using cloud services
\!T/23
Node 10
35
Using
\$T/23
Node 10
36
Using
\!##T/23
Node 10
\!write_key#field_index#T/23
37
Using ------------
38
Using
39
Configuring data
management
#project name
project_name="waziup"
#SUMMARY
#the entity name will then be sensor_name+scr_addr, e.g. "UPPA_Sensor2"
#the Fiware-ServicePath will be service_path which is based on both organization_name and
service_tree, e.g. "/UPPA/LIUPPA/T2I/CPHAM"
#the Fiware-Service will be project_name, e.g. "waziup"
source_list=[]
41
Editing key_WAZIUP_WS.py
CTRL-X to quit
42
clouds.json
43
Rebooting the gateway
45
Gateway web admin
interface (2)
q http://192.168.200.1/admin
46
Web admin features
47
Default configuration
\!##TC/18.5
48
Write your own cloud
script
These parameters are passed to the script. It is up to the cloud script to use these parameters or not.
49
Standalone gateway
50
Connect to the embedded
web server
51
Data from the local web
server
52
Visualize it on your
smartphone!
53
Running the gateway
without internet access
54
Improving casing and
adding PoE to gateway
55
Overview of the parts
56
Fixing the Raspberry to
the case
57
Prepare the DC Step-
Down (LM2596)
It is advised to connect the
DC plugs before soldering
58
Setting the step-down
module
59
Installing the PoE injector and
water-resistant ethernet plug
60
Connect the radio
module
GND
CS
RT
It is strongly advised
to also connect the
RESET pin (RT) to
the RPI's #11 pin
I
MOS
O
MIS
CLK
VCC
(GPIO17)
61
Install fixing parts of
the case
62
Fixing the antenna cable
63
Connecting and powering
your gateway
64