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.

Use Desktop MQTT Client to Publish to a Channel

This example shows how to use a desktop MQTT client such as MQTT.fx, which is a JavaFX based MQTT client, to publish to a channel. You can choose to publish multiple values to a channel feed if you have more than one sensor value that you want to send to ThingSpeak™. Alternatively, you can publish a single value to a channel field if you have only one sensor.

  1. Create a new channel, as shown in Collect Data in a New Channel.

  2. Download and install MQTT.fx.

  3. Configure the connection profile for the desktop MQTT client.

  4. Click Connect to connect to the ThingSpeak MQTT broker.

  5. Enter the topic channels/<channelID>/publish/<apikey> to publish data to a channel feed.

    Replace <channelID> with the channel ID and <apikey> with the write API key of the channel. Enter the message to publish to the channel feed. This PUBLISH message publishes a value of 45 to field 1 and 60 to field 2 of the specified channel, along with a status message MQTTPUBLISH.

    Alternatively, you can enter the topic channels/<channelID>/publish/fields/field<fieldnumber>/<apikey> to publish to a channel field.

    Replace <channelID> with the channel ID, <fieldnumber> with field number that want to update, and <apikey> with the write API key of the channel. Enter the message to publish to the channel field. This PUBLISH message publishes a value of 45 to field 1 of the specified channel.

See Also

|

Related Examples

More About

Was this topic helpful?