<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MQTT &#8211; About Things | A Hans Scharler Blog</title>
	<atom:link href="https://nothans.com/tag/mqtt/feed" rel="self" type="application/rss+xml" />
	<link>https://nothans.com</link>
	<description>Life, Comedy, Games, Tech, Marketing, and Community</description>
	<lastBuildDate>Sun, 21 Apr 2024 16:10:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/nothans.com/wp-content/uploads/2023/02/cropped-settings.png?fit=32%2C32&#038;ssl=1</url>
	<title>MQTT &#8211; About Things | A Hans Scharler Blog</title>
	<link>https://nothans.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">114568856</site>	<item>
		<title>Real-time Colors on CheerLights</title>
		<link>https://nothans.com/real-time-colors-on-cheerlights</link>
					<comments>https://nothans.com/real-time-colors-on-cheerlights#comments</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Thu, 27 Jun 2019 14:36:21 +0000</pubDate>
				<category><![CDATA[CheerLights]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[ThingSpeak]]></category>
		<category><![CDATA[cheerlights]]></category>
		<category><![CDATA[internet of things]]></category>
		<category><![CDATA[iot]]></category>
		<category><![CDATA[MQTT]]></category>
		<category><![CDATA[projects]]></category>
		<guid isPermaLink="false">http://nothans.com/?p=1311</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<p><a href="https://cheerlights.com">CheerLights</a> now supports the MQTT protocol. This means that devices and apps can receive real-time updates to changes in the CheerLights color without polling for the latest color.</p>
<p><a href="https://cheerlights.com/cheerlights-now-supports-mqtt/"><img data-recalc-dims="1" fetchpriority="high" decoding="async" data-attachment-id="1313" data-permalink="https://nothans.com/real-time-colors-on-cheerlights/mqtt_cheerlights_topic" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/MQTT_CheerLights_topic.png?fit=400%2C340&amp;ssl=1" data-orig-size="400,340" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="CheerLights MQTT" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/MQTT_CheerLights_topic.png?fit=300%2C255&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/MQTT_CheerLights_topic.png?fit=400%2C340&amp;ssl=1" class="aligncenter size-full wp-image-1313" src="https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/MQTT_CheerLights_topic.png?resize=400%2C340" alt="" width="400" height="340" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/MQTT_CheerLights_topic.png?w=400&amp;ssl=1 400w, https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/MQTT_CheerLights_topic.png?resize=300%2C255&amp;ssl=1 300w" sizes="(max-width: 400px) 100vw, 400px" /></a></p>
<h3>How to use MQTT</h3>
<p>Connect your device to <strong>mqtt.cheerlights.com:1883</strong> and subscribe to the &#8220;<strong>cheerlights</strong>&#8221; topic. When the CheerLights color changes, the color name will be streamed to your device. You no longer have to poll for the latest CheerLights color on the ThingSpeak API.</p>
<p>Here are the valid color names:</p>
<ul>
<li><strong>red&nbsp;</strong>(#FF0000)</li>
<li><strong>green&nbsp;</strong>(#008000)</li>
<li><strong>blue&nbsp;</strong>(#0000FF)</li>
<li><strong>cyan&nbsp;</strong>(#00FFFF)</li>
<li><strong>white&nbsp;</strong>(#FFFFFF)</li>
<li><strong>oldlace&nbsp;</strong>/ warmwhite&nbsp;(#FDF5E6)</li>
<li><strong>purple&nbsp;</strong>(#800080)</li>
<li><strong>magenta&nbsp;</strong>(#FF00FF)</li>
<li><strong>yellow&nbsp;</strong>(#FFFF00)</li>
<li><strong>orange&nbsp;</strong>(#FFA500)</li>
<li><strong>pink</strong>&nbsp;(#FFC0CB)</li>
</ul>
<p>Check out the <a href="https://cheerlights.com/cheerlights-api/">CheerLights API documentation</a> for more detail.</p>
<h3>Star Wars R2D2 Lamp on Twitch</h3>
<p>This news is just in time for an R2D2 Lamp live streaming on <a href="https://cheerlights.com/r2d2-cheerlights-lamp-streaming-on-twitch/">Twitch</a>.</p>
<p><a href="https://cheerlights.com/r2d2-cheerlights-lamp-streaming-on-twitch/"><img data-recalc-dims="1" decoding="async" data-attachment-id="1312" data-permalink="https://nothans.com/real-time-colors-on-cheerlights/r2d2_lamp" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/R2D2_Lamp.jpg?fit=640%2C480&amp;ssl=1" data-orig-size="640,480" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Star Wars R2D2 CheerLights Lamp" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/R2D2_Lamp.jpg?fit=300%2C225&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/R2D2_Lamp.jpg?fit=640%2C480&amp;ssl=1" class="aligncenter size-full wp-image-1312" src="https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/R2D2_Lamp.jpg?resize=640%2C480" alt="" width="640" height="480" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/R2D2_Lamp.jpg?w=640&amp;ssl=1 640w, https://i0.wp.com/nothans.com/wp-content/uploads/2019/06/R2D2_Lamp.jpg?resize=300%2C225&amp;ssl=1 300w" sizes="(max-width: 640px) 100vw, 640px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/real-time-colors-on-cheerlights/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1311</post-id>	</item>
		<item>
		<title>Use the New MQTT Service from ThingSpeak for Real-time CheerLights Updates</title>
		<link>https://nothans.com/use-the-new-mqtt-service-from-thingspeak-for-real-time-cheerlights-updates</link>
					<comments>https://nothans.com/use-the-new-mqtt-service-from-thingspeak-for-real-time-cheerlights-updates#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Sun, 10 Dec 2017 20:19:06 +0000</pubDate>
				<category><![CDATA[CheerLights]]></category>
		<category><![CDATA[ThingSpeak]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[cheerlights]]></category>
		<category><![CDATA[internet of things]]></category>
		<category><![CDATA[iot]]></category>
		<category><![CDATA[MQTT]]></category>
		<category><![CDATA[particle]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[web of things]]></category>
		<guid isPermaLink="false">http://nothans.com/?p=1147</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<p>It&#8217;s that time again. That time when people all across the world synchronize their lights together with <a href="http://cheerlights.com">CheerLights</a>! People have <a href="https://twitter.com/search?f=images&amp;vertical=default&amp;q=cheerlights">built</a> amazing CheerLights displays. I have seen everything from color-changing shoes to snowmen&#8230; and trees.</p>
<p><a href="http://cheerlights.com"><img data-recalc-dims="1" decoding="async" data-attachment-id="1148" data-permalink="https://nothans.com/use-the-new-mqtt-service-from-thingspeak-for-real-time-cheerlights-updates/cheerlights_2017" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/12/CheerLights_2017.gif?fit=609%2C609&amp;ssl=1" data-orig-size="609,609" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="CheerLights 2017" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/12/CheerLights_2017.gif?fit=300%2C300&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/12/CheerLights_2017.gif?fit=609%2C609&amp;ssl=1" class="aligncenter size-full wp-image-1148" src="https://i0.wp.com/nothans.com/wp-content/uploads/2017/12/CheerLights_2017.gif?resize=609%2C609" alt="" width="609" height="609"></a></p>
<p>&nbsp;</p>
<h3>CheerLights Introduction</h3>
<p>Here&#8217;s a&nbsp;quick&nbsp;introduction to the CheerLights project for those who are new to the project. Imagine 1000&#8217;s of multicolored lights all around the world synchronized to one color. When one of the lights turns red, they all turn red. To control CheerLights, send a tweet to&nbsp;<a title="Follow CheerLights on Twitter" href="http://twitter.com/cheerlights" target="_blank" rel="noopener">@cheerlights</a>&nbsp;or include “cheerlights” somewhere in your message with the name of a color.&nbsp;This will cause a chain reaction and all of the CheerLights displays and apps will change their color to red.</p>
<p><iframe loading="lazy" class="youtube-player" width="750" height="422" src="https://www.youtube.com/embed/7eCgA4oEN6g?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent" allowfullscreen="true" style="border:0;" sandbox="allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox"></iframe></p>
<p>&nbsp;</p>
<h3>ThingSpeak MQTT Service</h3>
<p>CheersLights is powered by <a href="https://thingspeak.com/channels/1417">ThingSpeak IoT</a>. And, this year, I am happy to introduce real-time CheerLights updates using ThingSpeak&#8217;s new <a href="https://blogs.mathworks.com/iot/2017/11/10/subscribe-to-thingspeak-iot-data-using-mqtt/">MQTT</a> service. Using the MQTT service by ThingSpeak, your CheerLights change instantly. ThingSpeak has posted an <a href="https://www.mathworks.com/help/thingspeak/use-particle-photon-client-to-subscribe-to-channel-updates.html">example</a> that gets a Particle Photon connected to CheerLights using MQTT. The&nbsp;<a href="https://www.mathworks.com/help/thingspeak/use-particle-photon-client-to-subscribe-to-channel-updates.html">Subscribe to Channel Updates Using Particle Photon Client</a> example shows&nbsp;you how to use a Particle Photon Wi-Fi board to subscribe to channel updates from the CheerLights <a href="https://thingspeak.com/channels/1417">channel</a>. The program displays the color read from the channel on the built-in LED on the Photon board. You can subscribe to the channel feed or directly to the color field on the CheerLights channel.</p>
<p>Once you learn how to use the MQTT service from ThingSpeak, you can easily adapt it to your IoT project. This is a&nbsp;great way&nbsp;to have real-time control of a device or real-time monitoring of sensors.</p>
<p><a href="https://www.mathworks.com/help/thingspeak/mqtt-api.html"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="1149" data-permalink="https://nothans.com/use-the-new-mqtt-service-from-thingspeak-for-real-time-cheerlights-updates/thingspeak_mqtt_subscribe" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/12/thingspeak_mqtt_subscribe.png?fit=552%2C432&amp;ssl=1" data-orig-size="552,432" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ThingSpeak MQTT Subscribe" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/12/thingspeak_mqtt_subscribe.png?fit=300%2C235&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/12/thingspeak_mqtt_subscribe.png?fit=552%2C432&amp;ssl=1" class="aligncenter size-full wp-image-1149" src="https://i0.wp.com/nothans.com/wp-content/uploads/2017/12/thingspeak_mqtt_subscribe.png?resize=552%2C432" alt="" width="552" height="432" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2017/12/thingspeak_mqtt_subscribe.png?w=552&amp;ssl=1 552w, https://i0.wp.com/nothans.com/wp-content/uploads/2017/12/thingspeak_mqtt_subscribe.png?resize=300%2C235&amp;ssl=1 300w" sizes="auto, (max-width: 552px) 100vw, 552px" /></a></p>
<p><strong>If you want to follow the project and see what others are building, visit <a href="http://cheerlights.com">CheerLights.com</a> or follow on <a href="https://twitter.com/search?q=cheerlights">Twitter</a>.</strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/use-the-new-mqtt-service-from-thingspeak-for-real-time-cheerlights-updates/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1147</post-id>	</item>
		<item>
		<title>Learn How to Use MQTT.fx with ThingSpeak</title>
		<link>https://nothans.com/learn-how-to-use-mqtt-fx-with-thingspeak</link>
					<comments>https://nothans.com/learn-how-to-use-mqtt-fx-with-thingspeak#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Mon, 23 Jan 2017 15:47:22 +0000</pubDate>
				<category><![CDATA[ThingSpeak]]></category>
		<category><![CDATA[internet of things]]></category>
		<category><![CDATA[iot]]></category>
		<category><![CDATA[MQTT]]></category>
		<category><![CDATA[thingspeak]]></category>
		<guid isPermaLink="false">http://nothans.com/?p=1017</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<p><a href="https://thingspeak.com">ThingSpeak</a> just <a href="http://blogs.mathworks.com/iot/2017/01/20/use-mqtt-to-send-iot-data-to-thingspeak/">announced</a> that they added MQTT as a way to send data to a ThingSpeak channel. This is great news since a lot of devices support MQTT. If you don&#8217;t have a device, but want to try out the MQTT protocol with ThingSpeak, you can use a desktop application called <a href="http://mqttfx.jfx4ee.org/">MQTT.fx</a>. In this example, I am going to explain how to use MQTT.fx to send data to a ThingSpeak channel.</p>
<p><a href="https://www.mathworks.com/help/thingspeak/mqtt-api.html"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="1018" data-permalink="https://nothans.com/learn-how-to-use-mqtt-fx-with-thingspeak/thingspeak_mqtt_broker" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/ThingSpeak_MQTT_Broker.png?fit=530%2C275&amp;ssl=1" data-orig-size="530,275" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ThingSpeak MQTT Broker" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/ThingSpeak_MQTT_Broker.png?fit=300%2C156&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/ThingSpeak_MQTT_Broker.png?fit=530%2C275&amp;ssl=1" class="aligncenter size-full wp-image-1018" src="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/ThingSpeak_MQTT_Broker.png?resize=530%2C275" alt="ThingSpeak MQTT Broker" width="530" height="275" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/ThingSpeak_MQTT_Broker.png?w=530&amp;ssl=1 530w, https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/ThingSpeak_MQTT_Broker.png?resize=300%2C156&amp;ssl=1 300w" sizes="auto, (max-width: 530px) 100vw, 530px" /></a></p>
<h3>Setup ThingSpeak</h3>
<ul>
<li><a href="https://thingspeak.com/users/sign_up">Sign up</a> for ThingSpeak (or <a href="https://thingspeak.com/login">log in</a> if you have an account)</li>
<li>Create a new <a href="https://thingspeak.com/channels">channel</a></li>
<li>Note the <strong>Channel ID</strong> and <strong>Write API Key</strong></li>
</ul>
<h3>Setup MQTT.fx</h3>
<ul>
<li>Download and install <a href="http://www.jensd.de/apps/mqttfx/1.1.0" target="_top">MQTT.fx</a>.</li>
<li>Configure the connection profile for the desktop MQTT client.
<ul>
<li>Broker Address: mqtt.thingspeak.com</li>
<li>Broker Port: 1883</li>
</ul>
</li>
</ul>
<p><a href="https://www.mathworks.com/help/thingspeak/use-desktop-mqtt-client-to-publish-to-a-channel.html"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="1019" data-permalink="https://nothans.com/learn-how-to-use-mqtt-fx-with-thingspeak/mqttdesktop" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop.png?fit=908%2C698&amp;ssl=1" data-orig-size="908,698" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="MQTT.fx Screenshot" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop.png?fit=300%2C231&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop.png?fit=750%2C577&amp;ssl=1" class="aligncenter size-full wp-image-1019" src="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop.png?resize=750%2C577" alt="MQTT.fx Screenshot" width="750" height="577" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop.png?w=908&amp;ssl=1 908w, https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop.png?resize=300%2C231&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop.png?resize=768%2C590&amp;ssl=1 768w" sizes="auto, (max-width: 750px) 100vw, 750px" /></a></p>
<ul>
<li>Click <b>Connect</b> to connect to the ThingSpeak MQTT broker.</li>
</ul>
<p><a href="https://www.mathworks.com/help/thingspeak/use-desktop-mqtt-client-to-publish-to-a-channel.html"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="1020" data-permalink="https://nothans.com/learn-how-to-use-mqtt-fx-with-thingspeak/mqttdesktop02" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop02.png?fit=487%2C118&amp;ssl=1" data-orig-size="487,118" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="mqttdesktop02" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop02.png?fit=300%2C73&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop02.png?fit=487%2C118&amp;ssl=1" class="aligncenter size-full wp-image-1020" src="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop02.png?resize=487%2C118" alt="mqttdesktop02" width="487" height="118" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop02.png?w=487&amp;ssl=1 487w, https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop02.png?resize=300%2C73&amp;ssl=1 300w" sizes="auto, (max-width: 487px) 100vw, 487px" /></a></p>
<ul>
<li>Enter the topic channels/&lt;channelID&gt;/publish/&lt;apikey&gt; to publish data to a channel feed. Replace &lt;channelID&gt; with the channel ID and &lt;apikey&gt; 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.</li>
</ul>
<p><a href="https://www.mathworks.com/help/thingspeak/use-desktop-mqtt-client-to-publish-to-a-channel.html"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="1021" data-permalink="https://nothans.com/learn-how-to-use-mqtt-fx-with-thingspeak/mqttdesktop03" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop03.png?fit=752%2C122&amp;ssl=1" data-orig-size="752,122" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="mqttdesktop03" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop03.png?fit=300%2C49&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop03.png?fit=750%2C122&amp;ssl=1" class="aligncenter wp-image-1021 size-full" src="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop03.png?resize=750%2C122" alt="mqttdesktop03" width="750" height="122" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop03.png?w=752&amp;ssl=1 752w, https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop03.png?resize=300%2C49&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop03.png?resize=750%2C122&amp;ssl=1 750w" sizes="auto, (max-width: 750px) 100vw, 750px" /></a></p>
<ul>
<li>Alternatively, you can enter the topic channels/&lt;channelID&gt;/publish/fields/field&lt;fieldnumber&gt;/&lt;apikey&gt; to publish to a channel field. Replace &lt;channelID&gt; with the channel ID, &lt;fieldnumber&gt; with field number that want to update, and &lt;apikey&gt; 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.</li>
</ul>
<p><a href="https://www.mathworks.com/help/thingspeak/use-desktop-mqtt-client-to-publish-to-a-channel.html"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="1022" data-permalink="https://nothans.com/learn-how-to-use-mqtt-fx-with-thingspeak/mqttdesktop04" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop04.png?fit=756%2C117&amp;ssl=1" data-orig-size="756,117" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="mqttdesktop04" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop04.png?fit=300%2C46&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop04.png?fit=750%2C116&amp;ssl=1" class="aligncenter size-full wp-image-1022" src="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop04.png?resize=750%2C116" alt="mqttdesktop04" width="750" height="116" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop04.png?w=756&amp;ssl=1 756w, https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop04.png?resize=300%2C46&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2017/01/mqttdesktop04.png?resize=750%2C117&amp;ssl=1 750w" sizes="auto, (max-width: 750px) 100vw, 750px" /></a></p>
<h3>Additional Resources</h3>
<ul>
<li class="add_margin_0"><strong><a href="https://www.mathworks.com/help/thingspeak/mqtt-basics.html">MQTT Basics</a> &#8211; </strong>Learn about the publish/subscribe architecture for connecting bandwidth and power-constrained devices over wireless networks</li>
<li class="add_margin_0"><strong><a href="https://www.mathworks.com/help/thingspeak/mqtt-client-configuration.html">MQTT Client Configuration</a> &#8211; </strong>Learn how to set up an MQTT client to communicate with the ThingSpeak MQTT broker</li>
<li class="add_margin_0"><strong><a href="https://www.mathworks.com/help/thingspeak/choose-between-rest-and-mqtt.html">Choose Between REST and MQTT</a> &#8211; </strong>Learn when to use REST and MQTT to update a channel</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/learn-how-to-use-mqtt-fx-with-thingspeak/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1017</post-id>	</item>
		<item>
		<title>Update a ThingSpeak Channel using MQTT on a Raspberry Pi</title>
		<link>https://nothans.com/thingspeak-tutorials/update-a-thingspeak-channel-using-mqtt-on-a-raspberry-pi</link>
					<comments>https://nothans.com/thingspeak-tutorials/update-a-thingspeak-channel-using-mqtt-on-a-raspberry-pi#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Tue, 13 Dec 2016 18:47:08 +0000</pubDate>
				<category><![CDATA[ThingSpeak]]></category>
		<category><![CDATA[internet of things]]></category>
		<category><![CDATA[iot]]></category>
		<category><![CDATA[MQTT]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<guid isPermaLink="false">http://community.thingspeak.com/?page_id=1972</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<p><a href="https://thingspeak.com">ThingSpeak</a> has added <a href="https://www.mathworks.com/help/thingspeak/mqtt-api.html">MQTT</a> as a method to accept channel updates.&nbsp; MQTT is different from HTTP/REST. It is specifically designed to be lightweight and intended for embedded devices with low RAM and CPU performance.&nbsp; Also, in most cases, MQTT uses less bandwidth.</p>



<p>MQTT operates under a publish/subscribe model in which clients connect to the MQTT broker and either publish data or subscribe to topics to receive data from other clients.&nbsp; MQTT messages can be sent using unsecured TCP, which is the easiest and has the lower RAM, CPU, and bandwidth requirements.&nbsp; MQTT messages can also be sent using WebSockets.&nbsp; This may be needed for situations when the standard port for MQTT, 1883, is blocked on the network.&nbsp; When using MQTT over WebSockets, it is possible to encrypt the communication with SSL.&nbsp; If your hardware is capable of using SSL over a WebSocket, that is the recommended method.</p>



<p>On the Raspberry Pi, an MQTT client library is required to send data to ThingSpeak.&nbsp; <a href="https://eclipse.org/paho/clients/python/">Paho</a> is an open-source MQTT client library that will be used for this example.&nbsp; It has been adapted to many languages, including Python.</p>



<p>This example will demonstrate how to publish data to a ThingSpeak channel using the Paho library.&nbsp; The CPU and RAM usage of the Raspberry Pi will be measured and published to ThingSpeak every 20 seconds.</p>


<h3 class="wp-block-heading" id="PublishUsingWebsocketsInPythonOnARaspberryPiExample-1">Setup</h3>


<p>1) Create a new channel as shown in&nbsp;<a href="https://www.mathworks.com/help/thingspeak/collect-data-in-a-new-channel.html" target="_blank" rel="noopener">Collect Data in a New Channel</a> with two fields named “CPU (%)” and “RAM (%)”.</p>



<p>2) Create an MQTT device by clicking&nbsp;<strong class="emphasis bold">Devices</strong>&nbsp;&gt;&nbsp;<strong class="emphasis bold">MQTT</strong>&nbsp;at the top of the ThingSpeak page, then&nbsp;<strong class="emphasis bold">Add Device</strong>. When setting up the device and adding the new channel to its authorized list, click&nbsp;<strong class="emphasis bold">Download Credentials</strong>&nbsp;&gt;&nbsp;<strong class="emphasis bold">Plain Text</strong>. For details, see&nbsp;<a class="a" href="https://www.mathworks.com/help/thingspeak/mqtt-basics.html#mw_0bf68abc-6c4e-4e2e-8312-e8223a203b71" data-docid="thingspeak#mw_0bf68abc-6c4e-4e2e-8312-e8223a203b71">Create a ThingSpeak MQTT Device</a>. Use the saved credentials in the Code section below.</p>



<p>3) Download the&nbsp;<a href="https://eclipse.org/paho/clients/python" target="_blank" rel="noopener">Paho MQTT</a>&nbsp;client library for Python. You can use the command line to install the libraries. If you are using Python 2, use this code:</p>



<div class="code_responsive">
<pre class="programlisting">sudo pip install paho-mqtt
sudo pip install psutil
</pre>
</div>



<p>If you use Python 3, use this code:</p>



<div class="code_responsive">
<pre class="programlisting">sudo pip3 install paho-mqtt
sudo pip3 install psutil</pre>
</div>


<h3 class="wp-block-heading" id="publishing-to-thingspeak-example">Publishing to ThingSpeak Example</h3>


<p>This example shows how simple it can be to send data to ThingSpeak using MQTT.</p>



<p>Three MQTT connection methods are demonstrated in this example: TCP, WebSockets, and SSL. To use a conventional TCP socket on port 1883, set useUnsecuredTCP=True.&nbsp; This connection method is the simplest and requires the least system resources.&nbsp; To use WebSockets on port 80, set <strong>useUnsecuredWebsockets=True</strong>.&nbsp; Websockets are helpful when the default MQTT port is blocked on the local network.&nbsp; Finally, if encryption is required, set <strong>useSSLWebsockets=True</strong>.&nbsp;&nbsp; Be sure only to set one of the connection method variables to True and leave the other two False.</p>



<p>Also, be sure to change the channel ID and API key to your channel’s settings.</p>



<pre class="wp-block-preformatted"># Publich to a ThingSpeak Channel Using MQTT
# 
# This is an example of publishing to multiple fields simultaneously.
# Connections over standard TCP, websocket or SSL are possible by setting
# the parameters below.
#
# CPU and RAM usage is collected every 20 seconds and published to a
# ThingSpeak channel using an MQTT Publish
#
# This example requires the Paho MQTT client package which
# is available at: http://eclipse.org/paho/clients/python
import paho.mqtt.publish as publish
import psutil
import string

# The ThingSpeak Channel ID.
# Replace &lt;YOUR-CHANNEL-ID&gt; with your channel ID.
channel_ID = "&lt;YOUR-CHANNEL-ID&gt;"

# The hostname of the ThingSpeak MQTT broker.
mqtt_host = "mqtt3.thingspeak.com"

# Your MQTT credentials for the device
mqtt_client_ID = "&lt;YOUR-CLIENT-ID&gt;"
mqtt_username  = "&lt;YOUR-USERNAME&gt;"
mqtt_password  = "&lt;YOUR-MQTT-PASSWORD&gt;"

t_transport = "websockets"
t_port = 80

# Create the topic string.
topic = "channels/" + channel_ID + "/publish"

while (True):

    # get the system performance data over 20 seconds.
    cpu_percent = psutil.cpu_percent(interval=20)
    ram_percent = psutil.virtual_memory().percent

    # build the payload string.
    payload = "field1=" + str(cpu_percent) + "&amp;field2=" + str(ram_percent)

    # attempt to publish this data to the topic.
    try:
        print ("Writing Payload = ", payload," to host: ", mqtt_host, " clientID= ", mqtt_client_ID, " User ", mqtt_username, " PWD ", mqtt_password)
        publish.single(topic, payload, hostname=mqtt_host, transport=t_transport, port=t_port, client_id=mqtt_client_ID, auth={'username':mqtt_username,'password':mqtt_password})
    except (keyboardInterrupt)
        break
    except Exception as e:
        print (e) </pre>



		<div id="respond" class="comment-respond wp-block-post-comments-form">
			<h3 id="reply-title" class="comment-reply-title">Leave a Reply<small><a rel="nofollow" id="cancel-comment-reply-link" href="/tag/mqtt/feed#respond" style="display:none;">Cancel reply</a></small></h3>			<form id="commentform" class="comment-form">
				<iframe
					title="Comment Form"
					src="https://jetpack.wordpress.com/jetpack-comment/?blogid=114568856&#038;postid=1972&#038;comment_registration=0&#038;require_name_email=1&#038;stc_enabled=0&#038;stb_enabled=0&#038;show_avatars=1&#038;avatar_default=mystery&#038;greeting=Leave+a+Reply&#038;jetpack_comments_nonce=2d1d697c54&#038;greeting_reply=Leave+a+Reply+to+%25s&#038;color_scheme=light&#038;lang=en_US&#038;jetpack_version=15.6&#038;iframe_unique_id=1&#038;show_cookie_consent=10&#038;has_cookie_consent=0&#038;is_current_user_subscribed=0&#038;token_key=%3Bnormal%3B&#038;sig=a95230eb5f80339f00cd88ac075002a6f76fa388#parent=https%3A%2F%2Fnothans.com%2Ftag%2Fmqtt%2Ffeed"
											name="jetpack_remote_comment"
						style="width:100%; height: 430px; border:0;"
										class="jetpack_remote_comment"
					id="jetpack_remote_comment"
					sandbox="allow-same-origin allow-top-navigation allow-scripts allow-forms allow-popups"
				>
									</iframe>
									<!--[if !IE]><!-->
					<script>
						document.addEventListener('DOMContentLoaded', function () {
							var commentForms = document.getElementsByClassName('jetpack_remote_comment');
							for (var i = 0; i < commentForms.length; i++) {
								commentForms[i].allowTransparency = false;
								commentForms[i].scrolling = 'no';
							}
						});
					</script>
					<!--<![endif]-->
							</form>
		</div>

		
		<input type="hidden" name="comment_parent" id="comment_parent" value="" />

		<p class="akismet_comment_form_privacy_notice">This site uses Akismet to reduce spam. <a href="https://akismet.com/privacy/" target="_blank" rel="nofollow noopener">Learn how your comment data is processed.</a></p>]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/thingspeak-tutorials/update-a-thingspeak-channel-using-mqtt-on-a-raspberry-pi/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1972</post-id>	</item>
		<item>
		<title>MQTT is So Hot Right Now</title>
		<link>https://nothans.com/mqtt-is-so-hot-right-now</link>
					<comments>https://nothans.com/mqtt-is-so-hot-right-now#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Thu, 11 Aug 2016 14:29:45 +0000</pubDate>
				<category><![CDATA[ThingSpeak]]></category>
		<category><![CDATA[internet of things]]></category>
		<category><![CDATA[iot]]></category>
		<category><![CDATA[meme]]></category>
		<category><![CDATA[MQTT]]></category>
		<guid isPermaLink="false">http://nothans.com/?p=928</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<p>I am preparing for my IoT talk today and researching the popularity of standard IoT protocols.</p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="https://imgflip.com/i/18rm9g"><img data-recalc-dims="1" loading="lazy" decoding="async" width="620" height="497" data-attachment-id="929" data-permalink="https://nothans.com/mqtt-is-so-hot-right-now/mqtt_meme" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Meme.jpg?fit=620%2C497&amp;ssl=1" data-orig-size="620,497" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="IoT MQTT Meme" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Meme.jpg?fit=300%2C240&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Meme.jpg?fit=620%2C497&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Meme.jpg?resize=620%2C497" alt="MQTT Meme" class="wp-image-929" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Meme.jpg?w=620&amp;ssl=1 620w, https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Meme.jpg?resize=300%2C240&amp;ssl=1 300w" sizes="auto, (max-width: 620px) 100vw, 620px" /></a></figure>
</div>


<p>I discovered that MQTT as a Google search term has taken off!</p>


<div class="wp-block-image">
<figure class="aligncenter"><img data-recalc-dims="1" loading="lazy" decoding="async" width="750" height="271" data-attachment-id="931" data-permalink="https://nothans.com/mqtt-is-so-hot-right-now/mqtt_trends" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Trends.png?fit=853%2C308&amp;ssl=1" data-orig-size="853,308" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="MQTT Search Trends" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Trends.png?fit=300%2C108&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Trends.png?fit=750%2C271&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Trends.png?resize=750%2C271" alt="MQTT Search Trends" class="wp-image-931" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Trends.png?w=853&amp;ssl=1 853w, https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Trends.png?resize=300%2C108&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2016/08/MQTT_Trends.png?resize=768%2C277&amp;ssl=1 768w" sizes="auto, (max-width: 750px) 100vw, 750px" /></figure>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/mqtt-is-so-hot-right-now/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">928</post-id>	</item>
	</channel>
</rss>
