RAK4260 WisDuo Breakout Board Quick Start Guide
Prerequisites
The following two sections provide a list of the components and tools you need in order to get started with the development board. Some of the components are included in the package, others you need to provide yourself.
What Do You Need?
Before going through the steps in the installation guide of the RAK4260 Breakout Board, make sure to prepare the necessary items listed below:
Hardware Tools
- RAK4260 Breakout Board (provided) – including LoRa antenna, Dupont lines (13x)
- USB to UART adapter – CH340 for example (not provided)
- RAKDAP1 DAPLink Tool (not provided)
- Gateway in range, for testing (not provided)
- Windows PC (not provided)
Software Tools
What's Included in the Package?
- RAK4260 Breakout Board
- LoRa antenna
- Dupont lines (24x)
Product Configuration
Interfacing with RAK4260 Breakout Board
Before powering the RAK4260 Breakout Board, make sure you have installed the included LoRa Antenna. Not doing so might damage the board.
USB to UART
- Connect your USB to the UART adapter to the pin header on the RAK4260 via a set of four (4) DuPont lines. See Figure 1 for reference on wiring the device properly.
-
Go to your Device Manager by pressing
Windows
+R
, and then typedevmgmt.msc
. Or, you can also search fordevmgmt.msc
in the Start Menu. -
Look for Ports (COM and LPT), and then find the name USB-SERIAL CH340. Take note of the COM Port Number as you will need it to connect with the board.
Windows 10 should recognize the board and automatically install drivers. If you didn't find any port with the name USB-Serial CH340, make sure to install the CH340 Drivers in your Windows PC.
- Open the RAK Serial Port Tool. Select the COM Port number (the one you noted in the previous step) and set the Baud Rate to 115200. Click OPEN, and you should be connected to the board and be able to send commands.
DAPLink Connection
Connect the tool in accordance with the diagram shown in Figure 4 and Figure 5.
Connecting to The Things Network (TTN)
The Things Network is about enabling low-power devices to be used in long-range gateways that connect to an open-source, decentralized network and exchange data with Applications. Learn more about The Things Network.
In this section, you will be connecting the RAK4260 Breakout Board to The Things Network (TTN).
- If you don't have an account yet, head on to the TTN site and create one. Once done, log in to your account and go to the console. Refer to Figure 7.
- Choose APPLICATIONS.
Adding an Application
- Click the add application button
Here are the things that you should take note of in adding an application:
- Application ID - this will be the unique id of your application in the Network. Note that the characters should be in lower case, no spaces are allowed.
- Description - this is a short and concise human-readable description of your application.
- Application EUI - this will be generated automatically by The Things Network for convenience.
- Handler Registration - the handler you want to register this application to.
- After filling in the necessary information, press the Add application. If the page is the same as shown in Figure 10, then you have successfully registered your application.
Register Device
- Scroll down until you see the Devices section. You can also click the Devices button at the top.
- Click Register device.
Here are the things that you should take note of in registering your device:
- Device ID - this is the unique identifier for your RAK4260 Breakout Board in your application. You need to enter this manually.
- Device EUI - this is the unique identifier for your device in the network. You can change it later if you want.
- App Key – this key will be used to secure the communication between the device and the network.
- App EUI – a unique identifier of the Application that you are registering the device within.
- Populate the Device ID and Device EUI (generate a random one by pressing the arrows) fields and leave the rest as is. Click Register. Now, your device is registered under the corresponding application.
In the Device Overview, there are two options for the Activation Method: OTAA and ABP. The default option is OTAA as shown above.
OTAA Mode
OTAA stands for Over-The-Air Activation. Detailed information about the OTAA will not be discussed in this document; however, the most important thing from a practical perspective is that a device needs to have the three (3) parameters: Device EUI, Application EUI, and App Key. It is already explained briefly in the previous section. It is set correctly in order for the LoRa Server to allow it to access the network.
These can be obtained from the Device Overview page, where they are grouped one after the other for convenience.
As these are randomly generated by TTN, you need to update your RAK4260 Breakout Board with their values to register it with the network. However, as mentioned before, you can only do this directly in the source code, compile it and then flash it to the device.
The following section will guide you through the process of doing this with the Atmel Studio.
Parameter and Firmware Setup
Execute the following steps to connect your device with the TTN. Register and then fill in the parameters obtained upon registering.
Edit OTAA Parameters in the Code
- Open your Atmel Studio and navigate to the demo firmware you downloaded from the RAKwireless GitHub repository.
2 Go to File → Open → Project/Solution
.
- Go to the folder where you downloaded the GitHub repository and select the APPS_ENDDEVICE_DEMO1 project file (it is in the directory with the same name as the file). Then click Open.
- Once your project has loaded up, you will be presented with a file structure that contains folders and files that you can edit. Copy the values of the three (3) parameters shown in Figure 14 and paste them into the
conf_app.h
file. This file is contained in thescr
config folder that you can access via Solution Explorer tree.
Here are the required parameters:
- Device EUI
- Application EUI
- Application Key
- After replacing the default values with the one for the device you registered with TTN, you can proceed to compile the project.
There is no need to edit anything else in order to compile the firmware that will allow you to connect to the TTN network.
Compile the Code
- Compile the code by going to the
Build → Build Solution
.
- The output should have no errors, as shown in Figure 20.
Flashing the Firmware
- Once compiled, you can find the output file in the Debug folder of the directory, where you downloaded the firmware. See Figure 21.
- As the firmware is now ready, you are going to proceed to flashing it. To do this, you need to utilize your RAKDAP1 hardware tool and the pyocd software tool.
Flash the Firmware Using RAKDAP1
Refer to the RAKDAP1 Flash and Debug Tool.
Connecting to TTN
Connect your USB to the UART adapter to the pin header on the RAK4260 via a set of four (4) DuPont lines. Refer to the Interfacing with RAK4260 Breakout Board section for more details.
Regional Band and Join Network Setup
- Upon opening the RAK Serial Port Tool, it should display the same details, as shown in Figure 22, provided it has been less than 5 seconds since you powered the board. The firmware is set to work in such a way that 5 seconds after powering the board it initializes with the default settings.
EU868 is used for the region as an example. This section shows how to change the default region and connect with the network.
- After the aforementioned 5-second elapse, the current configurations will be reported. These configurations are:
- Class A
- OTAA
- Unconfirmed LoRa Frames
- Fport - 1
These settings are not adjustable at this stage. If you want to change them, you need to start over at the stage where you modify the firmware files before compiling them.
- If you use Figure 23 as a reference, you will see there is a list of four (4) options to choose from. Go to the Main Menu by sending a number 4.
- After which, send a number 1 to select EU868 Regional Band. You may also choose a different number as a selection depending on your case.
- Once you have selected the band, the device will automatically try to join to the LoRaWAN network using the Device EUI, Application EUI, and Application Key set in the firmware configuration file.
- If the device is successful at joining the network, this will be reported with the Device Address that it has been assigned, and the parameters will be reported again (Class A, OTAA, etc.). You will be presented with the Configuration menu again in case you want to send another command. You will do this in the next section, where you will send some uplink data to the network.
Uplink LoRa Frame Testing
- You should now be on the Main menu and have four options. This time select Option 2 to send an uplink LoRa Frame.
The firmware uploaded into the RAK4260 Breakout Board is just an example. Thus, the data sent are just dummy temperature readings (the original Microchip code was for a board with an actual temperature sensor). It will be reported as output together with the transmission is successful, as shown in Figure 28.
This should be sufficient to prove that the board functions as intended, and it can send data over the network after successfully joining it. As this module is intended for development, the example firmware is limited to this functionality.
You can use this project as a base to develop a more complex firmware using the Microchip LoRaWAN Stack (MLS).