Gluing The IoT World With Java and LoRaWAN
Gluing The IoT World With Java and LoRaWAN
Gluing The IoT World With Java and LoRaWAN
LoRaWAN
The SkopjePulse.mk case
Panche Chavkovski
2018-02-06 / Jfokus
Who am I?
Panche Chavkovski
Senior Software Engineer @ netcetera
jug.mk Leader
Codefu.mk administrator
Hardware & IoT enthusiast
TTN SK Initiator
2
3
SkopjePulse
Problems Solution
§ extreme air pollution § Leverage technology
§ Crowd-sourced sensor network
§ Excessive urban noise
§ Data analysis and availability
§ Flash floods § Warnings
§ Clearer insights
No clear means for improvement § Data-driven basis for action
https://skopjepulse.mk/faq
4
System overview
LoRaWAN Analytics
Mobile
Devices Data Storage
apps
Front-end &
Data Fetching
! API
Warnings
5
LoRaWAN
6
LoRa & LoRaWAN
§ Based on FSK & CSS, multiple channels § MAC layer on top of LoRa
§ Low Power § IoT communication standard
§ Low Cost
§ Long range § Standardized stack
§ Free ISM bands: 433, 868, 915 MHz § Driven by LoRa Alliance
§ Proprietary by Semtech
7
Features
8
Limitations
Low speed (default BW)
§ SF12: 250bps with the farthest distance and the longest air-time
§ SF7: 5470bps with the shortest distance and the shortest air-time
Less frequent
§ 2-200 uplinks per day
§ 1-10 downlinks per day
9
LoRaWAN architecture
End nodes Gateway / concentrator Network server(s) Application server(s)
10
LoRaWAN devices
Different classes
§ Class A, rare async devices (current): one uplink with two downlink windows
§ Class B, always on, timed: beacon downlink windows
§ Class C, always on, always listening.
11
TheThingsNetwork
https://www.thethingsnetwork.org/
12
How to use TTN
Registration Integrations
https://console.thethingsnetwork.org/ § MQTT
§ Applications § HTTP
§ Devices § Data storage
§ Keys, UIDs, Credentials § Amazon AWS
§ Cayenne
§ EVRYTHNG
13
Devices
14
The start up kit
15
KiCAD usage
Scheme design 3D render and gerbers
PCB design
16
Assembly
Solder and connect
17
Make it work
Code Beware
§ Arduino or other embedded code § Select and inspect used sensors
§ Restricted environment § Test and / or calibrate
– 32KB flash § Check for factory defects
– 2KB RAM
§ Plan for hardware wear-out and lifespan
– 16MHz CPU
§ Don’t assume anything
§ Perpetual non-observed execution
18
System design
19
Rules to go by
20
Our approach
SpringBoot framework
§ Self contained web server / application
§ Modular
§ Starter packs for needed spring pieces
§ Less configuration, more conventions
§ Light(er)weight
§ Container and orchestrator friendly (Cloud native)
21
Data fetching
22
Communication first!
(almost) No overhead
§ Use binary protocols if possible
§ Always on connection
– reconnect fast
– plan for fallback
23
Our approach
24
Data storage
25
IoT data
IoT data is almost always impartial and time-series based
26
Our approach
Cassandra DB 3.7
27
Analytics
28
Averaging data
29
Warnings
!
30
Early warning system
31
Front-end & API
32
Provide and visualize the data
Interactive cockpit and data
explorers
§ D3js client side visualizations
§ Leaflet.js + OpenStreetMap
(+ Stamen designs)
34
Mobile apps
35
Native Android and iOS apps
36
Extras
37
WiFi devices
Where you *really* can’t do LoRaWAN
§ ESP8266 powered device
§ HTTPS communication
§ provision device address securely
§ implement own address -> key mapping
More: http://pance.mk/index.php/securing-esp8266-communication/
38
AWS This is my architecture
http://tiny.cc/awsttn
39
Discussion
40
Thank you
41