ThingSpeak

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Channel Configurations

ThingSpeak Channel Access

To read and write to a ThingSpeak™ channel, your application sends requests to the ThingSpeak server, either by issuing HTTP requests or using MATLAB® functions. Each ThingSpeak channel can have up to eight fields of data, in either numeric or alphanumeric format. A channel also has location information and a status update field.

Each channel data entry is stored with a date and timestamp and is assigned a unique entry ID (entry_id). You can retrieve stored data by time or by entry ID.

Use the ThingSpeak API to process numeric data, which includes timescaling, averaging, median, summing, and rounding.

You can create and update a ThingSpeak channel by posting a feed with your API key and data by using HTTP POST. The channel feeds supports JSON, XML, and CSV formats for integration into applications.

Channel Property Settings

Change your channel properties in the Channel Settings tab:

  • Channel ID: Auto-generated ID of your unique channel. Your application uses this ID to read data from the channel. You cannot change its value.

  • Name: Enter a unique name for the ThingSpeak channel.

  • Description: Enter a description of the ThingSpeak channel.

  • Field#: Check the box to enable the field, and enter a field name. Each ThingSpeak channel can have up to eight fields.

  • Metadata: Enter information about channel data, including JSON, XML, or CSV data.

  • Tags: Enter keywords that identify the channel. Separate tags with commas.

  • URL: If you have a website that contains information about your ThingSpeak channel, specify the URL.

  • Elevation: Specify the position of the sensor or thing that collects data in meters. For example, the elevation of the city of London is 35.052.

  • Show Location: Check this box to enable entering device location data on this page. The result is a Google® map with a location pinpoint displayed in the channel view. Even if this box is cleared, you can still read and write latitude and longitude information using the API.

    • Latitude: Specify the position of the sensor or thing that collects data in decimal degrees. For example, the latitude of the city of London is 51.5072.

    • Longitude: Specify the position of the sensor or thing that collects data in decimal degrees. For example, the longitude of the city of London is -0.1275.

  • Show Video: Check the box to include a video display on your channel view, using the following settings:

    • YouTube/Vimeo: Select your video service.

    • Video URL: Specify the full URL for your video.

  • Show Status: Check this box to add a window to your channel view for status updates. For example, this window can show executed commands from a TalkBack App that is configured to log to this channel, or it can show information that you send with an API command using the status parameter as described in Update a Channel Feed.

Related Topics

For alternative ways of setting channel properties, see Update Channel Information.

Private, Shared, and Public Channels

You can select private, public, or shared channel. On the My Channels page, go to the Sharing tab. By default, your channel is private and requires a Read API key to access its feed. A public channel gives other users the ability to use your feed without a Read API key. You can also make a channel shared with specified users. Users who have access to shared channels can see only the private view of a channel; they cannot add channels, see alerts, or see license information.

In both the private and public views, you can use plugins to enable visualization and analysis. You can also choose to display different plugins in each view.

Note

Free users can share a channel with only three other users.

API Keys

When you read or write data to your channel using the ThingSpeak API or MATLAB code, you need the appropriate read and write permissions. The 16-digit API key allows you to read from a private channel and write to a channel. You do not need an API key to read from a public ThingSpeak channel.

Write API Key

Use the Write API key to update a channel. If your Write API key is compromised, you can generate a new key. If you use MATLAB Analysis or MATLAB Visualization, the API info is displayed in the Help pane on the right.

To find your Write API key:

  • Click Channels > My Channels.

  • Select the channel to update.

  • Select API Keys tab.

Read API Key

The Read API key enables your application to read data from the API. You can generate multiple Read API keys for different applications.

To get a Read API key:

  • Click Channels > My Channels.

  • Select the channel to update.

  • Select API Keys tab.

  • Click Generate New Read API Key.

API Endpoints

HTTP API Address

For nonsecure communication to ThingSpeak using HTTP, use the address:

http://api.thingspeak.com

For secure communication to ThingSpeak using HTTPS, use the address:

https://api.thingspeak.com

HTTP API Static IP Address

To communicate with the ThingSpeak HTTP server IP, use the address:

http://184.106.153.149

MQTT API Address

To communicate with the ThingSpeak MQTT broker at the port 1883, use the address:

mqtt.thingspeak.com

Cross-Domain XML

To post using cross-domain XML, use the address:

http://api.thingspeak.com/crossdomain.xml

Channel Access in MATLAB

To read data from a private channel in MATLAB, use the thingSpeakRead function:

thingSpeakRead(channelID,'ReadKey','Your.Read.API.Key.String');
To write data from MATLAB, use the thingSpeakWrite function:
thingSpeakWrite(channelId,data,thingSpeakWrite(17504,[2.3,1.2,3.2],'WriteKey','Your.Write.API.Key.String');

API Rate Limits

A free user can update a ThingSpeak channel every 15 seconds, and a paid user can update every 1 second. Updating more frequently results in an error. The time between read requests is not limited by ThingSpeak for any users. To change settings to meet your application requirements locally, download the source code from GitHub .

API Caching

You can cache data when you transmit it via XML or JSON. Feeds returning more than 100 entries are cached for 5 minutes. This limit improves application performance. The last call or feeds specifying "results=100" or fewer are not cached, enabling production of real-time applications.

Channel Data Import

You can import data from a CSV file directly into a ThingSpeak channel.

To import data into a ThingSpeak channel:

  • Click Channels > My Channels.

  • Select the channel.

  • Select Data Import / Export tab.

  • Choose a file.

  • Click Upload.

Make sure your CSV file is properly formatted with all the relevant field headers defined as:

datetime,field1,field2,field3,field4,field5,field6,field7,field8,latitude,longitude,elevation,status
CSV imports are considered updates and consume messages in the same way as other updates. The CSV file is limited to 259,200 rows. You must send at least the datetime stamp and one field. The datetime stamp can be in these formats:

FormatSampleResult Datetime
Epoch1494878628 (seconds elapsed since 1-1-1970)May 15, 2017 20:03:48 GMT
ISO 86012017-05-15T20:03:48-05:00May 15, 2017 20:03:48 EST
MySQL2017-05-15 20:03:48 UTCMay 15, 2017 20:03:48 EST

If the datetime stamp includes a GMT/UTC offset, ThingSpeak uses this information to import data. If the datetime stamp does not have a GMT/UTC offset, specify a time zone.

Was this topic helpful?