In this tutorial, we will guide you through the process of connecting your Wio-E5 Development Kit to The Things Network (TTN) using AT commands and then visualizing the data on the Ubidots platform. The Wio-E5 Development Kit is a powerful and versatile tool for building IoT projects with LoRaWAN connectivity. By following these steps, you'll be able to quickly prototype and build IoT applications using the Wio-E5 Development Kit and visualize the data on Ubidots.
1. Connect the Wio-E5 Development Kit to your computer using a USB Type-C cable(I'm using MAC).
2. Install the USB driver for CP201x from SILICON LABS if you haven't done so.
3. Open a serial communication software (e.g., Arduino Serial Monitor), select the correct COM port, set the baud rate to 9600, and select "Both NL & CR."
4. Try to send "AT" to see the response
1. Log in your TTN account and navigate to the "Applications" tab. And select a cluster to start adding devices and gateways.
2. Click on "Add application" and fill in the required fields. Once the application is created, you will see the "Application ID."
Note: Here Application name and Description are not compulsory fields. If Application name is left blank, it will use the same name as Application ID by default
3. Click on "Register Device" within the application
Enter a unique 3-code: "JoinEUI"(App EUI), "DeviceEUI" and "AppKey".
After registering, you will see the "Device EUI" and "App Key" displayed on the device overview page.
Note: If you haven't registered your LoRaWAN® Gateway with TTN Console. Please refer to the instructions shown here.
Step 3: Configure the Wio-E5 Development Kit Using AT Commands1. Send the command "AT" to the Wio-E5 Development Kit using the serial communication software. If the connection is successful, you will receive an "OK" response.
- Set the device EUI by sending the following command:
AT+ID=DevEui,"your_device_eui"
- Set the application EUI by sending the following command:
AT+ID=AppEui,"your_application_eui"
- Set the application key by sending the following command:
AT+KEY=APPKEY,"your_app_key"
- Change the band plan to match your region by sending the following command:
AT+DR=your_band_plan.
- Enable the necessary channels for your band plan by sending the following command:
AT+CH=NUM, 0-7.
For example:
// If you are using US915
AT+DR=US915
AT+CH=NUM,8-15
// If you are using EU868
AT+DR=EU868
AT+CH=NUM,0-2
- Set the work mode to OTAA by sending the following command:
AT+MODE="LWOTAA"
Step 4: Connect to The Things Network and Send Data1. Send a join request by sending the following command:
AT+JOIN.
2. Wait for the response "Join Success." If it doesn't appear, try sending the join request again.
3. Send hex data to The Things Network by sending the following command:
AT+MSGHEX="your_data"
Replace "your_data" with the data you want to send(Here we use the payload of SenseCAP S2101):
AT+MSGHEX="01 01 10 B0 68 00 00 01 02 10 88 F4 00 00 8C FF"
4. You will be able to see also the uplink message on the TTN End devices page
5. Use the S2101 decoder to see the real value
The payload formatter is chosen by default by TTN for the selected SenseCap device and is provided by Seeed Studio in the following link. You can check this by going to your device’s “Payload formatters” tab and then checking that the “Formatter type” is set to “Use Device Repository formatters”, however, if you want to check out the decoder on its official page, you can do so by going to the GitHub repository, where it is sure to be updated.
And then you will see the decoded payload value
Ubidots is a low-code IoT application development platform that enabled rapidly assembling and launching IoT applications without having to write code or hire a software development team. Nowadays, over 40, 000+ applications already connect the dots with Ubidots. To meet the growing need for building IoT applications, we’ve been cooperating with Ubidots and supporting the community to add SenseCAP S210X sensors easily to Ubidots by using The Things Network LNS. The Things Network is a global collaborative Internet of Things ecosystem that creates networks, devices, and solutions using LoRaWAN.
Now, let's set up a Ubidots webhook, you could also follow this Blog.
1. Go to your Ubidots account on the “Devices” tab and click “Plugins”.
2. Create a new “The Things Stack” plugin. Leave the “Ubidots device type” on its default option, On “Ubidots Token” select "Default Token". Click on the arrow icon to go to the next step.
Give the plugin a name and a description, Click the check icon.
3. Click on the recently created plugin to navigate to its options. Search for the “Decoder” tab and copy the “HTTPs Endpoint URL”. This will be needed later.Scroll down to the “Decoding Function” section and paste the following code on the text field:
async function formatPayload(args){
var messages = args["uplink_message"]["decoded_payload"]["messages"];
var ubidotsPayload = {};
var varLabelMap =
{
4097:"air-temperature",
4098:"air-humidity",
4099:"light-intensity",
4100:"CO2-concentration",
4102:"soil-temperature",
4103:"soil-humidity",
4108:"soil-electrical-conductivity",
};
messages.forEach(msg => {
if (msg.hasOwnProperty("measurementId")) {
ubidotsPayload[varLabelMap[msg.measurementId]] = msg["measurementValue"];
}
});
return ubidotsPayload;
}
module.exports = { formatPayload };
4. Connect the Ubidots Pluging to TTN
Go to your End devices tab of TTN console. Navigate to the “integrations-Webhooks” and click on it.
Note:
Plugin ID: It’s from the “HTTPs Endpoint URL”. If your endpoint’s URL is “https://dataplugin.ubidots.com/api/web-hook/lN4s2dlb4IgPgpp4Xeoq02stXcE=” then your plugin ID is just “lN4s2dlb4IgPgpp4Xeoq02stXcE=”
Ubidots token: your Ubidots Token. you will be able to find it on the Ubidots Console.
5. Visualize the Data on Ubidots
Head to the “Devices” section on your Ubidots account and you’ll be able to see a newly created device with the same name as you used for “End device ID” on the TTN console. Here you can check an example.
Congratulations! You have successfully connected your Wio-E5 Development Kit to The Things Network and visualized the data on the Ubidots platform. You are now ready to build and prototype IoT applications using the Wio-E5 Development Kit and visualize the data on Ubidots.
Seeed offers different products for industries especially those that are seeking digital transformation. Let us know how we might be able to support you!
[Wiki] https://wiki.seeedstudio.com/LoRa_E5_Dev_Board/
[DataSheet]https://files.seeedstudio.com/products/317990687/res/LoRa-E5%20module%20datasheet_V1.1.pdf
Comments