<?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 Archives - Digital Urban</title>
	<atom:link href="https://www.digitalurban.org/blog/tag/mqtt/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.digitalurban.org/blog/tag/mqtt/</link>
	<description>Data, Cities, IoT, Writing, Music and Making Things</description>
	<lastBuildDate>Mon, 24 Mar 2025 11:48:14 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://www.digitalurban.org/wp-content/uploads/2012/07/Dulogosm-1.png</url>
	<title>mqtt Archives - Digital Urban</title>
	<link>https://www.digitalurban.org/blog/tag/mqtt/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>MQTT Frame &#8211; Beautifully Framed Live Data</title>
		<link>https://www.digitalurban.org/blog/2025/03/19/mqttframe/</link>
		
		<dc:creator><![CDATA[Andy]]></dc:creator>
		<pubDate>Wed, 19 Mar 2025 18:03:40 +0000</pubDate>
				<category><![CDATA[ios App]]></category>
		<category><![CDATA[dashboard]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[frame]]></category>
		<category><![CDATA[mqtt]]></category>
		<category><![CDATA[realtime]]></category>
		<guid isPermaLink="false">https://www.digitalurban.org/?p=7886</guid>

					<description><![CDATA[<p>The post <a href="https://www.digitalurban.org/blog/2025/03/19/mqttframe/">MQTT Frame &#8211; Beautifully Framed Live Data</a> appeared first on <a href="https://www.digitalurban.org">Digital Urban</a>.</p>
]]></description>
										<content:encoded><![CDATA[
		<div id="fws_6970d6a4aed86"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row top-level"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding inherit_tablet inherit_phone "  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				
<div class="wpb_text_column wpb_content_element " >
	<div class="wpb_wrapper">
		<p><!-- /wp:post-content --></p>
<p><!-- wp:paragraph -->Transform your iPhone into a beautifully framed, dynamic data display with MQTT Frame. Stay informed about environmental conditions, breaking news, or custom live data feeds elegantly presented within a selection of artistic frames.</p>
<p><!-- /wp:paragraph --><br />

<a href='https://www.digitalurban.org/blog/2025/03/19/mqttframe/img_5262/'><img fetchpriority="high" decoding="async" width="473" height="1024" src="https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5262-473x1024.png" class="attachment-large size-large" alt="" srcset="https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5262-473x1024.png 473w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5262-139x300.png 139w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5262-768x1662.png 768w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5262-710x1536.png 710w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5262-947x2048.png 947w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5262.png 1284w" sizes="(max-width: 473px) 100vw, 473px" /></a>
<a href='https://www.digitalurban.org/blog/2025/03/19/mqttframe/img_5261/'><img decoding="async" width="473" height="1024" src="https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5261-473x1024.png" class="attachment-large size-large" alt="" srcset="https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5261-473x1024.png 473w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5261-139x300.png 139w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5261-768x1662.png 768w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5261-710x1536.png 710w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5261-947x2048.png 947w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5261.png 1284w" sizes="(max-width: 473px) 100vw, 473px" /></a>
<a href='https://www.digitalurban.org/blog/2025/03/19/mqttframe/img_5264/'><img decoding="async" width="473" height="1024" src="https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5264-473x1024.png" class="attachment-large size-large" alt="" srcset="https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5264-473x1024.png 473w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5264-139x300.png 139w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5264-768x1662.png 768w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5264-710x1536.png 710w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5264-947x2048.png 947w, https://www.digitalurban.org/wp-content/uploads/2025/03/IMG_5264.png 1284w" sizes="(max-width: 473px) 100vw, 473px" /></a>
</p>
<h3 class="wp-block-heading">Key Features:</h3>
<p><!-- wp:list --></p>
<ul>
<li style="list-style-type: none;">
<ul><!-- wp:list-item --></ul>
</li>
<li><strong>Dynamic MQTT Integration</strong>: Easily subscribe to any MQTT topic and display live updates.</li>
<li><strong>Customizable Frames</strong>: Choose from multiple high-quality decorative frames to complement your home or office décor.</li>
<li><strong>Clean and Clear Data Display</strong>: Showcase important data such as temperature, pressure, news, and more with clear typography and layout.</li>
<li><strong>Fullscreen Mode</strong>: Tap to seamlessly switch to an immersive fullscreen view, maximizing readability and aesthetics.</li>
<li><strong>Easy Management</strong>: Add, edit, and reorder topics quickly through an intuitive interface.</li>
<li><strong>Instant Updates</strong>: Receive real-time data updates over MQTT, ensuring you’re always in the know.</li>
</ul>
<p><!-- /wp:list-item --></p>
<p><!-- wp:list-item /--></p>
<p><!-- wp:list-item /--></p>
<p><!-- wp:list-item /--></p>
<p><!-- wp:list-item /--></p>
<p><!-- wp:list-item /--><!-- /wp:list --></p>
<p><!-- wp:heading {"level":3} --></p>
<h3 class="wp-block-heading">Perfect For:</h3>
<p><!-- /wp:heading --></p>
<p><!-- wp:list --></p>
<ul>
<li style="list-style-type: none;">
<ul><!-- wp:list-item --></ul>
</li>
<li><strong>Home Assistant/Home Automation Enthusiasts</strong>: Display sensor data, home statuses, or environmental conditions.</li>
<li><strong>Personal Use</strong>: Stay updated with the latest news headlines, weather conditions, or any custom data stream.</li>
</ul>
<p><!-- /wp:list-item --> MQTT Frame merges elegant design with powerful real-time MQTT functionality, creating the perfect smart display for any setting.</p>
<p><!-- /wp:list --></p>
<p><!-- wp:heading {"level":5} --></p>
<h5 class="wp-block-heading">MQTT Frame is currently <a href="https://apps.apple.com/gb/app/mqtt-frame/id6743003699">available for free, on the Apple Store</a>, for support dm @digitalurban on X and bring your data to life in a beautiful new way.</h5>
<p><!-- /wp:heading --></p>
	</div>
</div>




			</div> 
		</div>
	</div> 
</div></div><p>The post <a href="https://www.digitalurban.org/blog/2025/03/19/mqttframe/">MQTT Frame &#8211; Beautifully Framed Live Data</a> appeared first on <a href="https://www.digitalurban.org">Digital Urban</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Turn Any Device into a Literary Clock with our MQTT Feed</title>
		<link>https://www.digitalurban.org/blog/2024/07/15/turning-any-device-into-a-literary-clock-with-mqtt/</link>
		
		<dc:creator><![CDATA[Andy]]></dc:creator>
		<pubDate>Mon, 15 Jul 2024 13:40:48 +0000</pubDate>
				<category><![CDATA[Making]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[literacy clock]]></category>
		<category><![CDATA[mqtt]]></category>
		<category><![CDATA[time quote clock]]></category>
		<guid isPermaLink="false">https://www.digitalurban.org/?p=7847</guid>

					<description><![CDATA[<p>The Concept of the Literary Clock A literary clock is a unique fusion of literature and timekeeping. Every minute of the day is represented by a corresponding quote from a...</p>
<p>The post <a href="https://www.digitalurban.org/blog/2024/07/15/turning-any-device-into-a-literary-clock-with-mqtt/">Turn Any Device into a Literary Clock with our MQTT Feed</a> appeared first on <a href="https://www.digitalurban.org">Digital Urban</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p><strong>The Concept of the Literary Clock</strong></p>



<p>A literary clock is a unique fusion of literature and timekeeping. Every minute of the day is represented by a corresponding quote from a literary work, providing not just the time, but a nugget of wisdom, humor, or beauty from the world of books. This idea transforms the mundane act of checking the time into a delightful literary experience. The initial concept, as outlined by the original <a href="https://www.literaryclock.com/posts/Lt0_Blueprint">Literary Clock Project</a>, involves creating a clock that displays quotes from various literary works for every minute of the day. This concept not only appeals to book lovers but also serves as an artistic and educational piece, bringing literature into everyday life in a novel way. For example, as we type this the time is twenty one minutes to five and the quote from the database, including the book name is:</p>



<figure class="wp-block-pullquote"><blockquote><p>&nbsp;</p><cite>&#8220;I was told that in his vest pocket he kept a chronometer instead of a watch. If someone asked him what time it was, he would say, &#8220;&#8221;<strong>A minute and twenty-one seconds to five</strong>.&#8221;&#8221;&#8221; Book: The Collected Stories</cite></blockquote></figure>



<p><strong>Crowdsourcing the Literary Database</strong></p>



<p>An essential aspect of this project was the crowdsourcing of the literary database. The <a href="https://www.literaryclock.com/posts/Lt1_Crowdsourcing">Literary Clock Project</a> engaged a global community of literature enthusiasts to contribute quotes for every minute of the day. This collaborative effort created a diverse and rich collection of quotes, encompassing a wide range of genres, periods, and authors. Contributors from around the world submitted their favourite passages, transforming this project into a communal celebration of literature. The concept was taken a step further by tjaap who cleaned up the database and ported it onto a Kindle, <a href="https://www.instructables.com/Literary-Clock-Made-From-E-reader/">complete with a full instructable</a> on how to build you own.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1024" height="637" src="https://www.digitalurban.org/wp-content/uploads/2024/07/Kindle.webp" alt="" class="wp-image-7850" srcset="https://www.digitalurban.org/wp-content/uploads/2024/07/Kindle.webp 1024w, https://www.digitalurban.org/wp-content/uploads/2024/07/Kindle-300x187.webp 300w, https://www.digitalurban.org/wp-content/uploads/2024/07/Kindle-768x478.webp 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">The Kindle Literary Clock by tjapp</figcaption></figure>



<p><strong>Porting to MQTT</strong></p>



<p>MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol designed for small sensors and mobile devices optimized for high-latency or unreliable networks. It’s perfect for the Internet of Things (IoT) applications where bandwidth and battery power are at a premium. It is also good for transmitting short text messages to display across multiple devices at the same time, as long as a device is connected to an MQTT broker, it will automatically display messages as they arrive.</p>



<p>As such, as have created a Python script to read the database and publish the time quotes every minute to our MQTT broker on the following address:<strong> /personal/ucfnap/timequote</strong> (its a little but like tuning a radio, but in the case of MQTT, subscribing to topics).</p>



<p><strong>How It Works:</strong></p>



<p>1. <strong>Data Collection</strong>: We are using the extensive CSV file containing literary quotes provided by the Kindle Literarty Clock project, where each quote is tagged with a specific minute of the day. To make it work with our script we tidied things up a little.</p>



<p>2. <strong>Publishing</strong>: This CSV is processed and published via the MQTT feed. Each minute, a new message is sent out containing the current time and the corresponding quote.</p>



<p>3. <strong>Subscription</strong>: Any device can subscribe to this MQTT feed to receive the quotes in real-time. This could be an e-ink screen, a smart display, or even a mobile application &#8211; ie at 10.47 a device would receive the following message:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><strong>10.07 am</strong>: In a meeting with Rod, Momo and Guy. We are rehearsing the final for the third time, with Rod and Guy taking the parts of the clients, when Rod&#8217;s secretary, Lorraine, bursts in. Book: I Don&#8217;t Know How She Does It</p>
</blockquote>



<p><strong>Applications</strong></p>



<p><strong>E-Ink Screens</strong></p>



<p>Perhaps one of the most elegant implementations of this concept is using e-ink screens. E-ink displays are known for their paper-like readability and low power consumption, making them perfect for a literary clock. For an example of this, you can check out our detailed guide on setting up an e-ink screen with MQTT via our previous project THE: Time Headlines and Environmental Information <a href="https://www.digitalurban.org/blog/2020/04/10/the/">here</a>.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="560" src="https://www.digitalurban.org/wp-content/uploads/2024/07/timequoteclock-1024x560.png" alt="Literacy Clock using MQTY" class="wp-image-7856" srcset="https://www.digitalurban.org/wp-content/uploads/2024/07/timequoteclock-1024x560.png 1024w, https://www.digitalurban.org/wp-content/uploads/2024/07/timequoteclock-300x164.png 300w, https://www.digitalurban.org/wp-content/uploads/2024/07/timequoteclock-768x420.png 768w, https://www.digitalurban.org/wp-content/uploads/2024/07/timequoteclock-1536x840.png 1536w, https://www.digitalurban.org/wp-content/uploads/2024/07/timequoteclock-2048x1120.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">Literary Clock using MQTT</figcaption></figure>



<p><strong>Smart Displays and Mobile Apps</strong></p>



<p>Beyond e-ink screens, this feed can be integrated into various smart displays and mobile applications. For example, we have intergrated it into our Home Assistant Dashboard, updating the time with a quote every minute. You could also add it to a HUB75 LED Matrix &#8211; below is our example of using an LED Matrix as a general data feed, but by simply changing the MQTT feed, it transforms into a Literary Clock.</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="Hub75 Matrix with MQTT and a Pimoroni Pi PicoW Interstate 75w" width="1080" height="608" src="https://www.youtube.com/embed/kG3OStmfXLk?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p>&nbsp;</p>



<p><strong>Setting Up Your Literary Clock</strong></p>



<p>Setting up your device is easy &#8211;</p>



<p>1. <strong>Choose Your Device</strong>: Select a device that can run an MQTT client. This could be an e-ink screen, a Raspberry Pi with a display, or a smartphone.</p>



<p>2. <strong>Install an MQTT Libary</strong>: There are numerous MQTT libraries available, we mainly use Paho.</p>



<p><p>3. <strong>Subscribe to the Feed</strong>: Point your client to the feed /personal/ucfnap/timequote&nbsp;</p>
<p>Configure your client to display the received messages. Our open MQTT Broker is mqtt.cetools.org on Port 1883</p></p>



<p></p>



<p>Of course you may not want to bother with Raspberry Pi&#8217;s or other about with MQTT, or hack a Kindle &#8211; in which case, for those looking for a ready-made commercial version, check out the <a href="https://www.authorclock.com/">Author Clock</a>.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="800" height="457" src="https://www.digitalurban.org/wp-content/uploads/2024/07/author-clock.png" alt="" class="wp-image-7851" srcset="https://www.digitalurban.org/wp-content/uploads/2024/07/author-clock.png 800w, https://www.digitalurban.org/wp-content/uploads/2024/07/author-clock-300x171.png 300w, https://www.digitalurban.org/wp-content/uploads/2024/07/author-clock-768x439.png 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /><figcaption class="wp-element-caption">The Rather Lovely Author Clock</figcaption></figure>



<p><p>The Author Clock is a beautifully designed literary clock that comes pre-loaded with thousands of quotes from a wide array of literary works. It’s an excellent choice for those who want to enjoy the literary clock experience without the need for a DIY setup.</p> <p>With our MQTT messages, any device can now be simply converted into a Literary Clock.</p></p>
<p>The post <a href="https://www.digitalurban.org/blog/2024/07/15/turning-any-device-into-a-literary-clock-with-mqtt/">Turn Any Device into a Literary Clock with our MQTT Feed</a> appeared first on <a href="https://www.digitalurban.org">Digital Urban</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Enhancing Live Weather Monitoring with MQTT and Chart.js</title>
		<link>https://www.digitalurban.org/blog/2024/06/27/enhancing-live-weather-monitoring-with-mqtt-and-chart-js/</link>
		
		<dc:creator><![CDATA[Andy]]></dc:creator>
		<pubDate>Thu, 27 Jun 2024 15:10:06 +0000</pubDate>
				<category><![CDATA[data]]></category>
		<category><![CDATA[Data Visualisation]]></category>
		<category><![CDATA[Weather]]></category>
		<category><![CDATA[Weather (Live)]]></category>
		<category><![CDATA[Weather Display]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[mqtt]]></category>
		<guid isPermaLink="false">https://www.digitalurban.org/?p=7816</guid>

					<description><![CDATA[<p>Introduction Viewing real-time data from a personal weather station such as a Davis Vantage Pro, a Tempest, or an EcoWhitt device can be complex. However, the majority of systems that...</p>
<p>The post <a href="https://www.digitalurban.org/blog/2024/06/27/enhancing-live-weather-monitoring-with-mqtt-and-chart-js/">Enhancing Live Weather Monitoring with MQTT and Chart.js</a> appeared first on <a href="https://www.digitalurban.org">Digital Urban</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2></h2>
<h3>Introduction</h3>
<p>Viewing real-time data from a personal weather station such as a Davis Vantage Pro, a Tempest, or an EcoWhitt device can be complex. However, the majority of systems that process weather data, such as Weather Display, Weewx, or CumlusMx, all have the ability to output MQTT data. This data can be used to display a real-time graph of the data, keeping you engaged with the latest weather updates, and supplemented with any other data which is MQTT-based.</p>
<p>With this in mind, we&#8217;ve developed a live weather monitoring dashboard as an illustrative example. This dashboard uses MQTT for real-time data updates and Chart.js for dynamic visualization. We&#8217;ve also included a visual indicator for connection status and a brief pulse effect to notify when new data arrives, enhancing the user experience.</p>
<p><img loading="lazy" decoding="async" class=" wp-image-7820 aligncenter" src="https://www.digitalurban.org/wp-content/uploads/2024/06/Screenshot-2024-06-27-at-15.48.35-300x185.png" alt="MQTT Weather Dashboard" width="600" height="370" srcset="https://www.digitalurban.org/wp-content/uploads/2024/06/Screenshot-2024-06-27-at-15.48.35-300x185.png 300w, https://www.digitalurban.org/wp-content/uploads/2024/06/Screenshot-2024-06-27-at-15.48.35-1024x631.png 1024w, https://www.digitalurban.org/wp-content/uploads/2024/06/Screenshot-2024-06-27-at-15.48.35-768x473.png 768w, https://www.digitalurban.org/wp-content/uploads/2024/06/Screenshot-2024-06-27-at-15.48.35-1536x946.png 1536w, https://www.digitalurban.org/wp-content/uploads/2024/06/Screenshot-2024-06-27-at-15.48.35-2048x1261.png 2048w" sizes="auto, (max-width: 600px) 100vw, 600px" /></p>
<p>You can view it live at: <a href="https://finchamweather.co.uk/weathergraph.htm">https://finchamweather.co.uk/weathergraph.htm</a></p>
<p>The data populates as the page loads &#8211; we could of course back load it via a database link, but the aim was to simply use MQTT and have a graphing system that streams in data, its a work in progress but here is how we got it working:</p>
<h3>Setting Up the Environment</h3>
<p>Before we dive into the code, ensure you have the following libraries included in your HTML:</p>
<ul>
<li>Paho MQTT: for MQTT protocol handling &#8211; our MQTT feed is open to use as a test, replace this with your own MQTT details in the main code.</li>
<li>Chart.js: for creating dynamic charts</li>
<li>Chart.js adapter for date-fns: for handling time scales in charts</li>
</ul>
<h3>Initial HTML Setup</h3>
<p>We&#8217;ll start by setting up the basic HTML structure. This includes elements for displaying the connection status, forecast, weather statistics, and the weather chart.</p>
<pre><code>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
    &lt;meta name="apple-mobile-web-app-capable" content="yes"&gt;
    &lt;meta name="apple-mobile-web-app-status-bar-style" content="black"&gt;
    &lt;title&gt;Live Weather Graph&lt;/title&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.1/mqttws31.js"&gt;&lt;/script&gt;
    &lt;script src="https://cdn.jsdelivr.net/npm/chart.js"&gt;&lt;/script&gt;
    &lt;script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns"&gt;&lt;/script&gt;
    &lt;style&gt;
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        #mqttStatus {
            margin-bottom: 20px;
            text-align: left;
            font-size: 1.2em;
        }
        .dot {
            height: 20px;
            width: 20px;
            border-radius: 50%;
            display: inline-block;
        }
        .green {
            background-color: green;
        }
        .red {
            background-color: red;
        }
        .orange {
            background-color: orange;
        }
        .pulse-once {
            animation: pulse-once 1s;
        }
        @keyframes pulse-once {
            0% { transform: scale(1); }
            50% { transform: scale(1.2); }
            100% { transform: scale(1); }
        }
        #forecast {
            margin-bottom: 20px;
            text-align: left;
            font-size: 1.2em;
            font-weight: bold;
        }
        #stats {
            display: flex;
            justify-content: center;
            gap: 20px;
            margin-bottom: 20px;
            font-size: 1.2em;
            font-weight: bold;
        }
        #stats div {
            padding: 10px 20px;
            border: 1px solid #ccc;
            border-radius: 8px;
            box-shadow: 2px 2px 12px #aaa;
            background-color: #f9f9f9;
        }
        canvas {
            border: 1px solid #ccc;
            box-shadow: 2px 2px 12px #aaa;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div id="mqttStatus"&gt;&lt;span id="connectionDot" class="dot red"&gt;&lt;/span&gt; mqtt: disconnected&lt;/div&gt;
    &lt;div id="forecast"&gt;Forecast: Loading...&lt;/div&gt;
    &lt;div id="stats"&gt;
        &lt;div id="maxWindSpeed"&gt;Max Wind Speed: 0 mph&lt;/div&gt;
        &lt;div id="maxTemp"&gt;Max Temperature: 0 °C&lt;/div&gt;
        &lt;div id="minTemp"&gt;Min Temperature: 0 °C&lt;/div&gt;
        &lt;div id="maxPressure"&gt;Max Pressure: 0 mbar&lt;/div&gt;
        &lt;div id="minPressure"&gt;Min Pressure: 0 mbar&lt;/div&gt;
    &lt;/div&gt;
    &lt;canvas id="weatherChart" width="800" height="400"&gt;&lt;/canvas&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<h3>Connecting to MQTT</h3>
<p>Next, we set up the MQTT connection. The MQTT client will connect to the broker, subscribe to the necessary topics, and handle messages when they arrive.</p>
<pre><code>// MQTT connection settings
var mqtt;
var reconnectTimeout = 2000;
var host = "mqtt.cetools.org";
var port = location.protocol === 'https:' ? 8081 : 8080;
var options = {
    timeout: 3,
    onSuccess: onConnect,
    onFailure: onFailure,
    useSSL: location.protocol === 'https:',
};
var clientID = "clientID" + parseInt(Math.random() * 100);

function updateConnectionStatus(status) {
    const dot = document.getElementById("connectionDot");
    if (status === "connected") {
        dot.className = "dot green";
        document.getElementById("mqttStatus").innerHTML = `&lt;span class="dot green" id="connectionDot"&gt;&lt;/span&gt; mqtt: connected`;
    } else if (status === "disconnected") {
        dot.className = "dot red";
        document.getElementById("mqttStatus").innerHTML = `&lt;span class="dot red" id="connectionDot"&gt;&lt;/span&gt; mqtt: disconnected`;
    } else if (status === "reconnecting") {
        dot.className = "dot orange";
        document.getElementById("mqttStatus").innerHTML = `&lt;span class="dot orange" id="connectionDot"&gt;&lt;/span&gt; mqtt: reconnecting`;
    }
}

function pulseDot() {
    const dot = document.getElementById("connectionDot");
    dot.classList.add("pulse-once");
    setTimeout(() =&gt; {
        dot.classList.remove("pulse-once");
    }, 1000); // Duration of the pulse-once animation
}

function onFailure(message) {
    console.log("Connection Attempt to Host " + host + " Failed: ", message.errorMessage);
    updateConnectionStatus("disconnected");
    setTimeout(MQTTconnect, reconnectTimeout);
}

function onConnect() {
    console.log("Connected ");
    updateConnectionStatus("connected");
    mqtt.subscribe("personal/ucfnaps/downhamweather/loop");
    mqtt.subscribe("personal/ucfnaps/eink/met");
}

function MQTTconnect() {
    console.log("Connecting to " + host + " on port " + port);
    updateConnectionStatus("reconnecting");
    mqtt = new Paho.MQTT.Client(host, port, clientID);
    mqtt.onMessageArrived = onMessageArrived;
    mqtt.onConnectionLost = function(responseObject) {
        if (responseObject.errorCode !== 0) {
            console.log("Connection Lost: " + responseObject.errorMessage);
            updateConnectionStatus("disconnected");
            setTimeout(MQTTconnect, reconnectTimeout);  // Attempt to reconnect
        }
    };
    mqtt.connect(options);
}

window.onload = function() {
    MQTTconnect();
}
</code></pre>
<h3>Handling Incoming Messages</h3>
<p>When messages arrive, we process the data and update the chart. We also update the connection dot to pulse briefly, indicating new data has been received.</p>
<pre><code>let lastUpdate = Date.now();  // Initialize to current time
let firstUpdate = true;  // Flag to ensure first update happens immediately

let maxWindSpeed = 0;
let maxTemp = -Infinity;
let minTemp = Infinity;
let maxPressure = -Infinity;
let minPressure = Infinity;

function updateWindSpeed(windSpeed, timestamp) {
    weatherChart.data .labels.push(timestamp);
    weatherChart.data.datasets[0].data.push(windSpeed);

    // Update max wind speed
    if (windSpeed &gt; maxWindSpeed) {
        maxWindSpeed = windSpeed;
        document.getElementById('maxWindSpeed').innerText = `Max Wind Speed: ${maxWindSpeed} mph`;
    }

    // Limit the number of data points to keep the chart responsive
    if (weatherChart.data.labels.length &gt; 1440) { // Assuming 1 data point per minute, keep 24 hours of data
        weatherChart.data.labels.shift();
        weatherChart.data.datasets[0].data.shift();
    }

    weatherChart.update();
}

function updateOtherMetrics(temperature, solarRadiation, rainAmount, pressure, timestamp) {
    weatherChart.data.datasets[1].data.push({x: timestamp, y: temperature});
    weatherChart.data.datasets[2].data.push({x: timestamp, y: solarRadiation});
    weatherChart.data.datasets[3].data.push({x: timestamp, y: rainAmount &gt; 0 ? rainAmount : null});
    weatherChart.data.datasets[4].data.push({x: timestamp, y: pressure});

    // Update max and min temperature
    if (temperature &gt; maxTemp) {
        maxTemp = temperature;
        document.getElementById('maxTemp').innerText = `Max Temperature: ${maxTemp} °C`;
    }
    if (temperature &lt; minTemp) { minTemp = temperature; document.getElementById('minTemp').innerText = `Min Temperature: ${minTemp} °C`; } // Update max and min pressure if (pressure &gt; maxPressure) {
        maxPressure = pressure;
        document.getElementById('maxPressure').innerText = `Max Pressure: ${maxPressure} mbar`;
    }
    if (pressure &lt; minPressure) { minPressure = pressure; document.getElementById('minPressure').innerText = `Min Pressure: ${minPressure} mbar`; } // Limit the number of data points to keep the chart responsive if (weatherChart.data.labels.length &gt; 1440) { // Assuming 1 data point per minute, keep 24 hours of data
        weatherChart.data.datasets[1].data.shift();
        weatherChart.data.datasets[2].data.shift();
        weatherChart.data.datasets[3].data.shift();
        weatherChart.data.datasets[4].data.shift();
    }

    weatherChart.update();
}

function updateForecast(forecast) {
    document.getElementById('forecast').innerText = `Forecast: ${forecast}`;
}

function onMessageArrived(message) {
    console.log("Message Arrived: " + message.destinationName + " : " + message.payloadString);
    if (message.destinationName === "personal/ucfnaps/downhamweather/loop") {
        const data = JSON.parse(message.payloadString);
        const windSpeed = data['windSpeed_mph'];  // Adjust this key according to your data structure
        const temperature = data['outTemp_C'];  // Adjust this key according to your data structure
        const solarRadiation = data['radiation_Wpm2'];  // Adjust this key according to your data structure
        const rainAmount = data['dayRain_mm'];  // Adjust this key according to your data structure
        const pressure = data['pressure_mbar'];  // Adjust this key according to your data structure

        const nowTimestamp = new Date();

        // Update wind speed every time
        updateWindSpeed(windSpeed, nowTimestamp);

        if (firstUpdate || Date.now() - lastUpdate &gt;= 60000) {
            // Update other metrics every minute
            updateOtherMetrics(temperature, solarRadiation, rainAmount, pressure, nowTimestamp);
            lastUpdate = Date.now();
            firstUpdate = false;  // Ensure subsequent updates follow the interval
        }

        // Pulse the dot when new data arrives
        pulseDot();
    } else if (message.destinationName === "personal/ucfnaps/eink/met") {
        const forecast = message.payloadString;
        updateForecast(forecast);
    }
}
</code></pre>
<h3>Chart.js Setup</h3>
<p>Now, let&#8217;s configure Chart.js to visualize the weather data. We will use multiple datasets to display wind speed, temperature, solar radiation, rain amount, and pressure.</p>
<pre><code>// Chart.js setup
const ctx = document.getElementById('weatherChart').getContext('2d');
const weatherChart = new Chart(ctx, {
    type: 'line',
    data: {
        labels: [],  // Time labels
        datasets: [{
            label: 'Wind Speed (mph)',
            data: [],
            borderColor: 'rgba(75, 192, 192, 1)',
            borderWidth: 3,
            fill: false,
            yAxisID: 'y-axis-1',
            tension: 0.1
        },
        {
            label: 'Temperature (°C)',
            data: [],
            borderColor: 'rgba(255, 99, 132, 1)',
            borderWidth: 3,
            fill: false,
            yAxisID: 'y-axis-2',
            tension: 0.1
        },
        {
            label: 'Solar Radiation (W/m²)',
            data: [],
            borderColor: 'rgba(255, 206, 86, 1)',
            borderWidth: 3,
            fill: false,
            yAxisID: 'y-axis-3',
            tension: 0.1
        },
        {
            label: 'Rain Amount (mm)',
            data: [],
            borderColor: 'rgba(54, 162, 235, 1)',
            borderWidth: 3,
            fill: false,
            yAxisID: 'y-axis-4',
            tension: 0.1
        },
        {
            label: 'Pressure (mbar)',
            data: [],
            borderColor: 'rgba(153, 102, 255, 1)',
            borderWidth: 3,
            fill: false,
            yAxisID: 'y-axis-5',
            tension: 0.1
        }]
    },
    options: {
        responsive: true,
        plugins: {
            legend: {
                position: 'top',
            },
            title: {
                display: true,
                text: 'Live Weather Data'
            },
            decimation: {
                enabled: true,
                algorithm: 'lttb',
                samples: 100,  // Adjust this value as needed for performance
            },
        },
        scales: {
            x: {
                type: 'time',
                time: {
                    unit: 'minute'
                },
                title: {
                    display: true,
                    text: 'Time'
                }
            },
            'y-axis-1': {
                type: 'linear',
                position: 'left',
                beginAtZero: true,
                title: {
                    display: true,
                    text: 'Wind Speed (mph)'
                }
            },
            'y-axis-2': {
                type: 'linear',
                position: 'right',
                beginAtZero: true,
                title: {
                    display: true,
                    text: 'Temperature (°C)'
                },
                grid: {
                    drawOnChartArea: false
                }
            },
            'y-axis-3': {
                type: 'linear',
                position: 'right',
                beginAtZero: true,
                title: {
                    display: true,
                    text: 'Solar Radiation (W/m²)'
                },
                grid: {
                    drawOnChartArea: false
                }
            },
            'y-axis-4': {
                type: 'linear',
                position: 'right',
                beginAtZero: true,
                title: {
                    display: true,
                    text: 'Rain Amount (mm)'
                },
                grid: {
                    drawOnChartArea: false
                }
            },
            'y-axis-5': {
                type: 'linear',
                position: 'right',
                beginAtZero: true,
                title: {
                    display: true,
                    text: 'Pressure (mbar)'
                },
                grid: {
                    drawOnChartArea: false
                }
            }
        },
        interaction: {
            intersect: false,
            mode: 'nearest',
        },
        elements: {
            line: {
                cubicInterpolationMode: 'monotone',
            },
        },
    }
});
</code></pre>
<h3>Conclusion</h3>
<p>By integrating MQTT and Chart.js, it is possible to create a dynamic and real-time weather monitoring dashboard. The connection status indicator provides immediate feedback on the connection state, and the pulsing effect when new data arrives enhances user experience by visually notifying them of updates.</p>
<p>This setup can be further extended by adding more datasets, customizing the chart&#8217;s appearance, or integrating additional sensors. The data of course couple be from any feed, but real-time weather monitoring provides a good example of how IoT and web technologies can be combined to create realtime dashboards.</p>
<p>The post <a href="https://www.digitalurban.org/blog/2024/06/27/enhancing-live-weather-monitoring-with-mqtt-and-chart-js/">Enhancing Live Weather Monitoring with MQTT and Chart.js</a> appeared first on <a href="https://www.digitalurban.org">Digital Urban</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Make an eInk MQTT Reader for the Time, News and Environmental Data</title>
		<link>https://www.digitalurban.org/blog/2020/04/10/the/</link>
		
		<dc:creator><![CDATA[Andy]]></dc:creator>
		<pubDate>Fri, 10 Apr 2020 14:10:45 +0000</pubDate>
				<category><![CDATA[Making]]></category>
		<category><![CDATA[dashboard]]></category>
		<category><![CDATA[data display]]></category>
		<category><![CDATA[eink]]></category>
		<category><![CDATA[inkyWHAT]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[mqtt]]></category>
		<category><![CDATA[tutorial]]></category>
		<guid isPermaLink="false">https://www.connected-environments.org/?p=437</guid>

					<description><![CDATA[<p>The post <a href="https://www.digitalurban.org/blog/2020/04/10/the/">Make an eInk MQTT Reader for the Time, News and Environmental Data</a> appeared first on <a href="https://www.digitalurban.org">Digital Urban</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div id="fws_6970d6a4bf766"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				
<div class="wpb_text_column wpb_content_element " >
	<div class="wpb_wrapper">
		<p><strong>&#8216;THE&#8217; is a mini MQTT Information Display for Time, News and Environmental Information.  </strong>Using a 4.2-inch eInk screen, its concept is simple &#8211; to display information on a rotational basis, updating every couple of minutes. The data can be any feed &#8211; from the latest news headlines through to your smart home, energy usage, live local environmental conditions or simply the time &#8211; THE &#8211; Time, Headlines &amp; Environment.</p>
	</div>
</div>




			</div> 
		</div>
	</div> 
</div></div>
		<div id="fws_6970d6a4c07ef"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				
<div class="wpb_text_column wpb_content_element " >
	<div class="wpb_wrapper">
		<p>&#8216;THE&#8217; is built from two simple off the shelf components (an eInk InkyWHAT screen from Pimoroni and a Raspberry Pi) the code and the 3D printed casing are open source, allowing you to modify or redesign your own. You can follow along here or also take a look at the build at Instructable &#8211; <a href="https://www.instructables.com/id/Make-Your-Own-MQTT-EInk-Display-for-Time-News-and-/">https://www.instructables.com/id/Make-Your-Own-MQTT-EInk-Display-for-Time-News-and-/</a><br />
The concept comes from a long tradition of viewing data on a screen, from systems such as Teletext, through to the beloved Chumby, onwards to the Sony Dash and then they current iterations of the Echo Show and Google Home. Yet there is a need for a simple information display that does not listen in, does not play music or videos and does not rely on having cloud-based data. Something that simply displays information, at a glance using a beautiful non lit eink screen, on widgets that cycle at predetermined intervals. One brilliant example is the eInk Status Display, using the InkyPhat see <a href="https://jsutton.co.uk/eink-mqtt-status/">https://jsutton.co.uk/eink-mqtt-status/</a> for details. Thus with these in mind and some code to work on &#8216;THE&#8217; was born, one cold weekend in November in deepest Norfolk, while thinking about the Connected Environments Curriculum back at University College London.</p>
	</div>
</div>




			</div> 
		</div>
	</div> 
</div></div>
		<div id="fws_6970d6a4c0c14"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				
	<div class="wpb_video_widget wpb_content_element vc_clearfix   vc_video-aspect-ratio-169 vc_video-el-width-100 vc_video-align-center" >
		<div class="wpb_wrapper">
			
			<div class="wpb_video_wrapper"><iframe loading="lazy" title="THE (Time, Headlines, Environmental) Updating via MQTT" width="1080" height="608" src="https://www.youtube.com/embed/hScxaoUQEjU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
		</div>
	</div>

			</div> 
		</div>
	</div> 
</div></div>
		<div id="fws_6970d6a4c8783"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				
<div class="wpb_text_column wpb_content_element " >
	<div class="wpb_wrapper">
		<p>At its heart, THE is powered by <strong>M</strong>essage<strong> Q</strong>ueuing<strong> T</strong>elemetry <strong>T</strong>ransport (MQTT), allowing it to receive messages as soon as they are broadcast, via series of scripts, written in Python. THE subscribes to the topic (THE/messages) which are displayed on the eInk screen whenever a new one arrives. This allows the hub of THE to simply be a displayer of a single message topic with the timings and subjects configured by external scripts. The configuration allows the system to display a wide range of data sources from internal sources around Smart Home Automation Systems through to the news headlines, personal messages to friends or family or simply to display the time.</p>
	</div>
</div>




			</div> 
		</div>
	</div> 
</div></div>
		<div id="fws_6970d6a4c8be0"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				<div class="img-with-aniamtion-wrap center" data-max-width="100%" data-max-width-mobile="default" data-shadow="none" data-animation="fade-in" >
      <div class="inner">
        <div class="hover-wrap"> 
          <div class="hover-wrap-inner">
            <img loading="lazy" decoding="async" class="img-with-animation skip-lazy " data-delay="0" height="1920" width="2560" data-animation="fade-in" src="https://www.digitalurban.org/wp-content/uploads/2020/04/IMG_1871-2-scaled-1.jpeg" alt="eInk MQTT Case" srcset="https://www.digitalurban.org/wp-content/uploads/2020/04/IMG_1871-2-scaled-1.jpeg 2560w, https://www.digitalurban.org/wp-content/uploads/2020/04/IMG_1871-2-scaled-1-300x225.jpeg 300w, https://www.digitalurban.org/wp-content/uploads/2020/04/IMG_1871-2-scaled-1-1024x768.jpeg 1024w, https://www.digitalurban.org/wp-content/uploads/2020/04/IMG_1871-2-scaled-1-768x576.jpeg 768w, https://www.digitalurban.org/wp-content/uploads/2020/04/IMG_1871-2-scaled-1-1536x1152.jpeg 1536w, https://www.digitalurban.org/wp-content/uploads/2020/04/IMG_1871-2-scaled-1-2048x1536.jpeg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" />
          </div>
        </div>
      </div>
    </div><div class="iwithtext"><div class="iwt-icon">  </div><div class="iwt-text"> <strong>To Make a THE you require:</strong></p>
<ol>
<li>A Raspberry Pi (a Pi zero, or a Pi 3 ) &#8211; we used a Pi 3 for ours.</li>
<li><a href="https://shop.pimoroni.com/products/inky-what?variant=13590497624147">An InkywHAT screen;</a></li>
<li>If using a Pi 3 &#8211; <a href="https://www.amazon.co.uk/dp/B07DBX1V44/ref=sspa_dk_detail_0?psc=1&amp;pd_rd_i=B07DBX1V44&amp;pd_rd_w=1HdMP&amp;pf_rd_p=1055d8b2-c10c-4d7d-b50d-96300553e15d&amp;pd_rd_wg=Y4qQz&amp;pf_rd_r=4JJ8PF3QKTVX0BY3XV24&amp;pd_rd_r=e3740e56-0705-448d-931f-71dec884f3ef&amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUExS1ZSQVVaREZQMEFIJmVuY3J5cHRlZElkPUEwNTMyMDk0MTQ1WTZCNklTQ005VyZlbmNyeXB0ZWRBZElkPUEwNDA0NTMzMzBJRUlNQk9UTVgxUiZ3aWRnZXROYW1lPXNwX2RldGFpbCZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU=">a right angled USB cable</a> (so the cable fits in the case);</li>
<li>An MQTT broker &#8211; either running on your Pi or elsewhere. Don&#8217;t worry if you do not have one or are not sure what MQTT is, its quick and easy to set up and once installed it will automatically run &#8211; take a look at <a href="https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/">https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/</a> for a full and easy to follow tutorial on getting MQTT running &#8211; in this case mosquitto on your Pi.</li>
<li>An easy to fit case &#8211; head over to <a href="https://www.thingiverse.com/thing:4036382">Thingiverse to download and print our open source case</a>.</li>
<li>Our free and open source scripts to collect the Time, News and Environment conditions.</li>
</ol>
<p> </div><div class="clear"></div></div>
			</div> 
		</div>
	</div> 
</div></div>
		<div id="fws_6970d6a4cd3bb"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				<div class="iwithtext"><div class="iwt-icon">  </div><div class="iwt-text"> <strong>Step One: Installing the InkywHAT</strong><br />
The first step is to set and install your InkyWhat eInk sceen. You can install the libraires required for your InkyWHAT by using the easy one-line-installer.<br />
Open a new terminal to connect to your Pi, and type the following, making sure to type y or n when prompted:</p>
<div class="codehilite">
<pre class="EnlighterJSRAW" data-enlighter-language="null">curl https://get.pimoroni.com/inky | bash</pre>
<p>The one-line-installer puts everything in place to get your eInk screen up and running, we recommend you head over to the <a href="https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-inky-what">Pimoroni Getting Started with InkyWhat</a> for more info and examples &#8211; just to check its working.
</div>
<p> </div><div class="clear"></div></div>
			</div> 
		</div>
	</div> 
</div></div>
		<div id="fws_6970d6a4cf8a9"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				<div class="img-with-aniamtion-wrap center" data-max-width="100%" data-max-width-mobile="default" data-shadow="none" data-animation="fade-in" >
      <div class="inner">
        <div class="hover-wrap"> 
          <div class="hover-wrap-inner">
            <img loading="lazy" decoding="async" class="img-with-animation skip-lazy " data-delay="0" height="100" width="100" data-animation="fade-in" src="" alt=""  />
          </div>
        </div>
      </div>
    </div>
			</div> 
		</div>
	</div> 
</div></div>
		<div id="fws_6970d6a4e43de"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				<div class="iwithtext"><div class="iwt-icon">  </div><div class="iwt-text"> <strong>Step Two: Getting the Time, News and Environmental Information</strong><br />
THE updates its information via subscribing to an MQTT topic, our custom scripts pull in other sources of information and publish to this topic, allowing any number of sources of information to be used. There are three main files &#8211; one for the Time, a second for the News Feed and a the third for Weather conditions.<br />
<strong>Getting the Time:</strong><br />
All our files are available via the Connected Environments githib for THE &#8211; <a href="https://github.com/ucl-casa-ce/THE">https://github.com/ucl-casa-ce/THE</a><br />
For the time &#8211; download timetomqtt.py.<br />
The script gets the current time and converts it to words for display on THE &#8211; so, for example, 12.14pm becomes The Time is Fourteen Minutes Past Twelve and so on. In the script you need to edit it to add in your own MQTT details  &#8211; we have highlighted the parts to edit in the code.<br />
Copy it across to your Pi in a folder &#8211; we use /home/pi/scripts  &#8211; this can be down either via the command line or via ftp via <a href="https://filezilla-project.org/">Filezilla</a> or similar.<br />
<strong>Getting the News:</strong><br />
For the news, download rsstomqtt.py.<br />
The script gets the latest news from Sky and publishes it to MQTT for THE. You can edit the news source as required in the file. This file can also be copied to pull in any RSS feed directly onto your THE. As before, in the script you need to edit it to add in your own MQTT details  &#8211; we have highlighted the parts to edit in the code.<br />
<strong>Getting the Weather:</strong><br />
For the weather, download darkskytomqtt.py<br />
You need to sign up to use the <a href="https://darksky.net/dev">Darksky API</a> (don&#8217;t worry, it&#8217;s free and allows up to 1000 calls a day, more than enough to display the latest weather on THE). In our script, simply put in your DarkSky key, which you will receive when you sign up to the API and also your longitude and latitude for the location you want to obtain the data for.<br />
You can find a long and lat via  <a href="https://www.latlong.net/">https://www.latlong.net/</a><br />
If all this is new then it may sound complicated but with a little trial and error you will be able to edit files, write your own and get the information you want on THE in no time. Any issues just drop is a line via the contact form below.. </div><div class="clear"></div></div>
			</div> 
		</div>
	</div> 
</div></div>
		<div id="fws_6970d6a4e9237"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				<div class="img-with-aniamtion-wrap center" data-max-width="100%" data-max-width-mobile="default" data-shadow="none" data-animation="fade-in" >
      <div class="inner">
        <div class="hover-wrap"> 
          <div class="hover-wrap-inner">
            <img loading="lazy" decoding="async" class="img-with-animation skip-lazy " data-delay="0" height="1920" width="2560" data-animation="fade-in" src="https://www.digitalurban.org/wp-content/uploads/2019/12/IMG_1883-scaled-1.jpeg" alt="THE: eink Time Headlines and Environmental Data" srcset="https://www.digitalurban.org/wp-content/uploads/2019/12/IMG_1883-scaled-1.jpeg 2560w, https://www.digitalurban.org/wp-content/uploads/2019/12/IMG_1883-scaled-1-300x225.jpeg 300w, https://www.digitalurban.org/wp-content/uploads/2019/12/IMG_1883-scaled-1-1024x768.jpeg 1024w, https://www.digitalurban.org/wp-content/uploads/2019/12/IMG_1883-scaled-1-768x576.jpeg 768w, https://www.digitalurban.org/wp-content/uploads/2019/12/IMG_1883-scaled-1-1536x1152.jpeg 1536w, https://www.digitalurban.org/wp-content/uploads/2019/12/IMG_1883-scaled-1-2048x1536.jpeg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" />
          </div>
        </div>
      </div>
    </div><div class="iwithtext"><div class="iwt-icon">  </div><div class="iwt-text"> <strong>Step Three &#8211; THE </strong><br />
Once you have the scripts to collect the feeds you needs to install the main script to run THE.<br />
Download THE_pi_what.py<br />
As with the other scripts, edit where indicated and add in your own MQTT details. Once edited, copy it across to your Pi with your other scripts.<br />
Finally you need the font and the background image:<br />
Download hm.ttf (the font)<br />
Download whatbackground.png<br />
These go in a new folder called &#8216;resources&#8217; inside the scripts folder you crearted on your pi &#8211; simply create the new folder and copy the files across. </div><div class="clear"></div></div>
			</div> 
		</div>
	</div> 
</div></div>
		<div id="fws_6970d6a4eebde"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				<div class="iwithtext"><div class="iwt-icon">  </div><div class="iwt-text"> <strong>Step Four &#8211; Run the Scripts at Set Times.</strong><br />
The scripts run at set times on the pi via the cron service. To set this up, simply log into your pi via ssh and type</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">sudo crontab -e</pre>
<p>This sets up a new cron process &#8211; if asked select option &#8216;2&#8217; to edit with nano &#8211; copy the following into the cron file and save (cntl x).</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">*/5 * * * * python3 /home/pi/scripts/timetomqtt.py
*/12 * * * * python3 /home/pi/scripts/rsstomqtt.py
*/18 * * * * python3 /home/pi/scripts/darkskytomqtt.py
@reboot sleep 10 &amp;&amp; python3 /home/pi/scripts/THE_pi_what.py
*/60 * * * * sudo reboot</pre>
<p>&nbsp;<br />
The scripts run at set times &#8211; change them to any time to wish. We reboot the pi every hour to keep things fresh &#8211; this is not required and we know it is not the best of practice but we have found it keeps things running for our purposes. </div><div class="clear"></div></div>
			</div> 
		</div>
	</div> 
</div></div>
		<div id="fws_6970d6a5011c3"  data-column-margin="default" data-midnight="dark"  class="wpb_row vc_row-fluid vc_row"  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-animation-delay="" data-bg-overlay="false"><div class="inner-wrap row-bg-layer" ><div class="row-bg viewport-desktop"  style=""></div></div></div><div class="row_col_wrap_12 col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" >
			<div class="wpb_wrapper">
				<div class="iwithtext"><div class="iwt-icon">  </div><div class="iwt-text"> <strong>Step Five</strong><br />
Reboot your Pi and sit back and wait  &#8211; your feeds will appear according the time intervals you set in your cron scripts.<br />
You can edit the files and add as many sources of information as you like.<br />
Do let us know if you make one, edit any scripts or remix the case. </div><div class="clear"></div></div>
			</div> 
		</div>
	</div> 
</div></div>
<p>The post <a href="https://www.digitalurban.org/blog/2020/04/10/the/">Make an eInk MQTT Reader for the Time, News and Environmental Data</a> appeared first on <a href="https://www.digitalurban.org">Digital Urban</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
