Blues Wireless App Accelerators are powerful, pre-built software components designed to streamline IoT development. By leveraging these accelerators, developers can rapidly prototype and deploy applications, reducing time-to-market.
Blues Wireless App Accelerators simplify device-to-cloud communication, enabling seamless integration with IoT platforms like Ubidots. When combined with Ubidots' user-friendly environment for data visualization and management, developers can quickly create end-to-end IoT solutions, from device connectivity to actionable insights, with minimal effort and reduced complexity.
This guide is about Blues Wireless' App Accelerator 18-temperature-and-humidity-monitor. Refer to the repository link to get more information about this project.
Requirements
AC to USB adapter (power brick)
USB-A to micro USB cable
Visual Studio Code with PlatformIO Extension
An active Ubidots account
Table of contents
1. Set up the hardware
Assemble the Notecard to the Notecarrier-F by removing the screw from the mounting receptacle on the Notecarrier-F. Place the Notecard into the M.2 slot on the Notecarrier. Once inserted, press gently until the Notecard is inserted. Re-insert the screw, being sure not to over-tighten it.
Secure both of the antenna's cables to their corresponding socket.
Connect the Notecard to your PC through a USB-A to micro USB cable. The USB port on the Notecard is labeled as NOTECARD USB.
Go to dev.blues.io.
Click on the USB button, then USB Notecard, and then select the port to which your Notecarrier is connected to.
If you're on a Mac, select either
Notecard (cu.usbmodemNOTE1)
orNotecard (tty.usbmodemNOTE1)
.On Windows, the option will show up as
USB Serial Device (COMx)
.On Linux, the option will show up as
Notecard (ttyACM0)
.
Validate the serial communication by issuing the following request into the in-browser terminal:
{"req" : "card.version"}
It will look something like this:
Plug the Swan into the Notecarrier, aligning the Swan's male headers with the Notecarrier's female headers.
Plug one end of the Qwiic cable into one of the Notecarrier Qwiic ports and the other end into one of the Qwiic ports on the BME280 breakout board.
In the end, the whole setup should look like this:
2. Create a Notehub project and link it to the Notecard
Navigate to the Notehub Projects Dashboard.
Click "Create Project" on the dashboard's upper-right corner. In the New Project card, give your project a name and ProductUID. Once done, click the Create Project button
Blues' Pro Tip: The ProductUID must be globally unique. To reduce collisions, Notehub prepends a generated namespace based on your account email, for instance com.your-company.your-name:
. Enter any identifier you like in the input on the right.
Take note of your ProductUID. This identifier is used by Notehub to associate your Notecard with your project.
Associate the Notecard to this particular project by issuing the following request on the in-browser terminal. Its output should be an empty JSON object.
{"req":"hub.set", "product":"com.your-company.your-name:your_product"}
Check the validity of the Notecard configuration by performing a manual synchronization to Notehub and sending synchronization status requests to the Notecard. To do so, make the following request on the in-browser terminal. If everything has been configured correctly, this should output an empty JSON object.
{"req":"hub.sync"}
3. Firmware setup
Head to Blues Wireless App Accelerators GitHub repo and clone it.
Navigate to the folder "18-temperature-and-humidity-monitor"
Launch VSCode.
Click the PlatformIO icon on the left-hand side and open this project's
firmware/arduino
folder. Quick Access > PIO Home > Open > Open Project.Open the file
src/main.cpp
. Uncomment the following line and replacecom.your-company:your-product-name
it with your ProductUID from Notehub Setup.
#define PRODUCT_UID "com.your-company:your-product-name"
Click the PlatformIO icon on the left-hand side again and click "Build" under Project Tasks → bw_swan_r5 → General. You should see "SUCCESS" in the terminal output pane.
Press and hold the button labeled "BOOT" on the Swan, and, while holding BOOT, press and release the button labeled "RST", and finally release the BOOT button. The Swan is now ready to be flashed.
Click "Upload" under Project Tasks → bw_swan_r5 → General. You should see "SUCCESS" in the terminal output pane.
At this point, the Swan firmware should be running and you should start to see events show up on Notehub under your project's "Events" view.
4. Create the Route to Ubidots
On the left side menu, click the Routes menu and then Create Route.
Give this route a name.
On the URL* field set the following value.
https://industrial.api.ubidots.com/api/v1.6/devices/[device]
The [devices] part on the URL is a placeholder that captures the devices identifier on Notehub, which has this format: dev:xxxxxxxxx. Where the "xxxxxx" is a unique identifier on Notehub. With that in mind, this route will send the event data to a Device on Ubidots whose Device Label is something like dev:xxxxxxxxx.
Add the authentication token as shown below and set its value to the Ubidots account Token that you wish to use for this application.
Scroll down to the Data section on the same page and select JSONata Expression from the dropdown menu at the Transform Data option.
Paste the following JSONata Expression on the text field:
{
"temperature": $.body.temperature.value ? {"value": $.body.temperature.value, "status": $.body.temperature.status, "timestamp" : $.when} : {"value" : $.body.temperature, "timestamp" : $.when},
"humidity": $.body.humidity.value ? {"value": $.body.humidity.value, "status": $.body.humidity.status, "timestamp" : $.when} : {"value" : $.body.humidity, "timestamp" : $.when}
}
Scroll up to the top of the page and click the Apply Changes button.
Once this is done, you should see a new device created in your Devices section:
5. Feedback, suggestions, and related articles
Feel free to post questions or suggestions in our community portal, or contact us via support@ubidots.com.
Other users also found helpful...