This example firmware sends LoRa messages to a The Things Network application via both earth-bound LoRa gateways and Lacuna Space's satellite.
The message sent are the classification results of the Bird songs model
running on a Arduino Nano 33 BLE Sense. The model classifies audio as either from the house sparrow, rose-ringed parakeet or as background noise.
Only when either bird has been classified with a result greater than 0.8
will the Nano 33 BLE sense transmit the results to the LS200.
The LS200 then adds the satellite
field and sets it to true
. This enables us
to determine which messages pass through the satellite.
Note: The example-lacuna-ls200.ino
sketch contains placeholders for
intialiasing and sending LoRa messages. Please replace with equivalent
implementations from your LoRaWAN library.
- Lacuna Space LS200 development kit
- Arduino Nano 33 BLE Sense
- (Optional) The Things Network Indoor Gateway
Get in touch with Lacuna Space for hardware and software setup.
-
Follow these steps to create a TTN application.
-
Add a device by following these steps. Also, choose
ABP
as Activation Method. -
Disable
Frame Counter Checks
for your device (Device > Settings
).
-
Add a Data Storage Integration to the application to store data for the last 7 days.
-
Add a decoder payload function
In TTN console go to Applications > Payload Format > decoder
and paste the
contents of ttn-payload-function.js
into the text field and save the payload functions.
From the TTN console copy (<> msb
):
- Device Address
- Network Session Key
- App Session Key
and add it to deviceAddress
, networkKey
and appKey
respectively in example-lacuna-ls200.ino
.
-
Build the application:
./arduino-build.sh --build
-
Flash the application:
./arduino-build.sh --flash
-
Clone the Edge Impulse Inc.'s housesparrow-roseringedparakeet-noise-100 model from Edge Impulse Studio
-
Follow running your impulse arduino guide to export the model as an Arduino library.
-
Create an sketch from the
nano_ble33_sense_microphone_continuous
example. -
Copy the contents of
nano_ble33_sense_microphone_continuous/nano_ble33_sense_microphone_continuous.ino
(found in this repo) into your sketch. -
Choose the right board, build and flash using Arduino IDE.
- Not flashing? You can double tap the button on the board to put it in bootloader mode.
- Nano (TX) -> (RX) LS200
- TX on pin
D4
. - RX on pin 5 on
J4
. - UART (115200 8N1)
-
Use a Tracker or Lacuna Space's Dashboard to determine the next good passing of satellite.
Note: Only run this application when the satellite is in range.
-
Reset the LS200. Note via the debug serial that the LS200 displays
Waiting for audio trigger..
.Note: ensure LS200 is always resetted after powering the Nano to mitigate synchronization and data corruption issues.
-
Now just wait for the bird songs to be detected.
-
Notice that the message is received in your TTN application (
Application > Data
). The data counter is an even number and thesatellite
field is set tofalse
.
E.g:
{
"housesparrow": "0.91406",
"redringedparakeet": "0.05078",
"noise": "0.03125",
"satellite": false,
}
- Confirm via the serial output that LS200 the sent the message via the satellite. The message should arrive moments later (~6 minutes) in your TTN application with an even counter value and the
satellite
field beingtrue
.
E.g:
{
"housesparrow": "0.91406",
"redringedparakeet": "0.05078",
"noise": "0.03125",
"satellite": true,
}
Consider complying to the Fair Access Policy
and use tools like Airtime Calculator (e.g. SF8BW125
) to determine the maximum amount of LoRa messages per 24 hours that can be sent in you're region.
Consider using a Lora Gateway if there are few in your area. See this map to see gateways near you.