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.


Use the MQTT API to update ThingSpeak™ channels

ThingSpeak, an IoT platform, enables clients to update a channel feed by publishing messages to the ThingSpeak MQTT broker. MQTT is a publish/subscribe model that runs over TCP/IP sockets or WebSockets. MQTT over WebSockets can be secured with SSL. A client device connects to the MQTT broker and can publish to a channel. ThingSpeak supports only publishing to channels using MQTT.

In order to use the MQTT API, you need to have an understanding of MQTT Basics, along with the knowledge of the MQTT library that you use.

MQTT API Functions

Publish to a Channel Feed Publish message to update multiple channel fields simultaneously
Publish to a Channel Field Feed Publish message to update single channel field

Examples and How To

Use Arduino Client to Publish to a Channel

Publish data to a ThingSpeak channel using an Arduino® device.

Use Desktop MQTT Client to Publish to a Channel

Publish to a channel using desktop MQTT client such as MQTT.fx.

Use Particle Photon Client to Publish to a Channel

Publish data to a ThingSpeak channel using a Particle Photon device.

Use Raspberry Pi board that runs Python WebSockets to Publish to a Channel

Publish data using WebSockets to a ThingSpeak channel.


MQTT Basics

Learn about the publish/subscribe architecture for connecting bandwidth and power-constrained devices over wireless networks.

MQTT Client Configuration

Learn how to setup an MQTT client to communicate with the ThingSpeak MQTT broker.

Choose Between REST API and MQTT API

Learn when to use REST and MQTT to update a channel.


MQTT Error Messages

See the list of MQTT error messages.

Was this topic helpful?