Software setup - Part 1
Now it's the time for the software hack!! It's not technically hacking, but rather an approach to make this kit behave as intended by forcefully putting instructions into its mind.
Yes!! We are going to control its mind.
But to control, I need to know how the mind of the RSL10-SENSE module works.
Basically, this is what is inside the module:
It looks a little scary at first. But it's not that scary too.
Basically the module consists of:
- an RSL10 SIP
- integrated BLE
- a BHI160 + BMM150 based Inertial measurement system
- a BME680 environmental sensor
- an INMP522 ultra-low-power microphone, and
- an integrated N24RF64 NFC module.
Yah!! As I said, it's not at all scary.
So now that we know what's in his mind, we need to get inside.
Ok, so what are the possibilities!!??
Let me find out...
Ok. There are 2 ways:
- Using the ON Semiconductor IDE which is based on the Eclipse Editor.
- Using the Atmosphere IoT Web interface.
Considering the pros and cons of both methods, I have finally decided to settle with the atmosphere IoT. The main reason being I am too lazy to code and the atmosphere IoT packs predefined elements that can be drag and dropped for making each and every feature of the module to work with the help of events and parameters. It also features cloud connectivity and even lets us compile our own mobile app to monitor and control the module.
Let us see how we can use the atmosphere IoT to program our RSL10-SENSE module.
This is the link that I had referenced, to begin with. It packs a lot of information regarding prerequisites and setting up the board to compile and run the mobile application.
I worked on an Ubuntu machine, so my steps would be based primarily on the same platform. I have also done similar steps (as far as my hobby time allowed) in a Windows 10 virtual machine.
Make sure we have the following pre-requisite software before proceeding:
1. SEGGER JLink Software - This is used as an interface to talk with the JLink debugger module.
2. Atmosphere IoT Agent - This allows the atmosphere web interface to talk with associated hardware for programming and debugging.
3. Atmosphere IoT app - From the respective stores, iPhone & android
Now once these are downloaded, install the SEGGER JLink Software. The Atmosphere IoT Agent is an app image, we just have to run this using Sudo privileges.
chmod u+x <app image>
Now add the current user to dialout group
sudo adduser $USER dialout
I would recommend logging in again for the changes to take the effect.
Now after re-logged in, start the atmosphere agent app. An atmosphere agent icon would appear at the top taskbar.
Now if we click on that icon and select status, we would get a webpage stating this:
This means that everything is up and running.
Now we move on to the next step. The programming.
Head to https://platform.atmosphereiot.com/
If you don't have an account already, now it's the time to make one.
Start a new project using RSL10-SENSE-GEVK as the device.
Give a cool name and let's start.
Now we are presented with a nice canvas and an element toolbox to the right.
Now as I told I am a bit lazy, I am gonna take the help from the atmosphere tutorial webpage to explain the upcoming steps.
Smart Healthcare Wearable a.k.a Smart Band
First of all I will explain the Smart Healthcare Wearable a.k.a Smart Band Programming
The first aspect of building this sample project is adding elements to the Embedded tab to create the project’s embedded firmware. This involves setting an interval to read embedded data, and when to run to read the board’s BME680 element.
Add the following elements to the canvas by clicking them in the Element Toolbox:
Interval element: The interval element sets the project to run at the time set in the element’s properties, which by default is set to once per second (1000 ms).
BME680 element: The BM3680 element reads the temperature, humidity, and pressure data. This is an environmental sensor that is onboard the RSL10-SENSE-GEVK, and its element is imported in the Element Toolbox for RSL-SENSE-GEVK projects by default.
BLE characteristic element: This element creates a GATT characteristic to use in your project and is a coupled element that bridges the project between the Embedded tab and Application tab, meaning it’s included on both tabs.
The interval and BME680 element will work as intended by default, so none of their properties need to be changed. Connect the interval element to the BME680 element. This creates an event between them, which can be seen in either the interval element’s properties or by clicking the connector’s button. The event added is within the Interval
trigger, with the BME680 ability Read Temperature (°C)
. This means that when the interval element is triggered (which is every second), it will read the sensor’s temperature data. Add a BLE characteristic element to the canvas. In the BLE characteristic element’s properties, change the Read Data Type and Write Data Type fields to Floating Point (32-bit)
. This allows the elements to read and write floating-point values that will eventually be sent through them. You’re encouraged to give the elements custom names that represent what they do or what data they are passing through, such as naming it “Temperature". Connect the BME680 element to the BLE characteristic element, which ties the value of the sensor to the Application tab. This creates an event between the two elements in the Temperature Read
trigger, with the ability Set Value
. This sets a value for the project’s interface after it reads the temperature sensor data. That’s all for work in the Embedded tab. To this point, an interval has been set that will run once per second after the project opens, and when run will read the temperature value from the onboard BME680 sensor.
Let's proceed to the Applications tab to create the project’s visual component. Here we’ll create a basic interface, pairing the sensor values sent from the Embedded tab with label elements to display their values on labels inside the mobile app. Click the Application tab to move to the application area of the project. Notice how the Element Toolbox has changed, and that the coupled BLE characteristic elements are displayed on the canvas. Click the button in the Application tab’s toolbar to display the app builder. This area creates a visual interface for your project. By default, this uses the smallest display size supported for an interface (320x560), but you can add an interface size by clicking the button. Use the display size that fits best with your mobile device.
Add the following elements:
Interval element: The interval element sets the project to run at the time set in the element’s properties, which by default is set to once per second (1000 ms).
Label element: The label element displays text on a project’s interface. Notice when the label is added to the canvas, a corresponding interface component is added to the app builder. The label component can be moved around on the interface wherever you like.
Analog meter element: The analog meter element adds a meter to measure value to a project’s interface.
Cloud element: The element enables a project’s data to be sent to the Atmosphere cloud.
Connect the interval element to the BLE characteristic elements. Within the interval element’s trigger properties, set each BLE characteristic’s event ability to Trigger
under the Interval
trigger, which will trigger the BLE characteristic elements every time the interval triggers. Connect the BLE characteristic element carrying the temperature data to the first label element. This creates an event between the two elements of Set Text
under the Read
trigger, which sets the text to the value of the label when the BLE characteristic is read. This correlates the set value from the BLE characteristic element in the Embedded tab to the label on the interface. Within the Set Text event, modify the Text field to "Temperature:" + readData.toFixed(2)
. This argument reads the temperature data and truncates the value to two decimal places. This is all that needs to be done for the project’s interface, simply using three labels to display text values. To this point, an interval has been set that will trigger the BLE characteristic elements once per second, which will display the read temperature values on the interface label. The cloud event element is a coupled element between the Application and Cloud tabs. Connect the BLE characteristic element carrying the temperature data to the cloud event element. This adds the Send Event
event to the BLE characteristic element’s Read
trigger, which sends the set value data to the Atmosphere when the BLE characteristic is read. Connect the BLE element to the Analog meter event and set the ranges and other characteristics if required.
These are the basic things that need to be done for the basic setup inside the Applications tab. but I have added a few more customizations such as adding background images and logos to give credits to certain entities.
Now let's move on to the Cloud tab.
Add the following elements:
Cloud storage element: The cloud storage element is used to persistently store data on the Atmosphere. This is most commonly used alongside the cloud event element to store the embedded data sent to the Atmosphere from a device.
Connect the temperature data cloud event element to the cloud storage element. By default, this creates an event using the Add Data
ability within the cloud event’s Event Received
trigger. This allows Atmosphere to add (and store) data sent to it from the connected cloud event element. Within the Add Data event, modify the Value field to {"Temperature": value}
, which will label the temperature dataset when displayed in the cloud.
That's all folks. We are done with the programming part !! As simple as that. No teeth crunching through hefty nifty codes. This is for lazy folks like me who want to get the best from minimum effort. As for the geeks, you can jump directly to the IDE and play or hack more Thanks for your patience if you followed me so far.
Smart Asset Monitoring
For asset monitoring, we need to use more elements:
In the Embedded tab, add the following:
BHI160 element: The BHI160 element is used to measure acceleration and angular velocity.
Add 4 BLE elements and connect each of them to the BH160 element to read each of the x, y, and z acceleration values with read and write parameters as floating-point type. Configure the fourth BLE element to read the full acceleration cluster values (x,y,z together) using a 3D float vector type for read and write.
In the Application tab, add the following:
Progress bar element: The progress bar element adds a progress bar component to a project’s interface.
Replace the Analog meter with 3 progress meter elements and connect each of the BLE x,y,z elements to their respective progress bar elements. Give appropriate ranges for each of the progress bar element. Add a Cloud Event element and connect the fourth BLE element to it.
In the Cloud tab, connect the new cloud event element to the Cloud storage element to publish the acceleration 3D-vector values to the atmosphere cloud.
The programming for the asset monitoring application is complete. Compile the application and proceed further to the next blog.
Blogs in this series:
Smart Module for Healthcare and Asset Monitoring - Blog #1 [Introduction]
Smart Module for Healthcare and Asset Monitoring - Blog #2 [Kit Unboxing]
Smart Module for Healthcare and Asset Monitoring - Blog #3 [Software Setup 1] --> Current
Smart Module for Healthcare and Asset Monitoring - Blog #4 [Software Setup 2]
Smart Module for Healthcare and Asset Monitoring - Blog #5 [Hardware Setup & Testing]