LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The...
Transcript of LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The...
![Page 1: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/1.jpg)
LoPy LoRaWAN IoTWorkshopUniversityofEdinburgh
PycomOctober2016
![Page 2: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/2.jpg)
ThePlanforToday
• Twohourworkshop• weareworkinginpairs,eachpairneedsalaptop.
• We’llgiveabitofbackgroundonLoRaWAN• Thewe’llgetstuckintoPycom LoPy programming• Gettingsetup• SimpleLoRaWAN communication• HookingupaLightSensor
• At4pmpresentationbyFreddeHaro CEOofPycom• Alldoneby5pm
![Page 3: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/3.jpg)
LoRaWANforLowPowerWideAreaNetworking
![Page 4: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/4.jpg)
LoRaWAN SpecificationEuropeLoRaWAN™forEuropeLoRaWAN definestenchannels,eightofwhicharemultidataratefrom250bpsto5.5kbps,asinglehighdatarateLoRa®channelat11kbps,andasingleFSKchannelat50kbps.ThemaximumoutputpowerallowedbyETSIinEuropeis+14dBM,withtheexceptionoftheG3bandwhichallows+27dBm.TherearedutycyclerestrictionsunderETSIbutnomaxtransmissionorchanneldwelltimelimitations.
![Page 5: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/5.jpg)
LoRaWAN Architecture
![Page 6: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/6.jpg)
LoRaWAN performancecharacteristics
![Page 7: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/7.jpg)
Green=5kmRed=10kmradiuscoveragecentred onGeorgeSquare
UniversityofEdinburghisputtinginplace5Kerlink gateways.
Multiplegatewaysalsoenabletriangulationofpositionofsensors(LoRaWAN 2.0).
![Page 8: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/8.jpg)
LoRaWAN DeviceClasses
“Aloha”
![Page 9: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/9.jpg)
KeyLoRaWAN NetworkingConcepts• Dataisencryptedatthenetworklayer(metadata)andseparatelyattheapplicationlayer(payload).• Application
• AnApplicationisidentifiedbyaunique64-bitApplicationEUI.• DevicesmustberegisteredwithaspecificApplication.
• Device• Adevicehasaunique64-bitDeviceEUIassignedbythemanufacturer.• Thenetworkwillrefertothedevicebyassigningita32-bitDeviceAddress.
• ActivationByPersonalisation (ABP)[insecure]• Requiresyouknowyourassigned32-bitDeviceAddress,and128-bitApplicationSessionKeyand128-bitNetworkSession
Key– astaticconfiguration.• OverTheAirActivation(OTAA)[secure]
• RequiresyouknowyourApplication’sKey(whichisassignedwhentheApplicationiscreated),ApplicationEUIandDeviceEUI.
• Sessionkeysareassigneddynamicallybythenetworkaspartofthejoinprocedure.• Framecountsaremaintainedbythenetworkanddeviceforuplink(devicetogateway)anddownlink(gatewaytodevice).Thenetworkwillrejectnewframesreceivedthathaveanearlierframecount.
WewillonlybeusingABPtoday.
![Page 10: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/10.jpg)
Whatweareaimingtobuildtoday
![Page 11: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/11.jpg)
Thisisourfirsttime!Pleasebepatient…Thisisreallynewtechnologyandyouhavetheverylatestfirmwarereleaseinyourhandsbeforeanyoneelse(!),andtherewillbelotsforallofustolearntodayJ
![Page 12: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/12.jpg)
Initialsetup
• DownloadandinstallthePymakr IDE• PlugyourLoPy inviatheUSBcabletoyourlaptop• Ifworking,youshouldseeaperiodicflashingbluelight
• RunPymakr IDE• TheLoPy willbeconnectedtoviaUSBserialport
• IfnottryexitingandrestartingPymakr…
![Page 13: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/13.jpg)
TurnofftheflashingblueLED
AttheMicro-Pythonprompttype:
import pycompycom.heartbeat(False)
![Page 14: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/14.jpg)
Let’ssendamessageviaLoRaWAN
• OpenanewsourcecodefileinPymakr tosaveyourcodein.• Youcansimplyrunthecontentsofthisfile(greenplaybutton)ontheLoPy.• Youwillneedtosetthevariousauth keystothoseforyourLoPy.
from network import LoRaimport timeimport socketlora = LoRa(mode=LoRa.LORAWAN)# ABP auth tuple (NwkSKey, AppSKey, DevAddr)auth = (bytes([…]), bytes([…]), …)lora.join(activation=LoRa.ABP, auth=auth)while not lora.has_joined():time.sleep(2.5)
s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)s.setblocking(False)s.send(“hello-X”) # X = your group number
![Page 15: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/15.jpg)
AndnowfortheLightSensor
• LightSensor drivercodewillbedistributedviaemail/USBstick.• Pleasetakecarewiringuptheboard,andusetheantistaticwriststrapprovided.• Therestisuptoyou!
• Thegoalistotransfertheluxlightreadingonceevery30secondstotheUoE LoRaWAN backend.
![Page 16: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/16.jpg)
WiringuptheLightSensorboard
• Pleasenoteontheexpansionboardpinout:G16=SDAG17=SCL
• Wewillconnect3V3ontheexpansionboardtoVINonthesensor,andGNDtoGNDasyouwouldexpect.
![Page 17: LoPy LoRaWAN IoT WorkshopLoPy LoRaWAN IoT Workshop University of Edinburgh Pycom October 2016 The Plan for Today • Two hour workshop • we are working in pairs, each pair needs](https://reader036.fdocuments.us/reader036/viewer/2022062922/5f0944577e708231d42600f4/html5/thumbnails/17.jpg)
That’sallfolks!Thankssomuchforyourparticipationandpleasesendusyourfeedbackbyemail,good/baditallhelpsimprovethetechandourworkshopdelivery,andpleasedoalsotelluswhatwouldyoulikeafutureworkshoptocoverwiththeLoPy?