Getting Started with SensorTile

This guide teaches you how to get started using Atmosphere with the SensorTile. This includes creating your first project, programming the project’s firmware into your SensorTile, registering the device to Atmosphere, and having its data displayed on a dashboard.

This guide demonstrates a simple project that reads the SensorTile’s temperature sensor once per second, which displays that information on the Atmosphere IoT app using a label, and sends the data to the cloud.

Prerequisite: You should already have an Atmosphere account.

Hardware Requirements

  • SensorTile
  • ST Nucleo board or other ST-LINK programmer.
  • Tablet or smartphone mobile device

The Nucleo board (or ST-LINK device) is needed to program the SensorTile. To learn more about the programming setup for the SensorTile, visit Programming SensorTile.

Software Requirements

  • 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.
  • Atmosphere IoT Agent. The Atmosphere IoT Agent is a local application that runs in the system tray and acts as an intermediary between the computer’s connectivity protocol drivers and the browser running Atmosphere, used to assist in programming your device. You can download the Atmosphere IoT agent from its downloads page.
  • Ensure Bluetooth is enabled on the mobile device you’ll use to interact with the SensorTile.

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.

  1. Click the New Project button. This displays a New Project window.
  2. Select the SensorTile project type and give the project a name, then click Create.

This opens a new SensorTile 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 temperature data via the board’s LSM303AGR sensor, and the sensor will send the data to a BLE characteristic.

  1. Add the following elements to the canvas by double-clicking them in the Element Toolbox:
    • Interval Element 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).
    • LSM303AGR Element LSM303AGR element: The LSM303AGR element is an onboard sensor that reads acceleration, magnetic forces, and temperature. In this project we’re going to have it read temperature.

      Each of the elements will work as intended by default, so none of their properties need to be changed.
  2. Connect the interval element to the LSM303AGR element. This creates an event between them, which can be seen in either the interval element’s properties, or by clicking the connector’s Configuration Button button. Within the Interval trigger’s event, modify the LSM303AGR’s ability to Read Temperature. This means that when the interval element is triggered (which is every second), it will read the temperature from the LSM303AGR sensor.
  3. Add a BLE Characteristic Element BLE characteristic element to the canvas, which 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. Select the BLE characteristic element, and change the Read Data Type field to Floating Point (32-bit). This enables the element to read a floating point integer, which is what the temperature value from the LSM303AGR is.
  4. Connect the LSM303AGR element to the BLE characteristic element, which ties the value of the temperature to the Application tab. Select the connector between them, then within the Temperature Read trigger, add an event. By default this adds a Set Value ability, which sets a value for the project’s interface after it reads the temperature value.

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 temperature data from the LSM303AGR element. The Embedded tab’s canvas should resemble the following image:

SensorTile Embedded Tab

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.

  1. Click the App Builder button in the Application tab’s toolbar to display the app 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 add display button. Use the display size that fits best with your mobile device.
  2. Add an Interval Element interval element to the canvas, and connect it to the existing BLE characteristic element. Select the connector between them, and within the Interval trigger’s event, modify the ability to Read. This reads the value of the BLE characteristic element sent from the Embedded tab every time the interval triggers.
  3. Add a Label Element label element to the canvas. 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.
  4. Connect the BLE characteristic element to the label element. This creates an event between the two elements of Set Text under the Read trigger, which sets the text on the label to the value 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.

This is all that needs to be done for the project’s interface, simply using a label to display the temperature value. To this point, an interval has been set that will read the BLE characteristic value once per second, which will display the temperature value on the interface label. The Application tab’s canvas should resemble the following image:

SensorTile Application Tab

Step 4 of 9: Enable the Project’s Cloud Connectivity

The third aspect of building this sample project is enabling it for cloud connectivity. This is done on both the Application tab and Cloud tab.

  1. While still in the Application tab, add a Cloud Event Element 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.
  2. Connect the BLE characteristic element to the cloud event element. This adds the Send Event event to the Read trigger, which sends the set value data to Atmosphere when the BLE characteristic is read.
  3. 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.
  4. Add a Cloud Storage Element 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 temperature value from the Embedded tab to Application tab, 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:

Embedded Application Cloud
SensorTile Embedded Tab SensorTile Application Tab SensorTile Cloud Tab

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.

  1. From any tab, click the Compile 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 Device

With the project compiled, your SensorTile can be programmed with the project’s embedded firmware.

In order to program a SensorTile, ensure you have the following initial setup configuration:

  • Connect a 5-pin ST-LINK header to the SWD pins of the SensorTile cradle and the SWD pins on ST-LINK.

If you're using an ST Nucleo board, remove the two jumpers on CN2. This will disconnect the ST-LINK on the Nucleo board from the rest of the Nucleo board, allowing it to connect to the SensorTile cradle. For further information and pictures detailing programming the SensorTile, visit the official SensorTile User Guide (Page 18).

With initial configuration of the SensorTile ready, ensure you have the remaining setup configuration requirements completed:

  • The SensorTile is connected to the computer via USB to an available communication port.
  • The Atmosphere IoT Agent is installed on the computer and running.
  • An Internet connection is maintained.

With setup complete, you can program your board:

  1. While the Embedded tab is active, click the Program Firmware button from the tab’s toolbar. This displays the Program Firmware window.
  2. Under Device Port, select the communication port the device is connected to.
  3. Click Program to start programming. When complete, you’ll receive a notification stating the device is programmed with the project’s embedded firmware.

Step 7 of 9: Register the Device

With firmware programmed, the SensorTile can now be recognized and connected to Atmosphere. From here, open the Atmosphere IoT app on your mobile device. We’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:

  1. Navigate to the Devices page in the app and click the Register Device 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 SensorTile is within range of the mobile device you are attempting to register from, otherwise it may not appear.
  2. The list of available devices appears. Select your device 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 Interface button at the top of the screen. This opens the project interface from within the Atmosphere IoT app.

The project’s interface displays the temperature value, which updates once per second.

Step 9 of 9: View Device Data

Now that the device’s data is sent to Atmosphere, let’s view it through one of the many device dashboard widgets available. In this guide we’ll use a data glance to chart the ADC reading.

  1. To add a widget to the device’s dashboard, click the Configuration button on the side of the page. This displays the menu of available widgets. Select the Data Glance data glance widget to add a data glance to the dashboard.
  2. Once on the dashboard, click the widget’s Menu menu icon to display its menu, then click Settings.
  3. Give the data glance a name, and then select its unit of measurement, an icon to represent what it’s for, and choose the data value to view. When finished, click Save.

This populates the data glance widget on the dashboard, which displays the value of the temperature and updates it once per second.

Congratulations, you just finished a complete SensorTile project with Atmosphere!