Requirements
Any of the Wio-E5 Series such as Wio-E5 Development Kit, Wio-E5 Mini board or Wio-E5 Module
Any serial console. You can use Arduino’s serial console or any of your choice
An active account on Helium Console
An active Ubidots Account
Access to a LoRaWAN gateway connected to Helium network
1. Get the Board’s DevEui, AppEui and AppKey
Wio-E5 comes with a Factory AT firmware that allows rapid application and solutions prototyping by using only a Serial console. Arduino’s serial console was used in this guide, however, you can choose any you feel comfortable with.
Pro Tip: remember to connect the device Antenna before connecting it to any source of power in order to avoid possible damages to the chip.
Start by connecting your board to the PC using a type C USB cable, then head over to your Arduino IDE (you don’t have to open a particular sketch), click on “Tools” --->“Serial Monitor”, just as the following image shows:
Once the serial console interface opens, start by setting the “baud rate” at 9600 and the line finisher at “Both NL & CR”. These settings you can find at the bottom right corner. Now you’ll send the first command: type “AT” to check if there is connection between the PC and the Wio-E5. The device should respond with an “OK” message through the serial console just as the following GIF shows.
The next is to obtain the device’s required information for registering it into Helium’s network. In the same manner as you just did, type the command “AT+ID=DevEui”. The device will then answer back with its “DevEui” number. Now, in order to obtain its “AppEui”, just type the command “AT+ID=AppEui” and, again, the device will answer back with its “AppEui” number. Keep those two values at hand for you will need them in the following steps.
The last step is to assign the device an “AppKey”, which is a 16 hexadecimal bytes long identifier. To do so, type the command “AT+KEY=APPKEY, “your-key”, replacing “your-key” with the actual key enclosed in double quotes. You can use a random number generator to generate the key. The following GIF illustrates this:
After successfully setting the “AppKey”, the device should echo what you just typed.
Remember to keep all those three values at hand since you'll need them in the next section.
2. Register the Device in Helium’s LoRaWAN
Log in into your Helium console, then look for the “Devices” section at the left side of the screen. There, click on the “Add New Device” button.
Then you’ll be prompted to a new page where you will be asked for the device credentials such as its name, “DevEui”, “AppEui” etc. Fill in those fields with the information acquired in step 1, keeping in mind that the “Name” that you select here is the one that will be displayed at Ubidots , so you might want to give it a meaningful name such as “Wio-E5....”. Lastly, leave the “Label” field empty and then hit the “Save Device” button and that’s it! Your device should be listed on Helium’s “Devices” section.
Now that the Wio-E5 is registered in a LoRa network, let’s proceed to connect it to the network. To do so, head back to the Arduino serial console and just like you did in the first step, type the following four commands:
AT+DR=AU915
AT+CH=NUM,8-15
AT+MODE=LWOTAA
AT+JOIN
You should get a response like the following one in case you did everything correctly:
3. Create the Integration and Connect It to Ubidots
For this step, you’ll need to have your Ubidots Token at hand, so we recommend you to copy it to your clipboard. Take a look at our help center if you forgot where to find it.
Head over to the “Integrations” section at the left side of your screen in your Helium console, there look for the “Add New Integration” button just like you did in the previous section when you added the new device. A new page will load listing Helium’s partner integrations, look for the Ubidots integration and click on it, then you’ll be taken to the integration creation interface where you’ll be asked for your Ubidots Token, as well as the integration name. Fill in those fields and then hit the “Add integration” button in order to save the changes.
Now with the integration created we need to tell Helium which device is going to use it and how. In order to do so, get to the “Flows” section at the left side of the screen on your Helium console, when the page loads you’ll notice a little bar labeled “NODES” with a “+” sign on it, click it and a menu will drop down displaying four options: “Labels”, “Devices”, “Functions”, “Integrations”.
Look for your device in the “Devices” section and drag and drop it in the blank area at the right, then look for the newly created integration in the “Integrations” lid and drag and drop your integration to the blank area. Now all you need to do is connect the two blocks. The following GIF illustrates this process:
4. Create the Decoder Function
All that remains is to create the decoder that will parse the raw data into a format compatible with Ubidots platform. Let’s head over to the “Plugins” section under the “Devices” tabin your Ubidots account.
After doing this, all of your previously created plugins will be displayed. Identify the one that you just created and click on the little pencil icon with the “Edit” label in order to edit this plugin’s settings, specifically the decoder function.
Head to the “Decoder” section once the page loads, there you’ll notice a text field with a bunch of code in it, please delete all of it and paste this:
import base64
import json
def format_payload(args):
base64String = args["payload"]
decodedString = base64.b64decode(base64String).decode('utf-8')
decodedString = decodedString.replace("'","\"")
myPayload = json.loads(decodedString)
print(myPayload)
return myPayload
Click on the “Save & Make Live” button to save the changes on our decoder.
The following GIF guides you through this instructions:
5. Send Data to Ubidots
Now, lets suppose we have a sensor getting temperature and humidity data that you want to send to Ubidots using your Wio-E5, let’s get back to the Arduino serial terminal and type the following:
AT+MSG="{'temperature':34, 'humidity':10} "
Head back to your Ubidots “Devices” section and there you will notice a newly created device with the label that you set on Helium, if you inspect for its variables, you’ll see that both the “temperature” and “humidity” variables have just been updated with the values 100 and 10, respectively.
6. Feedback, Suggestions and Related Articles
Feel free to post questions or suggestions in our community portal, or drop us a line at support@ubidots.com.