GroveStreams STMicroelectronics STM32F746 Discovery - Quick Start

This tutorial walks through the creation of a GroveStreams user account, an organization, and the programming of an STMicroelectronics STM32F746 Discovery board to upload temperature and voltage readings into GroveStreams every 20 seconds.

Sample code for this tutorial can be found here: https://developer.mbed.org/teams/GroveStreams/code/GroveStreams-Simple


STMicroelectronics - GroveStreams

STMicroelectronics - GroveStreams


Step 1: Create a Free GroveStreams User Account and Organization

Open a browser and navigate to the GroveStreams registration page and sign up:
GroveStreams - Create User Account

Log into GroveStreams after creating your free user account.

You will be prompted to create an organization. Select Yes:
GroveStreams - Create Organization


What's an Organization?
An organization is a Workspace, typically representing a home, business, or organization. Each organization has its own set of components, streams, dashboards, maps, and other items. An organization allows you to control user and device access to the organization. You are automatically the "owner" and given full access rights when you create an organization. Other users may invite you to their organizations with rights they give you. All of the organizations, you "own" or are a member of, will appear in your GroveStreams start page (the first page that appears when you sign in).


Enter a name for the new organization. It can be any name. Click Create Organization:
GroveStreams - Create Organization

Enter your new organization by clicking on its name:
GroveStreams - Create Organization


Step 2: Setup the Free ARM mbed Online IDE

Attach the board to the network via the CAT5 connector. Ensure the network has DNS capabilities and can reach the grovestreams.com website.

Plug the board into your computer via the micro USB. We used a Linux box running Ubuntu, but this tutorial will also work with Windows computers according to STM's documentation.

This board supports a wide range of IDEs. For this example we will use the free ARM mbed online IDE which is compatible with the STM32F746G-DISCO. The IDE requires a user account:
STMicroelectronics GroveStreams Register
1. Create a user account at mbed here.
2. Click on the Compiler button after the account has been created and confirmed.


Set the board within the compiler:
STMicroelectronics GroveStreams Register
1. Click No device is selected


STMicroelectronics GroveStreams Register
1. Click Add Platform


STMicroelectronics GroveStreams Register
1. Find and click on the DISCO-F746NG


STMicroelectronics GroveStreams Register
1. Select DISCO-F746NG
2. Click "Select Platform"


Step 3: Program the STM32F746

The mbed online compiler allows projects to be published for anyone to use. We've published this example. It can be inserted into your IDE:
STMicroelectronics GroveStreams Register
1. Right click on Projects and select Import Program - From URL
2. Source URL: https://developer.mbed.org/teams/GroveStreams/code/GroveStreams-Simple/
3. Enable Update
4. Click Import


Your Project should look like this:
STMicroelectronics GroveStreams Register
1. Double click main.cpp
2. Set the gsApiKey variable in your sketch to match your GroveStreams organization Secret API Key.

GroveStreams - API Key

To find your Secret API Key:
1. Select the Admin - API Keys menu option and choose the Feed Put API Key (with auto-registration and request stream rights) key
2. Click View Secret Key
3. Select and copy the API Secret Key to the clipboard (Ctrl-c) and paste it into your sketch (Ctrl-v) replacing the existing gsApiKey value.


STMicroelectronics GroveStreams Compile
1. Click Compile


STMicroelectronics GroveStreams Save Compiled
1. Save the compiled image onto the device by selecting the USB drive. The image may be saved automatically into your browser's download directory if you are not prompted for a save location.

The newly compiled image is automatically installed and ran by the board when it is saved onto the board's root directory.


Congratulations! You have successfully pushed data from and STMicroelectronics board that pushes measurements into GroveStreams.


Your data will arrive within 20 seconds as a data stream under a newly created component in Observation Studio:
STMicroelectronics GroveStreams Stream
1. The notification button will indicate if you have any notifications. Some notifications report errors. Check for any notifications that may contain any upload errors.
2. Select the Components folder.
3. Click the Refresh button.
4. Your new component will appear under the Components folder.
5. Select a Stream
6. Your latest measurements will appear within the Quick View panel. The Quick View panel will display No Data if no measurements have been uploaded.


Double click a stream to explore or edit historical values. Click on the Dashboards tab to create dashboards and maps. Right click on the component and choose Edit Component to set your component's location, add stream units, create events with notifications, and change other properties. Keep exploring and learning!

Continue with the GroveStreams Temperature Example to learn more about how to make the most of your data with GroveStreams.

How it Works

The board passed up data using three keys: The api_key, the componentID, and the streamID. The api_key told GroveStreams the security rights for the call and which organization to push the data into. GroveStreams detected that a component did not exist with the included component ID (the component ID is the board's MAC address) the first time the board pushed data to GroveStreams. GroveStreams then created a new component and placed the sample data within a stream. It used the current time on the GroveStreams server for the sample time since a time was not passsed up with the sample.

This example was made simple by allowing GroveStreams to create a default component with a default stream. GroveStreams will do its best to determine if the stream type is a number, text, or boolean based on the first sample arriving. Users can view or modify existing component definitions by right clicking on them and selecting Edit Component. Modify any component attributes except the component and stream IDs. Consider using component templates to avoid having to edit every component after it registers.

Troubleshooting

Successful API calls to GroveStreams should return a status of: HTTP/1.1 200 OK.

If the call made it to a GroveStreams server, but an error still occurred, a GroveStreams system notification will be created that contains the error. While in the GroveStreams organization's Observation Studio, click on the Notifications button located in the top toolbar (It looks like an envelope) and select the System tab. Click Refresh to list new notifications.

Ensure you are not using the same API Secret Key for different organizations. API Secret Keys are only associated with the organization they have been created within and can only be used for that organization.

Having problems or you wish to modify the solution and are not sure what to do?

Post a question on our forum or send us an email and we'll do our best to help you out: support@grovestreams.com


Helpful Links

GroveStreams Temperature Example
GroveStreams Help Center
GroveStreams Simple Feed PUT API
GroveStreams Forum
ARM mbed Free Online IDE
ARM mbed DISCO-F746NG