Next step: IoT gateway and IoT clouds #
LoRa devices send data to a LoRa IoT gateway. It is beyond the scope of this online tutorial to describe all the steps to build a low-cost LoRa IoT gateway but you can find all the necessary information from the following links.
- GitHub repository with a complete LoRa solution developed as part of the WAZIUP/WAZIHUB project
- Dedicated tutorial showing how you can build and configure the LoRa gateway with a Raspberry PI to start pushing data to the cloud [ local link]
- Dedicated tutorial explaining the gateway’s web admin interface extension to easily configure and update your gateway [ local link]
Here is the tutorial video from our YouTube channel for the gateway part.
We assume that a gateway is available for the training or you built such gateway. Note that with the simple PCB (WAZIHat for instance) to host the LoRa radio module for the gateway, it is very easy to build the gateway with a regular RaspberryPI and the SD card image provided on our web page describing how to build a low-cost LoRa gateways.
With the WAZIHat
With the RFM95 breakout freely available from our github: https://github.com/CongducPham/LowCostLoRaGw#pcbs
If you have the default configuration for both the device and gateway (i.e. SF12BW125 datarate and
CH_10_868=865.2MHz) then both components can communicate: the gateway is receiving data sent by the demo device, for instance
Demonstrating raw LoRa reception on the IoT gateway #
Here is an example of a raw reception. You may have slightly different output depending on the configuration of the IoT gateway.
pi@raspberrypi:~/lora_gateway $ sudo ./lora_gateway <<< using wiringPi >>> ^$**********Power ON ^$Frequency 865200000 ^$LoRa addr 1 ^$Use PA_BOOST amplifier line ^$Set LoRa txpower dBm to 14 ^$Preamble Length: 8 ^$Sync word: 0x12 ^$SX1276,865199936hz,SF12,BW125000,CR4:5,LDRO_On,SyncWord_0x12,IQNormal,Preamble_8 ^$SX1276,SLEEP,Version_12,PacketMode_LoRa,Explicit,CRC_On,AGCauto_On,LNAgain_1,LNAboostHF_On,LNAboostLF_On ^$SX127X configured as LR-BS. Waiting RF input for transparent RF-serial bridge ^$Will safely reset radio module every 100 packet received ^$Low-level gateway has downlink support 2021-12-21T08:18:53.027311 ^$Low-level gw status ON --- rxlora. dst=1 type=0x10 src=9 seq=0 len=10 SNR=4 RSSIpkt=-77 BW=125 CR=4/5 SF=12 ^p1,16,9,0,10,4,-77 ^r125,5,12,865200 ^2021-12-21T08:19:32.459992*2921192800 ??\!TC/20.50
Configuring the gateway for IoT cloud #
If you are working in groups where a gateway has been installed, do not perform these steps unless instructed by the instructor
Connect your gateway to a DHCP network to have Internet connectivity.
Your gateway also acts as a WiFi access point. Search for
Connect to this WiFi, password is
Use a web browser (you can use a smartphone or tablet for instance) and open
admin and Password:
Go to the
The ThingSpeak cloud #
Go to the
Cloud menu and select the
ThingSpeak tab to enable upload to the ThingSpeak cloud. You will need to enter your API write key. Here it is
SGSH52UGPVAUYG3S to use our LoRa test channel (
Last step is to reboot the gateway for changes to take effects. Wait about 1 minute, then power your LoRa demo end-device. With the provided configuration, the gateway will upload the demo device’s temperature to our LoRa test channel on the ThingSpeak cloud.
When looking at the low-level gateway log (
Get post-processing.log file) you should be able to see an output similar to:
2021-12-21T08:18:55.378145> <<< using wiringPi >>> 2021-12-21T08:18:55.378261> **********Power ON 2021-12-21T08:18:55.378375> LoRa CR4/5 2021-12-21T08:18:55.378487> LoRa SF 12 2021-12-21T08:18:55.378598> LoRa BW 125000 2021-12-21T08:18:55.378713> Frequency 865200000 2021-12-21T08:18:55.378821> LoRa addr 1 2021-12-21T08:18:55.378975> Use PA_BOOST amplifier line 2021-12-21T08:18:55.379083> Set LoRa txpower dBm to 14 2021-12-21T08:18:55.379186> Preamble Length: 8 2021-12-21T08:18:55.379289> Sync word: 0x12 2021-12-21T08:18:55.379392> SX1276,865199936hz,SF12,BW125000,CR4:5,LDRO_On,SyncWord_0x12,IQNormal,Preamble_8 2021-12-21T08:18:55.379496> SX1276,SLEEP,Version_12,PacketMode_LoRa,Explicit,CRC_On,AGCauto_On,LNAgain_1,LNAboostHF_On,LNAboostLF_On 2021-12-21T08:18:55.379600> SX127X configured as LR-BS. Waiting RF input for transparent RF-serial bridge 2021-12-21T08:18:55.379703> Will safely reset radio module every 100 packet received 2021-12-21T08:18:55.379808> Low-level gateway has downlink support 2021-12-21T08:18:55.379911> But downlink is disabled 2021-12-21T08:18:55.380012> 2021-12-21T08:18:53.027311 2021-12-21T08:18:55.380112> Low-level gw status ON 2021-12-21T08:19:32.460110> --- rxlora. dst=1 type=0x10 src=9 seq=7 len=10 SNR=6 RSSIpkt=-72 BW=125 CR=4/5 SF=12 2021-12-21T08:19:32.460337> 2021-12-21T08:19:32.459992 2021-12-21T08:19:32.460469> rcv ctrl pkt info (^p): 1,16,9,7,10,6,-72 2021-12-21T08:19:32.460594> splitted in: [1, 16, 9, 7, 10, 6, -72] 2021-12-21T08:19:32.460720> (dst=1 type=0x10(DATA) src=9 seq=7 len=10 SNR=6 RSSI=-72) 2021-12-21T08:19:32.460854> rcv ctrl radio info (^r): 125,5,12,865200 2021-12-21T08:19:32.461063> splitted in: [125, 5, 12, 865200] 2021-12-21T08:19:32.461202> (BW=125 CR=5 SF=12) 2021-12-21T08:19:32.461354> rcv timestamp (^t): 2021-12-21T08:19:32.458436*2855775172 2021-12-21T08:19:32.461477> 2021-12-21T08:19:32.461599> adding time zone info 2021-12-21T08:19:32.461728> new rcv timestamp (^t): 2021-12-21T08:19:32.458436+00:00 2021-12-21T08:19:32.461851> got first framing byte 2021-12-21T08:19:32.461967> --> got LoRa data prefix 2021-12-21T08:19:32.462079> +++ rxlora. dst=1 type=0x10 src=9 seq=7 len=10 SNR=6 RSSIpkt=-72 BW=125 CR=4/5 SF=12 2021-12-21T08:19:32.462192> valid app key: accept data 2021-12-21T08:19:32.462302> number of enabled clouds is 1 2021-12-21T08:19:32.462413> --> cloud 2021-12-21T08:19:32.462519> uploading with python CloudThingSpeak.py 2021-12-21T08:19:32.462629> python CloudThingSpeak.py "TC/20.50" "1,16,9,7,10,6,-72" "125,5,12,865200" "2021-12-21T08:19:32.458436+00:00" "0000DCA6325C2A7A" 2021-12-21T08:19:33.505723> ThingSpeak: uploading (multiple) 2021-12-21T08:19:33.506113> rcv msg to log (\!) on ThingSpeak ( default , default ): 2021-12-21T08:19:33.506407> ThingSpeak: will issue curl cmd 2021-12-21T08:19:33.506699> curl -s -k -X POST --data field1=20.50 https://api.thingspeak.com/update?key=SGSH52UGPVAUYG3S 2021-12-21T08:19:33.506943> ThingSpeak: returned code from server is 1008058 2021-12-21T08:19:33.507124> --> cloud end
The WAZIUP data cloud platform #
Go to the
Cloud menu and select the
Cloud WAZIUP tab.
First, enable the WAZIUP cloud if needed.
waziup. If you are deploying for another project, you can enter here your project name.
WAZIUP_TRAINING for instance
-DEMO for instance
Leave the other fields unchanged.
Last step is to reboot the gateway for changes to take effects. Wait about 1 minute, then power your LoRa demo end-device. With the provided configuration, the gateway will upload the demo device’s temperature on the WAZIUP cloud.
To see your data on the WAZIUP data cloud platform, go to
https://dashboard.waziup.io and log in as
guest and Password:
It is important to understand that the name of end-devices is set by the gateway when receiving data from the end-device and when upload data to clouds. The gateway retrieves the numeric address of an end-device (between 2 and 255) and will build a more comprehensive name, depending on the naming configuration for each cloud defined on the gateway.
With the above gateway configuration for the WAZIUP cloud, the name of your device is
WAZIUP_TRAINING-DEMO_Sensor9_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx as the device’s address is 9. You can see that the device name is defined as
organization_name+service_tree+"_Sensor"+device_address. Also, as you are using the WAZIUP guest account, the base name
WAZIUP_TRAINING-DEMO_Sensor9 is appended with the MD5 hash of your gateway id. The MD5 hash can be found on the gateway’s web admin interface in the
Gateway Configuration menu and
Here, our gateway id is
00000027EB5A71F7 and therefore the MD5 hash is
3304d293a4f5524e3d058929cf6583fb. The gateway id is automatically determined from the gateway’s network MAC address so you do not need to modify it. We advise you to use the default gateway id based on the gateway network MAC address.
Therefore, in our setting, we can search on the WAZIUP dashboard the device
WAZIUP_TRAINING-DEMO_Sensor9_3304d293a4f5524e3d058929cf6583fb. In your case, you will have a different MD5 hash value but the base name will be the same.
The final step is to create an account on the WAZIUP dashboard. Go to https://dashboard.waziup.io and follow procedure to create an account with a user name and a password. Use only letters and numbers for user name and password.
Once you have your user name and password, go on the gateway’s web admin interface, select
Cloud menu and the
Cloud WAZIUP tab to enter these information into the corresponding field.
Reboot the gateway for changes to take effects. Wait about 1 minute, then power your LoRa demo end-device.
Then go again to https://dashboard.waziup.io and log in with your user name and password. You should see your device, this time without the gateway’s id MD5 hash because you have been identified as a registered user.
You can also have a look at the following video that shows how to set up an operational gateway in less than 5mins.
2019 - Muhammad Ehsan, Mamour Diop & Congduc Pham