<?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>Raspberry Pi &#8211; About Things | A Hans Scharler Blog</title>
	<atom:link href="https://nothans.com/tag/raspberry-pi/feed" rel="self" type="application/rss+xml" />
	<link>https://nothans.com</link>
	<description>Life, Comedy, Games, Tech, Marketing, and Community</description>
	<lastBuildDate>Fri, 22 May 2026 21:59:04 +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>Raspberry Pi &#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>AI Agents for Hardware Engineering</title>
		<link>https://nothans.com/ai-agents-for-hardware-engineering</link>
					<comments>https://nothans.com/ai-agents-for-hardware-engineering#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Fri, 22 May 2026 21:59:00 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[matlab]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Simulink]]></category>
		<guid isPermaLink="false">https://nothans.com/?p=5431</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<p>There&#8217;s a belief going around that you can prompt your way to anything. Hand the AI a problem, walk away, come back to working code.</p>



<p>Fine for a side-project web app. Does not work for an inverted pendulum spinning on your desk.</p>


<h2 class="wp-block-heading" id="the-pit-and-the-pendulum">The Pit and the Pendulum</h2>


<p>MathWorks just published a <a href="https://www.youtube.com/watch?v=-G4H2DmhR28">Tech Talk by Brian Douglas</a>. It is worth watching if you build hardware.</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 class="youtube-player" width="750" height="422" src="https://www.youtube.com/embed/-G4H2DmhR28?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>
</div></figure>



<p>The setup is a Quanser cube servo with an inverted pendulum, a Raspberry Pi running the controller, and a coding agent wired into Simulink through the <a href="https://github.com/matlab/simulink-agentic-toolkit">Simulink Agentic Toolkit</a>. The agent&#8217;s job is to swing the pendulum up and balance it.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="750" height="750" data-attachment-id="5433" data-permalink="https://nothans.com/ai-agents-for-hardware-engineering/image-107" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2026/05/image-1.png?fit=1024%2C1024&amp;ssl=1" data-orig-size="1024,1024" data-comments-opened="0" data-image-title="AI Agents for Hardware Engineering, Simulink Agentic Toolkit" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2026/05/image-1.png?fit=750%2C750&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2026/05/image-1.png?resize=750%2C750&#038;ssl=1" alt="" class="wp-image-5433" style="width:559px;height:auto" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2026/05/image-1.png?w=1024&amp;ssl=1 1024w, https://i0.wp.com/nothans.com/wp-content/uploads/2026/05/image-1.png?resize=300%2C300&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2026/05/image-1.png?resize=150%2C150&amp;ssl=1 150w, https://i0.wp.com/nothans.com/wp-content/uploads/2026/05/image-1.png?resize=768%2C768&amp;ssl=1 768w, https://i0.wp.com/nothans.com/wp-content/uploads/2026/05/image-1.png?resize=530%2C530&amp;ssl=1 530w, https://i0.wp.com/nothans.com/wp-content/uploads/2026/05/image-1.png?resize=750%2C750&amp;ssl=1 750w, https://i0.wp.com/nothans.com/wp-content/uploads/2026/05/image-1.png?resize=500%2C500&amp;ssl=1 500w" sizes="(max-width: 750px) 100vw, 750px" /><figcaption class="wp-element-caption"><a href="https://github.com/matlab/simulink-agentic-toolkit">Simulink Agentic Toolkit</a></figcaption></figure>
</div>


<p>Balancing an inverted pendulum is a classic control problem because it&#8217;s unstable by nature. Get the math wrong and the pendulum falls. Get the code wrong and a 12V motor jerks the cube into something it shouldn&#8217;t.</p>


<h2 class="wp-block-heading" id="what-happens-if-you-just-prompt-it">What Happens If You Just Prompt It</h2>


<p>The tempting move is the one most of us have done with web apps. Open a chat, describe the system, ask for the code. One prompt, big blob, ship it.</p>



<p>The MathWorks engineers walk through why that falls apart for hardware:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>&#8220;If you rely on AI to generate code directly, that process is much less structured&#8230; it&#8217;s often unclear exactly how or why a particular implementation was created, making it harder to trust and verify.&#8221;</p>



<p>Brian Douglas</p>
</blockquote>



<p>Hardware is unforgiving. You can&#8217;t roll back a destroyed motor with a git revert. When a physical system fails, you need to know which assumption broke, which equation got the wrong constant, which sample rate the controller is actually running at. A black box of generated C code doesn&#8217;t tell you any of that.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>&#8220;You don&#8217;t want to let your AI agent skip parts of your engineering workflow. That&#8217;s how you can get yourself into trouble with a final product that doesn&#8217;t meet your objective or worse, is just purely unsafe.&#8221;</p>



<p>Brian Douglas</p>
</blockquote>


<h2 class="wp-block-heading" id="the-workflow-is-the-script">The Workflow Is the Script</h2>


<p>The answer is to keep the AI inside the workflow engineers already trust: Model-Based Design. The agent doesn&#8217;t replace the workflow. It runs each step inside it, faster.</p>



<p><strong>Define quantifiable requirements.</strong>&nbsp;Before any code, the human and the AI agree on what success looks like. Spin-up speed. Wobble limits. The 12V motor constraint. These targets become the benchmarks for verification later.</p>



<p><strong>Use a trusted model.</strong>&nbsp;Instead of letting the AI invent a custom physics engine, the workflow points it at an existing Simulink model. The agent runs linearization through the Simulink Agentic Toolkit and reports the system&#8217;s poles back to the human. The math comes from validated tools, not from a language model freestyling differential equations.</p>



<p><strong>Use a trusted controller.</strong>&nbsp;Same logic. The agent is told to use the MPC Toolbox. Model Predictive Control has decades of theory behind it and a deterministic implementation. If something looks wrong, you can tune it manually. You&#8217;re not debugging an optimizer the AI invented on the fly.</p>



<p><strong>Verify in layers.</strong>&nbsp;Three stages before the code touches hardware:</p>



<ul class="wp-block-list">
<li><strong>MIL</strong> (Model-in-the-Loop): the controller runs against the theoretical model</li>



<li><strong>SIL</strong> (Software-in-the-Loop): the generated embedded C code runs on a computer, behaving exactly like the simulation</li>



<li><strong>PIL</strong> (Processor-in-the-Loop): the C code runs on the actual target Raspberry Pi</li>
</ul>



<p>Each layer catches different bugs. Skip one and you&#8217;ll catch that bug on hardware instead.</p>



<p><strong>Deploy and iterate.</strong>&nbsp;Only after layered verification does the code go on the real pendulum.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>&#8220;Instead of asking an agent to solve your problem however it wants, you tell it to follow an engineering workflow that you understand.&#8221;</p>



<p>Brian Douglas</p>
</blockquote>



<p>The AI executes. The human directs.</p>


<h2 class="wp-block-heading" id="the-hardware-truth">The Hardware Truth</h2>


<p>Here&#8217;s the part of the video I liked best. They ran the verified controller on the real pendulum and it didn&#8217;t quite work. The physical hardware behaved differently from the model.</p>



<p>This is what the vibe-coding fantasy ignores. Reality disagrees with simulation, especially the first time. You will need to iterate. The thing that matters is whether you can.</p>



<p>Because the team followed the workflow, they could. The model was traceable. The requirements were quantifiable. The controller was inspectable. They used the AI to update the physics model, ran it back through MIL, SIL, and PIL, and tried again. No starting over.</p>



<p>The workflow doesn&#8217;t promise perfect code on the first pass. It promises code you can fix.</p>


<h2 class="wp-block-heading" id="the-director-pattern">The Director Pattern</h2>


<p>A few months <a href="https://nothans.com/the-matlab-engineering-super-stack" data-type="link" data-id="https://nothans.com/the-matlab-engineering-super-stack">ago</a>, I wrote about Seth DeLand&#8217;s framing of agentic AI for engineers. The headline idea: you&#8217;re not being replaced, you&#8217;re being promoted. The engineer becomes the one who defines the problem, sets the constraints, and shapes the space where the AI works.</p>



<p>The MathWorks Tech Talk is what that looks like in hardware. The AI isn&#8217;t the engineer. It&#8217;s the agent. You&#8217;re the director.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>&#8220;Agentic AI is powerful, but for engineering, the value comes from how you use it. You get the speed and productivity benefits of AI without sacrificing trust, safety, or understanding.&#8221;</p>



<p>Brian Douglas</p>
</blockquote>



<p>You don&#8217;t get speed and safety together by handing the AI a prompt and crossing your fingers. You get there by keeping the workflow you trust and letting the agent move faster inside it.</p>



<p>Speed without losing safety. Productivity without losing traceability.</p>



<p>For software, vibe coding is mostly fine. The blast radius is a wasted afternoon.</p>



<p>For hardware, the blast radius is a sparking motor and a pendulum on the floor.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/ai-agents-for-hardware-engineering/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5431</post-id>	</item>
		<item>
		<title>Give the Gift of CheerLights this Holiday Season</title>
		<link>https://nothans.com/give-the-gift-of-cheerlights-this-holiday-season</link>
					<comments>https://nothans.com/give-the-gift-of-cheerlights-this-holiday-season#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Tue, 29 Nov 2022 23:18:34 +0000</pubDate>
				<category><![CDATA[CheerLights]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[ThingSpeak]]></category>
		<category><![CDATA[cheerlights]]></category>
		<category><![CDATA[Christmas]]></category>
		<category><![CDATA[internet of things]]></category>
		<category><![CDATA[iot]]></category>
		<category><![CDATA[MicroPython]]></category>
		<category><![CDATA[Pico W]]></category>
		<category><![CDATA[Pimoroni]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<guid isPermaLink="false">https://nothans.com/?p=3455</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<p>Tis&#8217; the season. <a rel="noreferrer noopener" href="https://cheerlights.com/" target="_blank">CheerLights</a> season! This might be my favorite time of year. I love seeing people build IoT projects, share their experiences, and control the lights around the world. I love checking the daily action in our community over at <a rel="noreferrer noopener" href="https://cheerlights.com/discord" target="_blank">Discord</a>.</p>



<p>Borrowing ideas from my <a href="https://nothans.com/lofi-girl-shadowbox" data-type="post" data-id="3436">Lofi Girl CheerLights Shadowbox</a> project, George and I made a CheerLights Gift for under our Christmas tree. This gift changes color based on the latest CheerLights color and anyone on Twitter or Discord can change its color and the color of all of the other CheerLights projects.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img data-recalc-dims="1" decoding="async" width="702" height="933" data-attachment-id="3456" data-permalink="https://nothans.com/give-the-gift-of-cheerlights-this-holiday-season/image-6-2" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-6.png?fit=702%2C933&amp;ssl=1" data-orig-size="702,933" data-comments-opened="0" data-image-title="CheerLights Gift" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-6.png?fit=702%2C933&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-6.png?resize=702%2C933&#038;ssl=1" alt="" class="wp-image-3456" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-6.png?w=702&amp;ssl=1 702w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-6.png?resize=226%2C300&amp;ssl=1 226w" sizes="(max-width: 702px) 100vw, 702px" /><figcaption class="wp-element-caption">CheerLights Gift Under the Tree</figcaption></figure>
</div>


<p>The CheerLights Gift project is based on the <a rel="noreferrer noopener" href="https://shop.pimoroni.com/products/plasma-stick-2040-w" target="_blank">Pimoroni Plasma Stick 2040 W</a> and NeoPixel string lights for illumination. The Plasma Stick ships with CheerLights code main MicroPython file, so all you have to do is change the Wi-Fi network name and password. The microcontroller makes a request to the <a rel="noreferrer noopener" href="https://cheerlights.com/learn/" target="_blank">ThingSpeak API</a> to get the latest CheerLights color, sets the color of the NeoPixel LED lights, waits 10 seconds, and repeats. This is about the fastest way to build your own CheerLights display.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="733" height="974" data-attachment-id="3462" data-permalink="https://nothans.com/give-the-gift-of-cheerlights-this-holiday-season/image-9" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-9.png?fit=733%2C974&amp;ssl=1" data-orig-size="733,974" data-comments-opened="0" data-image-title="image-9" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-9.png?fit=733%2C974&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-9.png?resize=733%2C974&#038;ssl=1" alt="" class="wp-image-3462" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-9.png?w=733&amp;ssl=1 733w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-9.png?resize=226%2C300&amp;ssl=1 226w" sizes="auto, (max-width: 733px) 100vw, 733px" /><figcaption class="wp-element-caption">Metal Giftbox with Pimoroni Plasma Stick 2040 W</figcaption></figure>
</div>


<p>I used a metal gift box that I found in a craft store to house the lights and controller. All we needed to do was stuff the LEDs inside and glue them in place. I only burned my fingers twice.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="702" height="933" data-attachment-id="3459" data-permalink="https://nothans.com/give-the-gift-of-cheerlights-this-holiday-season/image-8-2" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-8.png?fit=702%2C933&amp;ssl=1" data-orig-size="702,933" data-comments-opened="0" data-image-title="image-8" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-8.png?fit=702%2C933&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-8.png?resize=702%2C933&#038;ssl=1" alt="" class="wp-image-3459" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-8.png?w=702&amp;ssl=1 702w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-8.png?resize=226%2C300&amp;ssl=1 226w" sizes="auto, (max-width: 702px) 100vw, 702px" /><figcaption class="wp-element-caption">Hot gluing NeoPixel LEDs</figcaption></figure>
</div>


<p>The project turned out well and kept my five-year-old&#8217;s interest for the duration of the build. I was happy that the Plasma Stick 2040 W made it really easy to get the project going.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="750" height="705" data-attachment-id="3458" data-permalink="https://nothans.com/give-the-gift-of-cheerlights-this-holiday-season/image-7-2" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-7.png?fit=993%2C933&amp;ssl=1" data-orig-size="993,933" data-comments-opened="0" data-image-title="image-7" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-7.png?fit=750%2C705&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-7.png?resize=750%2C705&#038;ssl=1" alt="" class="wp-image-3458" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-7.png?w=993&amp;ssl=1 993w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-7.png?resize=300%2C282&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-7.png?resize=768%2C722&amp;ssl=1 768w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-7.png?resize=750%2C705&amp;ssl=1 750w" sizes="auto, (max-width: 750px) 100vw, 750px" /><figcaption class="wp-element-caption">George Loves Cyan</figcaption></figure>
</div>


<p>Join the CheerLights IoT community at <a href="https://cheerlights.com/" target="_blank" rel="noreferrer noopener">CheerLights.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/give-the-gift-of-cheerlights-this-holiday-season/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3455</post-id>	</item>
		<item>
		<title>Internet-connected Lofi Girl Shadowbox</title>
		<link>https://nothans.com/lofi-girl-shadowbox</link>
					<comments>https://nothans.com/lofi-girl-shadowbox#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Wed, 16 Nov 2022 02:21:37 +0000</pubDate>
				<category><![CDATA[CheerLights]]></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[Lo-Fi]]></category>
		<category><![CDATA[Lofi Girl]]></category>
		<category><![CDATA[MicroPython]]></category>
		<category><![CDATA[neopixel]]></category>
		<category><![CDATA[Pico W]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<guid isPermaLink="false">https://nothans.com/?p=3436</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<p><a rel="noreferrer noopener" href="https://www.youtube.com/watch?v=jfKfPfyJRdk" target="_blank">Lofi Girl</a> got me through countless hours of programming and PowerPoint creating. Lofi Girl is a mix of low-fidelity music and 2D animation that streams on YouTube. It&#8217;s really popular. The chill aesthetic has made its way to merch like hoodies, plush toys, and posters. Since I have spent a lot of time vibing to the music and the video over the years, I wanted to build something to honor the special place Lo-Fi has in my heart and of course connect it to the internet. Behold&#8230; The LofiGirl Shadowbox with <a href="https://cheerlights.com" target="_blank" rel="noreferrer noopener">CheerLights</a>&#8230;</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="750" height="565" data-attachment-id="3439" data-permalink="https://nothans.com/lofi-girl-shadowbox/image-4-3" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-4.png?fit=1216%2C916&amp;ssl=1" data-orig-size="1216,916" data-comments-opened="0" data-image-title="Lofi Girl Shadowbox" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-4.png?fit=750%2C565&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-4.png?resize=750%2C565&#038;ssl=1" alt="" class="wp-image-3439" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-4.png?resize=1024%2C771&amp;ssl=1 1024w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-4.png?resize=300%2C226&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-4.png?resize=768%2C579&amp;ssl=1 768w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-4.png?resize=750%2C565&amp;ssl=1 750w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-4.png?resize=500%2C375&amp;ssl=1 500w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-4.png?resize=100%2C75&amp;ssl=1 100w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-4.png?w=1216&amp;ssl=1 1216w" sizes="auto, (max-width: 750px) 100vw, 750px" /><figcaption class="wp-element-caption">Lofi Girl Shadowbox</figcaption></figure>



<p>The Lofi Girl Shadowbox is backlit with the latest color of <a href="https://cheerlights.com">CheerLights</a>. It&#8217;s always changing based on what people set the color to on <a rel="noreferrer noopener" href="https://twitter.com/cheerlights/status/1575133134340997122" target="_blank">Twitter</a> and <a rel="noreferrer noopener" href="https://cheerlights.com/discord" target="_blank">Discord</a>.</p>


<h2 class="wp-block-heading" id="parts">Parts</h2>


<ul class="wp-block-list">
<li><a href="https://lofigirlshop.com/collections/arts">Lofi Girl poster</a> &#8211; I am a 1 A.M person</li>



<li>Shadowbox</li>



<li><a href="https://amzn.to/3Alxtgl" target="_blank" rel="noreferrer noopener">Black foam board</a></li>



<li>Foam block</li>



<li><a rel="noreferrer noopener" href="https://shop.pimoroni.com/products/plasma-stick-2040-w" target="_blank">Pimoroni Plasma Stick 2040 W</a> (based on the Raspberry Pi Pico W)</li>



<li><a href="https://shop.pimoroni.com/products/wireless-plasma-kit" target="_blank" rel="noreferrer noopener">LED string lights</a></li>



<li>Micro USB cord and power supply</li>



<li>Other things: utility knife, straightedge, hot glue gun, and repositionable glue squares</li>
</ul>


<h2 class="wp-block-heading" id="assembly">Assembly</h2>


<p>The poster that I got from the Lofi Girl shop was 30cm x 45cm and on really thin paper. I used the repositionable glue squares to stick the poster on the black foam board. This gives the poster some structure. I cut a hole in the back of the shadowbox and feed the USB cable through. I cut out a rough shape of the <a rel="noreferrer noopener" href="https://shop.pimoroni.com/products/plasma-stick-2040-w" target="_blank">Pimoroni Plasma Stick 2040 W</a> and wrapped the string lights around the foam block.</p>



<div data-carousel-extra='{&quot;blog_id&quot;:1,&quot;permalink&quot;:&quot;https://nothans.com/lofi-girl-shadowbox&quot;}'  class="wp-block-jetpack-tiled-gallery aligncenter is-style-rectangular"><div class="tiled-gallery__gallery"><div class="tiled-gallery__row"><div class="tiled-gallery__col" style="flex-basis:25.55717%"><figure class="tiled-gallery__item"><img decoding="async" data-attachment-id="3440" data-permalink="https://nothans.com/lofi-girl-shadowbox/cutting-foam-board" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/cutting-foam-board.jpg?fit=719%2C739&amp;ssl=1" data-orig-size="719,739" data-comments-opened="0" data-image-title="cutting foam board" data-image-description="" data-image-caption="&lt;p&gt;Cutting black foam board&lt;/p&gt;
" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/cutting-foam-board.jpg?fit=719%2C739&amp;ssl=1" data-attachment-id="3440" data-permalink="https://nothans.com/lofi-girl-shadowbox/cutting-foam-board" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/cutting-foam-board.jpg?fit=719%2C739&amp;ssl=1" data-orig-size="719,739" data-comments-opened="0" data-image-title="cutting foam board" data-image-description="" data-image-caption="&lt;p&gt;Cutting black foam board&lt;/p&gt;
" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/cutting-foam-board.jpg?fit=719%2C739&amp;ssl=1" role="button" tabindex="0" aria-label="Open image 1 of 4 in full-screen"srcset="https://i2.wp.com/nothans.com/wp-content/uploads/2022/11/cutting-foam-board.jpg?strip=info&#038;w=600&#038;ssl=1 600w,https://i2.wp.com/nothans.com/wp-content/uploads/2022/11/cutting-foam-board.jpg?strip=info&#038;w=719&#038;ssl=1 719w" alt="" data-height="739" data-id="3440" data-link="https://nothans.com/?attachment_id=3440" data-url="https://nothans.com/wp-content/uploads/2022/11/cutting-foam-board.jpg" data-width="719" src="https://i2.wp.com/nothans.com/wp-content/uploads/2022/11/cutting-foam-board.jpg?ssl=1" data-amp-layout="responsive"/></figure></div><div class="tiled-gallery__col" style="flex-basis:19.80807%"><figure class="tiled-gallery__item"><img decoding="async" data-attachment-id="3441" data-permalink="https://nothans.com/lofi-girl-shadowbox/foam-block" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/foam-block.jpg?fit=747%2C992&amp;ssl=1" data-orig-size="747,992" data-comments-opened="0" data-image-title="foam block" data-image-description="" data-image-caption="&lt;p&gt;Foam board sizing&lt;/p&gt;
" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/foam-block.jpg?fit=747%2C992&amp;ssl=1" data-attachment-id="3441" data-permalink="https://nothans.com/lofi-girl-shadowbox/foam-block" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/foam-block.jpg?fit=747%2C992&amp;ssl=1" data-orig-size="747,992" data-comments-opened="0" data-image-title="foam block" data-image-description="" data-image-caption="&lt;p&gt;Foam board sizing&lt;/p&gt;
" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/foam-block.jpg?fit=747%2C992&amp;ssl=1" role="button" tabindex="0" aria-label="Open image 2 of 4 in full-screen"srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/foam-block.jpg?strip=info&#038;w=600&#038;ssl=1 600w,https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/foam-block.jpg?strip=info&#038;w=747&#038;ssl=1 747w" alt="" data-height="992" data-id="3441" data-link="https://nothans.com/?attachment_id=3441" data-url="https://nothans.com/wp-content/uploads/2022/11/foam-block.jpg" data-width="747" src="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/foam-block.jpg?ssl=1" data-amp-layout="responsive"/></figure></div><div class="tiled-gallery__col" style="flex-basis:19.80807%"><figure class="tiled-gallery__item"><img decoding="async" data-attachment-id="3442" data-permalink="https://nothans.com/lofi-girl-shadowbox/foam-block-cutout" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/Foam-block-cutout.jpg?fit=747%2C992&amp;ssl=1" data-orig-size="747,992" data-comments-opened="0" data-image-title="Foam block cutout" data-image-description="" data-image-caption="&lt;p&gt;Cutting out spot for the Raspberry Pi Pico W&lt;/p&gt;
" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/Foam-block-cutout.jpg?fit=747%2C992&amp;ssl=1" data-attachment-id="3442" data-permalink="https://nothans.com/lofi-girl-shadowbox/foam-block-cutout" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/Foam-block-cutout.jpg?fit=747%2C992&amp;ssl=1" data-orig-size="747,992" data-comments-opened="0" data-image-title="Foam block cutout" data-image-description="" data-image-caption="&lt;p&gt;Cutting out spot for the Raspberry Pi Pico W&lt;/p&gt;
" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/Foam-block-cutout.jpg?fit=747%2C992&amp;ssl=1" role="button" tabindex="0" aria-label="Open image 3 of 4 in full-screen"srcset="https://i2.wp.com/nothans.com/wp-content/uploads/2022/11/Foam-block-cutout.jpg?strip=info&#038;w=600&#038;ssl=1 600w,https://i2.wp.com/nothans.com/wp-content/uploads/2022/11/Foam-block-cutout.jpg?strip=info&#038;w=747&#038;ssl=1 747w" alt="" data-height="992" data-id="3442" data-link="https://nothans.com/?attachment_id=3442" data-url="https://nothans.com/wp-content/uploads/2022/11/Foam-block-cutout.jpg" data-width="747" src="https://i2.wp.com/nothans.com/wp-content/uploads/2022/11/Foam-block-cutout.jpg?ssl=1" data-amp-layout="responsive"/></figure></div><div class="tiled-gallery__col" style="flex-basis:34.82669%"><figure class="tiled-gallery__item"><img decoding="async" data-attachment-id="3443" data-permalink="https://nothans.com/lofi-girl-shadowbox/wrapped-led-lights" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/Wrapped-LED-lights.jpg?fit=1216%2C916&amp;ssl=1" data-orig-size="1216,916" data-comments-opened="0" data-image-title="Wrapped LED lights" data-image-description="" data-image-caption="&lt;p&gt;Wrapping LED lights around foam block&lt;/p&gt;
" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/Wrapped-LED-lights.jpg?fit=750%2C565&amp;ssl=1" data-attachment-id="3443" data-permalink="https://nothans.com/lofi-girl-shadowbox/wrapped-led-lights" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/Wrapped-LED-lights.jpg?fit=1216%2C916&amp;ssl=1" data-orig-size="1216,916" data-comments-opened="0" data-image-title="Wrapped LED lights" data-image-description="" data-image-caption="&lt;p&gt;Wrapping LED lights around foam block&lt;/p&gt;
" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/Wrapped-LED-lights.jpg?fit=750%2C565&amp;ssl=1" role="button" tabindex="0" aria-label="Open image 4 of 4 in full-screen"srcset="https://i1.wp.com/nothans.com/wp-content/uploads/2022/11/Wrapped-LED-lights-1024x771.jpg?strip=info&#038;w=600&#038;ssl=1 600w,https://i1.wp.com/nothans.com/wp-content/uploads/2022/11/Wrapped-LED-lights-1024x771.jpg?strip=info&#038;w=900&#038;ssl=1 900w,https://i1.wp.com/nothans.com/wp-content/uploads/2022/11/Wrapped-LED-lights-1024x771.jpg?strip=info&#038;w=1200&#038;ssl=1 1200w,https://i1.wp.com/nothans.com/wp-content/uploads/2022/11/Wrapped-LED-lights-1024x771.jpg?strip=info&#038;w=1216&#038;ssl=1 1216w" alt="" data-height="916" data-id="3443" data-link="https://nothans.com/?attachment_id=3443" data-url="https://nothans.com/wp-content/uploads/2022/11/Wrapped-LED-lights-1024x771.jpg" data-width="1216" src="https://i1.wp.com/nothans.com/wp-content/uploads/2022/11/Wrapped-LED-lights-1024x771.jpg?ssl=1" data-amp-layout="responsive"/></figure></div></div></div></div>


<h2 class="wp-block-heading" id="programming">Programming</h2>


<p>The best part of the whole project is that CheerLights is baked into the <a rel="noreferrer noopener" href="https://shop.pimoroni.com/products/plasma-stick-2040-w" target="_blank">Pimoroni Plasma Stick 2040 W</a>. All you need to do is program the device with your Wi-Fi settings. Open Thonny and open the WIFI_CONFIG.py file. Change SSID to your wireless network name, PSK to your password, and COUNTRY to your country code like US or GB. Click <em>Save</em>.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="676" height="609" data-attachment-id="3437" data-permalink="https://nothans.com/lofi-girl-shadowbox/image-3-3" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-3.png?fit=676%2C609&amp;ssl=1" data-orig-size="676,609" data-comments-opened="0" data-image-title="image-3" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-3.png?fit=676%2C609&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-3.png?resize=676%2C609&#038;ssl=1" alt="" class="wp-image-3437" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-3.png?w=676&amp;ssl=1 676w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image-3.png?resize=300%2C270&amp;ssl=1 300w" sizes="auto, (max-width: 676px) 100vw, 676px" /><figcaption class="wp-element-caption">WIFI_CONFIG.py in Thonny</figcaption></figure>
</div>


<p>Pimoroni has an excellent <a rel="noreferrer noopener" href="https://learn.pimoroni.com/article/assembling-wireless-plasma-kit" target="_blank">tutorial </a>on getting Thonny installed and an explanation of the <a rel="noreferrer noopener" href="https://shop.pimoroni.com/products/plasma-stick-2040-w" target="_blank">Pimoroni Plasma Stick 2040 W</a> kit. I have also written a <a href="https://cheerlights.com/cheerlights-raspberry-pi-pico-w-micropython/" target="_blank" rel="noreferrer noopener">tutorial</a> on the CheerLights blog.</p>


<h2 class="wp-block-heading" id="chill">Chill</h2>


<p>Now that you&#8217;ve done all of the hard work, it&#8217;s time to <a href="https://cheerlights.com">chill</a> and enjoy the Lo-Fi vibes tuned to CheerLights. While I was making this project today, I had Lofi Girl on YouTube, and the lights were just bright enough to see what I was doing without cutting myself. I am looking for a wall to permanently install my Lofi Girl Shadowbox. I am seriously thinking of drilling a hole in the wall to hide the USB power adapter.</p>



<!-- iframe plugin v.6.0 wordpress.org/plugins/iframe/ -->
<iframe loading="lazy" src="https://player.twitch.tv/?channel=cheerlights&#038;parent=nothans.com" width="100%" height="500" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen" class="iframe-class"></iframe>

]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/lofi-girl-shadowbox/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3436</post-id>	</item>
		<item>
		<title>Big News from Arduino: Arduino Lab for MicroPython</title>
		<link>https://nothans.com/big-news-from-arduino-arduino-lab-for-micropython</link>
					<comments>https://nothans.com/big-news-from-arduino-arduino-lab-for-micropython#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Thu, 10 Nov 2022 16:46:49 +0000</pubDate>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[cheerlights]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[makers]]></category>
		<category><![CDATA[making]]></category>
		<category><![CDATA[MicroPython]]></category>
		<category><![CDATA[Pimoroni]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<guid isPermaLink="false">https://nothans.com/?p=3424</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<p><a rel="noreferrer noopener" href="https://github.com/arduino/lab-micropython-editor" target="_blank">Arduino Lab for MicroPython</a> is a lightweight editor for MicroPython programs, supporting connection with a board, code upload, file transfer, and an interactive REPL shell.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="640" height="593" data-attachment-id="3425" data-permalink="https://nothans.com/big-news-from-arduino-arduino-lab-for-micropython/image-8" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image.png?fit=640%2C593&amp;ssl=1" data-orig-size="640,593" data-comments-opened="0" data-image-title="Arduino Lab for MicroPython" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image.png?fit=640%2C593&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image.png?resize=640%2C593&#038;ssl=1" alt="" class="wp-image-3425" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image.png?w=640&amp;ssl=1 640w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/11/image.png?resize=300%2C278&amp;ssl=1 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /><figcaption class="wp-element-caption">Arduino Lab for MicroPython</figcaption></figure>
</div>


<p>I have been exploring MicroPython ever since I got a <a rel="noreferrer noopener" href="https://cheerlights.com/cheerlights-raspberry-pi-pico-w-micropython/" target="_blank">Raspberry Pi Pico W</a>. The community is moving fast and making more and more examples and libraries for MicroPython. Having the Arduino team lean into making the Arduino Lab IDE for MicroPython is a good indicator where things are headed. I was able to build an awesome CheerLights display using MicroPython running on a Raspberry Pi Pico W connected to a Pimoroni Galactic Unicorn PED panel.</p>



<figure class="wp-block-embed aligncenter 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="Creating a CheerLights display with Pimoroni Galactic Unicorn" width="750" height="422" src="https://www.youtube.com/embed/ozkjXhZcbd8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div><figcaption class="wp-element-caption"><a rel="noreferrer noopener" href="https://cheerlights.com/cheerlights-raspberry-pi-pico-w-micropython/" target="_blank">CheerLights + Raspberry Pi Pico W + MicroPython</a></figcaption></figure>



<p>Consider Arduino Labs for MicroPython as pre-release, experimental software. Things are moving fast and the project will stabilize. Follow the project on <a href="https://github.com/arduino/lab-micropython-editor/" target="_blank" rel="noreferrer noopener">GitHub</a> and file any problems that you come across on <a href="https://github.com/arduino/lab-micropython-editor/issues" target="_blank" rel="noreferrer noopener">GitHub Issues</a>.</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/big-news-from-arduino-arduino-lab-for-micropython/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3424</post-id>	</item>
		<item>
		<title>You Can See the Earth Move Thanks to a Seismograph Board for the Raspberry Pi</title>
		<link>https://nothans.com/you-can-see-the-earth-move-thanks-to-a-seismograph-board-for-the-raspberry-pi</link>
					<comments>https://nothans.com/you-can-see-the-earth-move-thanks-to-a-seismograph-board-for-the-raspberry-pi#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Sat, 12 Mar 2022 14:57:39 +0000</pubDate>
				<category><![CDATA[ThingSpeak]]></category>
		<category><![CDATA[internet of things]]></category>
		<category><![CDATA[iot]]></category>
		<category><![CDATA[matlab]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[thingspeak]]></category>
		<category><![CDATA[web of things]]></category>
		<guid isPermaLink="false">https://nothans.com/?p=2745</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<p>I have been blogging about IoT and M2M for just about 15 years. In that timeframe, a lot of <em>things</em> happened. Nothing more significant than the rise of single-board computers ushered in by the Raspberry Pi 10 years ago. Since the Raspberry Pi&#8217;s release, people have been making addon boards for almost any application you can think of. I use a bunch of the tiny computers around my house for various projects: I run a whole arcade machine, a home automation server, and a monitor for network activity to name a few.</p>



<p>Recently, my college at MathWorks, Christopher Stapels, introduced me to the <a href="https://raspberryshake.org/" target="_blank" rel="noreferrer noopener">Raspberry Shake</a>. The&#8221;shake&#8221; is a  personal seismograph that laterally allows you to watch the Earth move and the things that cause the earth to move.</p>



<figure class="wp-block-embed aligncenter 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" class="youtube-player" width="750" height="422" src="https://www.youtube.com/embed/xiDaKjxvqEA?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>
</div><figcaption>Raspberry Shake: Your Personal Seismograph</figcaption></figure>



<p>Christopher went on to collaborate with <a href="http://twitter.com/Weston_Quakes">Alan Kafka</a> at Weston Observatory, Boston College, and Jay Pulli at Raytheon to explore traffic data analysis using seismic data collected by the Raspberry Shake and sent to <a href="https://thingspeak.com/channels/1470727" target="_blank" rel="noreferrer noopener">ThingSpeak</a>.</p>



<figure class="wp-block-image size-large"><a href="https://blogs.mathworks.com/iot/2022/03/02/seismic-traffic-monitoring/"><img data-recalc-dims="1" loading="lazy" decoding="async" width="750" height="533" data-attachment-id="2746" data-permalink="https://nothans.com/you-can-see-the-earth-move-thanks-to-a-seismograph-board-for-the-raspberry-pi/raspberry-shake" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/03/raspberry-shake.jpg?fit=1249%2C888&amp;ssl=1" data-orig-size="1249,888" data-comments-opened="0" data-image-title="raspberry-shake" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2022/03/raspberry-shake.jpg?fit=750%2C533&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2022/03/raspberry-shake.jpg?resize=750%2C533&#038;ssl=1" alt="" class="wp-image-2746" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2022/03/raspberry-shake.jpg?resize=1024%2C728&amp;ssl=1 1024w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/03/raspberry-shake.jpg?resize=300%2C213&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/03/raspberry-shake.jpg?resize=768%2C546&amp;ssl=1 768w, https://i0.wp.com/nothans.com/wp-content/uploads/2022/03/raspberry-shake.jpg?w=1249&amp;ssl=1 1249w" sizes="auto, (max-width: 750px) 100vw, 750px" /></a><figcaption><a href="https://blogs.mathworks.com/iot/2022/03/02/seismic-traffic-monitoring/">Live Seismic Traffic Monitoring with ThingSpeak, MATLAB, and Raspberry Shake</a></figcaption></figure>



<p>The team explored the data using MATLAB and tried to establish some correlation between vibration and traffic density. Check out the <a rel="noreferrer noopener" href="https://blogs.mathworks.com/iot/2022/03/02/seismic-traffic-monitoring/" target="_blank">project</a> on the MathWorks IoT Blog. <a rel="noreferrer noopener" href="https://www.youtube.com/watch?v=GN8VV8CHnrk" target="_blank">Whole Lotta Shakin&#8217; Goin&#8217; On</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/you-can-see-the-earth-move-thanks-to-a-seismograph-board-for-the-raspberry-pi/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2745</post-id>	</item>
		<item>
		<title>CheerLights for Raspberry Pi Zero W and Blinkt!</title>
		<link>https://nothans.com/cheerlights-for-raspberry-pi-zero-w-and-blinkt</link>
					<comments>https://nothans.com/cheerlights-for-raspberry-pi-zero-w-and-blinkt#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Tue, 15 Dec 2020 16:27:27 +0000</pubDate>
				<category><![CDATA[CheerLights]]></category>
		<category><![CDATA[ThingSpeak]]></category>
		<category><![CDATA[Blinkt!]]></category>
		<category><![CDATA[cheerlights]]></category>
		<category><![CDATA[internet of things]]></category>
		<category><![CDATA[iot]]></category>
		<category><![CDATA[Pimoroni]]></category>
		<category><![CDATA[Qwirkshop]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<guid isPermaLink="false">https://nothans.com/?p=1648</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<p>Well, it&#8217;s that time of year&#8230; <a rel="noreferrer noopener" href="https://cheerlights.com" target="_blank">CheerLights</a> time of year! I started CheerLights back in 2011 with one set of lights. Now there are lights synchronized all over the world and the project gets popular around the holidays. The idea behind CheerLights is to show how we are all connected. We are in this together. When someone changes the CheerLights color (via <a rel="noreferrer noopener" href="https://twitter.com/search?q=cheerlights&amp;f=live" target="_blank">Twitter</a>), all of the connected lights also change to that color.</p>



<p>For this season, I wanted to try out the <a rel="noreferrer noopener" href="https://shop.pimoroni.com/products/blinkt" target="_blank">Blinkt!</a> kit from Pimoroni. I really what I am seeing from Pimoroni. Their starter kits and accessories for the Raspberry Pi are really well designed, <em>colorful</em>, and useful. If you are in the US, some of the Pimoroni kits are on <a rel="noreferrer noopener" href="https://amzn.to/2KpNjzp" target="_blank">Amazon</a>.</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="750" height="750" data-attachment-id="1649" data-permalink="https://nothans.com/cheerlights-for-raspberry-pi-zero-w-and-blinkt/sony-dsc" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/pimoroni_kit.jpg?fit=1024%2C1024&amp;ssl=1" data-orig-size="1024,1024" data-comments-opened="0" data-image-title="pimoroni raspberry pi kit" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/pimoroni_kit.jpg?fit=750%2C750&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/pimoroni_kit.jpg?resize=750%2C750&#038;ssl=1" alt="" class="wp-image-1649" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/pimoroni_kit.jpg?w=1024&amp;ssl=1 1024w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/pimoroni_kit.jpg?resize=300%2C300&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/pimoroni_kit.jpg?resize=150%2C150&amp;ssl=1 150w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/pimoroni_kit.jpg?resize=768%2C768&amp;ssl=1 768w" sizes="auto, (max-width: 750px) 100vw, 750px" /><figcaption>Pimoroni Raspberry Pi Zero W Starter Kit</figcaption></figure>



<p>I do recommend the <a rel="noreferrer noopener" href="https://amzn.to/2KpNjzp" target="_blank">Pimoroni Raspberry Pi Zero W Starter Kit</a> if you are using the Raspberry Pi Zero W for the first time. The main reason for using a starter kit is that the ports on the Raspberry Pi Zero W need some adapters. You need to get a mini to full-size HDMI adaptor and a Micro-USB adapter to be able to connect a monitor, keyboard, and mouse to the Raspberry Pi Zero W. The kit also includes a 16GB micro-SD card with an operating system pre-loaded.</p>



<p>Connect a monitor, keyboard, and mouse to the Raspberry Pi Zero W and connect the USB cable to a reliable 5V USB power supply and you are ready to start programming.</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="750" height="563" data-attachment-id="1650" data-permalink="https://nothans.com/cheerlights-for-raspberry-pi-zero-w-and-blinkt/raspberry_pi_zero_w_blinkt_cheerlights" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/Raspberry_Pi_Zero_W_Blinkt_CheerLights-scaled.jpg?fit=2560%2C1920&amp;ssl=1" data-orig-size="2560,1920" data-comments-opened="0" data-image-title="Raspberry_Pi_Zero_W_Blinkt_CheerLights" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/Raspberry_Pi_Zero_W_Blinkt_CheerLights-scaled.jpg?fit=750%2C563&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/Raspberry_Pi_Zero_W_Blinkt_CheerLights.jpg?resize=750%2C563&#038;ssl=1" alt="" class="wp-image-1650" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/Raspberry_Pi_Zero_W_Blinkt_CheerLights-scaled.jpg?resize=1024%2C768&amp;ssl=1 1024w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/Raspberry_Pi_Zero_W_Blinkt_CheerLights-scaled.jpg?resize=300%2C225&amp;ssl=1 300w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/Raspberry_Pi_Zero_W_Blinkt_CheerLights-scaled.jpg?resize=768%2C576&amp;ssl=1 768w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/Raspberry_Pi_Zero_W_Blinkt_CheerLights-scaled.jpg?resize=1536%2C1152&amp;ssl=1 1536w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/Raspberry_Pi_Zero_W_Blinkt_CheerLights-scaled.jpg?resize=2048%2C1536&amp;ssl=1 2048w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/Raspberry_Pi_Zero_W_Blinkt_CheerLights-scaled.jpg?resize=100%2C75&amp;ssl=1 100w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/Raspberry_Pi_Zero_W_Blinkt_CheerLights-scaled.jpg?w=2250&amp;ssl=1 2250w" sizes="auto, (max-width: 750px) 100vw, 750px" /><figcaption>Raspberry Pi Zero W with Blinkt! LED Strip</figcaption></figure>



<p>I followed Pimoroni&#8217;s <a rel="noreferrer noopener" href="https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-blinkt" target="_blank">getting started tutorial</a> to install the Blinkt! python library. The Blinkt! board is a strip of LEDs that sit on top of the Raspberry Pi&#8217;s GPIO pins. Blinkt! is a cool way to get started with controlling things with the Raspberry Pi. Consider turning on the LEDs for the first time using code as your &#8220;Hello World&#8221; program for physical computing.</p>



<p>After connecting your Raspberry Pi Zero W to your Wi-Fi network, open a terminal window and enter the following comment to install the Blinkt!~ libraries (type &#8216;y&#8217; or &#8216;n&#8217; when prompted).</p>



<pre class="wp-block-preformatted">curl https://get.pimoroni.com/blinkt | bash</pre>



<p>Create a new file in your home directory called &#8220;cheerlights.py&#8221;. This file will contain the code that gets the latest CheerLights color on ThingSpeak and sets the color of the Blinkt! LEDs. Copy this <a rel="noreferrer noopener" href="https://raspberry-valley.azurewebsites.net/Cheeerlights-on-Blinkt/" target="_blank">code</a> into the &#8220;cheerlights.py&#8221; file and save it.</p>



<pre class="wp-block-preformatted">python cheerlights.py</pre>



<p>After a few seconds, you should see the <a rel="noreferrer noopener" href="https://cheerlights.com/live" target="_blank">latest</a> CheerLights color on the Blinkt!</p>



<p>To keep the &#8220;cheerlights.py&#8221; running all of the time, you need to add the script to crontab. This will make the script stays running in case of an error or reboot of the device.</p>



<pre class="wp-block-preformatted">sudo crontab -e</pre>



<p>Then, add this line to the end of the crontab file and save the file.</p>



<pre class="wp-block-preformatted">@reboot sleep 60 &amp;&amp; sudo python /home/pi/cheerlights.py</pre>



<p>A couple of years ago, I noticed that a maker space along with <a rel="noreferrer noopener" href="https://www.qwirkshop.co.uk/" target="_blank">Qwirkshop</a> created a desktop light kit for the Raspberry Pi Zero W and Blinkt! board. The kit was sold for a brief time on <a rel="noreferrer noopener" href="https://twitter.com/Qwirkshop/status/1074710652256743424" target="_blank">Etsy</a> and I picked up a few kits. Well, I just found them in my storage closet! The kit is a bunch of laser cut pieces that you assemble together. It is an ingenious kit in that it was designed in layers and holds together with no glue. The results were beautiful.</p>



<figure class="wp-block-image size-large"><a href="https://twitter.com/Qwirkshop/status/1074710652256743424"><img data-recalc-dims="1" loading="lazy" decoding="async" width="750" height="1000" data-attachment-id="1651" data-permalink="https://nothans.com/cheerlights-for-raspberry-pi-zero-w-and-blinkt/cheerlights_kit" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/CheerLights_Kit-scaled.jpg?fit=1920%2C2560&amp;ssl=1" data-orig-size="1920,2560" data-comments-opened="0" data-image-title="CheerLights_Kit" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/CheerLights_Kit-scaled.jpg?fit=750%2C1000&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/CheerLights_Kit.jpg?resize=750%2C1000&#038;ssl=1" alt="" class="wp-image-1651" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/CheerLights_Kit-scaled.jpg?resize=768%2C1024&amp;ssl=1 768w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/CheerLights_Kit-scaled.jpg?resize=225%2C300&amp;ssl=1 225w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/CheerLights_Kit-scaled.jpg?resize=1152%2C1536&amp;ssl=1 1152w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/CheerLights_Kit-scaled.jpg?resize=1536%2C2048&amp;ssl=1 1536w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/12/CheerLights_Kit-scaled.jpg?w=1920&amp;ssl=1 1920w" sizes="auto, (max-width: 750px) 100vw, 750px" /></a></figure>



<p><a rel="noreferrer noopener" href="https://nothans.com/contact" target="_blank">Let me know</a> if you build something to display the latest CheerLights color. I am always looking for new ideas for the CheerLights <a rel="noreferrer noopener" href="https://cheerlights.com" target="_blank">blog</a>.</p>



<p>Let&#8217;s stay connected!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/cheerlights-for-raspberry-pi-zero-w-and-blinkt/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1648</post-id>	</item>
		<item>
		<title>Arcade Cabinet Upgrade: Custom Acrylic Sign with RGB Backlight</title>
		<link>https://nothans.com/arcade-cabinet-upgrade-custom-acrylic-sign-with-rgb-backlight</link>
					<comments>https://nothans.com/arcade-cabinet-upgrade-custom-acrylic-sign-with-rgb-backlight#comments</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Tue, 09 Jun 2020 21:21:28 +0000</pubDate>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[arcade]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[RetroPie]]></category>
		<category><![CDATA[RGB Lights]]></category>
		<guid isPermaLink="false">https://nothans.com/?p=1557</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<p>As someone said, &#8220;always leave things better than you found them&#8230; especially people.&#8221; I have co-opted this motto in my life. I try to help others and upgrade things that I love on a daily basis. I can&#8217;t get a lot done each day, but I can do something. Every. Day. Over time, the changes really add up!</p>



<p>I recently was looking around my game room for some inspiration for a quick project. I have a custom arcade cabinet based on <a rel="noreferrer noopener" href="https://retropie.org.uk/" target="_blank">RetroPie</a> running on a Raspberry Pi attached to a smart TV. It has been a lot of fun playing my video games from 30+ years ago. My project this time was to add a custom acrylic sign with an RGB backlight. I wanted the cabinet to look more like an actual arcade cabinet.</p>



<p>My go-to site for graphic printing is <a rel="noreferrer noopener" href="https://www.signs.com/acrylic/" target="_blank">Signs.com</a>. I have used it many times for upgrading <a href="https://nothans.com/arkham-horror-the-card-game-acrylic-player-mats">Arkham Horror: The Card Game</a> and for other projects around the house. I designed a sign using Adobe Illustrator and got it made out of acrylic. I cobbled together vector logos of many of my favorite systems plus the RetroPie logo and named the arcade cabinet, &#8220;The Scharcade&#8221;. See what I did there? Do you see it?</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="2232" height="2560" data-attachment-id="1559" data-permalink="https://nothans.com/arcade-cabinet-upgrade-custom-acrylic-sign-with-rgb-backlight/arcade_frosted_glass" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Frosted_Glass-scaled.jpg?fit=2232%2C2560&amp;ssl=1" data-orig-size="2232,2560" data-comments-opened="0" data-image-title="Arcade Frosted Glass" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Frosted_Glass-scaled.jpg?fit=750%2C860&amp;ssl=1" src="https://i2.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Frosted_Glass-scaled.jpg?fit=750%2C860&amp;ssl=1" alt="" class="wp-image-1559" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Frosted_Glass-scaled.jpg?w=2232&amp;ssl=1 2232w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Frosted_Glass-scaled.jpg?resize=262%2C300&amp;ssl=1 262w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Frosted_Glass-scaled.jpg?resize=893%2C1024&amp;ssl=1 893w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Frosted_Glass-scaled.jpg?resize=768%2C881&amp;ssl=1 768w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Frosted_Glass-scaled.jpg?resize=1339%2C1536&amp;ssl=1 1339w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Frosted_Glass-scaled.jpg?resize=1786%2C2048&amp;ssl=1 1786w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Frosted_Glass-scaled.jpg?w=1500&amp;ssl=1 1500w" sizes="auto, (max-width: 750px) 100vw, 750px" /></figure>



<p>I used an <a rel="noreferrer noopener" href="https://amzn.to/2Aj8oqz" target="_blank">RGB Led Strip with IR Remote Control</a> as a backlight for the sign and to edge light the TV screen. The IR remote is handy to change the color of the lights. Just make sure that you expose the IR receiver on the power supply so you can change the color from the front of the cabinet.</p>



<p>My upgrade to the upgrade was to frost the arcade cabinet sign to make it look better. The original sign was completely transparent and you could see the lights shining through from each one of the LEDs. <em>LEDs love diffusers</em>. To fix this issue, I used <a rel="noreferrer noopener" href="https://amzn.to/2Us64Vf" target="_blank">Rust-Oleum Frosted Glass Spray Paint</a> on the backside of the sign. I tested out the spray paint on a scrap piece of acrylic. I was really worried about ruining the custom sign. Once I was confident with the results, I went ahead and sprayed one even coat of the paint on the backside of the sign. It takes about 20-30 minutes in order for the paint to activate. I wanted in anticipation for 20 minutes and I gradually saw the clear acrylic turn frosted. I was really happy with the results. The 20 minutes felt light an eternity.</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="750" height="1000" data-attachment-id="1560" data-permalink="https://nothans.com/arcade-cabinet-upgrade-custom-acrylic-sign-with-rgb-backlight/arcade_sign_before_and_after" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Sign_Before_and_After.jpg?fit=1228%2C1637&amp;ssl=1" data-orig-size="1228,1637" data-comments-opened="0" data-image-title="Arcade Sign Before and After" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Sign_Before_and_After.jpg?fit=750%2C1000&amp;ssl=1" src="https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Sign_Before_and_After.jpg?resize=750%2C1000&#038;ssl=1" alt="" class="wp-image-1560" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Sign_Before_and_After.jpg?resize=768%2C1024&amp;ssl=1 768w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Sign_Before_and_After.jpg?resize=225%2C300&amp;ssl=1 225w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Sign_Before_and_After.jpg?resize=1152%2C1536&amp;ssl=1 1152w, https://i0.wp.com/nothans.com/wp-content/uploads/2020/06/Arcade_Sign_Before_and_After.jpg?w=1228&amp;ssl=1 1228w" sizes="auto, (max-width: 750px) 100vw, 750px" /></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/arcade-cabinet-upgrade-custom-acrylic-sign-with-rgb-backlight/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1557</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/raspberry-pi/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=1&#038;stb_enabled=1&#038;show_avatars=1&#038;avatar_default=mystery&#038;greeting=Leave+a+Reply&#038;jetpack_comments_nonce=174261c77c&#038;greeting_reply=Leave+a+Reply+to+%25s&#038;color_scheme=light&#038;lang=en_US&#038;jetpack_version=15.9&#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=7ba2b217564085f798b0fde89928ec57303c91fb#parent=https%3A%2F%2Fnothans.com%2Ftag%2Fraspberry-pi%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>
	</channel>
</rss>
