This guide will show you step by step how to transmit LoRaWAN packets using a longfi-arduino sketch on an STMicroelectronics B-L072Z-LRWAN1 Discovery kit.
In this guide, you will learn:
How to setup your environment
How to build and program a basic application that will send packets over the Helium Network
Verify real-time packets sent to the Helium Console via Hotspot that's in range
For this example, you will need the following:
Micro USB Type B Cable - Example
To start you’ll just need to install the included antenna.
We'll be using the ST-Link debugger on the Discovery board, so you'll want to connect the micro-USB B connector to the micro-USB port labeled
CN7 USB STLINK.
If you will be running the device using the AAA battery supply, you will need to remove a resistor on the underside of the board. We can just move it over to one of the pads and leave it attached for later. You don't have to worry about this right now, as we will be powering the board off the MicroUSB connection.
Download driver here.
That’s it for the hardware setup! Next we will setup your environment.
Download and install the latest version of Arduino IDE for your preferred OS.
The ST B-L072Z-LRWAN1 requires one package to be installed follow the instructions below.
To install, open your Arduino IDE:
Navigate to (File > Preferences), (Arduino > Preferences) on MacOS.
Find the section at the bottom called Additional Boards Manager URLs:
Add this URL in the text box:
Close the Preferences windows
Next, to install this board support package:
Navigate to (Tools > Boards > Boards Manager...)
Search for Tlera Corp STM32L0 Boards
Select the newest version and click Install
Now that we have the required Arduino board support and libraries installed, lets program the board with the provided example sketch.
To create a new Arduino sketch, open your Arduino IDE, (File > New). Next, replace the template sketch with the sketch found here, copy and paste the entirety of it.
Next we'll need to fill in the AppEUI, DevEUI, and AppKey, in the sketch, which you can find on the device details page on Console. For this sketch you do not need to modify the formatting of the EUIs and Key at all, simply copy and paste them as is.
At the top of the sketch, replace the three FILL_ME_IN fields, with the matching field from Console, example shown below.
Next, we need to select the correct board to build for in the Arduino IDE. Navigate to (Select Tools > Board: > B-L072Z-LRWAN1).
We're almost ready to upload our sketch, the very last step is to select the correct Serial port in the Arduino IDE. Navigate to (Tools > Port: COM# or /dev/ttyACM# or usbmodem) depending on whether you are on Windows, Mac, or Linux.
We're finally ready to upload our sketch to the board. In the Arduino IDE, click the right arrow button, or navigate to (Sketch > Upload), to build and upload your new firmware to the board. You should see something similar to the image below at the bottom of your Arduino IDE, when the upload is successful.
When your firmware update completes, the board will reset, and begin by joining the network. Let's use the Serial Monitor in the Arduino IDE to view the output from the board. Navigate to (Tools > Serial Monitor), you should begin to see output similar to below.
Now let's head back to Helium Console and look at our device page, you should see something similar to the screenshot below.
Congratulations! You have just transmitted data on the Helium network! The next step is to learn how to use your device data to build applications, visit our Integrations docs here.