A quick-start guide to connect your WisBlock RAK4631 to The Things Network using Arduino IDE
This guide walks you through setting up the Arduino IDE for WisBlock, installing necessary board support, and registering your device with The Things Network (TTN) to begin transmitting data. Whether you're prototyping or deploying IoT applications, this step-by-step tutorial helps you get started fast and efficiently.
Step 1: Setup Arduino IDE1.Use a USB-C cable to connect the WisBlock module to the PC.
2. Add WisBlock Board Support in Arduino IDE:
Activate the options called Compilation and Upload.
- Activate the options called Compilation and Upload.
In the window that appears, you will see a field called Additional Boards Manager URLs:
- In the window that appears, you will see a field called Additional Boards Manager URLs:
Copy and paste the following URL [https://raw.githubusercontent.com/RAKwireless/RAKwireless-Arduino-BSP-Index/main/package_rakwireless_index.json] into this field
- Click "OK" to save this URL.
3. Install the WisBlock Board in Arduino IDE:
4. Select the WisBlock RAK4631 Board:
Part 1: Creating an Application in TTN
1. Login to TTN:
2. Create a New Application:
- After filling out the required fields, click Create Application to finalize the setup.
Part 2: Adding an End Device to Your Application
1. Register an End Device:
2. Choose Registration Method:
3. Manual Configuration:
Part 3: Configuring the Device for TTN Connection
1. Open the LoRaWAN Example in Arduino IDE:
2. Understand the Key Files:
There are three key files in this project:
- There are three key files in this project:
lora_handler.cpp: This file manages the LoRaWAN communication, including network parameters like authentication keys and network settings.
main.h: This file contains global variables and function declarations used across the program. Main libraries for the application.
RAK4631-DeepSleep-LoRaWan.ino: The main file where sensor data is collected and transmitted to the network. It also handles power management, including deep sleep modes between transmissions.
3. Insert TTN Authentication Keys:
Open the `lora_handler.cpp` file in the Arduino IDE.
- Open the `lora_handler.cpp` file in the Arduino IDE.
Copy the DevEUI, JoinEUI (AppEUI), and AppKey from the TTN console (which you received during the registration process) and paste them into the respective fields in the lora_handler.cpp`file:
The numeric format might differ between TTN and Arduino IDE.On TTN, clicking "</>" changes the formatting. For the AppKey, you need to click the "Eye" icon first, then "</>".
4. Compile and Upload:
After entering the keys, compile the code by clicking Verify.
Finally click Upload to send the program to the device.
5. Check Data Transmission on TTN:
After uploading the code, go back to the TTN console.
Check if the data is being sent successfully from your end device. For example, the "Hello" message in the buffer will be transmitted in HEX format:
m_lora_app_data_buffer[buffSize++] = 'H';
m_lora_app_data_buffer[buffSize++] = 'e';
m_lora_app_data_buffer[buffSize++] = 'l';
m_lora_app_data_buffer[buffSize++] = 'l';
m_lora_app_data_buffer[buffSize++] = 'o';
Comments
Please log in or sign up to comment.