Mbed OS is designed to be an IoT stack within a small footprint. You can collect a lot of information from devices when working in the Mbed OS environment. You can then deliver the collected data to Arm Treasure Data Service, which performs data management as part of the Arm Pellion IoT platform.
You’ll need to determine the architecture that best supports your IoT implementation with Mbed OS and Arm Treasure Data. The following illustrations show typical architecture examples.
In this article, you are shown how to use an example program to connect a Mbed device with HTTP directly to Treasure Data using a Wifi connection.
The project page is here: https://os.mbed.com/users/JunkoNakajima/code/mbed-os-example-td-rest-online-compiler/
The program is tested on STM32L475.
- Treasure Data Account (contact us if you have an interest in IoT Platform)
- Mbed Account - (Sign-up if you don’t have an account)
- Mbed OS Device (for example, STM32L475)
Build Project on Mbed Cloud
Let's build the example project.
Select a Platform
First, choose your device on Online Compiler. Visit your Mbed Cloud portal and click “Compiler”. On your workspace, click no device selected (at the initial), and then click “Add Board‘.
In this example, search “STM32L475” on the window. You’ll see the following board. Then, click “Add to your Mbed Complier”. https://os.mbed.com/platforms/ST-Discovery-L475E-IOT01A/
Now, you can select the board as a platform on your online compiler.
Next, import the example project into your workspace. Visit the mbed Os example page, as shown in the following image, and click Import into Compiler. The program is then imported into your online compiler.
You must set three parameters (wifi-ssid and wifi-password, and api-key). Set the parameters in the mbed_app.json file, which is one of the imported files.
- wifi-ssid: Your Wifi SSID
- wifi-password: Your Wifi Password
- api-key: Your Treasure Data Account (See here)
Then, edit Database, Table in TreasureData_RESTAPI function on main.cpp.
Ensure your Mbed OS device is connected (via WIFI) to your PC. Use STLINK connector for the connection. (You can see a connector on the lower right of the board in the first image in this article.)
Compile your application, and copy the .bin file to your target board, the board that you previously selected as your platform.
To launch the application, physically push the reset button on your circuit board.
You can see records, delivered from your Mbed OS device, in Arm Treasure Data!