WiFi ThingSpeak Write
Publish data to the Internet of Things using WiFi ThingSpeak
Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.
Description
You can publish data from your target hardware to the Internet of Things using ThingSpeak™.
ThingSpeak is “an application platform for the Internet of Things. ThingSpeak allows you to build application around data collected by sensors. Features of ThingSpeak include, real-time data collection, data processing, visualizations, apps, and plugins.”
For more information, search the Help for “Publish/Retrieve Data to Internet of Things using ThingSpeak”.
Supported Hardware
This table lists the properties of the hardware supported by the block.
Target Hardware | Send Limit (Number of Bytes) |
---|---|
ESP8266 | 2048 byte |
Wi-Fi® Shield | 64 bytes |
Arduino® MKR1000, Arduino MKR Wi-Fi 1010, Arduino Nano 33 IoT, Arduino compatible ESP32 – WROOM, Arduino compatible ESP32 – WROVER | 1400 bytes |
Note
When using ESP8266 Wi-Fi hardware, you can use only one ESP8266 supported block in a model.
Parameters
Main
- Channel ID
Get the Channel ID parameter from your channel in ThingSpeak.com.
After creating a ThingSpeak channel for your target hardware:
In the ThingSpeak.com website, select Channels > My Channels.
Under the channel that you created for this target hardware, click Settings.
Click the Channel Settings tab and copy the Channel ID.
Open the WiFi ThingSpeak Write block in your model and paste the value into the Channel ID parameter.
- Write API key
Get the key for this parameter from the Write API Key parameter in ThingSpeak.com.
After creating a ThingSpeak channel for your target hardware:
In the thingspeak.com website, select Channels > My Channels.
Under the channel that you created for this target hardware, click Settings.
Click the API Keys tab.
Copy the key from Write API Key parameter.
Open the WiFi ThingSpeak Write block in your model and paste the copied API key into theWrite API key parameter.
- Number of variables to send
Set the number of variables to send.
The default value is
1
.- Update interval
Set the number of seconds to wait between sending the data.
The default value is
60
seconds.- Print diagnostic messages
Enable getting ThingSpeak server response data and sending it to the standard output device. Open any serial terminal, such as serial monitor of Arduino IDE, on your computer to view the data that is being written to ThingSpeak.
Optional
- Send location information
When this parameter is set to:
Input port
, specify the location using a signal that is connected to the location block input.Block dialog
, specify the location using the Location (latitude, longitude, altitude) parameter.In both cases, specify the location as a cell array of three elements:
[
latitude
,longitude
,altitude
]Use decimal degrees notation to specify latitude and longitude. Use meters to specify altitude. For example:
The lowest human-sized point underground, the TauTona Mine in Carletonville, South Africa:
[-26.416111,27.4275,-3900]
The highest point measured from sea level, the summit of Mount Everest in Nepal:
[27.988056,86.925278,8848]
- Location (latitude, longitude, altitude)
Setting the Send location information parameter to
Block dialog
displays this parameter.Specify the location as a cell array of three elements:
[
latitude
,longitude
,altitude
]