Main Content

Publish or Retrieve Data to Internet of Things Using ThingSpeak

You can publish or retrieve data on your hardware board, such as sensor data, to the Internet of Things using ThingSpeak™ Write or from the Internet of Things using ThingSpeak Read block.

For more information about how to use ThingSpeak, visit their Apps, Plugins, or Tutorials topics.

Set Up Model and ThingSpeak

  1. Configure your Simulink® model to run on the target hardware.

  2. Add a ThingSpeak Write or ThingSpeak Read block to the model.

  3. (Optional) Open the ThingSpeak Write or ThingSpeak Read block and configure its parameters.

  4. Connect signals from your model to the block input on the ThingSpeak Write block or block output on the ThingSpeak Read block.

  5. Sign up for an account at https://thingspeak.com/ and log in.

  6. Click Create New Channel.

  7. Update the channel’s name and fields for the data you are publishing.

  8. Click Update Channel.

Update and Deploy Model

  1. Click the API Keys tab and copy the Write API Key/Read API Key.

  2. In the ThingSpeak Write or ThingSpeak Read block, paste the key into the Write API key/Read API Key parameter.

  3. Save your changes to the model.

  4. On the Hardware tab of the Simulink model, in the Mode section, select Run on board, and then click Build, Deploy & Start.

    After several minutes, the model application starts running on the target hardware.

  5. On ThingSpeak.com, click the Private View tab or, if enabled, the Public View tab.

    The view displays the data that your target hardware is publishing to ThingSpeak.