This is a basic example on how to use PiSupply IoT LoRa Node pHAT for Raspberry Pi with balenaCloud.
The application will join TheThingsNetwork using OTAA and send the CPU temperature in Cayenne LPP format every 5 minutes.
All you need to do is:
- Create an application in balenaCloud, add a device, flash the generated image on an SD Card and boot your Raspberry Pi with it
- When your device appears in the balenaCloud console, go to
Device Configuration
and ensure thatUART
is enabled - Clone this repository
- Add the balena repo with
git remote add balena YourAccount@git.balena-cloud.com:YourAccount/YourApplication.git
(copy this line from your balenaCloud console) - Push the application to balenaCloud with:
git push balena master
The code will be pushed to your device after a few minutes. Note theDevice EUI
which will be printed in theLogs
window. - Create an application in TheThingsNetwork and register your device.
Enter theDevice EUI
copied from previous step - Back to the balenaCloud console, create 2 Service variables:
APP_EUI
withApp EUI
copied from TheThingsNetwork consoleAPP_KEY
withApp Key
copied from TheThingsNetwork console
Your application will restart and send the CPU temperature to TheThingsNetwork every 5 minutes.
SERIAL_PORT
: The default serial port is/dev/ttyS0
, depending on your Raspberry Pi model and configuration you might have to override the default (e.g./dev/ttyAMA0
)BAND
: The default LoRaWan region isEU868
, you can set this variable to match your region (supported regions are:EU868
,US915
,AU915
,KR920
,AS923
,IN865
)