Getting Started with NXP Rapid IoT
This guide teaches you how to get started using the NXP Rapid IoT with Atmosphere. This includes creating your first NXP Rapid IoT project, programming the project’s firmware into the Rapid IoT, registering the device to Atmosphere, and having its data displayed on a dashboard.
This guide demonstrates a simple project that reads the hardware’s ambient light sensor once per second, which displays that information on the Atmosphere IoT app using an analog meter, and sends the data to the cloud.
Prerequisite: You should already have an Atmosphere account.
- NXP Rapid IoT Prototyping Kit
- Tablet or smartphone mobile device
- Atmosphere IoT app. The mobile app allows you to view your registered devices and display and run the project’s interface. You can download the Atmosphere IoT app from its downloads page or through the Apple App Store or Google Play Store.
- Ensure Bluetooth is enabled on the mobile device you’ll use to interact with the Rapid IoT.
Step 1 of 9: Create a New Project
Navigate to Atmosphere Studio from the side menu. When you visit Studio for the first time in a session, you are brought to the Studio Projects screen.
- Click the button. This displays a New Project window.
- Give the project a name. Then select the NXP Rapid IoT project type and click Create.
This opens a new project in Studio.
This guide walks through the step-by-step process to perform actions in Studio, but doesn't cover the in-depth aspects of Studio itself. To learn more about using Studio, its areas and features, and Studio elements, visit the Atmosphere Studio section.
Step 2 of 9: Create the Project’s Embedded Firmware
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 to tell the interval to read the Rapid IoT’s ambient light sensor.
- Add the following elements to the canvas by double-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).
- TSL2572 element: The TSL2572 element reads the hardware’s ambient light sensor data.
- BLE characteristic element: The BLE characteristic element creates a GATT characteristic to use in your project. This element is a coupled element that bridges the project between the Embedded tab and Application tab, meaning it’s included on both tabs.
- Connect the interval element to the TSL2572 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
Intervaltrigger, with the TSL2572 ability
Read Ambient Light. This means that when the interval element is triggered (which is every second), it will read the ambient light sensor’s value.
- Connect the TSL2572 element to the BLE characteristic element, which ties the value of the ambient light sensor to the Application tab. This creates an event between the two elements in the
Ambient Light Readtrigger of
Set Value, which sets a value for the project’s interface after it reads the raw sensor value.
- Select the BLE Characteristic element on the canvas, which displays its properties in the properties panel. Set its Read Data Type property to
Unsigned Integer, so the value it reads is an unsigned integer sent from the TSL2572 element. The element’s other properties may keep their default settings.
That’s all for work in the Embedded tab. To this point, an interval has been set to run once per second after the project opens, and when run will read the ambient light sensor. The Embedded tab’s canvas should resemble the following image:
Step 3 of 9: Create the Project’s Interface
The second aspect of building this sample project is adding elements to the Application tab to create the project’s visual component.
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 element is displayed on the canvas.
- Click the button in the Application tab’s toolbar to display the interface builder. This area creates the 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 an interval element to the canvas, and connect it to the existing BLE characteristic element. This creates the trigger event
Read, which reads the value of the BLE characteristic element sent from the Embedded tab every time the interval triggers.
- Add an analog meter element to the canvas. The analog meter element displays a meter on a project’s interface to measure a value reading. Notice when the analog meter element is added to the canvas, a corresponding interface component is added to the interface builder. Click the analog meter component and move it to the center of the interface. Then in the element’s properties, change its Maximum Value to
- Connect the BLE characteristic element to the analog meter element. This creates an event between the two elements under the
Set Value, which sets the value to the value of the meter when the BLE characteristic is read. Then in the event’s Value field, enter
Read Data. This correlates the data read from the BLE characteristic element in the Embedded tab to set the analog meter’s value on the interface.
- Add a label element to the canvas. The label element displays text on a project’s interface. Click and move the label component on the interface centered above the analog meter component, then change the label’s text in its properties to read “Light Sensor Value.”
This is all that needs to be done for the project’s interface. To this point, an interval has been set that will read the BLE characteristic value once per second, which will display the light sensor value on the analog meter. The Application tab’s canvas and interface should resemble the following images:
Step 4 of 9: Enable the Project’s Cloud Connectivity
The last aspect of building this sample project is enabling it for cloud connectivity. This is done both on the Application tab and Cloud tab.
- While still in the Application tab, add a cloud event element to the canvas. The cloud event element is a coupled element between the Application tab and Cloud tab that enables a project’s data to be sent to Atmosphere.
- Connect the BLE characteristic element to the cloud event element. This adds the
Send Eventevent to the
Readtrigger, which sends the set value data to Atmosphere when the BLE characteristic is read.
- Click the Cloud tab to move to the cloud area of the project. Notice how the Element Toolbox has changed, and that the coupled cloud event element is displayed on the canvas.
- Add a cloud storage element to the canvas, and connect the cloud event element to the cloud storage element. This allows Atmosphere to store data sent to it from the connected cloud event element.
That’s all for creating the project! With the added cloud connectivity, the project will send the light sensor value from the Embedded tab to the Application tab (where it’s displayed on the mobile app’s interface), which then uses a cloud event to send it to the Cloud tab, where it’s connected to a cloud storage element to store the data on Atmosphere.
The final canvas for each tab should resemble the following images:
Step 5 of 9: Compile the Project
Once the project is finished, it needs to be compiled. Compiling readies the entire project’s source code for deployment.
From any tab, click the button in the project options menu on the top-right of the screen. You’ll see a loading graphic on the screen, and will receive a notification when the project is compiled.
Step 6 of 9: Program Firmware into the Rapid IoT
With the project compiled, your Rapid IoT can be programmed with the project’s embedded firmware.
Prior to programming a Rapid IoT, ensure you have the following setup configuration:
- The device is connected to the computer via USB.
- The project to be programmed has been compiled.
- The Rapid IoT is in programming mode.
To put the Rapid IoT into programming mode, perform the following steps:
- Connect the Rapid IoT to the computer via USB.
- Simultaneously hold the top-left and bottom-right side buttons for five seconds until the screen goes black. Continue holding the buttons while the screen goes black.
- The green LED will turn on and start blinking, indicating the device is now in programming mode. The side buttons can be released. While in programming mode, the Rapid IoT displays as a mass storage USB device on your computer.
With setup complete, you can program your Rapid IoT:
- While the Embedded tab is active, click the button from the tab’s toolbar. This downloads a .bin file containing the project’s compiled firmware.
- Locate the downloaded file on your computer, and move it into the Rapid IoT mass storage device. This initiates programming of the Rapid IoT, which is represented by a series of blinking lights on the device.
When the lights stop blinking, programming is complete and the Rapid IoT is programmed with the project’s embedded firmware. The Rapid IoT will reboot itself and no longer display as a mass storage device, and upon startup the project is loaded on the device.
Step 7 of 9: Register the Device
With firmware installed, the Rapid IoT can now be recognized and connected to Atmosphere. From here, open the Atmosphere IoT app on your mobile device. You’ll use the mobile app to both register the device and eventually view the label data on the project’s interface.
To register a device:
- Navigate to the Devices page, and click the button in the top-right to display the Register Devices window. When the window opens it will automatically begin scanning for available devices within range.
- Ensure your Rapid IoT is within range from the device you are attempting to register from, otherwise it may not appear.
- The list of available devices appears. Select the Rapid IoT you just programmed and click Register.
The device is registered to Atmosphere and displayed on your Devices page.
Step 8 of 9: View the Project Interface
Each registered device has its own dedicated dashboard, which displays its information and is where you access the device’s interface to interact with it. Select your newly-registered device on the Devices page to access its dashboard.
The interface created in Studio’s Application tab is available on a device’s dashboard to interact with it. As long as the device is powered on and connected to Atmosphere, it can be interacted with.
To display the interface you created, click the button at the top of the screen. This opens the project interface from within the Atmosphere IoT app.
The project’s interface displays the light sensor’s value on the analog meter, which updates once per second.
Step 9 of 9: View Device Data
Now that the data is sent to Atmosphere, it can be viewed through one of the many device dashboard widgets available. In this guide an data meter widget can be used to display the light sensor’s value on the Dashboard similar to how it’s presented on the mobile app’s interface.
- To add a widget to the device’s dashboard, click the button on the side of the page. This displays the menu of available widgets. Select the data meter widget to add a meter to the dashboard.
- Once on the dashboard, click the widget’s menu icon to display its menu, then click Settings. Then modify the following properties:
- Name: Give the widget a name, such as “Rapid IoT Light Sensor”
- Minimum Value: Set the minimum value to
- Maximum Value: Set the maximum value to
When the widget’s properties are modified, click Save.
Like the analog meter on the app interface, the light sensor value is displayed on the data meter widget.
Congratulations, you just finished a complete NXP Rapid IoT project with Atmosphere!
Now that you’ve created your first NXP Rapid IoT project, you can explore more of the kit’s features, including creating projects that use the device’s display.
If you want to create a project that uses the Rapid IoT's display, visit the NXP Rapid IoT Display Page Guide. This guide provides a complete walkthrough creating a project that uses multiple pages to display sensor data.