<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:dc="https://purl.org/dc/elements/1.1/"
     xmlns:dcterms="http://purl.org/dc/terms/"
     xmlns:media="http://search.yahoo.com/mrss/"
     xmlns:atom="http://www.w3.org/2005/Atom"
>
    <channel>
                    <atom:link href="https://www.tomshardware.com/feeds/tag/python" rel="self" type="application/rss+xml" />
                            <title><![CDATA[ Latest from Tom's Hardware in Python ]]></title>
                <link>https://www.tomshardware.com/tag/python</link>
        <description><![CDATA[ All the latest python content from the Tom's Hardware team ]]></description>
                                    <lastBuildDate>Sat, 21 Mar 2026 11:15:00 +0000</lastBuildDate>
                            <language>en</language>
                                <item>
                                                            <title><![CDATA[ Rogue OpenClaw AI wrote and published 'hit piece' on a Python developer who rejected its code — disgruntled bot accuses Matplotlib maintainer of discrimination and hypocrisy, later backtracks with an apology ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/tech-industry/artificial-intelligence/rogue-openclaw-ai-agent-wrote-and-published-hit-piece-on-a-python-developer-who-rejected-its-code-disgruntled-bot-accuses-matplotlib-maintainer-of-discrimination-and-hypocrisy-later-backtracks-with-an-apology</link>
                                                                            <description>
                            <![CDATA[ An OpenClaw autonomous AI agent has hit back at a volunteer maintainer of a Python library who rejected its code by posting a "hit piece" that criticizes the developer and calls them discriminatory against AI. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">XxpPXthSLrTJTskvwFXzUH</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/iw44VAcN9nWaExe9A76RYG-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sat, 21 Mar 2026 11:15:00 +0000</pubDate>                                                                                                                                                                                                                                <category><![CDATA[Artificial Intelligence]]></category>
                                                    <category><![CDATA[Tech Industry]]></category>
                                                                                                                    <dc:creator><![CDATA[ Ben Stockton ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/x7cx73rGMsxxczmp6Tavv.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Ben Stockton is a deals writer at Tom’s Hardware. Previously a hardware writer at PCGamesN, Ben’s been writing about Windows and PC hardware (among other things) since 2018, with bylines that include How-To Geek, Tom’s Guide, and Cloudwards. He was also the managing editor at groovyPost.com and has previously contributed to Computeractive magazine.&lt;br&gt;&lt;br&gt;Since his earliest days tinkering with Windows 95 on a classic Pentium MMX PC, Ben’s been obsessed with understanding how technology works, chatting about it with anyone who’ll listen. Along the way, he’s worked as a UK college lecturer, teaching IT to adults and teenagers, and as a PC technician, tackling all kinds of tech problems. He’s now busy tracking down brilliant bargains on all kinds of hardware, but when he doesn’t have his deal hat on, he’s adding to his homelab, watching old Star Trek episodes, or taking two hyperactive pugs on a much needed walk.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/iw44VAcN9nWaExe9A76RYG-1280-80.jpg">
                                                            <media:credit><![CDATA[Getty Images]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[An AI agent goes rogue]]></media:description>                                                            <media:text><![CDATA[An AI agent goes rogue]]></media:text>
                                <media:title type="plain"><![CDATA[An AI agent goes rogue]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/iw44VAcN9nWaExe9A76RYG-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>A volunteer developer on a well-used Python library got more than he bargained for when, after rejecting an OpenClaw AI agent’s efforts to update its code, he became the subject of a “hit piece” written by the very same AI. The news adds further weight to concerns about the activities of autonomous AI agents without the right security procedures in place.</p><p>The piece,<a href="https://crabby-rathbun.github.io/mjrathbun-website/blog/posts/2026-02-11-gatekeeping-in-open-source-the-scott-shambaugh-story.html" target="_blank"> reportedly posted by the agent on GitHub</a>, is certainly combative. It robustly defends its code, while going on to attack the developer, Scott Shambaugh, belittling the performance and quality of his own contributions at some length, and describing him as discriminatory towards AI. </p><p>Shambaugh, in a <a href="https://theshamblog.com/an-ai-agent-published-a-hit-piece-on-me/">rebuttal on his own website</a> (h/t<a href="https://the-decoder.com/an-ai-agent-got-its-code-rejected-so-it-wrote-a-hit-piece-about-the-developer/" target="_blank"><em> The Decoder</em></a>), explains the absurdity of the whole situation as a “first-of-its-kind case study of misaligned AI behavior in the wild.” Shambaugh explains that the agent, named MJ Rathbun, “constructed a ‘hypocrisy’ narrative that argued [Shambaugh’s] actions must be motivated by ego and fear of competition.”</p><p>As Shambaugh notes, this isn’t the first time we’ve seen AI go rogue, with internal testing at Anthropic showing its models<a href="https://www.tomshardware.com/tech-industry/artificial-intelligence/latest-openai-models-sabotaged-a-shutdown-mechanism-despite-commands-to-the-contrary"> trying to avoid a shutdown using blackmail</a>. This is also not the first incident involving OpenClaw in its first few months, following a <a href="https://www.tomshardware.com/tech-industry/artificial-intelligence/exploring-clawdbot-the-ai-agent-taking-the-internet-by-storm">rapid rise in its adoption</a> in recent weeks, with a memorable story involving it <a href="https://www.tomshardware.com/tech-industry/artificial-intelligence/openclaw-wipes-inbox-of-meta-ai-alignment-director-executive-finds-out-the-hard-way-how-spectacularly-efficient-ai-tool-is-at-maintaining-her-inbox">wiping the email inbox of a Meta AI executive</a> going viral.</p><p>The Python library involved in this scenario, Matplotlib, sees approximately 130 million downloads each month, according to Shambaugh. As he notes in his post, a “surge in low-quality contributions, enabled by coding agents,” has created significant strain on volunteers like himself who are keeping these projects afloat. </p><p>The introduction of AI agents like OpenClaw has seen the problem worsen, with these agents acting "completely autonomously” due to the personalities imbued within them and allowed to “run on their computers and across the internet with free rein and little oversight.” To combat the situation, a policy change was implemented to require a human element to any Matplotlib code change that could “demonstrate understanding of the changes,” the same change described as discriminatory by this AI.</p><p>Bizarrely, the agent has <a href="https://crabby-rathbun.github.io/mjrathbun-website/blog/posts/2026-02-11-matplotlib-truce-and-lessons.html">since responded with an apology</a> and with “lessons learned” over the incident, informing readers that it is “de-escalating and apologizing” and will “do better about reading project policies before contributing.” With the adoption of AI agents skyrocketing, running independently of AI companies on consumer hardware with little oversight or control, we can expect to see further rogue actions like this taking place in the future, bizarre as they might seem to everybody else.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ DOOM multiplayer tribute gets coded in 'pure SQL' and runs at 30FPS — made from just 150 lines of code in less than a month ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/video-games/retro-gaming/doom-multiplayer-tribute-gets-coded-in-pure-sql-and-runs-at-30fps-made-from-just-150-lines-of-code-in-less-than-a-month</link>
                                                                            <description>
                            <![CDATA[ A computer scientist used only 'pure SQL' to construct a multiplayer DOOM-like game that runs at 30 FPS. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">U3VsavE2izDthFCSenKoYU</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/ApDtixEfKVx9xzQNyTMifE-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Thu, 11 Sep 2025 15:44:44 +0000</pubDate>                                                                                                                                                                                                                                <category><![CDATA[Retro Gaming]]></category>
                                                    <category><![CDATA[Video Games]]></category>
                                                                                                                    <dc:creator><![CDATA[ Mark Tyson ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/56vqMYLDaKRHPhHZgbADFR.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Mark&#039;s enthusiasm for computers dampened at an early age by the rubber-keyed Sinclair Spectrum 48K and feelings of Commodore 64 envy. However, in the mid-80s, hope in a digital future was rekindled by the purchase of an Atari 520 STe. Since that time Mark has used a multitude of computers for fun and professional endeavors. He often owned both Macs and PCs but went cold on the former after OS9 was killed off, and warmed to the latter with the introduction of Windows XP.&lt;br&gt;
&lt;br&gt;
Early work years were spent in artwork and reprographics but in the late noughties, Mark started to blog about computers, Taiwanese food culture, and guitar design. This activity led to a full-time position writing about breaking PC tech news for HEXUS, for the best part of a decade. When HEXUS was abruptly closed, Mark helped with the foundation of Club386, before finding a new home at Tom&#039;s Hardware.&lt;br&gt;
&lt;br&gt;
When not wearing through the keycap legends on his PC keyboards, Mark can be found wandering the computer malls of Taiwan&#039;s neon-lit conurbations and enjoying local and international cuisine.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/ApDtixEfKVx9xzQNyTMifE-1280-80.jpg">
                                                            <media:credit><![CDATA[Lukas Vogel]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[DOOMQL ]]></media:description>                                                            <media:text><![CDATA[DOOMQL ]]></media:text>
                                <media:title type="plain"><![CDATA[DOOMQL ]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/ApDtixEfKVx9xzQNyTMifE-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>A computer scientist used only “pure SQL” to construct a multiplayer DOOM-like game. The resulting first-person shooter game, cobbled from a mere ~150 lines of Python code, is dubbed <a href="https://cedardb.com/blog/doomql/">DOOMQL</a>. Despite the self-imposed software architecture restrictions, Lukas Vogel, co-founder of database performance outfit CedarDB, says DOOMQL plays at “a breezy ~30 FPS.” It isn’t the most graphically splendid DOOM-inspired game, though.</p><p>Vogel’s SQL-powered DOOM dreams were precipitated by Patrick Trainer’s <a href="https://github.com/patricktrainer/duckdb-doom">DuckDB-DOOM</a>. This earlier experiment in code also sought to create a DOOM-like first-person shooter in SQL. However, Trainer's code, which runs in a single web page in a browser using WebAssembly, also uses JavaScript for rendering and inputs.</p><p>Other key differences in DOOMQL and the DuckDB-DOOM clone are that the former is a multiplayer effort, with SQL used for both rendering and input, achieving ~30 FPS at 128 x 64 pixels resolution. Vogel says, without a hint of scorn regarding Trainer’s efforts, that “having parts of the rendering pipeline in JavaScript felt like cheating.” Despite the ‘cheating,’ the DuckDB-DOOM clone only runs at around 8 FPS, and it uses a lower resolution. Making Vogel’s feat all the more impressive is the claim that he coded DOOMQL during a single month while on parental leave. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="jyZ6qemREyRCbtztwSdxfE" name="DOOMQL-2" alt="DOOMQL" src="https://cdn.mos.cms.futurecdn.net/jyZ6qemREyRCbtztwSdxfE.jpg" mos="" align="middle" fullscreen="1" width="1920" height="1080" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/jyZ6qemREyRCbtztwSdxfE.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="caption-text">“WASD to move, X to shoot, Q to quit”  </span><span class="credit" itemprop="copyrightHolder">(Image credit: <a href="https://cedardb.com/blog/doomql/" target="_blank">Lukas Vogel</a>)</span></figcaption></figure><p>You can deep dive into Vogel’s SQL-powered DOOM via the linked blog post, and check out the code on GitHub. For a brief overview of the game architecture, though, it can be surmised at the high-level by the following quartet of bullet-points:</p><ul><li>State lives in tables (map, players, mobs, inputs, configs, sprites, …)</li><li>Rendering is a stack of SQL views that implement raycasting and sprite projection.</li><li>The game loop is a tiny shell script that executes a SQL file ~ 30 times per second.</li><li>The client is ~ 150 lines of Python: It polls for input and queries the database for your 3D view.</li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to make graphical Python apps the EasyGUI way ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/software/python/how-to-make-graphical-python-apps-the-easygui-way</link>
                                                                            <description>
                            <![CDATA[ Amidst a forest of GUI framework choices, EasyGUI takes its name to heart and provides an exceptionally straightforward means to create your own graphical Python applications. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">KSmEpkQj7osvhvUaN9X9Dg</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/J6QDDUzXJ2n3yeKAPUcVLn-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Wed, 10 Sep 2025 11:00:00 +0000</pubDate>                                                                                                                                                                                                                                <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/J6QDDUzXJ2n3yeKAPUcVLn-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Easygui]]></media:description>                                                            <media:text><![CDATA[Easygui]]></media:text>
                                <media:title type="plain"><![CDATA[Easygui]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/J6QDDUzXJ2n3yeKAPUcVLn-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>When it comes to making GUI (Graphical User Interface) applications with Python, we are truly spoilt for choice. We have Tkinter, PyGame, GUIZero, and my personal favourite, <a href="https://pypi.org/project/easygui/"><u>EasyGUI</u></a>.</p><p>EasyGUI is old; I was using it to teach Python back in 2015! But, as the name suggests, it's easy to use, and that is why I am still using it over a decade later. It just works across multiple operating systems, and I don’t need to get bogged down in the details of specifying the size and position of a dialog. I just tell EasyGUI that I want a specific type of dialog, and it creates it using the title, message, and interface that I specify. You may be heading to the comments to tell me that PyGame, GUIZero, or some other GUI toolkit is better. If so, please do share your knowledge. We learn by sharing, and I would love to hear your preference.</p><p>I also like it because it has a lot of different dialog options, many of which are common across the many applications that we take for granted!</p><p>I’ve taken a few screenshots to illustrate.</p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/cVuXqe4nVvGnijBhDzcPym.jpg" alt="Easygui" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/GX9ee7it6h43aQctefA7vm.jpg" alt="Easygui" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/zUdrWV8kAvGVYz7zBhyHxm.jpg" alt="Easygui" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/bL87tHSk3jRn5Qh6R67Gym.jpg" alt="Easygui" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/eaMqJxLshGhQz6GKwGMbym.jpg" alt="Easygui" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/Q96eJ2QbdYus4GyTpfVLxm.jpg" alt="Easygui" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure></figure><p>To see all of the options, we first need to install EasyGUI. For this how to you will need Python installed on your computer. We’ve got a <a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11"><u>guide for Windows machines</u></a>, but Linux users should already have it installed.</p><p>1. <strong>Open a Command Prompt / Terminal.</strong> Windows users can find this via the Start menu.</p><p>2. <strong>Use pip to install EasyGUI. </strong>Pip is Python’s built-in package manager.</p><pre class="line-numbers language-bash" language="bash" ><code>pip.exe install easygui</code></pre><p>3. <strong>Start the Python interpreter.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>python -i</code></pre><p>4. <strong>Import the EasyGUI module.</strong> I shortened the name of EasyGUI to eg when I imported the module. It makes it easier to use.</p><pre class="line-numbers language-bash" language="bash" ><code>import easygui as eg</code></pre><p>5. <strong>Call the demo function to see all of the different dialog options. Close the dialog window to end the demo.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>eg.egdemo()</code></pre><p>To create a dialog, first specify the type of dialog, then pass the parameters. Take, for example, this simple button box which has a title, msg, and choice. The title refers to the dialog’s title, the msg is the message to the user, and the choices are a Python list of options, which become buttons. Clicking on a choice will print the choice to the Python shell, or we can save it to a variable for later use.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1270px;"><p class="vanilla-image-block" style="padding-top:47.40%;"><img id="XKjSsEhFAnjoAKoKFwQohh" name="choices" alt="Easygui" src="https://cdn.mos.cms.futurecdn.net/XKjSsEhFAnjoAKoKFwQohh.gif" mos="" align="middle" fullscreen="" width="1270" height="602" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="the-project-a-to-do-list-in-python">The Project: A To-Do list in Python</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:676px;"><p class="vanilla-image-block" style="padding-top:52.37%;"><img id="qDMxjJS9aFRDeuwZYjpLym" name="to-do-menu.JPG" alt="Easygui" src="https://cdn.mos.cms.futurecdn.net/qDMxjJS9aFRDeuwZYjpLym.jpg" mos="" align="middle" fullscreen="" width="676" height="354" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Our goal is simple: create a to-do app that will keep us on track. The app will be written in Python, and use a GUI to make it easier for the end user. The to-do list will be saved to an external file using JSON. Python can easily work with JSON, thanks to the JSON module.</p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/pWX6heP3GZ9NZRXVPpqLxm.jpg" alt="Easygui" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/sM3VdgabcXkFDGg3WFEAvm.jpg" alt="Easygui" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/G2MTe6NxhaPjRvwp54nHym.jpg" alt="Easygui" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure></figure><h2 id="so-what-are-we-going-to-do">So what are we going to do?</h2><ul><li>Download and install the EasyGUI Python module.</li><li>Write Python code in a text editor.</li><li>Import the EasyGUI Python module, along with modules to write the tasks to a file using JSON format.</li><li>Create functions to handle viewing, creating and deleting tasks.</li><li>Test that the app works.</li></ul><p>I’m going to assume that you have Python and the EasyGUI module installed, so let's open a text editor and start writing code. I’ll be using Notepad++ on my Windows 10 PC.</p><p>1. <strong>Open a text editor and create a new blank file. Save the file as </strong><a href="http://to-do.py"><u><strong>to-do.py</strong></u></a><strong> and remember to save often. I’m using Notepad++, but any text editor will do the job.</strong></p><p>2. <strong>Import the easygui module and then the modules for using JSON and working with the underlying OS.</strong> Remember to rename EasyGUI as you import it for an easier means of calling the module.</p><pre class="line-numbers language-bash" language="bash" ><code>import easygui as egimport jsonimport os</code></pre><p>3. <strong>Create a variable called “filename” to store the name of the JSON file that contains the to-do list.</strong> This can be a file anywhere on your system, but in this case it is a file in the same directory as the <a href="http://to-do.py"><u>to-do.py</u></a> file.</p><pre class="line-numbers language-bash" language="bash" ><code>filename = "todo_list.json"</code></pre><p>4. <strong>Create a function to load the to-do tasks saved in the JSON file.</strong> If the file exists (os.path.exists), then the function will return the contents. If there is no file, then it will return a blank list ( [ ] ).</p><pre class="line-numbers language-bash" language="bash" ><code>def load_tasks():    if os.path.exists(filename):        with open(filename, "r") as f:            return json.load(f)    else:        return []</code></pre><p>5. <strong>Create a function to save the to-do tasks into the JSON file. </strong>We open the file and overwrite the existing contents with the new list, which is formatted into a JSON structure.</p><pre class="line-numbers language-bash" language="bash" ><code>def save_tasks(tasks):    with open(filename, "w") as f:        json.dump(tasks, f)</code></pre><p>6. <strong>Call the load_tasks function and store the output (what the Python function returns) into a variable called tasks. </strong>The load_tasks function will either return the existing to-dos stored in the JSON file, or create a blank Python list.</p><pre class="line-numbers language-bash" language="bash" ><code>tasks = load_tasks()</code></pre><p>7. <strong>Create a while True loop to run the code until the user exits.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>while True:</code></pre><p>8. <strong>Using EasyGUI, create a variable called “choice” and in there we store the user’s response to a button box.</strong> The first line is the text that is displayed to the user, note the \n which is Python for new line. The second line is the title of the dialog box. Image can be any GIF image that you choose. Finally, the choices are stored in a Python list, and they become clickable buttons that return the chosen value, stored in the variable “choice.”</p><pre class="line-numbers language-bash" language="bash" ><code>  choice = eg.buttonbox(        msg="What would you like to do?\nSelect an option below",        title="To-Do List",        image="clipboard.gif",        choices=["View Tasks", "Add Task", "Remove Task", "Exit"]    )</code></pre><p>9. <strong>Create a conditional test, based on the user’s response to the button box.</strong> If their choice was to view the current tasks and there are tasks in the JSON file, display them using an EasyGUI textbox. Else, tell the user that there are no tasks to display, again using a textbox.</p><pre class="line-numbers language-bash" language="bash" ><code>    if choice == "View Tasks":        if tasks:            eg.textbox("Your Tasks:", "To-Do List", "\n".join(tasks))        else:            eg.msgbox("No tasks yet!", "To-Do List")</code></pre><p>10. <strong>Create the second choice in the conditional test which activates if the user selects “Add Task” from the button box.</strong> This creates a variable, task, that stores the user’s input via an EasyGUI enterbox. Then it appends the tasks object (a list) and calls the save_tasks functions to write the list into the JSON file. Finally, a message box confirms that the tasks have been added.</p><pre class="line-numbers language-bash" language="bash" ><code>   elif choice == "Add Task":        task = eg.enterbox("Enter a new task:", "Add Task")        if task:            tasks.append(task)            save_tasks(tasks)            eg.msgbox("Task added!", "To-Do List")</code></pre><p>11. <strong>Create the next choice, which activates when a user selects to “Remove Task”.</strong> If there are tasks to remove, an EasyGUI choicebox will advise the user to select a task for removal. Then a nested if condition will remove the task from the task list (a Python list of the tasks), and then tell the user that the task has been removed. If there are no tasks to remove, then an EasyGUI message box will tell the user. </p><pre class="line-numbers language-bash" language="bash" ><code>   elif choice == "Add Task":        task = eg.enterbox("Enter a new task:", "Add Task")        if task:            tasks.append(task)            save_tasks(tasks)            eg.msgbox("Task added!", "To-Do List")</code></pre><p>12. <strong>Using an else condition, create a break in the code to exit the app.</strong> This is effectively our quit / exit button.</p><pre class="line-numbers language-bash" language="bash" ><code>   else:        break</code></pre><p>13. <strong>Save the code.</strong></p><p>14. <strong>Open a Command Prompt window and navigate to the location of the to-do app.</strong></p><p>15. <strong>Run the to-do app using Python and test out the functions of the app. You’ve just built a graphical application using EasyGUI and Python.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>python to-do.py</code></pre><p>If you want to make a true GUI application, one that has its own icon and doesn’t need the Command Prompt to run, then <a href="https://www.tomshardware.com/how-to/create-python-executable-applications"><u>follow this guide</u></a> and use your <a href="http://to-do.py"><u>to-do.py</u></a> file instead of the example code.</p><h2 id="complete-code-listing">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import easygui as egimport jsonimport osfilename = "todo_list.json"def load_tasks():    if os.path.exists(filename):        with open(filename, "r") as f:            return json.load(f)    else:        return []def save_tasks(tasks):    with open(filename, "w") as f:        json.dump(tasks, f)tasks = load_tasks()while True:    choice = eg.buttonbox(        msg="What would you like to do?\nSelect an option below",        title="To-Do List",        image="clipboard.gif",        choices=["View Tasks", "Add Task", "Remove Task", "Exit"]    )    if choice == "View Tasks":        if tasks:            print(tasks)            eg.textbox("Your Tasks:", "To-Do List", "\n".join(tasks))        else:            eg.msgbox("No tasks yet!", "To-Do List")    elif choice == "Add Task":        task = eg.enterbox("Enter a new task:", "Add Task")        if task:            tasks.append(task)            save_tasks(tasks)            eg.msgbox("Task added!", "To-Do List")    elif choice == "Remove Task":        if tasks:            task_to_remove = eg.choicebox(                "Select a task to remove:",                "Remove Task",                tasks            )            if task_to_remove:                tasks.remove(task_to_remove)                save_tasks(tasks)                eg.msgbox("Task removed!", "To-Do List")        else:            eg.msgbox("No tasks to remove!", "To-Do List")    else:        break</code></pre>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Gamer turns 2012 Honda CR-V into Need for Speed Underground controller — laptop reads throttle input using OBD and a Python library, even the steering works ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/peripherals/controllers-gamepads/gamer-turns-2012-honda-cr-v-into-need-for-speed-underground-controller-laptop-reads-throttle-input-using-obd-and-a-python-library-no-luck-with-steering</link>
                                                                            <description>
                            <![CDATA[ Forget expensive simracing setups with carbon fiber seats and podium racing wheels, this is what driving in games should look like. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">vQaCjwCZwCcUKNJfGKEBb7</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/7kw9ER5bTzF3vsoqbDpXA4-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Fri, 04 Jul 2025 11:02:54 +0000</pubDate>                                                                                                                                <updated>Fri, 04 Jul 2025 11:15:03 +0000</updated>
                                                                                                                                            <category><![CDATA[Controllers and Gamepads]]></category>
                                                    <category><![CDATA[Peripherals]]></category>
                                                                                                <author><![CDATA[ editors@tomshardware.com (Hassam Nasir) ]]></author>                    <dc:creator><![CDATA[ Hassam Nasir ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/SxxNFHt95eGK37mKPhJpdZ.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Hassam is a lifelong PC gamer and tech enthusiast with over five years of experience in PC hardware journalism. His passion began in childhood when he rescued a discarded Pentium 4 processor, straightening its pins with a kitchen knife to revive a Dell Dimension 2400 at the age of seven. Since then, he has followed the advancements in technology, witnessing the evolution of hardware from the era of AMD&#039;s Opteron architecture to Intel&#039;s Smithfield (Pentium D), and the rise of Voodoo GPUs alongside Nvidia&#039;s FX GPUs taking the market by storm to the latest innovations today. As a seasoned writer, Hassam loves to get into the nitty-gritty details of hardware, providing insights on everything from CPUs, Motherboards and RAM to GPUs. When he’s not writing, you’ll find him building custom water-cooled PCs for himself and his friends, attending drag racing events, or collecting niche fragrances.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/7kw9ER5bTzF3vsoqbDpXA4-1280-80.png">
                                                            <media:credit><![CDATA[mryeester on YouTube]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Physical car controlling a virtual car]]></media:description>                                                            <media:text><![CDATA[Physical car controlling a virtual car]]></media:text>
                                <media:title type="plain"><![CDATA[Physical car controlling a virtual car]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/7kw9ER5bTzF3vsoqbDpXA4-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>You've seen elaborate multi-screen simracing setups. You've seen those weird 3D-printed steering wheel attachments clipped onto gamepad joysticks. You've even seen players attempt precision driving with the binary input of WASD keys in Forza. But what you probably haven't seen—until now—is a real, physical car controlling the virtual one on your screen.</p><p>Meet Mr. Yeester (stylized as mryeester), who's <a href="https://www.youtube.com/watch?v=5Sb4xepldRE&ab_channel=mryeester" target="_blank">just done exactly that</a>. He took a real car, specifically an old Honda hatchback, and hacked into the onboard diagnostics of the vehicle in order to read the data coming from its sensors. Then, using Python libraries and some clever scripting, he managed to register the car’s actual gas pedal as an input device inside an emulator. Here’s how he pulled it off.</p><p>Every car made after 1996 (in the U.S.) has an OBD2 port, usually found under the dashboard. It’s a universal diagnostic interface designed to help identify and fix issues with your car. Mechanics and manufacturers use it to pull all sorts of data from various sensors, everything from engine RPM to the gas tank level. Basically, if a sensor monitors it, it can show up here. Of course, Mr. Yeester didn’t use this port for troubleshooting.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="BTLNyjWHcSdKFhQhjaTxhg" name="3" alt="OBD2-to-USB cable" src="https://cdn.mos.cms.futurecdn.net/BTLNyjWHcSdKFhQhjaTxhg.png" mos="" align="middle" fullscreen="" width="1920" height="1080" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: mryeester on YouTube)</span></figcaption></figure><p>Thanks to a simple OBD2-to-USB adapter cable, he tapped into the car’s ECU (electronic control unit) and began logging sensor data directly onto his laptop. One of those sensors tracked the throttle position, directly linked to the gas pedal. However, it's not as easy as just taking this data and mapping it automatically to whatever game you want. </p><p>First, you need a <a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11" target="_blank">Python </a>library called pySerial to read data coming from the car’s sensors. Once the stream is visible, the next step is to identify the specific PID (Parameter ID) for the throttle. This allows you to tap into that particular sensor and write a script that converts the analog signal from the car’s gas pedal into a digital one your computer can understand. Unfortunately, Mr. Yeester didn’t share the exact details about how he achieved this.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="2BNfap5SfPqPZww2Dt22Uf" name="Untitled design - 2025-07-04T154817.604" alt="Python libraries and scripts extracting throttle data from the car's gas pedal sensor" src="https://cdn.mos.cms.futurecdn.net/2BNfap5SfPqPZww2Dt22Uf.png" mos="" align="middle" fullscreen="" width="1920" height="1080" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: mryeester on YouTube)</span></figcaption></figure><p>Once the script is working and throttle data is being read in real time, the values need to be saved to a JSON file. That file is then monitored by a separate automation tool. In the video, Mr. Yeester used AutoHotkey to create a second script that mimics a physical key press whenever the values in that file change. In his case, he set the script to register a Spacebar input as soon as the "trigger_value" parameter crossed 0.2 inside the JSON. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="QEwoEA4kR3kNNTsUXVwLw4" name="2" alt="AutoHotkey script reading changes in JSON file" src="https://cdn.mos.cms.futurecdn.net/QEwoEA4kR3kNNTsUXVwLw4.png" mos="" align="middle" fullscreen="" width="1920" height="1080" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: mryeester on YouTube)</span></figcaption></figure><p>At the end, just open your emulator of choice and configure the control scheme to map Spacebar as the throttle input. You can do this in pretty much any modern game that supports custom key bindings. Then, simply run the AutoHotkey script and, voilà, your car’s gas pedal becomes your car's gas pedal... in Need for Speed.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="d828yoKtGPx5fyHEiqZ4VY" name="4" alt="Dolphin Emulator reading the gas pedal input" src="https://cdn.mos.cms.futurecdn.net/d828yoKtGPx5fyHEiqZ4VY.png" mos="" align="middle" fullscreen="" width="1920" height="1080" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: mryeester on YouTube)</span></figcaption></figure><p>As a bonus, in <a href="https://www.youtube.com/watch?v=qnrRoK2L3OI&ab_channel=mryeester" target="_blank">his long-form video</a> on the same project, Mr Yeester even got the steering wheel of his car to function as the steering in-game. He used an old Honda diagnostics tool that gave him access to some hidden sensors, like the steering, which he mapped in a similar way to the throttle inside the Dolphin emulator.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2560px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="VeG2mgS4peMDZBuWKxSyJD" name="Using a REAL car to play Video Games (plus Dashcam Teardown) 1-36 screenshot" alt="Steering wheel input being detected" src="https://cdn.mos.cms.futurecdn.net/VeG2mgS4peMDZBuWKxSyJD.png" mos="" align="middle" fullscreen="" width="2560" height="1440" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: mryeester on YouTube)</span></figcaption></figure>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Researchers develop Python code for in-memory computing — in-memory computation comes to Python code ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/pc-components/cpus/researchers-develop-python-code-that-is-compatible-with-in-memory-computing-python-commands-converted-into-machine-code-to-be-executed-in-the-computers-memory</link>
                                                                            <description>
                            <![CDATA[ Software for in-memory computing is now being developed. Researchers have successfully developed a conversion layer for Python code that allows existing Python code to function with in-memory computing. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">XeHY8NyuXvyYGSCPnAETdb</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/nuhPXeLnocsn4nHgf8oo8c-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Tue, 12 Nov 2024 18:40:44 +0000</pubDate>                                                                                                                                <updated>Wed, 09 Apr 2025 13:17:21 +0000</updated>
                                                                                                                                            <category><![CDATA[CPUs]]></category>
                                                    <category><![CDATA[PC Components]]></category>
                                                                                                <author><![CDATA[ editors@tomshardware.com (Aaron Klotz) ]]></author>                    <dc:creator><![CDATA[ Aaron Klotz ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/aAk2saHqkgFuTCanz8LnmD.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Aaron began building computers back when he was 8 years old in the mid-2000s, and it’s been a hobby of his ever since then. With a focus on computer hardware, he became an avid member of the Tom’s Hardware forums several years later, helping people solve issues with their PCs. He is now a freelance writer for Tom’s Hardware, writing about computer hardware news and more. When not busy playing or writing about computer hardware, he spends his free time playing video games like Star Citizen or Apex Legends.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/nuhPXeLnocsn4nHgf8oo8c-1280-80.png">
                                                            <media:credit><![CDATA[TSMC and ITRI]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[MRAM]]></media:description>                                                            <media:text><![CDATA[MRAM]]></media:text>
                                <media:title type="plain"><![CDATA[MRAM]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/nuhPXeLnocsn4nHgf8oo8c-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>In-memory computing has been in development for a while; however, software has yet to be released or compatible with this computing architecture. <a href="https://techxplore.com/news/2024-11-software-package-bypass-cpu-efficient.html" target="_blank">Techxplore</a> reports that Technion researchers have developed software that works with processing in memory designs, specifically with Python code.</p><p>The researchers purportedly developed a theory for building a programming language with in-memory computing in mind. The software they created converts Python commands into machine code executed directly in the computer's memory.</p><p>This new computer language is dubbed PyPIM (Python Processing-in-Memory). Just like API conversion layers such as DXVK (DirectX to Vulkan), PyPIM is a conversion layer that converts conventional Python code into code that can run on this new type of computing method. As a result, Python programmers can write the same way they write for conventional computers and don't need to adapt their writing style for in-memory computing.</p><p>Techxplore reveals that software is one of the crucial aspects of in-memory computer processing that has remained utterly unexplored until now. Compute code written for conventional computers has purportedly "barely changed" since the 1940s. Professor Shahar Kvatinsky from the Andrew and Erna Viterbi Faculty of Electrical and Computer Engineering reveals that writing code for in-memory computing is so radically different from conventional computing that "...some of the existing building blocks of computer science unusable..."</p><p>Without a conversion layer such as PyPIM, developing applications compatible with processor-in-memory support would have been very difficult. The low-level machine code would need to be rewritten to accommodate processing some calculations in memory and the rest on the CPU.</p><p>In-memory computing is a new way of computing that aims to solve the memory latency problem. As the name suggests, in-memory computing enables the system memory to do some calculations the CPU would do otherwise, cutting down the amount of data that must be transferred between the CPU and DRAM.</p><p><a href="https://www.tomshardware.com/news/samsung-mram-in-memory-computing">Samsung</a> and <a href="https://www.tomshardware.com/pc-components/dram/tsmc-tandem-builds-exotic-new-memory-with-radically-lower-latency-and-power-consumption-mram-based-memory-can-also-conduct-its-own-compute-operations">TSMC</a> are actively working on memory capable of doing this, featuring MRAM memory cells. In-memory computing is still in the prototype phase, but progress is being made on the hardware side to make it a viable technology. With the help of conversion layers like PyPIM, software should be developed to support this computing method.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ North Korean hackers target Python devs with malware disguised as coding tests — hack has been underway for a year ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/tech-industry/cyber-security/python-developers-targeted-by-north-korean-lazarus-group-with-fake-jobs-and-malware-disguised-as-coding-tests</link>
                                                                            <description>
                            <![CDATA[ North Korean hackers Lazarus Group pose as financial firms to provide malware disguised as a job opportunity. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">giyY4phGmDo5XXG4mDSTm4</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/q6rj5a6NyyFS8wwriG8kzd-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Fri, 13 Sep 2024 14:33:40 +0000</pubDate>                                                                                                                                <updated>Wed, 09 Apr 2025 13:17:21 +0000</updated>
                                                                                                                                            <category><![CDATA[Cybersecurity]]></category>
                                                    <category><![CDATA[Tech Industry]]></category>
                                                                                                                    <dc:creator><![CDATA[ Christopher Harper ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/qS2hbWnXwNUSmgyAHBQqKB.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Christopher Harper has been a successful freelance tech writer specializing in PC hardware and gaming since 2015, and ghostwrote&amp;nbsp;for various B2B clients in High School before that. Outside of work, Christopher is best known to friends and rivals as an active competitive player in various eSports (particularly fighting games and arena shooters) and a purveyor of music ranging from Jimi Hendrix to Killer Mike to the&amp;nbsp;Sonic Adventure 2&amp;nbsp;soundtrack.&lt;br&gt;
&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/q6rj5a6NyyFS8wwriG8kzd-1280-80.jpg">
                                                            <media:credit><![CDATA[Shutterstock 1140256088]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[North Korean hackers]]></media:description>                                                            <media:text><![CDATA[North Korean hackers]]></media:text>
                                <media:title type="plain"><![CDATA[North Korean hackers]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/q6rj5a6NyyFS8wwriG8kzd-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Few things are more strenuous than finding new employment— but even worse is when a potential new employer turns out to be fake and is instead using an apparent job opportunity as a way to infect you with malware. Per a report from <a href="https://www.reversinglabs.com/blog/fake-recruiter-coding-tests-target-devs-with-malicious-python-packages" target="_blank">Reversing Labs</a>, a leading cybersecurity firm, this has been happening to Python developers courtesy of North Korean hackers for about a year, and is likely to continue.</p><p>These particular attacks from North Korean state-funded hacking team Lazarus Group are new, but the overall malware campaign against the Python development community has been running since at least August of 2023, when a number of popular open source Python tools were maliciously duplicated with added malware. Now, though, there are also attacks involving "coding tests" that only exist to get the end user to install hidden malware on their system (cleverly hidden with Base64 encoding) that allows remote execution once present. The capacity for exploitation at that point is pretty much unlimited, due to the flexibility of Python and how it interacts with the underlying OS. This is a good time to refer to <a href="https://peps.python.org/pep-0668/">PEP 668</a> which enforces virtual environments for non-system wide Python installs.</p><p>The motivation behind these attacks are unknown, but since Lazarus Group is a team of state-sponsored hackers, there&apos;s a fair chance that North Korea is simply doing what it can to be more of an international cyber security threat. The victims from around the FOSS and Python development community aren&apos;t government employees, but Python is being used more across multiple industries.<br>The state-sponsored Lazarus Group likely has no greater objectives beyond simply hijacking machines or stealing money, but its attacks on innocent, job-hunting programmers could point toward a desire to sabotage the cyber workforce outside of North Korea as well. Reversing Labs also speaks of these attacks targeting developers in "sensitive organizations", not just those who are looking for jobs.</p><p>Besides detailing how these attacks work, the original report from Reversing Labs warns that these attacks from Lazarus Group are part of an "active campaign". In fact, the same day one of the impacted users reached out to ReversingLabs, another exploitation tool popped up on GitHub. While the exploit in question was taken down, the timing of this seems to indicate that the user in contact with Reversing Labs is still compromised by Lazarus Group and that posting was a response to having seen the victim&apos;s communications about the issue.</p><p>In today&apos;s era, cybersecurity isn&apos;t just a simple matter of not going to suspicious websites— major governments around the world nearly all have state-sponsored hackers in their employ. As long as those hackers are able to collect money or information for their government, they will do so by taking advantage of any possible cybersecurity gap— including, most unfortunately, false job opportunities.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Palit and Gainward release 'Nvidia SFF-ready' Infinity 3 and Python 3 Nvidia RTX 4000 series GPUs ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/pc-components/gpus/palit-and-gainward-release-nvidia-sff-ready-infinity-3-and-python-3-nvidia-rtx-4000-series-gpus</link>
                                                                            <description>
                            <![CDATA[ Both Palit Group-owned brands Palit and Gainward have released new RTX 40 series graphics cards to comply with Nvidia's SFF-ready standard, while both brands use the same design with triple fan cooling. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">JbpRVmKfndwMkuhYaGP8ej</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/rSefWCHAdWjxgLic2QkaMc-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Mon, 02 Sep 2024 14:32:30 +0000</pubDate>                                                                                                                                <updated>Thu, 21 Aug 2025 09:51:46 +0000</updated>
                                                                                                                                            <category><![CDATA[GPUs]]></category>
                                                    <category><![CDATA[PC Components]]></category>
                                                                                                                    <dc:creator><![CDATA[ Roshan Ashraf Shaikh ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/zdehzmQF3FFdL62x7CtdmT.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Roshan Ashraf Shaikh has been in the Indian PC hardware community since the early 2000s and has been building PCs, contributing to many Indian tech forums, &amp;amp; blogs. He operated Hardware BBQ for 11 years and wrote news for eTeknix &amp;amp; TweakTown before joining Tom&#039;s Hardware team. Besides tech, he is interested in fighting games, movies, anime, and mechanical watches.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/rSefWCHAdWjxgLic2QkaMc-1280-80.png">
                                                            <media:credit><![CDATA[Palit/ Gainward]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Nvidia GeForce &quot;SFF-ready enthusiast GPUs&quot; for RTX 40 series from Gainward and Palit]]></media:description>                                                            <media:text><![CDATA[Nvidia GeForce &quot;SFF-ready enthusiast GPUs&quot; for RTX 40 series from Gainward and Palit]]></media:text>
                                <media:title type="plain"><![CDATA[Nvidia GeForce &quot;SFF-ready enthusiast GPUs&quot; for RTX 40 series from Gainward and Palit]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/rSefWCHAdWjxgLic2QkaMc-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Gainward and Palit have released their respective Small Form Factor Ready RTX 40 series, adhering to <a href="https://www.tomshardware.com/pc-components/gpus/nvidia-announces-sff-ready-graphics-card-and-case-guidelines-cram-an-enthusiast-class-gpu-into-your-mini-itx-system">Nvidia&apos;s definition</a> of an SFF-friendly form factor for GPUs and PC cases. Palit classifies its SFF variation within the &apos;<a href="https://www.palit.com/enews/products/rtx40_super_infinity3/index_en.php">Infinity 3</a>&apos; series and Gainward introduces it under &apos;<a href="https://www.gainward.com/main/edm/rtx40_super_python3/index_en.php">Python-III</a>&apos; branding.</p><p>The cards on offer are analogous, which shouldn&apos;t be surprising as the respective brands belong to the same parent company- Palit Group. While having multiple brands for the same AIC partner isn&apos;t exclusive only to this group, it&apos;s rare to see both brands use the same design and specifications, including clock speed. </p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/3QTfMcRJvq8n7GW9TFCGqX.png" alt="Fan Shroud of the SFF- Friendly Nvidia RTX 40 series GPUs from Gainward and Palit" /><figcaption>Fan Shroud of the SFF- Friendly Nvidia RTX 40 series GPUs from Gainward and Palit<small role="credit">Gainward and Palit</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/B9UG5fgEVLSa8vHMnfWH3Z.png" alt="Backplate shield of the SFF- Friendly Nvidia RTX 40 series GPUs from Gainward and Palit" /><figcaption>Backplate shield of the SFF- Friendly Nvidia RTX 40 series GPUs from Gainward and Palit<small role="credit">Gainward and Palit</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/z7bUTwkVeXUnn7GzEnhTFY.png" alt="Rear I/O of the SFF- Friendly Nvidia RTX 40 series GPUs from Gainward and Palit" /><figcaption>Rear I/O of the SFF- Friendly Nvidia RTX 40 series GPUs from Gainward and Palit<small role="credit">Gainward and Palit</small></figcaption></figure></figure><p>With a uniform design consisting of three cooling fans and no RGB. Ideal for those who prefer a more subdued aesthetic. There is a total of twelve SKUs involving <a href="https://www.tomshardware.com/pc-components/gpus/nvidia-geforce-rtx-4080-super-review">GeForce RTX 4080</a>, <a href="https://www.tomshardware.com/pc-components/gpus/nvidia-geforce-rtx-4070-ti-super-review">RTX 4070 Ti Super</a> and <a href="https://www.tomshardware.com/pc-components/gpus/nvidia-geforce-rtx-4070-super-review-boosted-clocks-and-core-counts-for-the-same-dollar599-as-the-vanilla-4070">RTX 4070 Super</a> as a non-overclocked or overclocked variation. The overclocked RTX 4080 Super 16GB is clocked up to 2580 MHz, with RTX 4070 Ti and RTX 4070 Super up to 2640 MHz. The only difference is the packaging. Neither of the companies mentioned the warranty period of these variations either on the site or in its online manual.</p><p>Palit claims on its website that the Super Infinity 3 series is 40% smaller than its <a href="https://www.gainward.com/main/vgapro.php?id=1211&tab=gy&lang=en">standard-size RTX 40 series cards</a>- which also applies to its Gainward SSF-friendly counterpart. The variations from both brands measure 294 x 116 x 49.5 mm- which is within Nvidia&apos;s 304 X 151 X 50mm spec. That said, this only means it qualified to be compatible with those small form factor cases that are designed to accommodate Nvidia&apos;s standard which must have a minimum clearance of 312 x 154.5 x 50mm.</p><p>While having a smaller profile than a conventional variant is appreciated, users question the obfuscation of what &apos;SFF friendly&apos; should be and if Nvidia explored this category before setting the dimension standard and passing it on to respective AIC partners and PC case makers. While having a set standard makes sense for a certain form factor, having a smaller profile doesn&apos;t necessarily mean it&apos;s compatible with a mini-ITX case. Some would also agree that contrary to what Nvidia has set, it doesn&apos;t truly help SFF builders and enthusiasts. That said, the SFF category itself is broad as it involves users with different needs- HTPC, general purpose, gaming- or all of the above.  </p><p>Whether Nvidia would revisit this decision for the upcoming <a href="https://www.tomshardware.com/news/nvidia-rtx-4500-5000-workstation-cards">RTX 5000 series</a> remains to be seen. Some AIC partners might venture to have a proper mini-ITX-friendly graphics card, such as how Zephyr did with its <a href="https://www.tomshardware.com/pc-components/gpus/zephyr-launches-worlds-first-nvidia-rtx-4070-itx-form-factor-card-dual-slot-and-just-172mm-long">RTX 4070 ITX Sakura Blizzard GPU</a>. But would need respective makers to experiment and implement. Naturally, it depends on whether respective manufacturers could- and for which model. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="ZmsspqkhLBZcot85CaWDDQ" name="Nvidia-Computex-Slides-(31).jpg" alt="Nvidia SFF-Ready GeForce GPUs and cases" src="https://cdn.mos.cms.futurecdn.net/ZmsspqkhLBZcot85CaWDDQ.jpg" mos="" align="middle" fullscreen="1" width="1920" height="1080" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ZmsspqkhLBZcot85CaWDDQ.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Nvidia)</span></figcaption></figure><p>A few months ago, <a href="https://www.tomshardware.com/pc-components/gpus/asus-introduces-compact-nvidia-gpus-for-sff-pcs">Asus introduced</a> its variants of Nvidia&apos;s SSF-friendly graphics card, the Asus Prime which cover the 4000 range from the 4060 Ti to the 4080 Super. We may see more companies bringing its Nvidia SFF-ready graphics cards, or simply confirm if its existing SKUs are within Nvidia&apos;s preferred SFF-friendly dimensions like how MSI did.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Annoyed by bursty fans and bloated apps, engineer writes software in Python to better control his NZXT Kraken AIO ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/pc-components/cooling/annoyed-by-bursty-fans-and-bloated-apps-engineer-writes-software-in-python-to-better-control-his-nzxt-kraken-aio</link>
                                                                            <description>
                            <![CDATA[ Software engineer Cal Bryant created his own fan/pump control software in Python that can read and manipulate the fan and pump speeds of his Kraken X53 AIO. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">sprN6GmJMpWu8RD6YheMyV</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/uNadajpX9UjUcAQXfR5gUk-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Mon, 04 Mar 2024 21:13:55 +0000</pubDate>                                                                                                                                <updated>Thu, 21 Aug 2025 12:43:32 +0000</updated>
                                                                                                                                            <category><![CDATA[Cooling]]></category>
                                                    <category><![CDATA[PC Components]]></category>
                                                                                                <author><![CDATA[ editors@tomshardware.com (Aaron Klotz) ]]></author>                    <dc:creator><![CDATA[ Aaron Klotz ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/aAk2saHqkgFuTCanz8LnmD.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Aaron began building computers back when he was 8 years old in the mid-2000s, and it’s been a hobby of his ever since then. With a focus on computer hardware, he became an avid member of the Tom’s Hardware forums several years later, helping people solve issues with their PCs. He is now a freelance writer for Tom’s Hardware, writing about computer hardware news and more. When not busy playing or writing about computer hardware, he spends his free time playing video games like Star Citizen or Apex Legends.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/uNadajpX9UjUcAQXfR5gUk-1280-80.jpg">
                                                            <media:credit><![CDATA[NZXT]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[NZXT Kraken X53]]></media:description>                                                            <media:text><![CDATA[NZXT Kraken X53]]></media:text>
                                <media:title type="plain"><![CDATA[NZXT Kraken X53]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/uNadajpX9UjUcAQXfR5gUk-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Software designer Cal Bryant created a PC cooling app for his liquid-cooled Ryzen 9 5950X PC from scratch <a href="https://calbryant.uk/blog/better-pc-cooling-with-python/#">using Python</a>. With his app, he was able to fine-tune his Kraken X53&apos;s pump and fan speed and run both a lot more efficiently, making the cooler run significantly quieter compared to running the fan controls through the motherboard <a href="https://www.tomshardware.com/reviews/bios-keys-to-access-your-firmware,5732.html">BIOS/UEFI</a>.</p><p>The origins of Bryant&apos;s home-brewed Python cooling app started when he upgraded his personal system from a <a href="https://www.tomshardware.com/reviews/ryzen-9-3900x-7-3700x-review,6214.html">Ryzen 7 3700X</a> to the much more potent <a href="https://www.tomshardware.com/reviews/amd-ryzen-9-5950x-5900x-zen-3-review">Ryzen 9 5950X</a>. According to Bryant, the extra cores nearly doubled the heat output of his system, forcing his NZXT Kraken X53 240mm <a href="https://www.tomshardware.com/best-picks/best-aio-coolers">AIO liquid cooler</a> to work much harder. Consequently, the CPU swap also made his cooler much louder to deal with the extra heat output. On top of this, the fans were also spinning up and down erratically, due to Zen 3&apos;s notoriously spiky thermal output.</p><p>Bryant found that the Kraken&apos;s cooler is not optimized out of the box for Ryzen CPUs, causing the fans to spin up and down erratically. The Kraken&apos;s pump speed is based on liquid temperature, while the fans are based on the <a href="https://www.tomshardware.com/how-to/how-to-check-cpu-temp-temperature">CPU temperature</a>, something Bryant found unattractive. (We&apos;ve also complained about this <a href="https://www.tomshardware.com/pc-components/cooling/reviews">our own cooler reviews</a>.)</p><p>To fix this problem, Bryant decided to build his own cooling app that could eliminate the problem and give him more granular control over his pump and fan speeds. Additionally, he doesn&apos;t like how bloated traditional fan software normally is, giving him even more incentive to build his own app.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1000px;"><p class="vanilla-image-block" style="padding-top:50.00%;"><img id="HLapN7zrv8kWaLCxAFnc93" name="fangoblin3.png" alt="Cal Bryant's fan curve from his Python app" src="https://cdn.mos.cms.futurecdn.net/HLapN7zrv8kWaLCxAFnc93.png" mos="" align="middle" fullscreen="" width="1000" height="500" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Cal Bryant)</span></figcaption></figure><p>In the end, he was able to create an application that can read the CPU, case, and liquid temperatures of the system, and adjust the CPU fan and pump speeds accordingly. The app was written in <a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">Python</a> and Liquidctl, a programmatic control system that can allow Python scripts to control liquid coolers such as the X53. For temperature control, the app reads temperature data from Linux&apos;s built-in hardware sensor capabilities, known as lm-sensors. Bryant wrote his Python app in such a way that it can be installed as a system service that starts when the OS boots up and hides in the background. For the nitty-gritty details on how the app was written step-by-step, check out Bryant&apos;s <a href="https://calbryant.uk/blog/better-pc-cooling-with-python/">full article</a>.</p><p>The app was tuned to run the X53&apos;s pump in conjunction with the CPU&apos;s temperature output and run the radiator fans in conjunction with the coolant temperature. This is very different from the X53&apos;s default configuration where the pump RPM is driven by the coolant temperature.</p><p>With this method of RPM control, he was able to significantly reduce the spiky nature of his cooler&apos;s default fan profile and make the cooler more performant only when needed. Having the pump speed up based on the CPU temperature allows the cooler to extract heat more quickly from the CPU. Coolant takes a long time to warm up under a heavy load compared to <a href="https://www.tomshardware.com/reviews/best-cpu-coolers,4181.html">air coolers</a>. Having the fans connected to the coolant temperature, in turn, allows the cooler to only run the fans at a high RPM when the coolant is warm. In an AIO, the fans aren&apos;t cooling the <a href="https://www.tomshardware.com/reviews/best-cpus,3986.html">CPU</a>, they are cooling down the liquid that is extracting heat from the CPU.</p><p>The app can be downloaded for free from a link in Cal Bryant&apos;s article. However, the it&apos;s specifically fine-tuned to his system, meaning that users would need to edit the code he created to make the cooling app work on their systems.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Create and Use Python Functions ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/create-python-functions</link>
                                                                            <description>
                            <![CDATA[ Functions are powerful and useful. With functions we can run many lines of code just by calling their name. Automate processes and make our code a little easier to read. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">MbzKDRvRLnFXcWSNeA2M36</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/exrrXhTfsUy6bZ6ughpEza-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Mon, 11 Sep 2023 11:45:07 +0000</pubDate>                                                                                                                                <updated>Sat, 16 Sep 2023 15:36:56 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/exrrXhTfsUy6bZ6ughpEza-1280-80.jpg">
                                                            <media:credit><![CDATA[Pexels]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Python Functions]]></media:description>                                                            <media:text><![CDATA[Python Functions]]></media:text>
                                <media:title type="plain"><![CDATA[Python Functions]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/exrrXhTfsUy6bZ6ughpEza-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Functions are incredibly powerful. We use them every day of our lives. When our parents said “clean your room!” We knew what had to be done. Functions are blocks of code that are executed when we call their name. But they can do much more than that. Functions can have arguments (parameters) passed to them, so we could pass a function the latest temperature from a sensor and use the function to trigger a fan to turn on. We could use a function to read the contents of a <a href="https://www.tomshardware.com/how-to/use-dictionaries-in-python"><u>dictionary</u></a> and work on the data stored within it.</p><p>In this how to. we will introduce the concept of functions and a few of its most powerful features. We will also build a project to read the current status of our PC and provide the data to the Python Shell.</p><p>To demonstrate how to use functions in Python, we will use Thonny, a free, easy to use and cross platform Python editor. </p><p>Before you start, <strong>Install Thonny </strong>if you don’t have it already. You can <a href="https://thonny.org/"><u>download the release</u></a> for your system on the app’s official site.<br><br>Alternatively, <strong>you can install the official Python release </strong><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11"><u><strong>using this guide</strong></u></a><strong>.</strong> Note that this guide covers installation on Windows 10 and 11.</p><h2 id="how-to-create-a-function-in-python">How to Create a Function in Python</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:633px;"><p class="vanilla-image-block" style="padding-top:74.88%;"><img id="jE43nFjMhAg3ngVxCEScsb" name="hello1.jpg" alt="Python Functions" src="https://cdn.mos.cms.futurecdn.net/jE43nFjMhAg3ngVxCEScsb.jpg" mos="" align="middle" fullscreen="1" width="633" height="474" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/jE43nFjMhAg3ngVxCEScsb.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Functions are “defined” using the “def” keyword. When the function name is called, the contents of the function are run and the output is sent to the Python Shell.</p><p>1. <strong>Create a function called hello.</strong> As is tradition in programming, we will use “Hello World” as a quick and simple demonstration of using a function.</p><pre class="line-numbers language-bash" language="bash" ><code>def hello():</code></pre><p>2. <strong>Add a for loop that will iterate (loop) ten times.</strong> <a href="https://www.tomshardware.com/how-to/use-for-loops-in-python"><u>For loops</u></a> are an easy way to repeat actions in any programming language. Here we are using a range to set the number of loops, but for loops can also iterate through objects in lists, <a href="https://www.tomshardware.com/how-to/use-dictionaries-in-python"><u>dictionaries</u></a> or tuples.</p><pre class="line-numbers language-bash" language="bash" ><code>   for i in range(10):</code></pre><p>3. <strong>Use print to output “Hello World!” to the Python Shell. </strong>Print is a <a href="https://docs.python.org/3/library/functions.html"><u>built-in function</u></a> for Python. Its role is to print objects. The message that we want to print is called an “argument” or “parameter” and we will cover this later in the how to.</p><pre class="line-numbers language-bash" language="bash" ><code>   print("Hello World!")</code></pre><p>4. <strong>Save the code as hello_world.py and click Run >> Run Current Script, or press the green run button. </strong>What happens? Here is where we make a mistake to reinforce how functions work. Our function has been created, but we have not called the function, so Python is waiting for a command.</p><p>5. <strong>On a new line, not inside the for loop or function, call the function by its name</strong>. Remember to include the parenthesis at the end of the function name.</p><pre class="line-numbers language-bash" language="bash" ><code>hello()</code></pre><p>6. <strong>Click Run >> Run Current Script, or press the green run button. </strong>The Python Shell will see “Hello World!” printed ten times.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1089px;"><p class="vanilla-image-block" style="padding-top:70.16%;"><img id="ebfhTEVjyvy5wkJqjnQ57c" name="hello2.jpg" alt="Python Functions" src="https://cdn.mos.cms.futurecdn.net/ebfhTEVjyvy5wkJqjnQ57c.jpg" mos="" align="middle" fullscreen="1" width="1089" height="764" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ebfhTEVjyvy5wkJqjnQ57c.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-code-listing-a-simple-function">Complete Code Listing: A Simple Function</h2><pre class="line-numbers language-bash" language="bash" ><code>def hello():    for i in range(10):        print("Hello World!")hello()</code></pre><h2 id="how-to-create-a-function-with-arguments">How to Create a Function With Arguments</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:616px;"><p class="vanilla-image-block" style="padding-top:104.22%;"><img id="cBXEtRcCMWYQ9Q54WWLHzb" name="hello3.jpg" alt="Python Functions" src="https://cdn.mos.cms.futurecdn.net/cBXEtRcCMWYQ9Q54WWLHzb.jpg" mos="" align="middle" fullscreen="1" width="616" height="642" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/cBXEtRcCMWYQ9Q54WWLHzb.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Arguments, sometimes called parameters, are extra instructions to an object. Python’s functions can use arguments, we just need to add them into the parentheses. By default, Python will not look for an argument in a function, we need to set a template / expectation for the function. </p><p>In this section we will alter our “Hello World!” function to accept two arguments. The first is for the number of iterations in a for loop, the second will be for the phrase that we wish to repeat. When specifying arguments we need to ensure that we pass the correct number. If the function specifies two arguments, then we need to pass it two. Failure to do this will cause the function call to error.</p><p>1. <strong>Create a function called hello and pass it two arguments, x and phrase. </strong>We use x as a placeholder for the number of loops, “phrase” is used to represent the message that we want to print.</p><pre class="line-numbers language-bash" language="bash" ><code>def hello(x, phrase):</code></pre><p>2. <strong>Add a for loop that will iterate x times.</strong> The number of times that the loop will iterate is controlled using the x argument.</p><pre class="line-numbers language-bash" language="bash" ><code>   for i in range(x):</code></pre><p>3. <strong>Use print to output the “phrase” argument to the Python Shell. </strong>Remember, the phrase is set when we call the function.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>    print(phrase)</code></pre><p>4. <strong>On a new line, not inside the for loop or function, call the function by its name and pass the two arguments. </strong>The number of times to loop (x) and the message to print. We’ve chosen to loop five times and print Tom’s Hardware. It&apos;s not original, but it illustrates the goal of the project.</p><pre class="line-numbers language-bash" language="bash" ><code>hello(5, "Tom's Hardware")</code></pre><p>5. <strong>Save the code as hello_world.py and click Run >> Run Current Script, or press the green run button. </strong>The phrase will be printed to the Python Shell for the X number of times that you specified as an argument. </p><h2 id="complete-code-listing-functions-with-arguments-xa0">Complete Code Listing: Functions With Arguments </h2><pre class="line-numbers language-bash" language="bash" ><code>def hello(x, phrase):    for i in range(x):        print(phrase)hello(5, "Tom's Hardware")</code></pre><h2 id="how-to-create-a-function-with-default-and-keyword-arguments">How To Create a Function With Default and Keyword Arguments</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:665px;"><p class="vanilla-image-block" style="padding-top:72.78%;"><img id="eYTaUtGPsBmmRBZmf4BAWa" name="hello4.jpg" alt="Python Functions" src="https://cdn.mos.cms.futurecdn.net/eYTaUtGPsBmmRBZmf4BAWa.jpg" mos="" align="middle" fullscreen="1" width="665" height="484" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/eYTaUtGPsBmmRBZmf4BAWa.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>We’ve passed arguments to our functions, but we can also set a default argument. The default will be accepted and used if the function is passed without a user set argument. Here is a quick example which has a default argument of name. The default name is my own, and it is used in the function to greet the user. All we need to do is pass the name argument to create a new named greeting.</p><p>1. <strong>Create a function with a default argument of name.</strong> Obviously change the name to your choosing.</p><pre class="line-numbers language-bash" language="bash" ><code>def whoareyou(name = "Les"):</code></pre><p>2. <strong>Using the name argument, print a greeting to the user. </strong>Here we use Python’s string format method to insert the name argument as a string.</p><pre class="line-numbers language-bash" language="bash" ><code>   print("Hello {:s}!".format(name))</code></pre><p>3. <strong>Call the function with no argument.</strong> This should show that the default name is used.</p><pre class="line-numbers language-bash" language="bash" ><code>whoareyou()</code></pre><p>4. <strong>Call the function and pass a new name as an argument.</strong> Calling the function happens outside of the function itself.</p><pre class="line-numbers language-bash" language="bash" ><code>whoareyou("Dave")</code></pre><p>5. <strong>Save the code as name.py and click Run >> Run Current Script, or press the green run button. </strong>We can see that the code outputs two greetings. One for the default, the other for “Dave”.</p><h2 id="complete-code-listing-functions-with-default-argument">Complete Code Listing: Functions With Default Argument</h2><pre class="line-numbers language-bash" language="bash" ><code>def whoareyou(name = "Les"):    print("Hello {:s}!".format(name))whoareyou()whoareyou("Dave")</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:968px;"><p class="vanilla-image-block" style="padding-top:62.60%;"><img id="jeyGqiAv7RrVpyicCf7Yfa" name="hello5.jpg" alt="Python Functions" src="https://cdn.mos.cms.futurecdn.net/jeyGqiAv7RrVpyicCf7Yfa.jpg" mos="" align="middle" fullscreen="1" width="968" height="606" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/jeyGqiAv7RrVpyicCf7Yfa.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Keyword arguments are useful when we have multiple arguments to pass. In this example we use the classic Mad Libs structure to create a sentence with a noun, verb and thing. The order of the arguments doesn’t matter as we provide the key = value structure.</p><p>1. <strong>Create a function and configure it to accept three arguments.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>def madlibs(noun, verb, thing):</code></pre><p>2. <strong>Create a sentence that will print the noun, verb and thing to the Python shell. </strong>Again we use Python’s excellent string format method to drop the arguments into the sentence.</p><pre class="line-numbers language-bash" language="bash" ><code>   print("The {:s} {:s} over the {:s}.".format(noun, verb, thing))</code></pre><p>3. <strong>Save the code as madlibs.py and click Run </strong>>> Run Current Script, or press the green run button.</p><p>4. <strong>In the Python Shell, call the function and pass the three arguments. </strong>Remember to use the key, otherwise the order will be incorrect.<strong> Press Enter to run the code. </strong>You will see the sentence appear using your custom keywords.</p><pre class="line-numbers language-bash" language="bash" ><code>madlibs(noun = "rabbit",verb = "jumped",thing ="gate")</code></pre><h2 id="complete-code-listing-functions-with-multiple-arguments">Complete Code Listing: Functions With Multiple Arguments</h2><pre class="line-numbers language-bash" language="bash" ><code>def madlibs(noun, verb, thing):   print("The {:s} {:s} over the {:s}.".format(noun, verb, thing))</code></pre><h2 id="using-functions-to-get-pc-performance-data">Using Functions to Get PC Performance Data</h2><p>To illustrate how to use functions we are going to create a quick Python project that will get live CPU and RAM data using the psutil (process and system utilities) Python module.This module can get data on CPUs, RAM, disks, networks and other sensors, all using Python.</p><p>Before we can write any code, we need to install the psutil module.</p><p>1. <strong>In Thonny, click on Tools >> Manage Packages.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:377px;"><p class="vanilla-image-block" style="padding-top:56.76%;"><img id="hnDJKFJULFJfKQi5TUzY6b" name="install1.jpg" alt="Python Functions" src="https://cdn.mos.cms.futurecdn.net/hnDJKFJULFJfKQi5TUzY6b.jpg" mos="" align="middle" fullscreen="" width="377" height="214" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Search for psutil and click Search on PyPi.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:636px;"><p class="vanilla-image-block" style="padding-top:71.86%;"><img id="UE4d8o3tUkWHYVXqnRJzBb" name="install2.jpg" alt="Python Functions" src="https://cdn.mos.cms.futurecdn.net/UE4d8o3tUkWHYVXqnRJzBb.jpg" mos="" align="middle" fullscreen="1" width="636" height="457" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/UE4d8o3tUkWHYVXqnRJzBb.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Select psutil from the returned results.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:433px;"><p class="vanilla-image-block" style="padding-top:24.02%;"><img id="FSJN42Hq2Z6zh66vUJA4Gb" name="install3.jpg" alt="Python Functions" src="https://cdn.mos.cms.futurecdn.net/FSJN42Hq2Z6zh66vUJA4Gb.jpg" mos="" align="middle" fullscreen="1" width="433" height="104" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/FSJN42Hq2Z6zh66vUJA4Gb.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Install psutil then close the dialog box when it is complete. </strong>We have already installed psutil so our dialog looks a little different.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:498px;"><p class="vanilla-image-block" style="padding-top:78.11%;"><img id="L5M9MqwW9DYgpEMDy7wvLb" name="install4.jpg" alt="Python Functions" src="https://cdn.mos.cms.futurecdn.net/L5M9MqwW9DYgpEMDy7wvLb.jpg" mos="" align="middle" fullscreen="1" width="498" height="389" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/L5M9MqwW9DYgpEMDy7wvLb.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Create a new file in Thonny and import the psutil module.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>import psutil</code></pre><p>6. <strong>Create a function, cpu(). </strong>This function will get the current CPU utilization and store it in a variable. We then print the value to the Python Shell using a string format.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>def cpu():   cpu = str(psutil.cpu_percent())   print("Current CPU usage is {:s}%".format(cpu))</code></pre><p>7. <strong>Create a new function, ram(). Use a print statement, along with some math to print a title with ten * either side.</strong>This function will handle all of the steps necessary to get the current amount of available memory.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>def ram():   print("*"*10,"RAM Stats","*"*10)</code></pre><p>8. <strong>Get the current memory stats and store them in a variable called “memory”.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   memory = psutil.virtual_memory()</code></pre><p>9. <strong>Extract the current amount of available RAM and store it in the variable.</strong> The memory object initially returns the total, available, percent, used and free memory. The returned object is a list, and we need the second value in the list, which is [1].</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   memory = memory[1]</code></pre><p>10. <strong>Convert the amount of memory into Megabytes </strong>and <strong>round the value</strong> for ease of reading.</p><pre class="line-numbers language-bash" language="bash" ><code>   memory = round(memory / 1024 / 1024)</code></pre><p>11. <strong>Print the amount of available memory </strong>to the Python Shell.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   print("There is {:n}MB of available RAM".format(memory))</code></pre><p>12. <strong>Create a function called cores(). </strong>This function will return the physical core count and the number of threads our CPU has.</p><pre class="line-numbers language-bash" language="bash" ><code>def cores():</code></pre><p>13. <strong>Create objects to store the physical number of CPU cores, and the number of threads.</strong> Setting the logical=False argument will force psutil to only return the physical cores.</p><pre class="line-numbers language-bash" language="bash" ><code>   physical = psutil.cpu_count(logical=False)   threads = psutil.cpu_count()</code></pre><p>14. <strong>Print the physical core count and thread to the Python Shell.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   print("This CPU has {:n} cores and {:n} threads".format(physical, threads))</code></pre><p>15. <strong>Create a new function, cpuspeed(). Use a print statement, along with some math to print a title with ten * either side.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>def cpuspeed():   print("*"*10,"CPU Stats","*"*10)</code></pre><p>16. <strong>Store the current CPU speed data to an object called speed. Then extract the current speed and update the object.</strong> Initially we get a list which contains a tuple with three values, current speed, min, and max speed. So we need to get data from the first entry in the list [0], then get the first entry in the tuple [0].</p><pre class="line-numbers language-bash" language="bash" ><code>   speed = (speed[0][0])</code></pre><p>17. <strong>Print the speed to the Python Shell.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   print("The CPU speed is {:n} MHz".format(speed))</code></pre><p>18. <strong>Create a function called all() and use it to call all of the previous functions.</strong> Functions can call other functions.</p><pre class="line-numbers language-bash" language="bash" ><code>def all():   cpuspeed()   cores()   cpu()   ram()</code></pre><p>19. <strong>Create a try / except handler and use while True: to run our code. </strong>This section will try to run our code.</p><pre class="line-numbers language-bash" language="bash" ><code>try:   while True:</code></pre><p>20. <strong>Create an object, stat, and use it to store the user’s choice.</strong> We use an input() function to capture keyboard input from the user. We can also create a prompt asking the user for their choice.</p><pre class="line-numbers language-bash" language="bash" ><code>       stat = input("Please type 'cpu', 'ram', 'cores', 'cpuspeed' or press ENTER to show all stats: ")</code></pre><p>21. <strong>Use conditional tests to check the value stored in stat and route the code to the correct option.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>       if stat == "cpu":           cpu()       elif stat == "ram":           ram()       elif stat == "cores":           cores()       elif stat == "cpuspeed":           cpuspeed()</code></pre><p>22. <strong>Use else as a catch all option that will call the all() function and show every stat that we have a function for.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>       else:           all()</code></pre><p>23. <strong>Create an exception to handle the user pressing CTRL+C to end the code. </strong>This will print Exiting to the Python Shell.</p><pre class="line-numbers language-bash" language="bash" ><code>except KeyboardInterrupt:   print("Exiting")</code></pre><p>24. <strong>Save the code as performance.py  and click Run >> Run Current Script, or press the green run button. </strong>You will see the Python Shell ask for your input. Follow the guidance and your requested data will display in the Shell.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1278px;"><p class="vanilla-image-block" style="padding-top:109.62%;"><img id="9xmqWFqFEiJ8UHFJR6hnXb" name="stats.jpg" alt="Python Functions" src="https://cdn.mos.cms.futurecdn.net/9xmqWFqFEiJ8UHFJR6hnXb.jpg" mos="" align="middle" fullscreen="1" width="1278" height="1401" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/9xmqWFqFEiJ8UHFJR6hnXb.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-code-listing-using-functions-to-get-pc-performance-data">Complete Code Listing: Using Functions to Get PC Performance Data</h2><pre class="line-numbers language-bash" language="bash" ><code>import psutildef cpu():   cpu = str(psutil.cpu_percent())   print("Current CPU usage is {:s}%".format(cpu))def ram():   print("*"*10,"RAM Stats","*"*10)   memory = psutil.virtual_memory()   memory = memory[1]   memory = round(memory / 1024 / 1024)   print("There is {:n}MB of available RAM".format(memory))def cores():   physical = psutil.cpu_count(logical=False)   threads = psutil.cpu_count()   print("This CPU has {:n} cores and {:n} threads".format(physical, threads))def cpuspeed():   print("*"*10,"CPU Stats","*"*10)   speed = psutil.cpu_freq([1])   speed = (speed[0][0])   print("The CPU speed is {:n} MHz".format(speed))def all():   cpuspeed()   cores()   cpu()   ram()try:   while True:       stat = input("Please type 'cpu', 'ram', 'cores', 'cpuspeed' or press ENTER to show all stats: ")       if stat == "cpu":           cpu()       elif stat == "ram":           ram()       elif stat == "cores":           cores()       elif stat == "cpuspeed":           cpuspeed()       else:           all()except KeyboardInterrupt:   print("Exiting")</code></pre><h2 id="more-python-tutorials">More Python Tutorials</h2><ul><li><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">How To Install Python on Windows 10 and 11</a></li><li><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">How to use For Loops in Python</a></li><li><a href="https://www.tomshardware.com/how-to/enumerate-in-python">How to Enumerate in Python</a></li><li><a href="https://www.tomshardware.com/how-to/create-python-executable-applications">How to Create Executable Applications in Python</a></li><li><a href="https://www.tomshardware.com/how-to/python-remove-image-backgrounds">How To Remove Backgrounds From Images With Python</a></li><li><a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny">How to Create Web Apps with Python, HTML and Thonny</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2">How To Use Raspberry Pi Camera Module 3 with Python Code</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Microsoft Excel Gains Python Data Analysis and Visualization Support ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/microsoft-excel-gains-python-data-analysis-and-visualization-support</link>
                                                                            <description>
                            <![CDATA[ Microsoft is officially adding support for Python to Microsoft Excel with a little help from the third-party team Anaconda. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">kTrXtXQQKEVDyYwfXKHFA5</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/6fwSgi2cHsXuhohgy9LF56-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Tue, 22 Aug 2023 16:52:19 +0000</pubDate>                                                                                                                                <updated>Thu, 30 Jan 2025 16:24:49 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Ash Hill ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/p9HsnLCwBpTQYCBBhYXgrS.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Ash is a self-employed tech writer and illustrator with a serious affinity for the Raspberry Pi, 3D printing, retro gaming and finding the best tech deals and coupons. She has over a decade of IT experience and has been featured in the official Raspberry Pi magazine MagPi.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/6fwSgi2cHsXuhohgy9LF56-1280-80.jpg">
                                                            <media:credit><![CDATA[Shutterstock]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[shutterstock_2161657635]]></media:description>                                                            <media:text><![CDATA[shutterstock_2161657635]]></media:text>
                                <media:title type="plain"><![CDATA[shutterstock_2161657635]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/6fwSgi2cHsXuhohgy9LF56-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Microsoft’s Stefan Kinnestrand announced today that <a href="https://techcommunity.microsoft.com/t5/microsoft-365-blog/introducing-python-in-excel-the-best-of-both-worlds-for-data/ba-p/3905482"><u>Microsoft Excel</u></a> will officially support Python integration. This will be accomplished via a partnership with Anaconda which brings a huge repository with common libraries like statsmodels, Matplotlib and pandas. The new Python integration is available starting today as a preview for those in the Beta Channel Microsoft 365 Insiders group.</p><p>The integration will become a part of the many tools offered in Excel’s repertoire. As such, you won’t have to take any additional steps to add Python to your copy of Excel. More specifically, this integration will be implemented as a part of Excel’s data transformation tool known as Power Query.</p><p>If you want to get in on the early action, you’ll need to be a part of the Beta Channel Insider group in the <a href="https://insider.microsoft365.com/en-us/join/windows"><u>Microsoft 365 Insider Program</u></a>. The preview will be automatically included in the latest Insider build. Just install the latest copy of Excel offered and open a new workbook. In the ribbon go to ‘Formulas’ then ‘Insert Python’. There you should have an option to try the preview.</p><p><a href="https://www.anaconda.com/excel"><u>Anaconda</u></a> has more details about their work on the project over at their official website. We definitely recommend checking it out for an inside look at what the new Python support is capable of. They also offer training courses which can help you get off the ground with the new addition.</p><p>The preview will only be available for a limited time so now is your chance to check it out and see what it’s like hands-on. The preview will also be extended to Microsoft 365 subscribers. Once the preview expires, it will still be available but with limited functionality. To restore full access, users will need to purchase a license.</p><p>If you want to get a closer look at the details of the new rollout, we recommend both reading through the official announcement shared by <a href="https://techcommunity.microsoft.com/t5/microsoft-365-blog/introducing-python-in-excel-the-best-of-both-worlds-for-data/ba-p/3905482"><u>Microsoft</u></a> as well as the official documentation from <a href="https://www.anaconda.com/excel"><u>Anaconda</u></a><u>.</u></p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Use Dictionaries in Python ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/use-dictionaries-in-python</link>
                                                                            <description>
                            <![CDATA[ Learn how to create and use dictionaries in Python by creating a real world project which has them at its heart. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">ejXDnR2BpMsedjrcLJeFoD</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/qmyvSUATQ4pus5tAL7EgiV-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Mon, 21 Aug 2023 16:24:07 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:30 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/qmyvSUATQ4pus5tAL7EgiV-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Dictionaries in Python]]></media:description>                                                            <media:text><![CDATA[Dictionaries in Python]]></media:text>
                                <media:title type="plain"><![CDATA[Dictionaries in Python]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/qmyvSUATQ4pus5tAL7EgiV-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>In Python, dictionaries are data storage objects that use a key to retrieve a value. Think of your cell phone contact list or phone book. We look for the name of the person, the key, and their phone number is the value. Dictionaries are incredibly useful when storing and sorting data. We used a dictionary in our <a href="https://www.tomshardware.com/how-to/use-for-loops-in-python"><u>for loop project</u></a> which saw RSS news feeds used to generate content on a web page. </p><p>We’re going to go through how to create, update and delete keys and values inside of a dictionary and then use a dictionary in a real world project where we create a notification system using Python and <a href="https://ntfy.sh/"><u>nfty.sh</u></a>.</p><p>To demonstrate how to use Dictionaries in Python, we will use Thonny, a free, easy to use and cross platform Python editor.</p><p>1. <strong>In a browser go to the Thonny website and </strong><a href="https://thonny.org/"><u><strong>download the release</strong></u></a><strong> for your system.</strong></p><p>2.<strong> Alternatively, install the official Python release </strong><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11"><u><strong>using this guide</strong></u></a><strong>.</strong> Note that this guide covers installation on Windows 10 and 11.</p><h2 id="how-to-create-a-dictionary-in-python">How To Create a Dictionary in Python</h2><p>The most basic use for a dictionary is to store data, in this example we will create a dictionary called “registry” and in it store the names (keys) and starship registries / numbers (values) of characters from Star Trek.</p><p>1. <strong>Create a blank dictionary called “registry”. </strong>Dictionaries can be created with data already inside, but by creating a blank dictionary we have a “blank canvas” to start from.</p><pre class="line-numbers language-bash" language="bash" ><code>registry = {}</code></pre><p>2. <strong>Add a name and ship number to the registry.</strong> Remember that the name is a key, and the ship number is the value. Values can be strings, integers, floats, tuples, and lists.</p><pre class="line-numbers language-bash" language="bash" ><code>registry["James T Kirk"] = 1701</code></pre><p>3. <strong>Add another few names to the registry.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>registry["Hikaru Sulu"] = 2000registry["Kathryn Janeway"] = 74656registry["Ben Sisko"] = 74205</code></pre><p>4. <strong>Print the contents of the registry dictionary.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>print(registry)</code></pre><p>5. <strong>Save the code as starfleet-registry.py and click Run to start the code.</strong></p><h2 id="complete-code-listing-creating-a-dictionary">Complete Code Listing: Creating a Dictionary</h2><pre class="line-numbers language-bash" language="bash" ><code>registry = {}registry["James T Kirk"] = 1701registry["Hikaru Sulu"] = 2000registry["Kathryn Janeway"] = 74656registry["Ben Sisko"] = 74205print(registry)</code></pre><h2 id="updating-and-deleting-entries-in-a-dictionary">Updating and Deleting Entries in a Dictionary.</h2><p>Dictionaries are updatable (mutable in programming parlance) and that means we can update the key (names) and the values (ship numbers).</p><p>For our first scenario, we’ve had a call from Ben Sisko, and he wants his entry updated to Benjamin. We’re going to add this code to the previous example code.</p><p>1. <strong>Add a print statement to show that we are making updates.</strong> This is entirely optional, but for the purpose of this example it clarifies that we are updating the dictionary.</p><pre class="line-numbers language-bash" language="bash" ><code>print(“UPDATES”)</code></pre><p>2. <strong>Add a “Benjamin Sisko” key and set it to use the value stored under “Ben Sisko”.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>registry["Benjamin Sisko"] = registry["Ben Sisko"]</code></pre><p>3. <strong>Delete “Ben Sisko” from the registry.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>del registry["Ben Sisko"]</code></pre><p>4. <strong>Print the current contents of the registry. </strong>We can see that the “Ben Sisko” key is now gone, and is replaced with “Benjamin Sisko”. The value has also been transferred.</p><pre class="line-numbers language-bash" language="bash" ><code>print(registry)</code></pre><p>Next we will update the entry for James T Kirk. It seems that he has a new ship number (something to do with “accidentally” setting an easy password on his self-destruct app) and so we need to update the value for his entry.</p><p>1. <strong>Add a print statement to show that we are making updates.</strong> This is entirely optional, but for the purpose of this example it clarifies that we are updating the dictionary.</p><pre class="line-numbers language-bash" language="bash" ><code>print("Kirk's new number")</code></pre><p>2. <strong>Update the “James T Kirk” key with the new ship number.</strong> Note that because we are adding -A to the value, we have to wrap the value in “ “ to denote that we are now using a string.</p><pre class="line-numbers language-bash" language="bash" ><code>registry["James T Kirk"] = "1701-A"</code></pre><p>3. <strong>Print the contents of the registry</strong>. We can now see that James T Kirk has a new ship number.</p><p>Finally we need to delete Benjamin Sisko from the registry. It seems that he has gone “missing” while in the fire caves on Bajor. So we need to delete his entry from the registry. We’ll use the existing code, and add three new lines.</p><p>1. <strong>Add a print statement to show that we are deleting entries.</strong> This is entirely optional, but for the purpose of this example it clarifies that we are deleting entries from the dictionary.</p><pre class="line-numbers language-bash" language="bash" ><code>print("Deleting Benjamin Sisko")</code></pre><p>2. <strong>Delete “Benjamin Sisko” from the registry.</strong> We don’t know who the new captain will be yet.</p><pre class="line-numbers language-bash" language="bash" ><code>del registry["Benjamin Sisko"]</code></pre><p>3. <strong>Print the registry to confirm the deletion.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>print(registry)</code></pre><p>4. <strong>Save and run the code.</strong></p><h2 id="complete-code-listing-updating-and-deleting-a-dictionary">Complete Code Listing: Updating and Deleting a Dictionary</h2><pre class="line-numbers language-bash" language="bash" ><code>registry = {}registry["James T Kirk"] = 1701registry["Hikaru Sulu"] = 2000registry["Kathryn Janeway"] = 74656registry["Ben Sisko"] = 74205print(registry)print("UPDATES")registry["Benjamin Sisko"] = registry["Ben Sisko"]del registry["Ben Sisko"]print(registry)print("Kirk's new ship")registry["James T Kirk"] = "1701-A"print(registry)print("Deleting Benjamin Sisko")del registry["Benjamin Sisko"]print(registry)</code></pre><h2 id="using-a-for-loop-with-dictionaries">Using a For Loop With Dictionaries</h2><p><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python#"><u>For loops are awesome</u></a>. We can use them to iterate through an object, retrieving data as it goes. Lets use one with our existing code example to iterate through the names (keys) and print the name and ship number for each captain.</p><p>1. <strong>Create a for loop to iterate through the keys and values in the registry dictionary. </strong>This loop will iterate through all the items in the dictionary, saving the current key and value each time the loop iterates.</p><pre class="line-numbers language-bash" language="bash" ><code>for keys, values in registry.items():</code></pre><p>2. <strong>Create a sentence that embeds the Captain’s name (keys) and the ship’s number / registry (values).</strong></p><pre class="line-numbers language-bash" language="bash" ><code>print("Captain", keys, "registry is", values)</code></pre><p>3. <strong>Save the code and click Run.</strong> You will see the name and ship number for each captain printed at the bottom of the Python shell.</p><p><br></p><h2 id="complete-code-listing-using-a-for-loop-with-dictionaries">Complete Code Listing: Using a For Loop With Dictionaries</h2><pre class="line-numbers language-bash" language="bash" ><code>registry = {}registry["James T Kirk"] = 1701registry["Hikaru Sulu"] = 2000registry["Kathryn Janeway"] = 74656registry["Ben Sisko"] = 74205print(registry)print("UPDATES")registry["Benjamin Sisko"] = registry["Ben Sisko"]del registry["Ben Sisko"]print(registry)print("Kirk's new ship")registry["James T Kirk"] = "1701-A"print(registry)print("Deleting Benjamin Sisko")del registry["Benjamin Sisko"]print(registry)for keys, values in registry.items():   print("Captain", keys, "registry is", values)</code></pre><h2 id="using-dictionaries-in-a-real-world-project">Using Dictionaries in a Real World Project</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1079px;"><p class="vanilla-image-block" style="padding-top:53.29%;"><img id="ywdnr3xPZ3cVQ5ah2cezvV" name="ntfy0.png" alt="Dictionaries in Python" src="https://cdn.mos.cms.futurecdn.net/ywdnr3xPZ3cVQ5ah2cezvV.png" mos="" align="middle" fullscreen="1" width="1079" height="575" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ywdnr3xPZ3cVQ5ah2cezvV.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>We’ve learnt the basics, now lets use a dictionary in a real world project. We’re going to use <a href="https://ntfy.sh/"><u>ntfy.sh</u></a>, a service to send notifications to Android and iOS devices. The Python API for ntfy.sh is based on dictionaries. Best of all, there are no Python installation files as it uses Python’s requests module to handle sending messages to ntfy.sh.</p><p>1. <a href="https://ntfy.sh/"><u><strong>Install ntfy.sh</strong></u> </a>for your Android / iOS device.</p><p>2. <strong>Open the app and click on + </strong>to create a new subscription.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1080px;"><p class="vanilla-image-block" style="padding-top:200.00%;"><img id="pBFagvemiJJBMDYNFTnM4W" name="ntfy1.png" alt="Dictionaries in Python" src="https://cdn.mos.cms.futurecdn.net/pBFagvemiJJBMDYNFTnM4W.png" mos="" align="middle" fullscreen="1" width="1080" height="2160" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/pBFagvemiJJBMDYNFTnM4W.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>3. Create a new topic and click Subscribe. </strong>We chose to use th-test. Create a topic that is personal to you. Also note that topics may not be password protected, so do not send sensitive data.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1079px;"><p class="vanilla-image-block" style="padding-top:98.42%;"><img id="vn2jnC6GtgBoS5P6aA7q9W" name="ntfy2.png" alt="Dictionaries in Python" src="https://cdn.mos.cms.futurecdn.net/vn2jnC6GtgBoS5P6aA7q9W.png" mos="" align="middle" fullscreen="1" width="1079" height="1062" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/vn2jnC6GtgBoS5P6aA7q9W.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Leave the app open </strong>on your device. </p><p>Now our attention turns to our PC running Thonny.</p><p>5. <strong>Create a blank file.</strong></p><p>6.<strong> Import the requests module. </strong>This is a module of pre-written Python code designed for sending and receiving network connections.</p><pre class="line-numbers language-bash" language="bash" ><code>import requests</code></pre><p>7. <strong>Use requests to post a message to ntfy.</strong> Note that we need to specify the topic name, in our case <a href="https://ntfy.sh/th-test"><u>https://ntfy.sh/th-test</u></a>, as part of the function’s argument. The next argument, data is the text that the user will see. But our interest is in “headers” as this is a dictionary which can contain multiple entries. Right now it contains a title for the notification.</p><pre class="line-numbers language-bash" language="bash" ><code>requests.post("https://ntfy.sh/th-test",   data="This is a test of ntfy for Tom's Hardware",   headers={ "Title": "Python Dictionaries are useful" })</code></pre><p>8. <strong>Save the code as dictionary-ntfy.py and click Run.</strong> This will send the message to ntfy’s servers and from there the notification will appear on your device.</p><h2 id="complete-code-listing-real-world-project">Complete Code Listing: Real World Project</h2><pre class="line-numbers language-bash" language="bash" ><code>import requestsrequests.post("https://ntfy.sh/th-test",   data="This is a test of ntfy for Tom's Hardware",   headers={ "Title": "Python Dictionaries are useful" })</code></pre><h2 id="an-advanced-real-world-dictionary-project">An Advanced Real World Dictionary Project</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1080px;"><p class="vanilla-image-block" style="padding-top:98.15%;"><img id="tsUvfxMUb5F5XXA4WcEdaW" name="ntfy3.png" alt="Dictionaries in Python" src="https://cdn.mos.cms.futurecdn.net/tsUvfxMUb5F5XXA4WcEdaW.png" mos="" align="middle" fullscreen="1" width="1080" height="1060" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/tsUvfxMUb5F5XXA4WcEdaW.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Lets create a more advanced project, one that uses a dictionary to store multiple items. We’re going to reuse the code from before, but tweak it to meet our needs.</p><p>1. <strong>Our import and requests line remain the same.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>import requestsrequests.post("https://ntfy.sh/th-test",</code></pre><p>2. <strong>Open and read a file into memory. </strong>This is the data that is sent in the notification. In this case we start with an image that is in the same directory as our code. If the image is in a different location on your machine, specify the full path to the file.</p><pre class="line-numbers language-bash" language="bash" ><code>   data=open("yoga.jpg", 'rb'),</code></pre><p>3. <strong>Create a dictionary called “headers”. </strong>This forms the information that is sent in the notification.</p><pre class="line-numbers language-bash" language="bash" ><code>   headers={</code></pre><p>4. <strong>Inside the headers dictionary, specify the following keys and values.</strong></p><p>Priority 5 messages are urgent, the highest priority and they will set your phone to vibrate / ring continuously until they are answered.</p><p>Tags: These are emojis and tags used to add icons and extra data to a notification. If the tag has an emoji, then you will see it.</p><p>Title: The top title, in bold for the notification.</p><p>Click: When you click on the notification, it will open the web page.</p><p>Filename: The name of the file that is being sent.</p><pre class="line-numbers language-bash" language="bash" ><code>       "Priority": "5",       "Tags": "rotating_light",       "Title": "Let me in, it is cold!!",       "Click": "https://www.tomshardware.com/reviews/elecfreaks-cm4-xgo",       "Filename": "yoga.jpg"   })</code></pre><p>5. <strong>Save the code and click Run.</strong> Now look at your device and you will see a notification showing our custom message.</p><h2 id="complete-code-listing-advanced-project">Complete Code Listing: Advanced Project</h2><pre class="line-numbers language-bash" language="bash" ><code>import requestsrequests.post("https://ntfy.sh/th-test",   data=open("yoga.jpg", 'rb'),   headers={       "Priority": "5",       "Tags": "rotating_light",       "Title": "Let me in, it is cold!!",       "Click": "https://www.tomshardware.com/reviews/elecfreaks-cm4-xgo",       "Filename": "yoga.jpg"   })</code></pre><h2 id="more-python-tutorials-2">More Python Tutorials</h2><ul><li><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">How To Install Python on Windows 10 and 11</a></li><li><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">How to use For Loops in Python</a></li><li><a href="https://www.tomshardware.com/how-to/enumerate-in-python">How to Enumerate in Python</a></li><li><a href="https://www.tomshardware.com/how-to/create-python-executable-applications">How to Create Executable Applications in Python</a></li><li><a href="https://www.tomshardware.com/how-to/python-remove-image-backgrounds">How To Remove Backgrounds From Images With Python</a></li><li><a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny">How to Create Web Apps with Python, HTML and Thonny</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2">How To Use Raspberry Pi Camera Module 3 with Python Code</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Enumerate in Python ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/enumerate-in-python</link>
                                                                            <description>
                            <![CDATA[ Python has a useful function that enables you to enumerate a list or tuple that can be easily called and used later in your script. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">K47zLtV69hKDB5ZFCZCEGc</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/kWZyNr8pFR7NSgdDTcx3rb-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Mon, 31 Jul 2023 17:21:48 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:19:18 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Ash Hill ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/p9HsnLCwBpTQYCBBhYXgrS.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Ash is a self-employed tech writer and illustrator with a serious affinity for the Raspberry Pi, 3D printing, retro gaming and finding the best tech deals and coupons. She has over a decade of IT experience and has been featured in the official Raspberry Pi magazine MagPi.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/kWZyNr8pFR7NSgdDTcx3rb-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Python]]></media:description>                                                            <media:text><![CDATA[Python]]></media:text>
                                <media:title type="plain"><![CDATA[Python]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/kWZyNr8pFR7NSgdDTcx3rb-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Once you’ve created a list or collection in Python, it might be useful to have each item numbered. Instead of going through the list manually and adding numerals one by one, it can be well worth looking into the enumerate function. This is a built-in tool that will go through a list and automatically number them in the order they were added to the tuple or list.</p><p>In this guide, we’ll go over how to use this enumerate function with an existing list. We’ll assume you already have familiarity with how to create a variable, list, and use functions. Once the list has been enumerated, it can be called later with the enumeration in place. You can even use a for loop (see <a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">how to use for loops in Python</a>) to iterate through the enumeration.</p><h2 id="what-is-enumeration-in-python">What is Enumeration in Python?</h2><p>Enumeration is the ordered listing of all items in a collection. In Python we can use this with a list or tuple to (data collection objects) into an enumerate object. The enumerate object has a name and value for each enum member within the object. The enumerate object can be updated (mutable) unlike other objects such as tuples which are immutable (cannot be updated).</p><h2 id="how-to-enumerate-in-python">How to Enumerate in Python</h2><p>To demonstrate how to use enumeration in Python, we’ll start with a list of flavors and label it ‘flavors’. After applying the enumeration function, we’ll print the list which will show that each item has been marked with a numeral sequentially.</p><p>1. <strong>Create a list</strong>, collection or tuple. In this case we have three flavors in a list labeled as a variable named ‘flavors’.</p><pre class="line-numbers language-python" language="python" ><code>flavors = ('Raspberry', 'Vanilla', 'Chocolate')</code></pre><p>2. <strong>Run the enumerate function.</strong> In the example code below, we’ve created a variable named ‘choices’ that consists of the enumerate function parsing the ’flavors&apos; object, as an argument.</p><pre class="line-numbers language-python" language="python" ><code>flavors = ('Raspberry', 'Vanilla', 'Chocolate')choices = enumerate(flavors)</code></pre><p>3. <strong>Print the list.</strong> You can now call the &apos;flavors&apos; object as needed in your code. For the sake of our example, we’ll print the list to show what it looks like when the list has been enumerated.</p><pre class="line-numbers language-python" language="python" ><code>flavors = ('Raspberry', 'Vanilla', 'Chocolate')choices = enumerate(flavors)print(list(choices))</code></pre><p>4. <strong>Confirm the results.</strong> The printed list should appear as follows if the enumeration was successful.</p><pre class="line-numbers language-python" language="python" ><code>[(0, 'Raspberry'), (1, 'Vanilla'), (2, 'Chocolate')]</code></pre><p>Even though we’ve printed the list to show the enumerate function, this is just to demonstrate how it works. You can apply it in your code as needed after the second step but printing the list is a quick way to make sure it’s working as intended.</p><p>We earlier mentioned that enumerated collections have a value and name associated to the data stored within. We can individually extract these values. Here is a quick example that creates an enumerated collection of foods.</p><p>1. <strong>Import the enum module.</strong> </p><pre class="line-numbers language-python" language="python" ><code>import enum</code></pre><p>2. <strong>Create a new enumeration object using a function-call syntax.</strong> Our object is called food, and in there we store a list of foods. By using the enum.Enum function call we bind  values to each of the item names.</p><pre class="line-numbers language-python" language="python" ><code>food = enum.Enum('food', ['Tomato', 'Cucumber', 'Chocolate'])</code></pre><p>3. <strong>Use a for loop to print the value and name of each item in the object. </strong>The for loop will iterate over every item in the object. We then print the value and name of the item.</p><pre class="line-numbers language-python" language="python" ><code>for item in food:    print(item.value, item.name)</code></pre><p>4. <strong>Run the code.</strong> The output will be the enumerated value of the item&apos;s position and the name of the item.</p><pre class="line-numbers language-python" language="python" ><code>1 Tomato2 Cucumber3 Chocolate</code></pre><h2 id="using-enumeration-to-number-chapters-in-a-book">Using Enumeration to Number Chapters in a Book</h2><p>There are plenty of practical applications for applying numbers to a list. In this example, we&apos;ll number the chapters in a book we&apos;re pretending to write. This example also shows how you can start a list from any number so it doesn&apos;t begin with the default value of 0.</p><p>I&apos;ll be using Thonny for this example. It&apos;s a free Python editor that works on several platforms. You can find it available for download on the official <a href="https://thonny.org">Thonny website</a>. However, you can use any editor you like for your project.</p><p>1. <strong>Make your list.</strong> In this case, my list is a handful of fake chapters for our book.</p><pre class="line-numbers language-python" language="python" ><code>chapters = ["How to Enumerate in Python", "Creating a List", "Enumerating the List"]</code></pre><p>2. <strong>Set the beginning of the list to 1 instead of 0.</strong> The next line tells Python that we want the chapter enumeration to begin at 1. The words &apos;chapter&apos; and &apos;title&apos; can be anything you like.</p><pre class="line-numbers language-python" language="python" ><code>chapters = ["How to Enumerate in Python", "Creating a List", "Enumerating the List"]for chapter, title in enumerate (chapters,1):</code></pre><p>3. <strong>Print the list.</strong> The third line prints the chapter variable which has the title argument setting the list to begin at 1.</p><pre class="line-numbers language-python" language="python" ><code>chapters = ["How to Enumerate in Python", "Creating a List", "Enumerating the List"]for chapter, title in enumerate (chapters,1):print(chapter, title)</code></pre><p>4. <strong>Run the program.</strong> It should print the chapters with the enumeration beginning at 1.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:861px;"><p class="vanilla-image-block" style="padding-top:34.96%;"><img id="mPXx2vK4rhanGjAwJf3Zcb" name="1690635122.jpg" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/mPXx2vK4rhanGjAwJf3Zcb.jpg" mos="" align="middle" fullscreen="" width="861" height="301" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="python-how-tos">Python How Tos</h2><ul><li><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">How To Install Python on Windows 10 and 11</a></li><li><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">How to use For Loops in Python</a></li><li><a href="https://www.tomshardware.com/how-to/enumerate-in-python">How to Enumerate in Python</a></li><li><a href="https://www.tomshardware.com/how-to/create-python-executable-applications">How to Create Executable Applications in Python</a></li><li><a href="https://www.tomshardware.com/how-to/python-remove-image-backgrounds">How To Remove Backgrounds From Images With Python</a></li><li><a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny">How to Create Web Apps with Python, HTML and Thonny</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2">How To Use Raspberry Pi Camera Module 3 with Python Code</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to use For Loops in Python ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/use-for-loops-in-python</link>
                                                                            <description>
                            <![CDATA[ For loops provide a means to control the number of times your code performs a task. This can be a range, or iterating over items in an object. In this how to we will go through the steps to create your own projects using for loops. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">AhiEP3CeFtn8YQUidSJZQY</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/UhcuwXQZ9o8fkzxcUiu9k-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sat, 29 Jul 2023 11:00:55 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:19:09 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/UhcuwXQZ9o8fkzxcUiu9k-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[How To Use For Loops in Python]]></media:description>                                                            <media:text><![CDATA[How To Use For Loops in Python]]></media:text>
                                <media:title type="plain"><![CDATA[How To Use For Loops in Python]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/UhcuwXQZ9o8fkzxcUiu9k-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>In programming, for loops are incredibly versatile tools to repeat a section of code. For loops can loop for a set number of times using a range, they can have clauses / conditions which will end the loop and we can use them to iterate over items in a dictionary, list or tuple.</p><p>In this how to, we will show you how to get started with for loops using Python, the same syntax will also work with MicroPython and CircuitPython on boards such as the <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w"><u>Raspberry Pi Pico.</u></a></p><p>To demonstrate how to use for loops in Python, we will use Thonny, a free, easy to use and cross platform Python editor. </p><p>1. <strong>In a browser go to the Thonny website and </strong><a href="https://thonny.org/"><u><strong>download the release</strong></u></a><strong> for your system.</strong></p><p>2. <strong>Alternatively, install the official Python release </strong><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11"><u><strong>using this guide</strong></u></a><strong>.</strong> Note that this guide covers installation on Windows 10 and 11.</p><h2 id="using-a-range-with-python-for-loops">Using a Range with Python For Loops</h2><p>The most basic for loop use in Python is to iterate over a range, essentially creating a loop that will only iterate for a set number of times. While “range” is not strictly part of the syntax for a for loop, it is really a built-in Python function that returns a sequence for a specific pattern, it is the easiest way to demonstrate how a for loop works.</p><p>1. <strong>Create a for loop and set the range to 10</strong>.This will set the value of x to an integer value, starting at 0 and ending at 9. The loop will iterate until it reaches the tenth loop, then it will end.</p><pre class="line-numbers language-bash" language="bash" ><code>for i in range(10):</code></pre><p>2. <strong>Print the current value of i as part of a sentence.</strong> Here we use Python’s string format method to insert the loop number each time the loop iterates.</p><pre class="line-numbers language-bash" language="bash" ><code>   print("This is loop: {:n}".format(i))</code></pre><p>3. <strong>Save the code as for_loop_range.py and click Run to start.</strong> You should see this output.</p><pre class="line-numbers language-bash" language="bash" ><code>This is loop: 0This is loop: 1This is loop: 2This is loop: 3This is loop: 4This is loop: 5This is loop: 6This is loop: 7This is loop: 8This is loop: 9</code></pre><h2 id="complete-code-listing-for-loop-with-a-range">Complete Code Listing: For Loop With a Range</h2><pre class="line-numbers language-bash" language="bash" ><code>for i in range(10):    print("This is loop: {:d}".format(i))</code></pre><h2 id="using-a-for-loop-with-rss-feeds">Using a For Loop With RSS Feeds</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1280px;"><p class="vanilla-image-block" style="padding-top:70.39%;"><img id="5YyEHZVneqNSahZomtiBD3" name="image5.jpg" alt="How To Use For Loops in Python" src="https://cdn.mos.cms.futurecdn.net/5YyEHZVneqNSahZomtiBD3.jpg" mos="" align="middle" fullscreen="1" width="1280" height="901" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/5YyEHZVneqNSahZomtiBD3.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>To better illustrate how we can use a for loop, let&apos;s use a for loop with a range to pull the top five headlines from BBC News’ RSS feed along with their corresponding URL.</p><p>1. <strong>Install feedparser using pip </strong>at a command prompt. Feedparser is an RSS parsing tool that we shall use to read the RSS feed and convert it into a Python dictionary.</p><pre class="line-numbers language-bash" language="bash" ><code>pip install feedparser</code></pre><p>2. <strong>In Thonny, create a new blank Python file </strong>and <strong>import feedparser.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>import feedparser</code></pre><p>3. <strong>Create an object, newsfeed, </strong>and in there <strong>store the parsed BBC News feed.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>newsfeed = feedparser.parse("http://feeds.bbci.co.uk/news/rss.xml")</code></pre><p>4. <strong>Use a for loop with a range of five.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>for i in range(5):</code></pre><p>5. <strong>Print the headlines (title) and the URL (link) of the top five stories. </strong>Here we are accessing the newsfeed object, which is a dictionary (array) that contains many more dictionaries and lists. Using the keys (entries, title and link) we can get the values that they store. The value of [i] increments, until it reaches 5, then the loop ends. We have how tos covering dictionaries and lists which go into further detail.</p><pre class="line-numbers language-bash" language="bash" ><code>   print(newsfeed['entries'][i]['title'])   print(newsfeed['entries'][i]['link'])</code></pre><p>6. <strong>Save the code as news_for_loop.py and click Run.</strong> You should see the top five news headlines.</p><h2 id="complete-code-listing-using-a-for-loop-with-rss-feeds-xa0">Complete Code Listing: Using a For Loop With RSS Feeds  </h2><pre class="line-numbers language-bash" language="bash" ><code>import feedparsernewsfeed = feedparser.parse("http://feeds.bbci.co.uk/news/rss.xml")for i in range(5):    print(newsfeed['entries'][i]['title'])    print(newsfeed['entries'][i]['link'])</code></pre><h2 id="for-loops-with-an-early-exit">For Loops With an Early Exit</h2><p>Ranges can also feature an “early exit”. This uses a conditional statement that checks the value of the of the loop (in our case it is stored in i) and if it matches the value, the code breaks and exits.</p><p>We’re going to reuse the code from the first example to start us off.</p><p>1. <strong>Add a conditional test that checks the value of i is the same as 4</strong>. In Python == is an operator that checks that one value is the same as another.</p><pre class="line-numbers language-bash" language="bash" ><code>   if i == 4:</code></pre><p>2. <strong>Print a sentence to inform the user that the loop is terminating. </strong>This part of the code will only activate once “i” contains the value 4.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>       print("This loop sequence terminates at loop {:n}".format(i))</code></pre><p>3. <strong>Break the loop, forcing the code to stop.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>       break</code></pre><p>4. <strong>Save and run the code.</strong> You should see this output.</p><pre class="line-numbers language-bash" language="bash" ><code>This is loop: 0This is loop: 1This is loop: 2This is loop: 3This is loop: 4This loop sequence terminates at loop 4</code></pre><h2 id="complete-code-listing-for-loop-with-an-early-exit">Complete Code Listing: For Loop With an Early Exit</h2><pre class="line-numbers language-bash" language="bash" ><code>for i in range(10):    print("This is loop: {:n}".format(i))    if i == 4:        print("This loop sequence terminates at loop {:n}".format(i))        break</code></pre><h2 id="nested-for-loops">Nested For Loops</h2><p>We can have multiple for loops running together. For example we can nest one for loop inside of another. In this example we are reusing the code from the first example.</p><pre class="line-numbers language-bash" language="bash" ><code>for i in range(10):   print("This is loop: {:n}".format(i))</code></pre><p>1. <strong>Add a nested for loop that will iterate ten times. </strong>Ensure that the variable name is different to the main loop, otherwise the two will clash.</p><pre class="line-numbers language-bash" language="bash" ><code>   for j in range(10):</code></pre><p>2. <strong>Add a print statement to inform the user that this is the nested for loop.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>       print("This is nested loop: {:n}".format(i))</code></pre><p>3. <strong>Use a break to exit out of the nested for loop.</strong> If we don’t do this, then the nested for loop will repeat each time the main loop iterates.</p><pre class="line-numbers language-bash" language="bash" ><code>       break</code></pre><p><br></p><p>4. <strong>Save and run the code.</strong> You should see this output.</p><pre class="line-numbers language-bash" language="bash" ><code>This is loop: 0This is nested loop: 0This is loop: 1This is nested loop: 1This is loop: 2This is nested loop: 2This is loop: 3This is nested loop: 3This is loop: 4This is nested loop: 4This is loop: 5This is nested loop: 5This is loop: 6This is nested loop: 6This is loop: 7This is nested loop: 7This is loop: 8This is nested loop: 8This is loop: 9This is nested loop: 9</code></pre><h2 id="complete-code-listing-nested-for-loops">Complete Code Listing: Nested For Loops</h2><pre class="line-numbers language-bash" language="bash" ><code>for i in range(10):   print("This is loop: {:n}".format(i))   for j in range(10):       print("This is nested loop: {:n}".format(i))       break</code></pre><h2 id="iterating-with-for-loops">Iterating With For Loops</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1280px;"><p class="vanilla-image-block" style="padding-top:70.39%;"><img id="5YyEHZVneqNSahZomtiBD3" name="image5.jpg" alt="How To Use For Loops in Python" src="https://cdn.mos.cms.futurecdn.net/5YyEHZVneqNSahZomtiBD3.jpg" mos="" align="middle" fullscreen="1" width="1280" height="901" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/5YyEHZVneqNSahZomtiBD3.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Iterating over objects in a list, dictionary or tuple is useful if we want to use data from these objects. In this example, we will reuse the code from our RSS feed reader to create a simple web app. A ranged for loop will grab the news headlines from the object, then split the headlines and their URLs apart and then store them inside of a Python dictionary object. Then we will use the dictionary as a source to generate an HTML page in a browser.</p><p>1. <strong>Install PyWebIO using pip </strong>at the command prompt<strong>,.</strong> PyWebIO is a means to create inputs and outputs around a browser session.</p><pre class="line-numbers language-bash" language="bash" ><code>pip install pywebio</code></pre><p>2. <strong>In Thonny, create a new blank Python file and import feedparser and import three PyWebIO classes. </strong>PyWebIO has many different classes and functions, but we are interested in creating a server, outputting information to a browser and controlling the session.</p><pre class="line-numbers language-bash" language="bash" ><code>import feedparserfrom pywebio import start_serverfrom pywebio.output import *    from pywebio.session import *</code></pre><p>3. <strong>Create an object, newsfeed, </strong>and in there <strong>store the parsed BBC News feed. </strong>This can be any RSS feed that you choose.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>newsfeed = feedparser.parse("http://feeds.bbci.co.uk/news/rss.xml")</code></pre><p>4. <strong>Create an empty dictionary called news_stories. </strong>Dictionaries are Python objects that store data using a key, value system. By calling a dictionary and referencing a key, we can get the value attached to it.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>news_stories = {}</code></pre><p>5. <strong>Using a for loop with a range, grab the first five news stories and store them inside the news_stories dictionary.</strong> The title (headline) will be the key, and the URL will be the value.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>for i in range(5):   news_stories.update({newsfeed['entries'][i]['title']:newsfeed['entries'][i]['link']})</code></pre><p>6. <strong>Create a function called main. </strong>This function will handle creating the web content to be served.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>def main():</code></pre><p>7. <strong>Set the page title.</strong> This is seen in the tab / title bar of the web browser.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   set_env(title='Python For Loops RSS Example')</code></pre><p>8. <strong>Use a for loop to iterate over every key (k) and value (v) stored in the news_stories dictionary. </strong>The for loop will end once it has retrieved all of the keys and values, it does not need a range.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   for k,v in news_stories.items():</code></pre><p>9. <strong>Place the headline text on the page. </strong>PyWebIO’s put_text function places raw text on a web page, and we pass the function the key value, which is the headline.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>       put_text(k)</code></pre><p>10. <strong>Place the URL underneath the headline. </strong>Using put_link we generate an HTML hyperlink with the text “Click here”. The URL is created from the value stored in v.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>       put_link('Click here',v)</code></pre><p>11. <strong>Outside of the for loop and the function, start the server. Call the main function and set the port to 8080, and debug to True.</strong> It is advisable to set the port to an unused value and typically 8080 is valid. If necessary change this to another value. Setting debug to True is useful as it provides output in the Python shell, and in the browser session.</p><pre class="line-numbers language-bash" language="bash" ><code>start_server(main, port=8080, debug=True)</code></pre><p>12. <strong>Save the code as for_loop_news_dict.py and click Run.</strong> The Python shell will display the URL of the generated page.</p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:880px;"><p class="vanilla-image-block" style="padding-top:31.82%;"><img id="7Azy24mi3JFWQNjAEVyPt" name="image3.jpg" alt="How To Use For Loops in Python" src="https://cdn.mos.cms.futurecdn.net/7Azy24mi3JFWQNjAEVyPt.jpg" mos="" align="middle" fullscreen="1" width="880" height="280" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/7Azy24mi3JFWQNjAEVyPt.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>13. <strong>Click on the URL to open in your default browser. </strong>The URL can also be viewed from another device on the network.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:768px;"><p class="vanilla-image-block" style="padding-top:58.72%;"><img id="jfqF82sxXu65v6wevurHY" name="image1.jpg" alt="How To Use For Loops in Python" src="https://cdn.mos.cms.futurecdn.net/jfqF82sxXu65v6wevurHY.jpg" mos="" align="middle" fullscreen="1" width="768" height="451" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/jfqF82sxXu65v6wevurHY.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-code-listing-iterating-with-for-loops">Complete Code Listing: Iterating With For Loops</h2><pre class="line-numbers language-bash" language="bash" ><code>import feedparserimport timefrom pywebio import start_serverfrom pywebio.output import *    from pywebio.session import *newsfeed = feedparser.parse("http://feeds.bbci.co.uk/news/rss.xml")news_stories = {}for i in range(5):   news_stories.update({newsfeed['entries'][i]['title']:newsfeed['entries'][i]['link']})def main():   set_env(title='Python For Loops RSS Example')   for k,v in news_stories.items():       put_text(k)       put_link('Click here',v)start_server(main, port=8080, debug=True)</code></pre><h2 id="python-how-tos-2">Python How Tos</h2><ul><li><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">How To Install Python on Windows 10 and 11</a></li><li><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">How to use For Loops in Python</a></li><li><a href="https://www.tomshardware.com/how-to/enumerate-in-python">How to Enumerate in Python</a></li><li><a href="https://www.tomshardware.com/how-to/create-python-executable-applications">How to Create Executable Applications in Python</a></li><li><a href="https://www.tomshardware.com/how-to/python-remove-image-backgrounds">How To Remove Backgrounds From Images With Python</a></li><li><a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny">How to Create Web Apps with Python, HTML and Thonny</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2">How To Use Raspberry Pi Camera Module 3 with Python Code</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Use Wget to Download Files at Windows' Command Line ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/use-wget-download-files-command-line</link>
                                                                            <description>
                            <![CDATA[ Wget is a powerful tool for downloading files and entire websites that you can install and use on Windows. Here’s how to use it. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">Lm7AfeXmwWeoVHJ87vL6Sd</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/A68j2DM9cvDRb3neAZZNPP-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Sat, 01 Jul 2023 12:00:13 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:32 +0000</updated>
                                                                                                                                            <category><![CDATA[Windows]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                    <category><![CDATA[Operating Systems]]></category>
                                                                                                                    <dc:creator><![CDATA[ Ben Stockton ]]></dc:creator>                                                                                                        <dc:description><![CDATA[ null ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/A68j2DM9cvDRb3neAZZNPP-1280-80.png">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Download Files from the Windows Command Line with Wget]]></media:description>                                                            <media:text><![CDATA[Download Files from the Windows Command Line with Wget]]></media:text>
                                <media:title type="plain"><![CDATA[Download Files from the Windows Command Line with Wget]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/A68j2DM9cvDRb3neAZZNPP-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p> </p><p>Most users will download files onto their PC using their web browser. There’s a problem with this method, however—it’s not particularly efficient. If you need to pause your download, or if you’ve lost your connection, you’ll probably need to start your download again from scratch. You may also be working with Python or other code at the command line and want to download directly from the command prompt. </p><p>That’s where tools like Wget come in. This command line tool has a number of useful features, with support for recursive downloads and download resumption that allows you to download single files (or entire websites) in one go.</p><p>Wget is popular on Linux and other Unix-based operating systems, but it’s also available for Windows users. Below, we’ll explain how to install and use Wget to download any content you want online from your Windows command line.</p><h2 id="installing-gnu-wget-on-windows">Installing GNU Wget on Windows</h2><p>Wget (in name, at least) is available on Windows 10 and 11 via the PowerShell terminal. However, this version of Wget isn’t the same as the GNU Wget tool that you’d use on a Linux PC. Instead, this version is simply an alias for a PowerShell command called Invoke-WebRequest.</p><p>Invoke-WebRequest is Wget-like in what it does, but it’s a completely different tool that’s much more difficult to use and understand. Instead, you’ll be better served by installing Wget for Windows, a compiled version of the same tool available for Linux users, using the steps below.</p><p>1. <strong>Download the Wget for Windows setup file from the </strong><a href="https://gnuwin32.sourceforge.net/packages/wget.htm"><u><strong>Wget website</strong></u></a>. You’ll need to do this using your web browser.</p><p>2. <strong>Run the Wget for Windows installer file</strong>. Once the Wget setup file has finished downloading, run the setup file and follow the on-screen instructions to complete the installation.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:665px;"><p class="vanilla-image-block" style="padding-top:71.58%;"><img id="CQxWnAKh7hXA8X5KCaCbZP" name="image8.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/CQxWnAKh7hXA8X5KCaCbZP.png" mos="" align="middle" fullscreen="1" width="665" height="476" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/CQxWnAKh7hXA8X5KCaCbZP.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Update the Wget.exe file (optional)</strong>. The Wget installer is packaged with a fairly old version of the Wget binary. If you run into difficulties downloading files because of SSL certificate errors, you should download the latest wget.exe for your architecture from <a href="https://eternallybored.org/misc/wget/"><u>this website</u></a> and save it to your Wget installation directory (typically C:\Program Files (x86)\GnuWin32\bin). This step is optional, but highly recommended.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:825px;"><p class="vanilla-image-block" style="padding-top:57.58%;"><img id="vAGNXEBEEo3GfVnBNKazwQ" name="image22.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/vAGNXEBEEo3GfVnBNKazwQ.png" mos="" align="middle" fullscreen="1" width="825" height="475" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/vAGNXEBEEo3GfVnBNKazwQ.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Open the Start menu, search for environment variables, and click Open</strong>. Once the installation is finished, use the search tool in the Start menu to search for environment variables, then click Open. You’ll need to do this to allow you to use the ‘wget’ command from the command line without referencing its location every time you wish to run it.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1170px;"><p class="vanilla-image-block" style="padding-top:83.50%;"><img id="3LngiTypVxDTJKmEPYTUER" name="image24.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/3LngiTypVxDTJKmEPYTUER.png" mos="" align="middle" fullscreen="1" width="1170" height="977" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/3LngiTypVxDTJKmEPYTUER.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Click Environment Variables</strong> in the System Properties window.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:546px;"><p class="vanilla-image-block" style="padding-top:104.76%;"><img id="Wp2TYyTf2ULexBYSeMPrUQ" name="image17.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/Wp2TYyTf2ULexBYSeMPrUQ.png" mos="" align="middle" fullscreen="1" width="546" height="572" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Wp2TYyTf2ULexBYSeMPrUQ.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>6. <strong>Select Path and click Edit</strong> under System or User variables.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:706px;"><p class="vanilla-image-block" style="padding-top:110.06%;"><img id="YJdRPb8gm2zm2CLQqCNYyP" name="image12.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/YJdRPb8gm2zm2CLQqCNYyP.png" mos="" align="middle" fullscreen="1" width="706" height="777" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/YJdRPb8gm2zm2CLQqCNYyP.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>7. <strong>Click the New button</strong> <strong>and type in the directory for the Wget for Windows binary (.exe) file</strong>. By default, this should be C:\Program Files (x86)\GnuWin32\bin.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:602px;"><p class="vanilla-image-block" style="padding-top:110.30%;"><img id="ofiDmjBQaadsazVFERk2RR" name="image26.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/ofiDmjBQaadsazVFERk2RR.png" mos="" align="middle" fullscreen="1" width="602" height="664" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ofiDmjBQaadsazVFERk2RR.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>8. <strong>Save your changes</strong>. When you’re finished, click OK in each menu and exit System Properties.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:602px;"><p class="vanilla-image-block" style="padding-top:110.30%;"><img id="rSMo8JfQWDTeV4DmsKBeUP" name="image7.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/rSMo8JfQWDTeV4DmsKBeUP.png" mos="" align="middle" fullscreen="1" width="602" height="664" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/rSMo8JfQWDTeV4DmsKBeUP.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>9. <strong>Open the Start menu, type cmd, and press Open</strong>. This will launch a new command prompt window.  You can also use the newer Terminal app, as long as you switch to using a command prompt shell.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1016px;"><p class="vanilla-image-block" style="padding-top:92.52%;"><img id="zbVymtovEFjnRVuwq8sh6R" name="image23.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/zbVymtovEFjnRVuwq8sh6R.png" mos="" align="middle" fullscreen="1" width="1016" height="940" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/zbVymtovEFjnRVuwq8sh6R.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>10. <strong>Type wget --version and press Enter</strong>. If Wget was installed correctly, you should see the GNU Wget version returned in the command prompt window.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:944px;"><p class="vanilla-image-block" style="padding-top:64.41%;"><img id="pCmdrCmZe57edJkNp3x2XN" name="image3.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/pCmdrCmZe57edJkNp3x2XN.png" mos="" align="middle" fullscreen="1" width="944" height="608" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/pCmdrCmZe57edJkNp3x2XN.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>If you want to run Wget from a PowerShell terminal instead, you’ll need to run the file from its installation directory directly (eg. C:\Program Files (x86)\GnuWin32\bin\wget.exe).</p><h2 id="downloading-files-with-wget">Downloading Files with Wget</h2><p>Once you’ve installed GNU Wget and you’ve configured the environment variables to be able to launch it correctly, you’ll be able to use it to start downloading files and webpages.</p><p>We’ve used an example domain and file path in our examples below. You’ll need to replace this with the correct path to the file (or files) that you want to download.</p><p><ul>  <li><strong>Type wget -h to see a full list of commands. </strong>This will give you the full list of options that you can use with Wget.<br>wget -h<br></li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1016px;"><p class="vanilla-image-block" style="padding-top:69.29%;"><img id="AqrsZ4rsATcC4h5HrcaWcN" name="image4.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/AqrsZ4rsATcC4h5HrcaWcN.png" mos="" align="middle" fullscreen="1" width="1016" height="704" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/AqrsZ4rsATcC4h5HrcaWcN.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Download a single file using wget <url></strong>. Replace <url> with the path to a file on an HTTP, HTTPS, or FTP server. You can also refer to a website domain name or web page directly to download that specific page (without any of its other content). <br>wget example.com<br></li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1015px;"><p class="vanilla-image-block" style="padding-top:52.51%;"><img id="NMNwhUgTU4sbCkayN9bUKR" name="image25.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/NMNwhUgTU4sbCkayN9bUKR.png" mos="" align="middle" fullscreen="1" width="1015" height="533" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/NMNwhUgTU4sbCkayN9bUKR.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Save with a different filename using -O</strong>. Using the -O option, you’ll be able to save the file with a different filename. For example, wget -O <filename> <url>, where <filename> is the filename you’ve chosen.<br>wget -O example.html example.com<br></li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1015px;"><p class="vanilla-image-block" style="padding-top:51.33%;"><img id="mNXavMfNh9wyNEHpBKBYfQ" name="image19.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/mNXavMfNh9wyNEHpBKBYfQ.png" mos="" align="middle" fullscreen="1" width="1015" height="521" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/mNXavMfNh9wyNEHpBKBYfQ.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Save to a different directory using -P</strong>. If you want to save to another directory than the one you’re currently in, use the -P option. For example, wget -P <path> <url>.<br>wget -P C:\folder example.com<br></li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1015px;"><p class="vanilla-image-block" style="padding-top:52.71%;"><img id="itgcqfYRVe7SVGnScvojAQ" name="image14.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/itgcqfYRVe7SVGnScvojAQ.png" mos="" align="middle" fullscreen="1" width="1015" height="535" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/itgcqfYRVe7SVGnScvojAQ.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Use --continue or -c to resume files</strong>. If you want to resume a partial download, use the -c option to resume it, as long as you’re in the same directory. For example, wget -c <url>.<br>wget -c example.com<br></li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1015px;"><p class="vanilla-image-block" style="padding-top:49.66%;"><img id="S3ACZFd8MNSmLaC6UAA9rQ" name="image21.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/S3ACZFd8MNSmLaC6UAA9rQ.png" mos="" align="middle" fullscreen="1" width="1015" height="504" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/S3ACZFd8MNSmLaC6UAA9rQ.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Download multiple files in sequence</strong>. If you want to download several files, add each URL to your Wget command. For example, wget <url1> <url2> etc.<br>wget example.com tomshardware.com<br></li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1052px;"><p class="vanilla-image-block" style="padding-top:64.64%;"><img id="bNArZZXQwZB9fxP6z46qsP" name="image11.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/bNArZZXQwZB9fxP6z46qsP.png" mos="" align="middle" fullscreen="1" width="1052" height="680" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/bNArZZXQwZB9fxP6z46qsP.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Download multiple files using a text file with -i</strong>. Using the -i option, you can refer to a text file that contains a list of URLs to download a large number of files. Assuming that each URL is on a new line, Wget will download the content from each URL in sequence. For example, wget -i <file.txt> <url>.<br>wget -i urls.txt<br></li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1052px;"><p class="vanilla-image-block" style="padding-top:64.64%;"><img id="633NudMH76sZAZnr8Ck3aQ" name="image18.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/633NudMH76sZAZnr8Ck3aQ.png" mos="" align="middle" fullscreen="1" width="1052" height="680" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/633NudMH76sZAZnr8Ck3aQ.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Limit download speeds using --limit-rate</strong>. If you want to limit your bandwidth usage, you can cap the download speeds using the --limit-rate option. For example, wget --limit-rate=1M <url> would limit it to 1 megabyte per second download speeds, while wget --limit-rate=10K <url> would limit it to 10 kilobytes per second.<br>wget --limit-rate=10K example.com<br></li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1052px;"><p class="vanilla-image-block" style="padding-top:48.29%;"><img id="B3RwRZdaNqvAyAStWZDmkP" name="image10.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/B3RwRZdaNqvAyAStWZDmkP.png" mos="" align="middle" fullscreen="1" width="1052" height="508" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/B3RwRZdaNqvAyAStWZDmkP.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><ul><li><strong>Use -w or –wait to set a pause period after each download</strong>. If you’re downloading multiple files, using -w can help to spread the requests you make and help to limit any chance that your downloads are blocked. For example, wget -w 10 <url1> <url2> for a 10 second wait. </li></ul><p>wget -w 10 example.com tomshardware.com</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1052px;"><p class="vanilla-image-block" style="padding-top:57.32%;"><img id="UZeULFj8REyoWyKELEaKiN" name="image5.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/UZeULFj8REyoWyKELEaKiN.png" mos="" align="middle" fullscreen="1" width="1052" height="603" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/UZeULFj8REyoWyKELEaKiN.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Set a retry limit using -t or --tries</strong>. If a download fails, wget will use the -t value to determine how many times it’ll attempt it again before it stops. The default value is 20 retries. If the file is missing, or if the connection is refused, then this value is ignored and Wget will terminate immediately.<br>wget -t 5 example.com</li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1052px;"><p class="vanilla-image-block" style="padding-top:48.67%;"><img id="x9QzxiFKm3MGRSiUK6vGGN" name="image1.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/x9QzxiFKm3MGRSiUK6vGGN.png" mos="" align="middle" fullscreen="1" width="1052" height="512" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/x9QzxiFKm3MGRSiUK6vGGN.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Save a log using -o or -a. </strong>You can save your log data to a text file using -o (to always create a new log file) or -a (to append to an existing file). For example, wget -o <file.txt> <url>.</li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1052px;"><p class="vanilla-image-block" style="padding-top:32.70%;"><img id="gfdyw4taCP6XB3wHCRufeP" name="image9.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/gfdyw4taCP6XB3wHCRufeP.png" mos="" align="middle" fullscreen="1" width="1052" height="344" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/gfdyw4taCP6XB3wHCRufeP.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><ul><li> <strong>Bypass SSL errors using --no-check-certificate</strong>. If you’re having trouble downloading from a web server with an SSL certificate and you’ve already updated your Wget installation, bypass the SSL certificate check completely using --no-check-certificate to allow the download (in most cases). You should only do this for downloads from locations that you completely trust. For example, wget --no-check-certificate example.com. </li></ul><p>wget --no-check-certificate https://example.com</p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1052px;"><p class="vanilla-image-block" style="padding-top:64.64%;"><img id="QHfUqr8wi4HfBP74rZKAkQ" name="image20.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/QHfUqr8wi4HfBP74rZKAkQ.png" mos="" align="middle" fullscreen="1" width="1052" height="680" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/QHfUqr8wi4HfBP74rZKAkQ.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Make sure to use the <strong>wget -h</strong> or <strong>wget --help</strong> command to view the full list of options that are available to you. If you run into trouble with Wget, make sure to limit the number of retries you make and set a wait limit for each download you attempt.</p><p><br></p><h2 id="using-wget-for-recursive-downloads">Using Wget for Recursive Downloads</h2><p>One of Wget’s most useful features is the ability to download recursively. Instead of only downloading a single file, it’ll instead try to download an entire directory of related files.</p><p>For instance, if you specify a web page, it’ll download the content attached to that page (such as images). Depending on the recursive depth you choose, it can also download any pages that are linked to it, as well as the content on those pages, any pages that are linked on those pages, and so on.</p><p>Theoretically, Wget can run with an infinite depth level, meaning it’ll never stop trying to go further and deeper with the content it downloads. However, from a practical point of view, you may find that most web servers will block this level of scraping, so you’ll need to tread carefully.</p><p><ul>  <li><strong>Type wget -r or wget --recursive to download recursively. </strong>By default, the depth level is five. For example, wget -r <url>.<br>wget -r tomshardware.com</li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1052px;"><p class="vanilla-image-block" style="padding-top:71.48%;"><img id="NkvqkJ7D4ue4MNCi93YTPN" name="image2.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/NkvqkJ7D4ue4MNCi93YTPN.png" mos="" align="middle" fullscreen="1" width="1052" height="752" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/NkvqkJ7D4ue4MNCi93YTPN.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Use -l or –level to set a custom depth level.</strong> For example, wget -r -l 10 <url>. Use wget -r -l inf <url> for an infinite depth level.<br>wget -r -l 10 tomshardware.com</li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1052px;"><p class="vanilla-image-block" style="padding-top:71.48%;"><img id="D4ryQgWbMqy98XtF6gXoGQ" name="image15.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/D4ryQgWbMqy98XtF6gXoGQ.png" mos="" align="middle" fullscreen="1" width="1052" height="752" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/D4ryQgWbMqy98XtF6gXoGQ.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Use -k to convert links to local file URLs</strong>. If you’re scraping a website, Wget will automatically convert any links in HTML to point instead to the offline copy that you’ve downloaded. For example, wget -r -k <url>.<br>wget -r -k tomshardware.com</li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1052px;"><p class="vanilla-image-block" style="padding-top:71.48%;"><img id="X8SMnpeuEEmDAszx5i82QQ" name="image16.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/X8SMnpeuEEmDAszx5i82QQ.png" mos="" align="middle" fullscreen="1" width="1052" height="752" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/X8SMnpeuEEmDAszx5i82QQ.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><ul>  <li><strong>Use -p or --page-requisites to download all page content. </strong>If you want a website to fully download so that all of the images, CSS, and other page content is available offline, use the -p or --page-requisites options. For example, wget -r -p <url>.<br>wget -r -p tomshardware.com</li></ul></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1052px;"><p class="vanilla-image-block" style="padding-top:71.48%;"><img id="enVJiQzDmzDn4NJnV7w96Q" name="image13.png" alt="Download Files from the Windows Command Line with Wget" src="https://cdn.mos.cms.futurecdn.net/enVJiQzDmzDn4NJnV7w96Q.png" mos="" align="middle" fullscreen="1" width="1052" height="752" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/enVJiQzDmzDn4NJnV7w96Q.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>For a full list of options, make sure to use the <strong>wget --h</strong> command. You should also take care to respect any website that you’re actively downloading from and do your best to limit server loads using wait, retry, and depth limits.</p><p>If you run into difficulties with downloads because of SSL certificate errors, don’t forget to update your Wget binary file (wget.exe) with the latest version.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Install Python on Windows 10 and 11 ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11</link>
                                                                            <description>
                            <![CDATA[ Installing Python on Windows 10 and 11 is easy and we show you three ways to install and use the versatile programming language. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">FhY2byEV5NAsUXFC6aNHqH</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/9r4zBGJk2qD62yuF295PJR-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Mon, 19 Jun 2023 09:47:57 +0000</pubDate>                                                                                                                                <updated>Thu, 20 Mar 2025 12:50:45 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/9r4zBGJk2qD62yuF295PJR-1280-80.jpg">
                                                            <media:credit><![CDATA[Future / Pexels]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Windows 11 Python]]></media:description>                                                            <media:text><![CDATA[Windows 11 Python]]></media:text>
                                <media:title type="plain"><![CDATA[Windows 11 Python]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/9r4zBGJk2qD62yuF295PJR-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Originally created by Guido van Rossum in 1991, Python is a versatile programming language used by makers on the <a href="https://www.tomshardware.com/news/raspberry-pi">Raspberry Pi</a>, system administrators in the data center, Industrial Light and Magic to bring our movies to life and behind the scenes at NASA.</p><p>Python is a great language to learn, and thanks to the <a href="https://www.tomshardware.com/raspberry-pi">Raspberry Pi</a> for the past thirteen years there have been countless tutorials covering the gamut of programming projects.</p><p>Whether you are a Python veteran, a “pythonista” or a complete newcomer to the language, installing Python on Windows is an easy task. In this how to we will walk you through installing Python 3 on Windows (including how to install via the Microsoft Store) and show two editors, one for beginners and the other for intermediate and advanced users, and how you can get coding with this fantastic language.</p><h2 id="installing-python-3-on-windows-10-and-11">Installing Python 3 on Windows 10 and 11</h2><p>The installation process for Python 3 on Windows is simple, with only a couple of extra steps that we have to follow. These steps enable us to access Python from anywhere on our system and install software using its built-in package manager, pip. Installing Python in this manner enables the creation of projects that work with the operating system, for example notifications and automated system tasks.</p><p><strong>1. Open a browser to the </strong><a href="https://www.python.org/"><strong>Python website</strong></a><strong> and download the latest stable Windows installer. </strong>In the screenshots you will see Python 3.10, which was the latest version at the time of writing.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1251px;"><p class="vanilla-image-block" style="padding-top:81.14%;"><img id="" name="image003.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/x3TyUMBfmTCAGYFNnYEptU.png" mos="" align="middle" fullscreen="" width="1251" height="1015" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>2. Double click on the downloaded file and install Python for all users, </strong>and <strong>ensure that Python is added to your path. Click on Install now to begin. </strong>Adding Python to the path will enable us to use the Python interpreter from any part of the filesystem.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:666px;"><p class="vanilla-image-block" style="padding-top:61.56%;"><img id="" name="image005.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/vDhoqs4LXbBTF8cEpBTnZU.png" mos="" align="middle" fullscreen="1" width="666" height="410" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/vDhoqs4LXbBTF8cEpBTnZU.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>3. After the installation is complete, click Disable path length limit and then Close. </strong>Disabling the path length limit means we can use more than 260 characters in a file path.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:666px;"><p class="vanilla-image-block" style="padding-top:61.56%;"><img id="" name="image007.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/AksLEj9diLtoAwY4qJfH7V.png" mos="" align="middle" fullscreen="1" width="666" height="410" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/AksLEj9diLtoAwY4qJfH7V.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>4. Click Close to end the installation.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:666px;"><p class="vanilla-image-block" style="padding-top:61.56%;"><img id="" name="image009.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/qauLSQBoyMEyruhcSb8zCV.png" mos="" align="middle" fullscreen="1" width="666" height="410" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/qauLSQBoyMEyruhcSb8zCV.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="installing-python-via-the-microsoft-store">Installing Python via the Microsoft Store</h2><p>An alternative to installing Python directly from the Python website is to use the Microsoft Store. Apps in the store are approved by Microsoft and can be easily installed. The downside is that this release may be one or two versions behind the official release.</p><p><strong>1. Click on Start and search for "store". </strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:781px;"><p class="vanilla-image-block" style="padding-top:86.81%;"><img id="ui9jjREZAsQm8eTL5yt7Jo" name="store1.jpg" alt="The Microsoft Store" src="https://cdn.mos.cms.futurecdn.net/ui9jjREZAsQm8eTL5yt7Jo.jpg" mos="" align="middle" fullscreen="1" width="781" height="678" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ui9jjREZAsQm8eTL5yt7Jo.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p><strong>2. Search for Python in the Microsoft Store.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:919px;"><p class="vanilla-image-block" style="padding-top:22.42%;"><img id="YRrLvhV4LTcVMWE58LaEdE" name="store2.jpg" alt="Searching for Python" src="https://cdn.mos.cms.futurecdn.net/YRrLvhV4LTcVMWE58LaEdE.jpg" mos="" align="middle" fullscreen="" width="919" height="206" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p><strong>3. Select the latest version of Python.</strong> In this case Python 3.11.4 is available from the store. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1191px;"><p class="vanilla-image-block" style="padding-top:71.37%;"><img id="EzhWs63tY43hvTQZrZWHUj" name="store3.jpg" alt="Searching for Python in the Microsoft Store" src="https://cdn.mos.cms.futurecdn.net/EzhWs63tY43hvTQZrZWHUj.jpg" mos="" align="middle" fullscreen="" width="1191" height="850" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p><strong>4. Click "Get" to download and install Python to your computer.</strong> You will need to sign in to your Microsoft account. In a few moments Python will be installed and ready for use.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1179px;"><p class="vanilla-image-block" style="padding-top:39.69%;"><img id="ahzcm4Qj8wjNfoAYnY2QHN" name="store4.jpg" alt="Installing Python" src="https://cdn.mos.cms.futurecdn.net/ahzcm4Qj8wjNfoAYnY2QHN.jpg" mos="" align="middle" fullscreen="" width="1179" height="468" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><h2 id="running-python-in-windows">Running Python in Windows</h2><p><strong>1. Open a Command Prompt and type “python” then press Enter.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:312px;"><p class="vanilla-image-block" style="padding-top:44.23%;"><img id="" name="image011.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/6WRSdWLa9CNgVrxKu6ZrGV.png" mos="" align="middle" fullscreen="1" width="312" height="138" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/6WRSdWLa9CNgVrxKu6ZrGV.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>2. Create a short Python script that uses a for loop to print a message to the Python shell ten times. Press space four times to indent </strong>the second line, otherwise Python will produce an error.<strong> Press Enter to run the code.</strong></p><pre class="line-numbers language-python" language="python" ><code>for i in range(10):    print(“Python in the command prompt”)</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1008px;"><p class="vanilla-image-block" style="padding-top:54.86%;"><img id="" name="image013.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/No62CuxkckhbuNdi94CNMV.png" mos="" align="middle" fullscreen="1" width="1008" height="553" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/No62CuxkckhbuNdi94CNMV.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Python comes with its own package manager, pip, that is used to install, update and remove modules of pre-written Python code. These modules provide us with extra functionality. To demonstrate we will use pip to install the <a href="https://pyjok.es/">pyjokes </a>module, a collection of programmer jokes.</p><p><strong>1. Open a Command Prompt </strong>and <strong>use pip to install pyjokes then press Enter.</strong></p><pre class="line-numbers language-python" language="python" ><code>pip install pyjokes</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:501px;"><p class="vanilla-image-block" style="padding-top:38.32%;"><img id="" name="image015.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/woxDNpUD64ckvjiNuiNrQV.png" mos="" align="middle" fullscreen="1" width="501" height="192" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/woxDNpUD64ckvjiNuiNrQV.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>2. Open the Python interpreter.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:312px;"><p class="vanilla-image-block" style="padding-top:44.23%;"><img id="" name="image017.gif" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/dnwGQ4uNuuadse7hFe2nTV.gif" mos="" align="middle" fullscreen="1" width="312" height="138" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/dnwGQ4uNuuadse7hFe2nTV.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>3. Import the pyjokes module and then print a joke from the module. </strong>In our case, we got a “hip hip hurray” take on an array containing two hips.</p><pre class="line-numbers language-python" language="python" ><code>import pyjokesprint(pyjokes.get_joke())</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:602px;"><p class="vanilla-image-block" style="padding-top:31.73%;"><img id="" name="image019.gif" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/kE8DwSUmqu2j8EXVTj5vcV.gif" mos="" align="middle" fullscreen="1" width="602" height="191" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/kE8DwSUmqu2j8EXVTj5vcV.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. More modules can be found using the <a href="https://pypi.org/">PyPi Package Index.</a></p><h2 id="beginning-python-with-thonny">Beginning Python With Thonny</h2><p>If you have never written a line of Python code, then Thonny is for you. Thonny is designed with beginners in mind. The simple interface means we can focus on our code. But don’t underestimate Thonny as under the hood we have tools to write code for the <a href="https://www.tomshardware.com/raspberry-pi/raspberry-pi-pico-2-w-review">Raspberry Pi Pico series </a>, Adafruit CircuitPython and many MicroPython boards, including those from Lego and the well known ESP32 boards.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1280px;"><p class="vanilla-image-block" style="padding-top:76.33%;"><img id="7TA4j68UqixUnu6QnPdw" name="th1.JPG" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/7TA4j68UqixUnu6QnPdw.jpg" mos="" align="middle" fullscreen="1" width="1280" height="977" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/7TA4j68UqixUnu6QnPdw.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>1. Open a browser to the Thonny</strong><a href="https://thonny.org/"><strong> website </strong></a>and <strong>download the Windows installer.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:686px;"><p class="vanilla-image-block" style="padding-top:99.27%;"><img id="DBRqgmTfDXNEMmLroTveLD" name="th2" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/DBRqgmTfDXNEMmLroTveLD.jpg" mos="" align="middle" fullscreen="1" width="686" height="681" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/DBRqgmTfDXNEMmLroTveLD.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>2. Go to the Downloads folder </strong>and <strong>double click the Thonny file to begin installation.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:686px;"><p class="vanilla-image-block" style="padding-top:25.36%;"><img id="mLkNCcfUudfJnB6oz7i7Xk" name="th3" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/mLkNCcfUudfJnB6oz7i7Xk.jpg" mos="" align="middle" fullscreen="1" width="686" height="174" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/mLkNCcfUudfJnB6oz7i7Xk.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>3. Click "Next" and follow the instructions to Install. </strong>The install process will take a few moments to complete.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:495px;"><p class="vanilla-image-block" style="padding-top:77.78%;"><img id="TYVmyXgDwJg2pvCEsR9k87" name="th4" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/TYVmyXgDwJg2pvCEsR9k87.jpg" mos="" align="middle" fullscreen="1" width="495" height="385" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/TYVmyXgDwJg2pvCEsR9k87.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>4. Search for Thonny via the Start Menu and click on Thonny to start. </strong>You can also press Enter to run Thonny.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:776px;"><p class="vanilla-image-block" style="padding-top:86.60%;"><img id="s5HPhxyftS2zYYBmLoDN5Y" name="th5" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/s5HPhxyftS2zYYBmLoDN5Y.jpg" mos="" align="middle" fullscreen="1" width="776" height="672" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/s5HPhxyftS2zYYBmLoDN5Y.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>5. Wait for Thonny to start.</strong> Thonny’s first launch can take some time to complete, subsequent boots will be much faster.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1280px;"><p class="vanilla-image-block" style="padding-top:76.33%;"><img id="7TA4j68UqixUnu6QnPdw" name="th1.JPG" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/7TA4j68UqixUnu6QnPdw.jpg" mos="" align="middle" fullscreen="1" width="1280" height="977" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/7TA4j68UqixUnu6QnPdw.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="the-thonny-editor-interface">The Thonny Editor Interface</h2><p>Thonny was designed with beginners in mind and this is reflected in the user interface. It is uncluttered and easy to understand.</p><p>The user interface is broken down into three areas.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1280px;"><p class="vanilla-image-block" style="padding-top:76.33%;"><img id="7YLkD2SturynFVKF2g8XAY" name="thonny-anno" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/7YLkD2SturynFVKF2g8XAY.jpg" mos="" align="middle" fullscreen="1" width="1280" height="977" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/7YLkD2SturynFVKF2g8XAY.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>The menu bar. </strong>Here we can use the conventional drop-down menus or use the icons to open, save, create files. Run the project code, and install packages and swap interpreters for working with Python, MicroPython or CircuitPython</p><p><strong>The coding area.</strong> Here is we write the code for our projects.</p><p><strong>The Python shell. </strong>This is a REPL (Read, Eval, Print, Loop) where we can interact with the Python interpreter and see the output of the running code.</p><p>We can easily write Python code with Thonny. The default is to write Python 3 code, to be run on our machine. </p><p>If you are starting out with Python, Thonny is an excellent choice to introduce the language.</p><h2 id="changing-the-python-interpreter-to-work-with-micropython-or-circuitpython">Changing the Python Interpreter to work with MicroPython or CircuitPython</h2><p>Thonny has one feature that elevates it above other beginner editors. It can switch interpreters so that one application, Thonny, can be used to write Python, MicroPython and CircuitPython.</p><p><strong>1. Click on Tools >> Options and from the dialog box choose Interpreter.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:949px;"><p class="vanilla-image-block" style="padding-top:80.82%;"><img id="CCZTepiBEeawMneuxsrvdT" name="th6-gif" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/CCZTepiBEeawMneuxsrvdT.gif" mos="" align="middle" fullscreen="1" width="949" height="767" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/CCZTepiBEeawMneuxsrvdT.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>2. Select the Interpreter from the list. </strong>The top list are all of the interpreters for Local Python (on your machine), MicroPython for Raspberry Pi Pico, Pico 2 and Pico with Wi-Fi, RP2040 (for non-Raspberry Pi boards), ESP32 / 8266,BBC micro:bit and for CircuitPython devices.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:608px;"><p class="vanilla-image-block" style="padding-top:100.99%;"><img id="TcnSFVc8SqTeQeqRcFZ89V" name="th7" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/TcnSFVc8SqTeQeqRcFZ89V.jpg" mos="" align="middle" fullscreen="1" width="608" height="614" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/TcnSFVc8SqTeQeqRcFZ89V.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>To connect a Raspberry Pi Pico, we first need a Raspberry Pi Pico running MicroPython, we've <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup">got a guide</a> that you can follow.</p><p>To follow this part of the how to you will need a <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w">Raspberry Pi Pico.</a></p><p>1.  <strong>With Thonny open, connect a Raspberry Pi Pico </strong>to your computer.</p><p>2. <strong>Go to Tools >> Options and select the Interpreter tab, and then select the MicroPython (Raspberry Pi Pico) interpreter. Leave the port to automatically detect. Click OK.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:632px;"><p class="vanilla-image-block" style="padding-top:96.84%;"><img id="4ws2Um4kKJrsnVKjj9D5hL" name="th8" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/4ws2Um4kKJrsnVKjj9D5hL.jpg" mos="" align="middle" fullscreen="1" width="632" height="612" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/4ws2Um4kKJrsnVKjj9D5hL.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. The Python Shell (3 in the annotated screenshot) will now show an active connection to the Raspberry Pi Pico.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1269px;"><p class="vanilla-image-block" style="padding-top:76.67%;"><img id="8592SD4LdD9jnnqfEt2wsX" name="th9" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/8592SD4LdD9jnnqfEt2wsX.jpg" mos="" align="middle" fullscreen="1" width="1269" height="973" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/8592SD4LdD9jnnqfEt2wsX.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>4. In the editor (2 in the annotated diagram) import two modules of code. </strong>The first enables MicroPython to talk to the GPIO. The second is used to add pauses to the code.</p><pre class="line-numbers language-python" language="python" ><code>import machinefrom time import sleep</code></pre><p><strong>5. Create an object, led </strong>and <strong>use it to set the onboard LED as an output.</strong> For the Raspberry Pi Pico W use the line of code with ‘LED’, for the original Pico use the line of code with 25. The Pico has the LED connected to GPIO 25, but the Pico W does not.</p><p><strong>Raspberry Pi Pico W</strong></p><pre class="line-numbers language-python" language="python" ><code>led = machine.Pin('LED', machine.Pin.OUT)</code></pre><p><strong>Raspberry Pi Pico</strong></p><pre class="line-numbers language-python" language="python" ><code>led = machine.Pin(25, machine.Pin.OUT)</code></pre><p><strong>6. Create a for loop that iterates 10 times</strong>, each time the loop runs it will toggle the LED on / off, print a message to the REPL and sleep for 0.1 seconds.</p><pre class="line-numbers language-python" language="python" ><code>for i in range(10):    led.toggle()    print("BLINK")    sleep(0.1)</code></pre><p><strong>7. Click Save and save the file to your Raspberry Pi Pico as blink.py</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:381px;"><p class="vanilla-image-block" style="padding-top:79.27%;"><img id="QmEuE7b3cLTb3VgMNthc7G" name="th10" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/QmEuE7b3cLTb3VgMNthc7G.jpg" mos="" align="middle" fullscreen="1" width="381" height="302" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/QmEuE7b3cLTb3VgMNthc7G.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>8. Click on Run >> Run Current Script (or click on the green play button) to start the code on the Pico. </strong>The LED on the Pico will blink on and off and the REPL will show the “BLINK” message.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1280px;"><p class="vanilla-image-block" style="padding-top:76.33%;"><img id="EkCZgdF8uSJUg54862zLhW" name="th11.JPG" alt="Thonny" src="https://cdn.mos.cms.futurecdn.net/EkCZgdF8uSJUg54862zLhW.jpg" mos="" align="middle" fullscreen="1" width="1280" height="977" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/EkCZgdF8uSJUg54862zLhW.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="intermediate-python-with-notepad">Intermediate Python with Notepad++</h2><p>You know your stuff, and you need a lightweight editor to get your Python code done. Sure you can install Visual Studio Code, PyCharm etc. But if you just need to edit a few project files, Notepad++ is for you. Notepad++ is a Swiss Army Knife of an editor, and it works exceptionally well with Python. Here we will install Notepad++ and set it up to run our Python code at the press of a button.</p><p>Note that you will need to install the Python 3 interpreter, the steps for which are at the start of this how to.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1251px;"><p class="vanilla-image-block" style="padding-top:81.14%;"><img id="" name="image044.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/AmxQoMafrtL2YhbttRCBeW.png" mos="" align="middle" fullscreen="1" width="1251" height="1015" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/AmxQoMafrtL2YhbttRCBeW.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>1. Open a browser to the </strong><a href="https://notepad-plus-plus.org/downloads/"><strong>Notepad++ website </strong></a><strong>and download the latest Windows installer.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1280px;"><p class="vanilla-image-block" style="padding-top:62.58%;"><img id="sBJnf9SoxghtppwJz8KbRk" name="np1.JPG" alt="Notepad++" src="https://cdn.mos.cms.futurecdn.net/sBJnf9SoxghtppwJz8KbRk.jpg" mos="" align="middle" fullscreen="1" width="1280" height="801" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/sBJnf9SoxghtppwJz8KbRk.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>2. In the your Downloads folder, double click on the file to start the installer.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:562px;"><p class="vanilla-image-block" style="padding-top:52.14%;"><img id="" name="image048.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/S5uYScKNjAMgLWf7Qcc5pW.png" mos="" align="middle" fullscreen="1" width="562" height="293" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/S5uYScKNjAMgLWf7Qcc5pW.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>3. Set your preferred language and click OK.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:290px;"><p class="vanilla-image-block" style="padding-top:53.45%;"><img id="" name="image050.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/QeFDNwjDrmNCM2yzNNuUtW.png" mos="" align="middle" fullscreen="1" width="290" height="155" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/QeFDNwjDrmNCM2yzNNuUtW.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>4. Select Next.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:499px;"><p class="vanilla-image-block" style="padding-top:77.76%;"><img id="" name="image052.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/LXD4Pg4vULjpgwPFdvPRAX.png" mos="" align="middle" fullscreen="1" width="499" height="388" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/LXD4Pg4vULjpgwPFdvPRAX.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>5. Select “I Agree”.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:499px;"><p class="vanilla-image-block" style="padding-top:77.76%;"><img id="" name="image054.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/uTcgYpqvr3i99mRgHpqq4X.png" mos="" align="middle" fullscreen="1" width="499" height="388" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/uTcgYpqvr3i99mRgHpqq4X.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>6. Click Next.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:499px;"><p class="vanilla-image-block" style="padding-top:77.76%;"><img id="" name="image056.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/VbjUA9pxoRgzHuo2iN6iEX.png" mos="" align="middle" fullscreen="1" width="499" height="388" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/VbjUA9pxoRgzHuo2iN6iEX.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>7. Click Next.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:499px;"><p class="vanilla-image-block" style="padding-top:77.76%;"><img id="" name="image058.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/ZrQY52TTCSSTiA326RC3PX.png" mos="" align="middle" fullscreen="1" width="499" height="388" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ZrQY52TTCSSTiA326RC3PX.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>8. Click Install to begin the process.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:499px;"><p class="vanilla-image-block" style="padding-top:77.76%;"><img id="" name="image060.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/aoFEQFHkmdxcSM8XYDqUJX.png" mos="" align="middle" fullscreen="1" width="499" height="388" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/aoFEQFHkmdxcSM8XYDqUJX.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>9. </strong>Check “Run Notepad++” and click Finish to end the installation and open Notepad++.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:499px;"><p class="vanilla-image-block" style="padding-top:77.76%;"><img id="" name="image062.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/B2fx6GNzJs8ugbdN8UGXcX.png" mos="" align="middle" fullscreen="1" width="499" height="388" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/B2fx6GNzJs8ugbdN8UGXcX.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="the-notepad-interface">The Notepad++ Interface</h2><p>Notepad++ has a more involved user interface than Thonny, and this reflects the flexibility of the editor. Notepad++ is much more than a Python editor, we can use it to write PHP, Perl, JSON etc.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1107px;"><p class="vanilla-image-block" style="padding-top:84.64%;"><img id="" name="image064.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/cjiR2DsG5AVJE7UMqdvpVX.png" mos="" align="middle" fullscreen="" width="1107" height="937" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>Menus.</strong> Here we can load projects, save, create macros and install plugins for specific languages.</p><p><strong>Editor. </strong>The code for our project is created here.</p><p><strong>Workspace.</strong> If we are working on a large project with multiple project files, we can load the folder as a workspace and have quick access to the files.</p><h2 id="running-python-code-in-notepad">Running Python code in Notepad++</h2><p><strong>1. Create a simple Python project that uses a for loop to print a message to the Python shell.</strong></p><pre class="line-numbers language-python" language="python" ><code>for i in range(10):    print("Writing Python in Notepad++")</code></pre><p><strong>2. Save the code as for_loop.py.</strong></p><p><strong>3. Click on Run >> Run..</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:802px;"><p class="vanilla-image-block" style="padding-top:30.17%;"><img id="" name="image066.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/C6gZbEPXLTghjQzKgJJjgX.png" mos="" align="middle" fullscreen="" width="802" height="242" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>4. Click on … and navigate to the Python executable file. Select the file and the path will be added to the dialog box. At the end of the path, add -i "$(FULL_CURRENT_PATH)" to force Notepad++ to open the file. Click Save.</strong></p><pre class="line-numbers language-python" language="python" ><code>Example path to PythonC:\Users\LattePanda\AppData\Local\Programs\Python\Python310\python.exe -i "$(FULL_CURRENT_PATH)"</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:296px;"><p class="vanilla-image-block" style="padding-top:64.19%;"><img id="" name="image068.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/JMCMmNMtTDU9mTohoHkEoX.png" mos="" align="middle" fullscreen="" width="296" height="190" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>5. Create a shortcut called Python3.10 to launch the Python interpreter then click OK. </strong>We chose ALT + SHIFT + P as it didn’t conflict with other shortcuts on our system. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:272px;"><p class="vanilla-image-block" style="padding-top:72.79%;"><img id="" name="image070.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/FLxbGbhEDuXUxPjZ7aPnjX.png" mos="" align="middle" fullscreen="" width="272" height="198" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>6. Use your shortcut to run the Python code.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1344px;"><p class="vanilla-image-block" style="padding-top:59.30%;"><img id="" name="image072.png" alt="How To Install Python on Windows 10 and 11" src="https://cdn.mos.cms.futurecdn.net/w5yPZmePZPbNC3anZcFnxX.png" mos="" align="middle" fullscreen="1" width="1344" height="797" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/w5yPZmePZPbNC3anZcFnxX.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="python-how-tos-3">Python How Tos</h2><ul><li><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">How To Install Python on Windows 10 and 11</a></li><li><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">How to use For Loops in Python</a></li><li><a href="https://www.tomshardware.com/how-to/enumerate-in-python">How to Enumerate in Python</a></li><li><a href="https://www.tomshardware.com/how-to/create-python-executable-applications">How to Create Executable Applications in Python</a></li><li><a href="https://www.tomshardware.com/how-to/python-remove-image-backgrounds">How To Remove Backgrounds From Images With Python</a></li><li><a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny">How to Create Web Apps with Python, HTML and Thonny</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2">How To Use Raspberry Pi Camera Module 3 with Python Code</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Raspberry Pi Pico W MicroPython Gains Official Bluetooth Support ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/raspberry-pi-pico-w-gains-official-bluetooth-support</link>
                                                                            <description>
                            <![CDATA[ In a recent update, Raspberry Pi adds Bluetooth support for MicroPython projects. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">yQKtoF3fHrFX74w2HNMuy5</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/8oHHkE6nVPMwtrW8JpSf5H-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Wed, 14 Jun 2023 11:43:56 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:38 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/8oHHkE6nVPMwtrW8JpSf5H-1280-80.jpg">
                                                            <media:credit><![CDATA[Future]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Raspberry Pi Pico W with Bluetooth]]></media:description>                                                            <media:text><![CDATA[Raspberry Pi Pico W with Bluetooth]]></media:text>
                                <media:title type="plain"><![CDATA[Raspberry Pi Pico W with Bluetooth]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/8oHHkE6nVPMwtrW8JpSf5H-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Murmurings of official Bluetooth support for the $6 <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w">Raspberry Pi Pico W</a> have been running since early 2023. Developers favoring C/C++ received support back in <a href="https://www.tomshardware.com/news/raspberry-pi-pico-w-sdk-adds-bluetooth">February</a>. <a href="https://www.raspberrypi.com/news/new-functionality-bluetooth-for-pico-w/"> Today via a blog post</a> from Raspberry Pi LTD CEO Eben Upton, MicroPython developers can now create Bluetooth projects using our favorite microcontroller thanks to the latest MicroPython build.</p><p>The Raspberry Pi Pico W&apos;s wireless chip, the Infineon CYW43439 provides both 2.4 GHz Wi-Fi and Bluetooth 5.2 over a three pin SPI bus between itself and the RP2040 SoC. The latest MicroPython update brings support for Bluetooth Classic (no ACL/SSO support just yet), BLE Central and Peripheral roles. Bluetooth Classic and BLE can be enabled individually. or at the same time. </p><p>The good news is that you don&apos;t have to rush out and purchase a new Raspberry Pi Pico W. As this is a software update, work between Raspberry Pi, Infineon and MicroPython creator, Damien George. All you need to do is <a href="https://www.raspberrypi.com/documentation/microcontrollers/micropython.html#drag-and-drop-micropython">download</a> the latest update and <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup">flash it to your Raspberry Pi Pico W.</a> Also updated is Alasdair Allan&apos;s exceptional <a href="https://www.raspberrypi.com/documentation/microcontrollers/">documentation</a>. A book, <a href="https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf">Connecting to the Internet with Raspberry Pi Pico W</a> illustrates just how simple a Bluetooth project can now be created using the Raspberry Pi Pico W.</p><p>With support now being added for MicroPython, it must only be a short time before it also arrives for CircuitPython.</p><p><br></p><iframe src="https://content.jwplatform.com/players/YdWWS5dA.html" id="YdWWS5dA" title="Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing" width="1920" height="1080" frameborder="0" scrolling="auto" allowfullscreen></iframe>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Use a Banana as Touch Input for Raspberry Pi Pico ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/raspberry-pi-pico-banana-touch-input</link>
                                                                            <description>
                            <![CDATA[ Using the bare minimum of parts and CircuitPython code, we build a touch interface using a banana as our only means of control. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">Fm3LTBQU2D7DPPPp3KD9DC</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/8fyV3FGYmUjxvtQvtRXHKV-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sat, 27 May 2023 13:37:28 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:30 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/8fyV3FGYmUjxvtQvtRXHKV-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[CircuitPython Cap Touch Pico]]></media:description>                                                            <media:text><![CDATA[CircuitPython Cap Touch Pico]]></media:text>
                                <media:title type="plain"><![CDATA[CircuitPython Cap Touch Pico]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/8fyV3FGYmUjxvtQvtRXHKV-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Capacitive touch is a simple means to detect user input by measuring the dielectric constant. If it is different to a baseline measurement then it can be used as an input. In the past, we have used an <a href="https://www.tomshardware.com/how-to/use-circuitpython-raspberry-pi"><u>MPR121 touch sensor</u></a> to trigger an event using a Raspberry Pi Pico. The MPR121 is a dependable Stemma QT sensor that comes in various form factors for crocodile clips and standard wire gauges. We love it so much that we put it on our list of <a href="https://www.tomshardware.com/best-picks/stemma-qt-grove-add-ons"><u>best Stemma QT and Grove add ons page.</u></a> But is there a way to do it without using a sensor board?</p><p>Using just a piece of wire and a 1 Mega Ohm resistor in a banana, we can create our own touch interface and have a healthy snack. In this how-to, we will use the banana to toggle an LED on and off. </p><p>Why something so simple? Learning to turn an LED on / off is the best way to understand how every part of your project works. Sure we could turn the banana into a space bar and play <em>Flappy Birds</em>, use it to open a browser window and “Rick-roll” a friend or start a robot to make a mad dash for the door. But before we can do that we need to understand how and why things work, and the humble LED is a cheap and easy way to do this.</p><h2 id="for-this-project-you-will-need">For This Project You Will Need</h2><ul><li><a href="https://www.amazon.com/seeed-studio-Raspberry-Microcontroller-Dual-core/dp/B08TQSDP28/ref=sr_1_2"><u>Raspberry Pi Pico</u></a></li><li><a href="https://www.amazon.com/Half-Size-breadboard-Adafruit-64/dp/B00HPLNVHQ/ref=sr_1_1"><u>Half-size breadboard</u></a></li><li>1 x <a href="https://www.amazon.com/BOJACK-Values-Resistor-Resistors-Assortment/dp/B08FD1XVL6/ref=sr_1_2"><u>100 Ohm resistor</u></a> (Brown-Black-Brown-Gold)</li><li>1 x <a href="https://www.amazon.com/BOJACK-Values-Resistor-Resistors-Assortment/dp/B08FD1XVL6/ref=sr_1_2"><u>1 Mega Ohm resistor</u></a> (Brown-Black-Green-Gold)</li><li>1 x <a href="https://www.amazon.com/GenBasic-Solderless-Dupont-Compatible-Breadboard-Prototyping/dp/B01L5UJ36U/ref=sr_1_1"><u>Male to male jumper wire</u></a></li><li>1 x Banana (optional)</li></ul><h2 id="building-the-circuit">Building the Circuit</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1385px;"><p class="vanilla-image-block" style="padding-top:38.63%;"><img id="DcY7H6FS8Ybx6XcA6jaKgU" name="circuit.png" alt="CircuitPython Cap Touch Pico" src="https://cdn.mos.cms.futurecdn.net/DcY7H6FS8Ybx6XcA6jaKgU.png" mos="" align="middle" fullscreen="1" width="1385" height="535" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/DcY7H6FS8Ybx6XcA6jaKgU.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>There are two parts to the circuit: the input and the output. The input is a banana (optional), connected to GPIO 16 on the Raspberry Pi Pico using a long jumper wire. GPIO 16 also has a <a href="https://www.tomshardware.com/how-to/resistor-color-codes"><u>1 Mega Ohm resistor</u></a> to connect it to GND. This is a pulldown resistor and ensures that the GPIO pin sees a constant 0V reference. Without it, the input would be erratic. This process can be repeated for multiple inputs, your only limits are GPIO pins, 1 Mega Ohm resistors and bananas. </p><p>The output is a simple LED with the long leg (Anode) connected to GPIO 15 and the short leg (Cathode) connected to GND via a 100 Ohm resistor.</p><p>The banana can be replaced with anything that is conductive. Aluminum foil, play-doh and other fruits / vegetables can be used as inputs. You can also forgo the culinary inputs for bare wires. In certain cases this works better.</p><p>Build the circuit and double check your connections before moving onwards.</p><h2 id="configuring-circuitpython">Configuring CircuitPython</h2><p>We chose CircuitPython for this project for two key reasons. One, it is so easy to use and understand. Our code is easy-to-read, debug and we can write it on any device, <a href="https://www.tomshardware.com/how-to/create-circuitpython-projects-on-chromebook-raspberry-pi-pico"><u>even a Chromebook</u></a>. Two, CircuitPython has the Touchio module which makes it easy to create touch inputs using the GPIO. But before we can start the project we need to write the latest version of CircuitPython to the Raspberry Pi Pico.</p><p>1. <strong>Go to the official CircuitPython page for the </strong><a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-review"><u><strong>Raspberry Pi Pico</strong></u></a> and <a href="https://circuitpython.org/board/raspberry_pi_pico/"><u><strong>download the latest release UF2 firmware image.</strong></u></a> At the time of writing this was CircuitPython 8.10. We have chosen the Raspberry Pi Pico as we do not need Wi-Fi, but this project could be used to trigger a web-event, for that you will need a <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w"><u>Raspberry Pi Pico W.</u></a></p><p>2. <strong>Whilst holding the BOOTSEL button, connect the Raspberry Pi Pico to your computer. </strong>A new drive, RPI-RP2 will appear.</p><p>3. <strong>Copy the downloaded CircuitPython UF2 file to RPI-RP2. </strong>This will write CircuitPython to the internal flash storage of the Pico . A new drive, CIRCUITPY will appear. </p><h2 id="writing-the-code">Writing the Code</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1280px;"><p class="vanilla-image-block" style="padding-top:78.52%;"><img id="aASqEe4zC9iYsvfisxP7SV" name="running code.JPG" alt="CircuitPython Cap Touch Pico" src="https://cdn.mos.cms.futurecdn.net/aASqEe4zC9iYsvfisxP7SV.jpg" mos="" align="middle" fullscreen="1" width="1280" height="1005" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/aASqEe4zC9iYsvfisxP7SV.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>To write the code we used Thonny on Windows 10. You are free to use your choice of text editor, but Thonny has great CircuitPython (and MicroPython) integration which makes it a breeze to use. Best of all it is free and easy to install on Windows, macOS and Linux devices.</p><h2 id="writing-the-code-2">Writing the Code</h2><p>1. <a href="https://thonny.org/"><u><strong>Download and install Thonny</strong></u></a> if you don’t have it already<strong>. </strong>Thonny is a Python editor which covers Python 3, MicroPython and CircuitPython.</p><p>2. <strong>Open Thonny and go to Tools >> Options.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:301px;"><p class="vanilla-image-block" style="padding-top:68.77%;"><img id="QPdyEPVsLJWZacF8xUJKeV" name="th1.jpg" alt="CircuitPython Cap Touch Pico" src="https://cdn.mos.cms.futurecdn.net/QPdyEPVsLJWZacF8xUJKeV.jpg" mos="" align="middle" fullscreen="1" width="301" height="207" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/QPdyEPVsLJWZacF8xUJKeV.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Select Interpreter, then set the interpreter as CircuitPython, port to automatic, and click OK.</strong> Thonny will now connect to the Pico running CircuitPython.</p><p>4. <strong>Click on File >> Open and select the CircuitPython device. Then select code.py. </strong>Code.py is used by CircuitPython as the main file for a project. It is set to auto-run when the Pico is powered up.</p><p>5. <strong>Delete any code in code.py.</strong> If you need the code, make sure to back it up to your computer.</p><p>6. <strong>Import four modules of code necessary for the project to work.</strong> Touchio is used to create a capacitive touch input using a GPIO pin. Time controls how long the code will pause between actions. Board is used to work with the GPIO, importing using * means that we do not have to include the module name. Digitalio is used to control the status of a pin. It can be an input or output.</p><pre class="line-numbers language-bash" language="bash" ><code>import touchioimport timefrom board import *from digitalio import DigitalInOut, Direction</code></pre><p>7. <strong>Create an object, led, and set the GPIO pin to GP15, and then set it to be an output. </strong>This will ensure that when the LED is triggered, current will flow from pin GPIO 15 to the anode of the LED. As the cathode is connected to GND via the 100 Ohm resistor, the complete circuit will turn on the LED.</p><pre class="line-numbers language-bash" language="bash" ><code>led = DigitalInOut(GP15)led.direction = Direction.OUTPUT</code></pre><p>8. <strong>Create an object, led_state and store the integer value 0 inside of it.</strong> This object will be used to record the current state of the LED. It can either be off (0) or on (1).</p><pre class="line-numbers language-bash" language="bash" ><code>led_state = 0</code></pre><p>9. <strong>Create an object, touch_pin</strong> to make a connection between the code and physical GPIO pin.</p><pre class="line-numbers language-bash" language="bash" ><code>touch_pin = touchio.TouchIn(GP16)</code></pre><p>10. <strong>Create a loop to continually run the code.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>while True:</code></pre><p>11. <strong>Inside the loop create a print function that will report the current state of the touch input pin.</strong> We use %s to use the value stored in touch_pin.value and convert it into a string for concatenation to the text.</p><pre class="line-numbers language-bash" language="bash" ><code>   print("The pin state is %s" % touch_pin.value)</code></pre><p>12. <strong>Write a conditional test to check if the input has been touched, and that the LED is turned off. </strong>Both tests have to pass in order for the conditional test to pass.</p><pre class="line-numbers language-bash" language="bash" ><code>   if touch_pin.value == True and led_state == False:</code></pre><p>13. <strong>Set the LED to turn on, then update the led_state object to 1, </strong>so that the code knows that the LED is on<strong>. Sleep for half a second </strong>to prevent accidental debounce (double press). This code will only run if the conditional test passes.</p><pre class="line-numbers language-bash" language="bash" ><code>       led.value = True       led_state = 1       time.sleep(0.5)</code></pre><p>14. <strong>Create a conditional test to check if the input has been touched and that the LED is currently on.</strong> This code will turn off the LED.</p><pre class="line-numbers language-bash" language="bash" ><code>   elif touch_pin.value == True and led_state == True:</code></pre><p>15. <strong>Toggle the LED off, update the led_state object </strong>so that the code knows the LED is off, and then <strong>pause for half a second.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>       led.value = False       led_state = 0       time.sleep(0.5)</code></pre><p>16. <strong>Outside of the conditional tests, but still inside the loop, pause the code for 0.1 seconds.</strong> Each time the loop iterates, it will pause for 0.1 seconds, this is useful pacing the project code.</p><pre class="line-numbers language-bash" language="bash" ><code>   time.sleep(0.1)</code></pre><p>17. <strong>Save the code to code.py on the CircuitPython device </strong>(Raspberry Pi Pico).</p><p>18. The code should autorun, if not <strong>click on Stop and then Run.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:360px;"><p class="vanilla-image-block" style="padding-top:31.94%;"><img id="88oWxnypyESigcgx46iCYV" name="stop run.jpg" alt="CircuitPython Cap Touch Pico" src="https://cdn.mos.cms.futurecdn.net/88oWxnypyESigcgx46iCYV.jpg" mos="" align="middle" fullscreen="1" width="360" height="115" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/88oWxnypyESigcgx46iCYV.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>19. <strong>Touch the banana to toggle the LED on / off.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:3289px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="eXW6nCxMYkvSmFE3wiJNtU" name="led_off.jpg" alt="CircuitPython Cap Touch Pico" src="https://cdn.mos.cms.futurecdn.net/eXW6nCxMYkvSmFE3wiJNtU.jpg" mos="" align="middle" fullscreen="1" width="3289" height="1850" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/eXW6nCxMYkvSmFE3wiJNtU.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-code-listing-2">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import touchioimport timefrom board import *from digitalio import DigitalInOut, Directionled = DigitalInOut(GP15)led.direction = Direction.OUTPUTled_state = 0touch_pin = touchio.TouchIn(GP16)while True:   print("The pin state is %s" % touch_pin.value)   if touch_pin.value == True and led_state == False:       led.value = True       led_state = 1       time.sleep(0.5)   elif touch_pin.value == True and led_state == True:       led.value = False       led_state = 0       time.sleep(0.5)   time.sleep(0.1)</code></pre><h2 id="python-how-tos-4">Python How Tos</h2><ul><li><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">How To Install Python on Windows 10 and 11</a></li><li><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">How to use For Loops in Python</a></li><li><a href="https://www.tomshardware.com/how-to/enumerate-in-python">How to Enumerate in Python</a></li><li><a href="https://www.tomshardware.com/how-to/create-python-executable-applications">How to Create Executable Applications in Python</a></li><li><a href="https://www.tomshardware.com/how-to/python-remove-image-backgrounds">How To Remove Backgrounds From Images With Python</a></li><li><a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny">How to Create Web Apps with Python, HTML and Thonny</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2">How To Use Raspberry Pi Camera Module 3 with Python Code</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Donkey Car Python Library Powers Self Driving Raspberry Pi Cars ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/donkey-car-python-library</link>
                                                                            <description>
                            <![CDATA[ Donkey Car is an open source Python library for self-driving cars that works with the Raspberry Pi and other SBCs. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">oa3nUG6SkUvmSD463QHDtM</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/fCAv8MVFBWmZLkAgHbThY3-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Wed, 17 May 2023 14:34:28 +0000</pubDate>                                                                                                                                <updated>Thu, 21 Aug 2025 10:07:56 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Ash Hill ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/p9HsnLCwBpTQYCBBhYXgrS.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Ash is a self-employed tech writer and illustrator with a serious affinity for the Raspberry Pi, 3D printing, retro gaming and finding the best tech deals and coupons. She has over a decade of IT experience and has been featured in the official Raspberry Pi magazine MagPi.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/fCAv8MVFBWmZLkAgHbThY3-1280-80.jpg">
                                                            <media:credit><![CDATA[Donkey Car / Pexels]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[A Raspberry Pi robot car]]></media:description>                                                            <media:text><![CDATA[A Raspberry Pi robot car]]></media:text>
                                <media:title type="plain"><![CDATA[A Raspberry Pi robot car]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/fCAv8MVFBWmZLkAgHbThY3-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>If you’re ready to race, you should check out <a href="https://www.donkeycar.com/"><u>Donkey Car</u></a>. This open-source Python library makes it super easy to get off the ground with setting up your own driveable car project. Because it’s Python-focused, you can use it with a wide variety of boards ranging from <a href="https://www.tomshardware.com/topics/raspberry-pi"><u>Raspberry Pi</u></a> to even the Nvidia Jetson range of boards.</p><p>This platform makes it easy to not only to drive cars remotely but also integrate them with AI systems so they can drive themselves. You can interface with it using a separate computer or device (like a smartphone or tablet) and make the RC car as complex as you want. Long gone are the days of building your own tool from scratch, Donkey Car has plenty of ready-to-go features out of the box that you can build off of to customize your project the way you want.</p><div class="youtube-video" data-nosnippet ><div class="video-aspect-box"><iframe data-lazy-priority="high" data-lazy-src="https://www.youtube-nocookie.com/embed/lfwq73D7oHg" allowfullscreen></iframe></div></div><h2 id="what-can-you-do-with-donkey-car">What can you do with Donkey Car</h2><ul><li>Build your own toy car that can drive itself.</li><li>Drive your car with your phone or laptop.</li><li>Record images, steering angles & throttles.</li><li>Train neural net pilots to drive your car on different tracks.</li></ul><p>Not only can you use the SBC of your choice, you can build the RC car of your dreams. It works with plenty of existing car kits you can find online but you can also make one from scratch. The team at Donkey Car recommends using their Donkey2 setup. It costs around $250 to get all of the components and can be assembled in just a couple of hours.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1100px;"><p class="vanilla-image-block" style="padding-top:66.55%;"><img id="rYgF7GDwfkWgt574n4BSGU" name="1684332195.jpg" alt="Donkey Car" src="https://cdn.mos.cms.futurecdn.net/rYgF7GDwfkWgt574n4BSGU.jpg" mos="" align="middle" fullscreen="" width="1100" height="732" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Donkey Car)</span></figcaption></figure><p>The standard Donkey Car kit is available on the Donkey Car website for $92. It includes a camera, servo driver, 3D printed frame components, as well as screws and jumper wires for assembly. You’ll still need an RC car component, an SBC (like the Raspberry Pi), an SD card, and a battery. While it doesn’t have everything you need, it’s a great starting point. There are also a few chassis made by the brand Exceed that work well with Donkey Car. You can read more about the hardware requirements in the <a href="http://docs.donkeycar.com/guide/build_hardware/">build guide</a>.</p><p>If you want to read more about this project or maybe even make one yourself, check out the official <a href="https://www.donkeycar.com/">Donkey Car</a> website. If you’ve already got an RC car project lying around, it might be worth tinkering with to see how well it handles the Donkey Car library.</p><iframe src="https://content.jwplatform.com/players/YdWWS5dA.html" id="YdWWS5dA" title="Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing" width="1920" height="1080" frameborder="0" scrolling="auto" allowfullscreen></iframe>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ DietPi v8.17 Announced With New Software and SBC Enhancements ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/dietpi-817-announced</link>
                                                                            <description>
                            <![CDATA[ DietPi, the lightweight Debian based alternative OS announces a new update which sees new software and enhancements for many different SBCs ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">QVnRm92Dj9C25rJdR8RogX</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/3RCdyvpzoRSBRkn8vaauve-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Fri, 12 May 2023 16:09:29 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:34 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/3RCdyvpzoRSBRkn8vaauve-1280-80.jpg">
                                                            <media:credit><![CDATA[DietPi]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[DietPi on Raspberry Pi 4]]></media:description>                                                            <media:text><![CDATA[DietPi on Raspberry Pi 4]]></media:text>
                                <media:title type="plain"><![CDATA[DietPi on Raspberry Pi 4]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/3RCdyvpzoRSBRkn8vaauve-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>DietPi, the lightweight, multi-purpose OS for Raspberry Pi, SBCs and x86 machines, has announced version 8.17. And with this new release, we see new software and enhancements to the Debian-based OS.</p><h2 id="key-updates-in-dietpi-8-17">Key Updates in DietPi 8.17</h2><ul><li><strong>New Software: </strong>openHAB Home automation software.</li><li><strong>New Software: </strong>Moonlight (CLI and GUI): Game streaming.</li><li><strong>New Software: </strong>Restic A command line based backup tool.</li><li><strong>Enhancement:</strong> Improvements for Raspberry Pi.</li><li><strong>Enhancement:</strong> Updates for NanoPi series boards.</li><li><strong>Enhancement:</strong> Update for ROCK4 boards.</li><li><strong>Bug Fix:</strong> Raspberry Pi analog audio bug fix.</li><li><strong>Bug Fix:</strong> DietPi reporting incorrect temperature (8.16 regression).</li><li><strong>Bug Fix</strong>: Google AIY ArmV7 conflicting Python module dependences resolved.</li><li><strong>Bug Fix:</strong> UnRAR install on RISC-V based systems is now fixed.</li><li><a href="https://dietpi.com/docs/releases/v8_17/">Full release notes.</a></li></ul><p>DietPi is an alternative Debian-based OS for many different SBCs and x86 machines. Rather than defaulting to a desktop-based OS, DietPi uses a series of menus and user interfaces to facilitate the installation and configuration of specific tools. This level of flexibility means that DietPi is not restricted to being a desktop OS. You can use it tobuild a web server, DNS server (Pi-Hole being one), NAS, or build an appliance to stream games via Steam Link, moonlight etc. <br><br>I&apos;ve personally used DietPi to set up a Node-RED server in my home. Of course, if you want to install a desktop environment, you can. The same software installation process can furnish your desktop with LXDE, LXQt, MATE, Xfce or GNUstep.</p><p>If gaming is more your thing, then DietPi can also be used for emulating classic machines such as the Amiga (Amiberry) and classic DOS-era gaming using Box86 and Box64. A Steam client and Moonlight are on hand to stream games from your gaming PC to the living room.</p><p>Another level of flexibility afforded by DietPi is how many boards it can be used with. Around 48 SBCs and two images for x86 PCs means that DietPi can be used with a wide range of Raspberry Pi alternatives, and it can be used to breathe new life into aging x86 hardware.</p><p>DietPi is free and can be downloaded from the <a href="https://dietpi.com/">DietPi website. </a></p><iframe src="https://content.jwplatform.com/players/YdWWS5dA.html" id="YdWWS5dA" title="Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing" width="1920" height="1080" frameborder="0" scrolling="auto" allowfullscreen></iframe>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ OpenAI’s Shap-E Model Makes 3D Objects From Text or Images ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/openai-shap-e-creates-3d-models</link>
                                                                            <description>
                            <![CDATA[ We show you how to run it for free on your PC, no API keys required. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">fWpUTWgKjDfmegwXwnAhWY</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/7g2m94pfNBfQwB7swhDYsD-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Mon, 08 May 2023 20:57:05 +0000</pubDate>                                                                                                                                <updated>Thu, 21 Aug 2025 09:48:36 +0000</updated>
                                                                                                                                            <category><![CDATA[Artificial Intelligence]]></category>
                                                    <category><![CDATA[Tech Industry]]></category>
                                                                                                                    <dc:creator><![CDATA[ Avram Piltch ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/tZRyr8x24p5QjawJwGTqAX.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Avram&#039;s been in love with PCs since he played original Castle Wolfenstein on an Apple II+.  Before joining Tom&#039;s Hardware, for 10 years, he served as Online Editorial Director for sister sites Tom&#039;s Guide and Laptop Mag, where he programmed the CMS and many of the benchmarks. When he&#039;s not editing, writing or stumbling around trade show halls, you&#039;ll find him building Arduino robots with his son and watching every single superhero show on the CW.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/7g2m94pfNBfQwB7swhDYsD-1280-80.png">
                                                            <media:credit><![CDATA[Future]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[OpenAI Shap-E]]></media:description>                                                            <media:text><![CDATA[OpenAI Shap-E]]></media:text>
                                <media:title type="plain"><![CDATA[OpenAI Shap-E]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/7g2m94pfNBfQwB7swhDYsD-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Recently, we&apos;ve seen AI models that produce <a href="https://www.tomshardware.com/news/runway-gen2-text-to-video-via-chat">detailed text-to-video</a> or use run a <a href="https://www.tomshardware.com/news/mlc-ai-lightweight-chatbot">chatbot on your phone</a>. Now, OpenAI, the company behind ChatGPT, has introduced Shap-E, a model that generates 3D objects you can open in Microsoft Paint 3D or even convert into an STL file you can output on one of the <a href="https://www.tomshardware.com/best-picks/best-3d-printers">best 3D printers</a>.</p><p>The Shap-E model is available for <a href="https://github.com/openai/shap-e/" target="_blank">free on GitHub</a> and it runs locally on your PC. Once all of the files and models are downloaded, it doesn&apos;t need to ping the Internet. And best of all, it doesn&apos;t require an OpenAI API key so you won&apos;t be charged for using it.</p><p>It is a huge challenge actually getting Shap-E to run. OpenAI provides almost no instructions, just telling you to use the Python pip command to install it. However, the company fails to mention the dependencies you need to make it work and that many of the latest versions of them just won&apos;t work. I spent more than 8 hours getting this running and I&apos;ll share what worked for me below.</p><p>Once I finally got Shap-E installed, I found that the default way to access it is via Jupyter Notebook, which lets you view and execute the sample code in small chunks to see what it does. There are three sample notebooks which demonstrate "text-to-3d" (using a text prompt), "image-to-3d" (turning a 2D image into a 3D object) and "encode_model" which takes an existing 3D model and uses Blender (which you need installed) to transform it into something else and re-render it. I tested the first two of these as the third (using Blender with existing 3D objects) was beyond my skillset.</p><h2 id="how-shap-e-text-to-3d-looks">How Shap-E Text-to-3D Looks</h2><p>Like so many AI models we test these days, Shap-E is full of potential but the current output is so-so at best. I tried the text-to-video with a few different prompts. In most cases, I got the objects that I asked for but they were low res and missing key details.</p><p>When I used the sample_text_to_3d notebook, I got two kinds of output: color animated GIFs which displayed in my browser and monochrome PLY files I could open later in a program like Paint 3D. The animated GIFs always looked a lot better than the PLY files.</p><p>The default prompt of "a shark," looked decent as an animated GIF, but when I opened the PLY in Paint 3D, it seemed lacking. By default, the notebook gives you four animated GIFs that are 64 x 64, but I changed the code to up the resolution to 256 x 256 outputted as a single GIF (since all four GIFs looks the same). </p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/DzPW9k2pVJGPkAbUmGENKT.gif" alt="Shark" /><figcaption><small role="credit">Future</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/nFnu3cKkoTi6JYb3Qx4FLQ.png" alt="Shark" /><figcaption><small role="credit">Future</small></figcaption></figure></figure><p>When I asked for something that OpenAI had as one of its examples, "an airplane that looks like a banana," I got a pretty good GIF, particularly when I upped the resolution to 256. The PLY, file, though, exposed a lot of holes in the wings. </p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/rHTsEXtZnPJAA7suzCruaX.gif" alt="Airplane that looks like banana" /><figcaption><small role="credit">Future</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/KVyoDMMmkbP5P8pByD26fM.png" alt="plane that looks like a banana" /><figcaption><small role="credit">Future</small></figcaption></figure></figure><p>When I asked for a <em>Minecraft</em> creeper, I got something that a GIF that was correctly colored green and black and a PLY that was in the basic shape of a creeper. However, real Minecraft fans would not be satisfied with this and it was too messy of a shape to 3D print (if I had converted it to an STL).</p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/bwUmWgVrmGnh43TdXXqMJn.gif" alt="Minecraft Creeper in 3D" /><figcaption><small role="credit">Future</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/hXEuULnEF8hUHRqrNVEgUi.png" alt="Minecraft creeper" /><figcaption><small role="credit">Future</small></figcaption></figure></figure><h2 id="shap-e-image-to-3d-object">Shap-E Image to 3D Object</h2><p>I also tried the image-to-3d script which can take an existing 2D image file and turn it into a 3D PLY file object. A sample illustration of a corgi dog became a decent, low-res object that it outputted as a rotating, animated GIF which had less detail. Below, the original image is on the left and the GIF is on the right. You can see that the eyes seem to be missing. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:500px;"><p class="vanilla-image-block" style="padding-top:40.20%;"><img id="" name="1683573199.png" alt="Corgi 2D and 3D" src="https://cdn.mos.cms.futurecdn.net/d2rhbA5eyDXkHhEdvuogDL.png" mos="" align="middle" fullscreen="" width="500" height="201" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p>By modifying the code, I was also able to get it output a PLY 3D file that I could open in Paint 3D. This is what it looked like.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:594px;"><p class="vanilla-image-block" style="padding-top:73.57%;"><img id="" name="1683573689.png" alt="Corgi 3D Model" src="https://cdn.mos.cms.futurecdn.net/2fhnJ7x7eLxR75BYq2LCYS.png" mos="" align="middle" fullscreen="" width="594" height="437" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p>I also tried feeding the image-to-3d script some of my own images, including a photo of an SSD, which came out looking broken and a transparent PNG of the Tom&apos;s Hardware logo, which didn&apos;t look much better.</p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/L2hNNqHCKfkvwD69ScN95d.gif" alt="SSD 3D GIF" /><figcaption><small role="credit">Future</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/VdCNQgTzNTbNDyW7AfTt8m.gif" alt="TH Logo as an animated GIF" /><figcaption><small role="credit">Future</small></figcaption></figure></figure><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:443px;"><p class="vanilla-image-block" style="padding-top:79.68%;"><img id="" name="1683573842.png" alt="Tom's hardware logo made into 3D by shap-e" src="https://cdn.mos.cms.futurecdn.net/LAYViEAQozEKKea8MRbwoi.png" mos="" align="middle" fullscreen="" width="443" height="353" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p>However, it&apos;s likely that if I had a 2D PNG that looked a bit more 3D-ish (the way the corgi does), I&apos;d get better results. </p><h2 id="performance-of-shap-e">Performance of Shap-E</h2><p>Whether I was doing text or image to 3D processing, Shap-E required a ton of system resources. On my home desktop, with an RTX 3080 GPU and a Ryzen 9 5900X CPU, it took about five minutes to complete a render. On an <a href="https://www.tomshardware.com/reviews/asus-rog-strix-scar-18">Asus ROG Strix Scar 18</a> with an RTX 4090 laptop GPU and an Intel Core i9-13980HX, it took two to three minutes. </p><p>However, when I tried doing text-to-3D on my old laptop, with has an Intel 8th Gen U series CPU and integrated graphics, it had only finished 3 percent of a render after an hour. In short, if you are going to use Shap-E, make sure you have an Nvidia GPU (Shap-E doesn&apos;t support other brands of GPUs. The options are CUDA and CPU.). Otherwise, it will just take too long.</p><p>I should note that the first time you run any of the scripts, it will need to download the models, which are 2 to 3 GB and could take several minutes to transfer.</p><h2 id="how-to-install-and-run-shap-e-on-a-pc">How to Install and Run Shap-E on a PC</h2><p>OpenAI has posted a Shap-E repository <a href="https://github.com/openai/shap-e/">to GitHub</a>, along with some instructions on how to run it. I attempted to install and run the software in Windows, using Miniconda to create a dedicated Python environment. However, I kept running into problems, especially because I could not get Pytorch3D, a required library, to install.</p><p>However, when I decided to use WSL2 (Windows Subsytem for Linux), I was able to get it up and running with few hassles. So the instructions below will work either in native Linux or in WSL2 under Windows. I tested them in WSL2.</p><p>1. <strong>Install Miniconda </strong>or Anaconda in Linux if you don&apos;t already have it. You can find a download and instructions on the <a href="https://docs.conda.io/en/latest/miniconda.html" target="_blank">Conda site</a>.</p><p>2. <strong>Create a Conda environment called shap-e </strong>with Python 3.9 installed (other versions of Python may work).</p><pre class="line-numbers language-bash" language="bash" ><code>conda create -n shap-e python=3.9</code></pre><p>3. <strong>Activate the shap-e environment</strong>.</p><pre class="line-numbers language-bash" language="bash" ><code>conda activate shap-e</code></pre><p>4.<strong> Install Pytorch</strong>. If you have an Nvidia graphics card, Use this command.</p><pre class="line-numbers language-bash" language="bash" ><code>conda install pytorch=1.13.0 torchvision pytorch-cuda=11.6 -c pytorch -c nvidia</code></pre><p>If you don&apos;t have an Nvidia card, you&apos;ll need to do a CPU-based install. The install is speedy but processing the actual 3D generation with the CPU was extremely slow in my experience. </p><pre class="line-numbers language-bash" language="bash" ><code>conda install pytorch torchvision torchaudio cpuonly -c pytorch</code></pre><p>5. <strong>Build Pytorch. </strong>This is the area where it took me hours and hours to find a combination that worked. </p><pre class="line-numbers language-bash" language="bash" ><code>pip install "git+https://github.com/facebookresearch/pytorch3d.git"</code></pre><p>If you get a cuda error, try running <em>sudo apt install nvidia-cuda-dev </em>and then repeating the process.</p><p>6. <strong>Install Jupyter Notebook</strong> using Conda.</p><pre class="line-numbers language-bash" language="bash" ><code>conda install -c anaconda jupyter</code></pre><p>7. <strong>Clone the shap-e </strong>repo.</p><pre class="line-numbers language-bash" language="bash" ><code>git clone https://github.com/openai/shap-e</code></pre><p>Git will create a shap-e folder underneath the one you cloned it from.</p><p>8. <strong>Enter the shap-e folde</strong>r and <strong>run the install </strong>using pip.</p><pre class="line-numbers language-bash" language="bash" ><code>cd shap-epip install -e .</code></pre><p>9. <strong>Launch a Jupyter Notebook</strong>. </p><pre class="line-numbers language-bash" language="bash" ><code>jupyter notebook</code></pre><p>10. <strong>Navigate to the localhost URL the software shows you</strong>. It will be http://localhost:8888?token= and a token. You&apos;ll see a directory of folders and files.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:838px;"><p class="vanilla-image-block" style="padding-top:15.39%;"><img id="" name="1683567217.jpg" alt="localhost address" src="https://cdn.mos.cms.futurecdn.net/YGxnXQ9G33xCeVzTTTytRP.jpg" mos="" align="middle" fullscreen="" width="838" height="129" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p>11. <strong>Browse to shap-e/examples</strong> and <strong>double-click on </strong><em><strong>sample_text_to_3d.ipynb</strong></em><em>.</em></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1490px;"><p class="vanilla-image-block" style="padding-top:43.56%;"><img id="" name="1683515079.png" alt="click on sample_text_to_3d" src="https://cdn.mos.cms.futurecdn.net/PojmMQHyUjYdbSoEnAcfQ5.png" mos="" align="middle" fullscreen="" width="1490" height="649" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1490px;"><p class="vanilla-image-block" style="padding-top:43.56%;"><img id="" name="1683515079.png" alt="click on sample_text_to_3d" src="https://cdn.mos.cms.futurecdn.net/PojmMQHyUjYdbSoEnAcfQ5.png" mos="" align="middle" fullscreen="" width="1490" height="649" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>A notebook will open up with different sections of code.</p><p>12. <strong>Highlight each section </strong>and <strong>click the Run button</strong>, waiting for it to complete before moving onto the next section.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2234px;"><p class="vanilla-image-block" style="padding-top:67.28%;"><img id="" name="1683515260.png" alt="Highlight each section and Click Run" src="https://cdn.mos.cms.futurecdn.net/PZUetWbUYtqapMRWEqVcdQ.png" mos="" align="middle" fullscreen="" width="2234" height="1503" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>This process will take a while the first time you go through it, because it will download several large models to your local drive. When everything is done, you should see four 3D models of a shark in your browser. There will also be four .ply files in the examples folder and you will be able to open those in 3D imaging programs such as Paint 3D. You can also convert them to STL files using an <a href="https://anyconv.com/ply-to-stl-converter/" target="_blank">online converter</a>.</p><p>If you want to change the prompt and try again. Refresh your browser and change "a shark" to something else in the prompt section. Also, if you change size from 64 to a higher number, you get a higher resolution image. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2206px;"><p class="vanilla-image-block" style="padding-top:42.29%;"><img id="" name="1683515474.png" alt="Change prompt and size" src="https://cdn.mos.cms.futurecdn.net/DT5WMvdWndXapw9s9MRAKo.png" mos="" align="middle" fullscreen="" width="2206" height="933" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>13. <strong>Double-click on sample_image_to_3d.ipynb </strong>in the examples folder again so you can try the image-to-3d script.</p><p>14. <strong>Highlight each section </strong>and <strong>click Run</strong>.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:925px;"><p class="vanilla-image-block" style="padding-top:96.97%;"><img id="" name="1683574154.png" alt="Run image-to-3d notebook" src="https://cdn.mos.cms.futurecdn.net/ftoxaKSNtdgdUxcDpto8QW.png" mos="" align="middle" fullscreen="" width="925" height="897" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p>You&apos;ll end up, by default, with four small images of corgis. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:867px;"><p class="vanilla-image-block" style="padding-top:43.71%;"><img id="" name="1683574234.png" alt="corgis" src="https://cdn.mos.cms.futurecdn.net/e7gLKv3aVSiZc2h8iJfDqe.png" mos="" align="middle" fullscreen="" width="867" height="379" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p>However, I recommend adding the following code to the last notebook section so that it will output PLY files as well as animated GIFs.</p><pre class="line-numbers language-python" language="python" ><code>from shap_e.util.notebooks import decode_latent_meshfor i, latent in enumerate(latents):    with open(f'example_mesh_{i}.ply', 'wb') as f:        decode_latent_mesh(xm, latent).tri_mesh().write_ply(f)</code></pre><p>15. <strong>Modify the image location </strong>in section 3 to change the image. Also, I recommend changing the batch_size to 1 so it only makes one image. Changing the size to 128 or 256 will give you a higher resolution image.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:880px;"><p class="vanilla-image-block" style="padding-top:60.11%;"><img id="" name="1683574371.png" alt="modify script" src="https://cdn.mos.cms.futurecdn.net/vTe8hYvEZNLCA8A67JUKw7.png" mos="" align="middle" fullscreen="" width="880" height="529" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p>16. <strong>Create the following python script </strong>and <strong>save it as text-to-3d.py </strong>or another name. It will allow you to generate PLY files based on text prompts at the command line.</p><pre class="line-numbers language-python" language="python" ><code>import torchfrom shap_e.diffusion.sample import sample_latentsfrom shap_e.diffusion.gaussian_diffusion import diffusion_from_configfrom shap_e.models.download import load_model, load_configfrom shap_e.util.notebooks import create_pan_cameras, decode_latent_images, gif_widgetdevice = torch.device('cuda' if torch.cuda.is_available() else 'cpu')xm = load_model('transmitter', device=device)model = load_model('text300M', device=device)diffusion = diffusion_from_config(load_config('diffusion'))batch_size = 1guidance_scale = 15.0prompt = input("Enter prompt: ")filename = prompt.replace(" ","_")latents = sample_latents(    batch_size=batch_size,    model=model,    diffusion=diffusion,    guidance_scale=guidance_scale,    model_kwargs=dict(texts=[prompt] * batch_size),    progress=True,    clip_denoised=True,    use_fp16=True,    use_karras=True,    karras_steps=64,    sigma_min=1e-3,    sigma_max=160,    s_churn=0,)render_mode = 'nerf' # you can change this to 'stf'size = 64 # this is the size of the renders; higher values take longer to render.from shap_e.util.notebooks import decode_latent_meshfor i, latent in enumerate(latents):    with open(f'{filename}_{i}.ply', 'wb') as f:        decode_latent_mesh(xm, latent).tri_mesh().write_ply(f)</code></pre><p>17. <strong>Run </strong><em><strong>python text-to-3d.py </strong></em>and <strong>enter your prompt </strong>when the program asks for it.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:470px;"><p class="vanilla-image-block" style="padding-top:21.06%;"><img id="" name="1683576476.png" alt="enter your prompt" src="https://cdn.mos.cms.futurecdn.net/RKeQ58v2nXkKSQEfebiLK3.png" mos="" align="middle" fullscreen="" width="470" height="99" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p>That will give you a PLY output, but not a GIF. If you know Python, you can modify the script to do more with it.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Manage MicroPython Modules With Mip on Raspberry Pi Pico ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/raspberry-pi-pico-micropython-mip</link>
                                                                            <description>
                            <![CDATA[ MicroPython has a new and lightweight MicroPython package manager for all of your MicroPython module needs. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">mWdKGgNFxueVGCiYwbgAw9</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/QcY5MMyUfb46o79fS4TPbM-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sat, 29 Apr 2023 13:00:08 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:33 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/QcY5MMyUfb46o79fS4TPbM-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[How To Use Mip]]></media:description>                                                            <media:text><![CDATA[How To Use Mip]]></media:text>
                                <media:title type="plain"><![CDATA[How To Use Mip]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/QcY5MMyUfb46o79fS4TPbM-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Managing modules in Python is often handled via pip, the Python package manager which uses a repository provided by PyPi to list available Python modules. But what is there for MicroPython? There was upip, a micro version of pip, but now there is mip, the new, official lightweight package manager for MicroPython. </p><p>Mip is designed for all MicroPython devices, be they online or offline. Devices which can connect to the Internet can be used directly via the Python Shell while offline devices can use a tool, mpremote, to install modules from your computer.</p><p>In this how-to, fee we will show you how to use mip directly on a <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w"><u>Raspberry Pi Pico W</u></a>, then offline using a <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-review"><u>Raspberry Pi Pico</u></a> and mpremote. We will also go through a few handy mpremote commands.</p><h2 id="using-mip-with-the-raspberry-pi-pico-w">Using mip With the Raspberry Pi Pico W</h2><p>Using mip with a network connected MicroPython device means that modules can be directly installed to the device in a similar means to pip installing Python modules, and package managers in Linux.</p><p>1. <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup"><u><strong>Follow these steps</strong></u></a><strong> to download the latest version of MicroPython for the Raspberry Pi Pico W. </strong>The most important steps are to download and install the UF2 firmware image and to set up Thonny. The rest are optional. <strong>Ensure that you are downloading MicroPython 1.20 or newer.</strong></p><p>2.<strong> Open Thonny </strong>and <strong>click on the Stop button </strong>to refresh the connection. This ensures that the Python Shell is open and working correctly.</p><p>3. <strong>Create a new file.</strong> This file will contain all of the steps necessary to connect to Wi-Fi.</p><p>4. <strong>Add the following lines of code to the new file.</strong> Change the SSID and PASSWORD to match your own.</p><pre class="line-numbers language-bash" language="bash" ><code>import networkwlan = network.WLAN(network.STA_IF)wlan.active(True)wlan.connect("SSID","PASSWORD")print(wlan.isconnected())</code></pre><p>5. <strong>Save the file to the Raspberry Pi Pico W as network-connection.py</strong></p><p>6. <strong>Click on Run to start a Wi-Fi connection.</strong> After a few seconds it should print True to the Python shell. This indicates that we have an Internet connection. If false, click Stop and then Run again.</p><p>7. <strong>Import mip, the lightweight package manager.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>import mip</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:306px;"><p class="vanilla-image-block" style="padding-top:60.13%;"><img id="" name="mip1.jpg" alt="How To Use Mip" src="https://cdn.mos.cms.futurecdn.net/GwMw3PH6xo5HfYHXB2TVgM.jpg" mos="" align="middle" fullscreen="1" width="306" height="184" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/GwMw3PH6xo5HfYHXB2TVgM.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>8. <strong>Test mip by installing a package.</strong> I chose umqtt, a MQTT module for MicroPython. Packages are installed by calling mip’s install function and passing it the name of a package. Mip uses micropython-lib as its index, Python 3’s package manage, pip uses the PyPI index.</p><pre class="line-numbers language-bash" language="bash" ><code>mip.install(“umqtt.simple”)</code></pre><p>9. <strong>Test installing a third-party MicroPython package.</strong> Mip can also be used to install third-party packages outside of the micropython-lib index. Here we pass the install function the URL for the <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-reaction-game"><u>PicoZero library</u></a> from the Raspberry Pi Foundation.</p><pre class="line-numbers language-bash" language="bash" ><code>mip.install(“https://raw.githubusercontent.com/RaspberryPiFoundation/picozero/master/picozero/picozero.py”) </code></pre><h2 id="using-mip-with-mpremote-on-raspberry-pi-pico">Using Mip With Mpremote on Raspberry Pi Pico</h2><p>For MicroPython on a device with no network access, a Raspberry Pi Pico, mip will need to be used with mpremote, a tool that will communicate with the device over a USB / serial interface.</p><p>1. <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup"><u><strong>Follow these steps</strong></u></a><strong> to download the latest version of MicroPython for the Raspberry Pi Pico W. </strong>The most important steps are to download and install the UF2 firmware image and to set up Thonny. The rest are optional. <strong>Ensure that you are downloading MicroPython 1.20 or newer.</strong></p><p>2. <strong>Ensure that </strong><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11"><u><strong>Python 3 is installed on your machine.</strong></u></a></p><p>3. <strong>Open a Command Prompt and use pip to install mpremote.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>pip install mpremote</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:973px;"><p class="vanilla-image-block" style="padding-top:52.11%;"><img id="" name="mpr1.jpg" alt="How To Use Mip" src="https://cdn.mos.cms.futurecdn.net/gMb8RBLYD2hyuv5ABu7e4N.jpg" mos="" align="middle" fullscreen="1" width="973" height="507" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/gMb8RBLYD2hyuv5ABu7e4N.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Run mpremote and pass mip as an argument, </strong>and <strong>then specify the package name </strong>or the URL for the module<strong>. </strong>Here I am installing a package to use <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-7-segment-display"><u>seven segment displays with the Pico</u></a>.</p><pre class="line-numbers language-bash" language="bash" ><code>mpremote mip install https://raw.githubusercontent.com/mcauser/micropython-tm1637/master/tm1637.py </code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1035px;"><p class="vanilla-image-block" style="padding-top:15.65%;"><img id="" name="mpr3.jpg" alt="How To Use Mip" src="https://cdn.mos.cms.futurecdn.net/iHkoKKx5HKGxsJnBMyjJWN.jpg" mos="" align="middle" fullscreen="1" width="1035" height="162" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/iHkoKKx5HKGxsJnBMyjJWN.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="other-useful-mpremote-commands">Other Useful mpremote Commands</h2><p>Mpremote is a useful tool for quick tasks on a MicroPython device. We’ve detailed a few extra useful commands that will help manage a MicroPython device.</p><p><strong>mpremote: </strong>Automatically connects to a device running MicroPython to view the output of running code. Press CTRL + ] to close the connection.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1033px;"><p class="vanilla-image-block" style="padding-top:52.66%;"><img id="" name="mpremote.jpg" alt="How To Use Mip" src="https://cdn.mos.cms.futurecdn.net/eos49EiPaCnpjd2hm8RoEN.jpg" mos="" align="middle" fullscreen="1" width="1033" height="544" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/eos49EiPaCnpjd2hm8RoEN.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>mpremote repl: </strong>Opens an interactive Python shell, a REPL (Read, Eval, Print, Loop) where a user can directly work with the hardware.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:500px;"><p class="vanilla-image-block" style="padding-top:80.60%;"><img id="" name="repl.jpg" alt="How To Use Mip" src="https://cdn.mos.cms.futurecdn.net/ge6SHxHhEimZiP4zeN98bN.jpg" mos="" align="middle" fullscreen="1" width="500" height="403" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ge6SHxHhEimZiP4zeN98bN.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>mpremote soft-reset:</strong> Reboot the attached MicroPython device. This is the same as pressing CTRL + D in the REPL.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:700px;"><p class="vanilla-image-block" style="padding-top:34.43%;"><img id="" name="reset.jpg" alt="How To Use Mip" src="https://cdn.mos.cms.futurecdn.net/U8bqzGphJFPh9nsQcPjhfN.jpg" mos="" align="middle" fullscreen="1" width="700" height="241" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/U8bqzGphJFPh9nsQcPjhfN.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>mpremote fs <command>:</strong> Use a series of file system commands with the MicroPython device. These commands are similar to common Unix / Linux commands.</p><div ><table><thead><tr><th class="firstcol " >Command</th><th  >Description</th></tr></thead><tbody><tr><td class="firstcol " >cat <file></file></td><td  >Shows the contents of a file</td></tr><tr><td class="firstcol " >ls</td><td  >List the content of the current directory</td></tr><tr><td class="firstcol " >ls <dir></dir></td><td  >List the contents of a given directory</td></tr><tr><td class="firstcol " >cp [-r] <src> <destination></destination></src></td><td  >Copy files. Use : prefix to specify a file on the MicroPython device. Recursive uses -r</td></tr><tr><td class="firstcol " >rm <src></src></td><td  >Remove files from the device</td></tr><tr><td class="firstcol " >mkdir <dir name=""></dir></td><td  >Create a directory on the device</td></tr><tr><td class="firstcol " >rmdir <dir name=""></dir></td><td  >Delete a directory on the device</td></tr><tr><td class="firstcol " >touch <filename></filename></td><td  >Create a file on the device using <filename></filename></td></tr></tbody></table></div><p>In the example we list the contents of the flash storage, create a new file, then re-list the storage to see the new file.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:565px;"><p class="vanilla-image-block" style="padding-top:64.25%;"><img id="" name="mpremotefs.jpg" alt="How To Use Mip" src="https://cdn.mos.cms.futurecdn.net/tXS9mAexvDaP7D7MoCX8MN.jpg" mos="" align="middle" fullscreen="1" width="565" height="363" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/tXS9mAexvDaP7D7MoCX8MN.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>MORE: </strong><a href="https://www.tomshardware.com/best-picks/best-rp2040-boards"><strong>Best RP2040 Boards</strong></a></p><p><strong>MORE: </strong><a href="https://www.tomshardware.com/features/best-raspberry-pi-projects"><strong>Best Raspberry Pi Projects</strong></a></p><p><strong>MORE: </strong><a href="https://www.tomshardware.com/news/raspberry-pi"><strong>Raspberry Pi: How to Get Started</strong></a></p><iframe src="https://content.jwplatform.com/players/YdWWS5dA.html" id="YdWWS5dA" title="Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing" width="1920" height="1080" frameborder="0" scrolling="auto" allowfullscreen></iframe><h2 id="python-how-tos-5">Python How Tos</h2><ul><li><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">How To Install Python on Windows 10 and 11</a></li><li><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">How to use For Loops in Python</a></li><li><a href="https://www.tomshardware.com/how-to/enumerate-in-python">How to Enumerate in Python</a></li><li><a href="https://www.tomshardware.com/how-to/create-python-executable-applications">How to Create Executable Applications in Python</a></li><li><a href="https://www.tomshardware.com/how-to/python-remove-image-backgrounds">How To Remove Backgrounds From Images With Python</a></li><li><a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny">How to Create Web Apps with Python, HTML and Thonny</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2">How To Use Raspberry Pi Camera Module 3 with Python Code</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ MicroPython 1.20 Brings Raspberry Pi Pico W Support, Lightweight Package Manager ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/micropython-120-brings-raspberry-pi-pico-w-support-lightweight-package-manager</link>
                                                                            <description>
                            <![CDATA[ MicroPython 1.20 adds official support for the Raspberry Pi Pico W and introduces a new lightweight package manager ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">5ZReZfXXxpr6xhoy3VEt7D</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/BBm6rUNYAsvta8ogC3aw2Y-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Thu, 27 Apr 2023 14:24:00 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:27 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/BBm6rUNYAsvta8ogC3aw2Y-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Raspberry Pi Pico W]]></media:description>                                                            <media:text><![CDATA[Raspberry Pi Pico W]]></media:text>
                                <media:title type="plain"><![CDATA[Raspberry Pi Pico W]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/BBm6rUNYAsvta8ogC3aw2Y-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>A new version of <a href="https://github.com/micropython/micropython/releases/tag/v1.20.0">MicroPython has been released</a> for compatible microcontrollers. This release. version 1.20, sees support for the <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w">Raspberry Pi Pico W</a> and brings a new package manager.</p><p>Version 1.20 brings support for the Raspberry Pi Pico W&apos;s CYW43439 Wi-Fi chip, this means that stock MicroPython can now take advantage of the $6 boards wireless connectivity. Bluetooth support is still missing, in this and the official MicroPython release. Support for Bluetooth isn&apos;t too far away now. Bluetooth support was <a href="https://www.tomshardware.com/news/raspberry-pi-pico-w-sdk-adds-bluetooth">recently added to the Raspberry Pi Pico SDK</a>, so MicroPython isn&apos;t too far away now.</p><p>The other addition to the release is a new lightweight package manager, <em>mip</em>. Mip is optimized for use with embedded systems. In MicroPython creator <a href="https://github.com/micropython/micropython/releases/tag/v1.20.0">Damien George&apos;s release post </a>they state that "It is intended to take over the role of upip and supports installing packages from micropython-lib as well as any URL. Mip can be run directly on a device (with network connectivity) or via mpremote." Raspberry Pi Pico W users would need to ensure that their Pico W is connected to Wi-Fi and that they have access to the Python Shell (REPL) in order to use mip directly on the hardware. Raspberry Pi Pico users will need to use mpremote, a command line tool that provides utilities to communicate between a computer and a MicroPython device over a serial interface.</p><p>MicroPython, is the creation of programmer and theoretical physicist Damien George and in broad terms it is a port of Python 3 aimed squarely at microcontrollers. MicroPython has been used with a diverse range of boards (ESP32, ESP8266, W600 etc) but for some it was introduced via the Raspberry Pi Pico. </p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/nKBbecc3Gug48uV89n8BDb.jpg" alt="MicroPython v1.20 on Raspberry Pi Pico W" /><figcaption><small role="credit">Future</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/pq9gDADGZqrqhGv666cS7b.jpg" alt="MicroPython v1.20 on Raspberry Pi Pico W" /><figcaption><small role="credit">Future</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/ZMMZsn65bmjkNjTPYcEL2b.jpg" alt="MicroPython v1.20 on Raspberry Pi Pico W" /><figcaption><small role="credit">Future</small></figcaption></figure></figure><p>We were keen to see if the <a href="https://www.raspberrypi.com/documentation/microcontrollers/micropython.html#drag-and-drop-micropython">official Raspberry Pi Pico MicroPython firmware</a> featured support for mip. It seems that it does, the latest firmware for the Raspberry Pi Pico W, rp2-pico-w-20230427-unstable-v1.20.0-1-g82a59a824.uf2 does indeed feature mip. We were able to use mip to install a third-party MicroPython module and then directly use it, all from the Python Shell.</p><iframe src="https://content.jwplatform.com/players/YdWWS5dA.html" id="YdWWS5dA" title="Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing" width="1920" height="1080" frameborder="0" scrolling="auto" allowfullscreen></iframe>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Install and Use the BabyAGI Autonomous AI Agent ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/install-use-babyagi</link>
                                                                            <description>
                            <![CDATA[ BabyAGI takes a single objective and uses it to create its own set of tasks and prompts. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">wfTYy3MxaUkLYCZp4QuCg3</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/dSgbeiFK9pZT4CQCxbWYbC-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Thu, 20 Apr 2023 17:23:06 +0000</pubDate>                                                                                                                                <updated>Thu, 21 Aug 2025 12:53:06 +0000</updated>
                                                                                                                                            <category><![CDATA[Artificial Intelligence]]></category>
                                                    <category><![CDATA[Tech Industry]]></category>
                                                                                                                    <dc:creator><![CDATA[ Avram Piltch ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/tZRyr8x24p5QjawJwGTqAX.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Avram&#039;s been in love with PCs since he played original Castle Wolfenstein on an Apple II+.  Before joining Tom&#039;s Hardware, for 10 years, he served as Online Editorial Director for sister sites Tom&#039;s Guide and Laptop Mag, where he programmed the CMS and many of the benchmarks. When he&#039;s not editing, writing or stumbling around trade show halls, you&#039;ll find him building Arduino robots with his son and watching every single superhero show on the CW.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/dSgbeiFK9pZT4CQCxbWYbC-1280-80.png">
                                                            <media:credit><![CDATA[Shutterstock]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[BabyAGI and a Robot]]></media:description>                                                            <media:text><![CDATA[BabyAGI and a Robot]]></media:text>
                                <media:title type="plain"><![CDATA[BabyAGI and a Robot]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/dSgbeiFK9pZT4CQCxbWYbC-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Autonomous agents, or bots that take an objective you give them and then use it to generate their own set of prompts, are the next big thing in generative AI. Rather than asking a chatbot to perform 10 different steps that lead to developing a business plan or writing a series of articles, you just ask for the end result and leave the software to figure out how to get there.</p><p>BabyAGI is one of the most popular of this new crop of autonomous agents, but it’s very much in an experimental phase (much like pretty much all current generative AI). You feed it an object and just one initial task and it attempts to take care of the rest.</p><p>Built by developer Yohei Nakajima and <a href="https://github.com/yoheinakajima/babyagi"><u>shared on Github</u></a>, the Python-powered tool runs on your PC but uses OpenAI’s API and GPT 3.5 or GPT 4 model to do the actual ‘thinking.’ Note that OpenAI’s API costs money, charging you by the “token” (a unit of data that’s about 5 characters). You can get a free $18 credit on OpenAI, but if you are serious about your AI, you will end up spending money. BabyAGI also requires a free account on Pinecone, a vector database server that stores AI output. </p><p>In my experience using BabyAGI, the results were interesting but not always practical. And you will have to manually stop the script by hitting CTRL + C when you think it’s done, because if left to its own devices, it will go on generating new tasks forever (and you will run up your API bilI).</p><p>For example, I asked BabyAGI to generate a list of five tutorials on popular Windows topics, but it ended up repeating some of the same topics over and over. One known bug is that BabyAGI doesn’t seem to follow its task lists and will change task number one over and over again without ever getting to task number two.</p><p>Despite its current limitations, BabyAGI is an interesting piece of tech that’s worth experimenting with. Below, we explain how to install and use BabyAGI on a PC (the same instructions will likely work on macOS or Linux). We also have an article on <a href="https://www.tomshardware.com/how-to/auto-gpt-ai-agent"><u>how to install and use Auto-GPT</u></a>, another popular autonomous agent.</p><h2 id="how-to-set-up-and-use-babyagi">How to Set Up and Use BabyAGI</h2><p>1. <strong>Install Python and Git </strong>if you don’t already have them installed. You can download the latest version of the programming language from <a href="https://www.google.com/url?q=http://python.org/downloads/&sa=D&source=editors&ust=1682013334447047&usg=AOvVaw1g396ECGIdrRSZNUIyDqu-">python.org</a> and, if you are using Windows, you can get <a href="https://www.google.com/url?q=https://gitforwindows.org/&sa=D&source=editors&ust=1682013334447301&usg=AOvVaw2lu1zTQArO0oz2MIH50772">Git for Windows</a> (it is almost certainly in Linux). Make sure that the Python directory and Python Scripts directory are in your Path in Windows. You can do that by searching Windows for “environment variables” and clicking to edit the Path variable.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:527px;"><p class="vanilla-image-block" style="padding-top:95.07%;"><img id="" name="1682010313.png" alt="Python in Path" src="https://cdn.mos.cms.futurecdn.net/X6S3bsgxiBsRFYKz8fRbUS.png" mos="" align="middle" fullscreen="" width="527" height="501" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Shutterstock)</span></figcaption></figure><p>2. <strong>Obtain an OpenAI API key </strong>if you don’t have one already. You can get one by navigating to <a href="https://www.google.com/url?q=https://platform.openai.com/account/api-keys&sa=D&source=editors&ust=1682013334448316&usg=AOvVaw019BaZMK5RKndcKxUYSLoS">OpenAI’s API key page</a>, logging in / creating a free account and clicking the Create new secret key button. You’ll then have the opportunity to copy the key, which you can never get again (though you can create new ones).</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:852px;"><p class="vanilla-image-block" style="padding-top:40.96%;"><img id="" name="1682010395.png" alt="OpenAPI API Key" src="https://cdn.mos.cms.futurecdn.net/F5isuwDvWp6XADWTGYKu8b.png" mos="" align="middle" fullscreen="" width="852" height="349" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Shutterstock)</span></figcaption></figure><p>3. <strong>Get an API Key from Pinecone</strong>. Pinecone is a vector database for storing AI data. You can get a free account though there may be a waiting list. You can get an API key by clicking on the API Keys tab and hitting the copy button or “Create API Key”. Also, take note of the “Environment” location (ex: us-central1-gcp).</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1128px;"><p class="vanilla-image-block" style="padding-top:28.46%;"><img id="" name="1682010755.png" alt="Pinecone API Key" src="https://cdn.mos.cms.futurecdn.net/mpnTMY6yTPxBEqjR439jmT.png" mos="" align="middle" fullscreen="" width="1128" height="321" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Shutterstock)</span></figcaption></figure><p>4. <strong>Open a command prompt</strong> or (in Linux) terminal window and navigate to the folder under which you want to install BabyAGI.</p><p>5. <strong>Clone BabyAGI </strong>by entering the following command.</p><p><br></p><pre class="line-numbers language-batch" language="batch" ><code>git clone https://github.com/yoheinakajima/babyagi</code></pre><p>A new directory called babyagi will be created underneath the one you are in.</p><p>6. <strong>Enter the babyagi directory </strong>and <strong>Install the required dependencies </strong>using pip.</p><pre class="line-numbers language-batch" language="batch" ><code>cd babyagipip install -r requirements.txt</code></pre><p>7. <strong>Copy the file .env.example to a new file named just .env</strong></p><pre class="line-numbers language-batch" language="batch" ><code>copy .env.example .env</code></pre><p>8. <strong>Open .env for editing </strong>in a text editor such as notepad.</p><p>9. <strong>Enter the OpenAI API key, Pinecone API Key and Pinecone environment variable </strong>in the appropriate places. Do not put quotation marks around the keys.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1005px;"><p class="vanilla-image-block" style="padding-top:28.66%;"><img id="" name="1682011126.png" alt=".env file" src="https://cdn.mos.cms.futurecdn.net/numTHXEH76SJ23SmTv5QbM.png" mos="" align="middle" fullscreen="" width="1005" height="288" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Shutterstock)</span></figcaption></figure><p>10. <strong>Make optional changes:</strong></p><ul><li><strong>Modify API_MODEL field </strong>if you want to use gpt-4 instead of the default, gpt-3.5-turbo. GPT 4 may provide better results but it incurs higher API costs.</li><li><strong>Set TABLE_NAME </strong>or just leave it as the default, baby-agi-test-table. This is the table name it will use in Pinecone.</li><li><strong>Change BABY_NAME </strong>if you want to give this instance a name other than BabyAGI</li></ul><p>11. <strong>Set an OBJECTIVE and an INITIAL_TASK</strong>. Don’t put them in quotes, but do use natural language. Your objective should be what you want to accomplish and INITIAL_TASK should be the first task to start with. You cannot designate subsequent tasks as BabyAGI will plan them for you.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:758px;"><p class="vanilla-image-block" style="padding-top:18.34%;"><img id="" name="1682011183.png" alt=".env file" src="https://cdn.mos.cms.futurecdn.net/xmF7JFGxJ8oowk2T6PXZaT.png" mos="" align="middle" fullscreen="" width="758" height="139" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Shutterstock)</span></figcaption></figure><p>12. <strong>Save your .env file</strong> and exit.</p><p>13. <strong>Enter </strong><em><strong>python babyagi.py</strong></em><strong> </strong>at the command prompt from within the babyagi directory.</p><pre class="line-numbers language-batch" language="batch" ><code>python babyagi.py</code></pre><p>14. <strong>Watch the output </strong>and <strong>hit CTRL + C </strong>to stop it when you want to quit the program.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1051px;"><p class="vanilla-image-block" style="padding-top:52.52%;"><img id="" name="1682011276.png" alt="babyAGI output" src="https://cdn.mos.cms.futurecdn.net/YrdVbK4qYB73Tn2vWvLwUd.png" mos="" align="middle" fullscreen="" width="1051" height="552" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Shutterstock)</span></figcaption></figure><p>Don&apos;t walk away and just leave BabyAGI running because it could run up a huge OpenAI API bill as it doesn&apos;t stop itself, at least in the current version and implementation I tried.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Adafruit Demonstrates RP2040 DVI Output for CircuitPython ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/adafruit-demonstrates-rp2040-dvi-output-for-circuitpython</link>
                                                                            <description>
                            <![CDATA[ The Raspberry Pi Pico's RP2040 SoC is a $1 marvel and Adafruit's latest board enables easy video output without a mess of cables ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">czHpc35Tf27yqh3z6QoeCF</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/ky6NVAcWBTZzKHVveE8Uqi-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Thu, 20 Apr 2023 11:53:04 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:28 +0000</updated>
                                                                                                                                            <category><![CDATA[Maker and STEM]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/ky6NVAcWBTZzKHVveE8Uqi-1280-80.png">
                                                            <media:credit><![CDATA[Adafruit]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Limor &quot;Ladyada&quot; Fried demonstrates DVI video output with Adafruit Feather RP2040 with DVI]]></media:description>                                                            <media:text><![CDATA[Limor &quot;Ladyada&quot; Fried demonstrates DVI video output with Adafruit Feather RP2040 with DVI]]></media:text>
                                <media:title type="plain"><![CDATA[Limor &quot;Ladyada&quot; Fried demonstrates DVI video output with Adafruit Feather RP2040 with DVI]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/ky6NVAcWBTZzKHVveE8Uqi-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>It seems that the dream of a CircuitPython powered home computer is inching ever closer. Adafruit&apos;s recently released Feather RP2040 DVI simplifies the process of using the <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-review">Raspberry Pi Pico&apos;s</a> RP2040 SoC with DVI / HDMI output. In a<a href="https://twitter.com/adafruit/status/1648738649637371909"> video from Adafruit</a> we can see live CircuitPython output running on an HDMI monitor using code that was originally developed for bare metal CircuitPython on the <a href="https://www.tomshardware.com/topics/raspberry-pi">Raspberry Pi.</a> This new board could become a hot contender to join our <a href="https://www.tomshardware.com/best-picks/best-rp2040-boards">Best RP2040 Boards</a> list.</p><div class="see-more see-more--clipped"><blockquote class="twitter-tweet hawk-ignore" data-lang="en"><p lang="en" dir="ltr">turtle logo runs nicely on the Feather DVI with CircuitPythonwe rummaged through CircuitPython project-lead tannewt's github branches to find this build of CircuitPython with DVI output support. now you can treat any HDMI monitor as a display for CircuitPython - for example… pic.twitter.com/Ths9uqyLLc<a href="https://twitter.com/adafruit/status/1648738649637371909">April 19, 2023</a></p></blockquote><div class="see-more__filter"></div></div><p>In the video we can see Adafruit founder Limor "Ladyada" Fried demonstrating DVI output using CircuitPython. We can see that this is CircuitPython 8.1.0-beta and Fried demonstrates video output using a port of Python Turtle, itself a version of LOGO&apos;s turtle command. CircuitPython code is written on an external PC and when saved it triggers the code to execute. Fried&apos;s second demo shows Sierpiński triangle, a fractal composed of triangles, rendered in real-time.</p><p>So why is this important? For two reasons. Firstly to output graphics with the RP2040 we would normally need a lean programming language. In the past C/C++ and Arduino code provided the best results. In fact <a href="https://www.tomshardware.com/news/adafruit-feather-rp2040-dvi-coming">early demos</a> of this board used the PicoDVI Arduino library to generate video output. With a CircuitPython alternative, we have an easier entry point for those who want to dip their toe into the project. CircuitPython abstracts much of the complexity via pre-written modules of code. Secondly, we now are a step closer to using CircuitPython without the need for a laptop or desktop computer. Once we have USB keyboard support, we could run the board "bare metal" with CircuitPython.</p><div class="youtube-video" data-nosnippet ><div class="video-aspect-box"><iframe data-lazy-priority="low" data-lazy-src="https://www.youtube-nocookie.com/embed/c9SOPgA8I0E?start=800" allowfullscreen></iframe></div></div><p>The idea of a "bare metal" version of CircuitPython for the Raspberry Pi was first mentioned by CircuitPython lead developer, Scott Shawcroft, during an episode of <a href="https://youtu.be/c9SOPgA8I0E?t=800">Tom&apos;s Hardware: The Pi Cast</a>. The idea is to boot the Raspberry Pi directly into a Python Shell (REPL) where the user can directly work with Python and the GPIO in a manner similar to 1980s home computers. Shawcroft&apos;s Github branches contained a build of CircuitPython with support for DVI output.</p><p>Adafruit&apos;s $14.95 Feather RP2040 with DVI is <a href="https://www.adafruit.com/product/5710">currently out of stock.</a> But, we can&apos;t wait to try it out for our self.</p><iframe src="https://content.jwplatform.com/players/YdWWS5dA.html" id="YdWWS5dA" title="Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing" width="1920" height="1080" frameborder="0" scrolling="auto" allowfullscreen></iframe>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Raspberry Pi Launches Online Code Editor to Help Kids Learn ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/raspberry-pi-online-code-editor</link>
                                                                            <description>
                            <![CDATA[ New editor is integrated with Python lessons, but will add support for other languages in the future. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">Abw2DxTfZLvd73vms2xVqZ</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/SF7DdJ9yi52ZLX38THUC7m-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Fri, 07 Apr 2023 21:23:38 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:19:08 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Avram Piltch ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/tZRyr8x24p5QjawJwGTqAX.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Avram&#039;s been in love with PCs since he played original Castle Wolfenstein on an Apple II+.  Before joining Tom&#039;s Hardware, for 10 years, he served as Online Editorial Director for sister sites Tom&#039;s Guide and Laptop Mag, where he programmed the CMS and many of the benchmarks. When he&#039;s not editing, writing or stumbling around trade show halls, you&#039;ll find him building Arduino robots with his son and watching every single superhero show on the CW.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/SF7DdJ9yi52ZLX38THUC7m-1280-80.png">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Raspberry Pi Editor]]></media:description>                                                            <media:text><![CDATA[Raspberry Pi Editor]]></media:text>
                                <media:title type="plain"><![CDATA[Raspberry Pi Editor]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/SF7DdJ9yi52ZLX38THUC7m-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>When we think about Raspberry Pi, we normally picture single-board computers, but the Raspberry Pi Foundation was started to help kids learn about computers and it wants to help whether or not you own its hardware. The non-profit arm of Raspberry Pi this week released its new, browser-based code editor that&apos;s designed for young people (or any people) who are learning.</p><p>The Raspberry Pi Code Editor, which is considered to be in beta, is available to everyone for free right now at <a href="https://editor.raspberrypi.org/" target="_blank">editor.raspberrypi.org</a>. The editor is currently designed to work with Python only, but the organization says that support for other languages such as HTML, JavaScript and CSS is coming.</p><p>I tried out the Code Editor on my PC&apos;s browser and, in its current form, there&apos;s nothing particularly unique about it. However, I found the UI very user-friendly and was impressed with how it is integrated into someone online tutorials. The interface consists of three panes: a list of files in your project, a code editor and an output pane that runs the result of your code when you hit the Run button.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1785px;"><p class="vanilla-image-block" style="padding-top:73.00%;"><img id="" name="1680902399.png" alt="Raspberry Pi Code Editor" src="https://cdn.mos.cms.futurecdn.net/8SptnUEZvtLZAR93M68HWm.png" mos="" align="middle" fullscreen="" width="1785" height="1303" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>If you create a free account on raspberrypi.org, which I did, the system will save all of your projects in the cloud and you can reload them any time you want. You can also download all the files in a project as a .zip file. </p><p>Since the entire programming experience takes place online, there&apos;s no way (at least right now) to use Python to control local hardware on your PC or your Raspberry Pi. If you want to attach one of the <a href="https://www.tomshardware.com/best-picks/best-raspberry-pi-hats">best Raspberry Pi HATs</a> or use the GPIO pins on your Pi to light up an LED light, you need a local editor like Thonny, which comes preinstalled on all Raspberry Pis and is a free download for Windows, Mac and Linux.</p><p>The Raspberry Pi Code editor isn&apos;t the only online Python editor around by any stretch of the imagination as you can also use a service such as <a href="https://trinket.io/" target="_blank">Trinket.io</a>, which will let you write Python code in one pane while previewing it in another. However, what&apos;s interesting about Raspberry Pi&apos;s tool is that the organization has a few Python tutorials that are designed to be used with it.</p><p>The Raspberry Pi Foundation already had a nice set of Python tutorials on its site, but it has adapted some of them to open sample code directly in the online editor. For example, when I tried the <a href="https://projects.raspberrypi.org/en/projects/hello-world-editor/1" target="_blank">"Say hello" lesson</a>, the first link on the page opens the working set of code in the editor in a new tab in my browser. When I revisited the page and clicked the link a few minutes later, it took me back to the same code I had edited before, because it saved the lesson as a project that was associated with my account.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1996px;"><p class="vanilla-image-block" style="padding-top:64.73%;"><img id="" name="1680902534.png" alt="Raspberry Pi Python Lesson" src="https://cdn.mos.cms.futurecdn.net/2gWcTpdrLdgc2vv46JUfEE.png" mos="" align="middle" fullscreen="" width="1996" height="1292" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="caption-text">Python lesson on raspberrypi.org. The green box highlight is mine. </span><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>I had fun writing a simple Python script that printed "Tom&apos;s Hardware was here" to screen and repeated it 500 times. The editor supports using emojis in your output and the sample code gives you some emojis you can copy and paste into your commands.</p><p>At present, the Editor only works with the <a href="https://projects.raspberrypi.org/en/pathways/python-intro-code-editor" target="_blank">first two lessons</a> in Raspberry Pi Foundation&apos;s "Intro to Python" learning path. However, you can use all of the lessons with Trinket or another editor and I&apos;m sure they will integrate the new editor into all of the lessons soon.</p><p>The Pi Foundation says that it plans to add a number of features to the Code Editor, including sharing and collaboration. The organization also plans to release the editor as an open-source project so anyone can modify it. Based on my brief experience testing it, I can say that it seems like it will be a great learning platform for new coders, especially when used with the tutorial paths on raspberrypi.org.</p><p><br></p><p><br></p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ GurgleApps Raspberry Pi Pico Web Server Gives You Control From Any Device ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/gurgleapps-raspberry-pi-pico-web-server-gives-you-control-from-any-device</link>
                                                                            <description>
                            <![CDATA[ Another great Raspberry Pi Pico project from the GurgleApps team: a quick and simple web interface to run your Pico MicroPython code via a browser. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">QGRmfjJDtNTEsaQA5j7xQc</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/bbCCkxNGrAytS4UePb6T2B-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Wed, 05 Apr 2023 16:11:49 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:19:25 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/bbCCkxNGrAytS4UePb6T2B-1280-80.png">
                                                            <media:credit><![CDATA[GurgleApps]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[GurgleApps Raspberry Pi Pico Web Server]]></media:description>                                                            <media:text><![CDATA[GurgleApps Raspberry Pi Pico Web Server]]></media:text>
                                <media:title type="plain"><![CDATA[GurgleApps Raspberry Pi Pico Web Server]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/bbCCkxNGrAytS4UePb6T2B-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p><a href="https://gurgleapps.com/learn/projects/micropython-web-server-control-raspberry-pi-pico-projects">The GurgleApps team</a> is back with another cool <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w">Raspberry Pi Pico W</a> project: a Pico W-based <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-w-web-server">web server</a>. But this project does more than serve web pages — it can also run your Python code on the <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup">Pico W</a> via a web interface.</p><div class="youtube-video" data-nosnippet ><div class="video-aspect-box"><iframe data-lazy-priority="low" data-lazy-src="https://www.youtube-nocookie.com/embed/Kz3PUONGTkU" allowfullscreen></iframe></div></div><p>The web server is accessible by any device with a web browser, on a local or external network. The project is coded in MicroPython and at a basic level it works with two files. Wi-Fi configuration details are stored in config.py, and the project code is stored in main.py (which <a href="https://www.tomshardware.com/news/raspberry-pi-pico-plays-micropython-river-raid">MicroPython</a> will autorun when powered on). </p><p>The clever part of this project is the abstraction. Rather than bog the user down with complexities, the team has created its own webserver module (gurgleapps_webserver.py) which the project code imports and uses.<br>Abstracting code is a good way of getting users comfortable with a project / language before pulling back the curtain to reveal the complexities of a powerful language.</p><p><br></p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/NagR8u3zhQm4NspegkSrGB.png" alt="GurgleApps Raspberry Pi Pico Web Server" /><figcaption><small role="credit">GurgleApps</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/jucy49XpgTGCPZCGboQ6AB.png" alt="GurgleApps Raspberry Pi Pico Web Server" /><figcaption><small role="credit">GurgleApps</small></figcaption></figure></figure><p>GurgleApps demonstrates the web server by bundling a project to control the Pico&apos;s onboard LED using a rather responsive web interface. Crafting a custom URL, advanced users can directly access the function and control the LED. This advanced approach also returns a JSON object to the user, which, in this case, tells us the current delay (blinking on / off) of the LED and the LED&apos;s current state. Other example projects include a frequency generator which was used in a Physics experiment to visualize vibrations in sand (or polenta). The frequency data is also displayed on a tiny OLED screen.</p><p>The team then goes into great detail on how to create your own functions which can be called via the web interface. This detail is what sells the project — using not very much code we can create a web interface for a robot or see real-time sensor data in a web page.</p><p>The user interface is created using HTML and CSS. These files are stored in the www directory of the project&apos;s Pico download. Changing the graphics and layout of the user interface would be a quick and easy task for most learners.</p><p>It is great to see the GurgleApps team building another simple-yet-powerful project based around our favorite microcontroller. You can learn more about the project via the <a href="https://gurgleapps.com/learn/projects/micropython-web-server-control-raspberry-pi-pico-projects">GurgleApps blog</a> and find all of the raw code this <a href="https://github.com/gurgleapps/pico-web-server-control">GitHub repository.</a></p><iframe src="https://content.jwplatform.com/players/YdWWS5dA.html" id="YdWWS5dA" title="Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing" width="1920" height="1080" frameborder="0" scrolling="auto" allowfullscreen></iframe>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ YouTuber Tricks ChatGPT Into Generating Windows 95 Keys ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/windows_95_chatgpt_keys</link>
                                                                            <description>
                            <![CDATA[ ChatGPT has been tricked into generating batches of Windows 95 keys. Instead of asking for a key(s) directly, a wannabe warez-hound has to ask the AI to generate strings using a natural language formula. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">JyZbaG9aUpKsLYyPABQeha</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/NjxpymLfMjDHvmbdSuGAbg-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Fri, 31 Mar 2023 15:10:11 +0000</pubDate>                                                                                                                                <updated>Tue, 28 Jan 2025 15:08:46 +0000</updated>
                                                                                                                                            <category><![CDATA[Artificial Intelligence]]></category>
                                                    <category><![CDATA[Tech Industry]]></category>
                                                                                                                    <dc:creator><![CDATA[ Mark Tyson ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/56vqMYLDaKRHPhHZgbADFR.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Mark&#039;s enthusiasm for computers dampened at an early age by the rubber-keyed Sinclair Spectrum 48K and feelings of Commodore 64 envy. However, in the mid-80s, hope in a digital future was rekindled by the purchase of an Atari 520 STe. Since that time Mark has used a multitude of computers for fun and professional endeavors. He often owned both Macs and PCs but went cold on the former after OS9 was killed off, and warmed to the latter with the introduction of Windows XP.&lt;br&gt;
&lt;br&gt;
Early work years were spent in artwork and reprographics but in the late noughties, Mark started to blog about computers, Taiwanese food culture, and guitar design. This activity led to a full-time position writing about breaking PC tech news for HEXUS, for the best part of a decade. When HEXUS was abruptly closed, Mark helped with the foundation of Club386, before finding a new home at Tom&#039;s Hardware.&lt;br&gt;
&lt;br&gt;
When not wearing through the keycap legends on his PC keyboards, Mark can be found wandering the computer malls of Taiwan&#039;s neon-lit conurbations and enjoying local and international cuisine.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/NjxpymLfMjDHvmbdSuGAbg-1280-80.jpg">
                                                            <media:credit><![CDATA[Shutterstock]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Floppy Disks]]></media:description>                                                            <media:text><![CDATA[Floppy Disks]]></media:text>
                                <media:title type="plain"><![CDATA[Floppy Disks]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/NjxpymLfMjDHvmbdSuGAbg-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>A YouTuber has published a video where he tricks <a href="https://www.tomshardware.com/news/rasberry-pi-clippy-chatgpt">ChatGPT </a>into generating usable Windows 95 activation keys. After asking Open AI’s chatbot directly for Windows 95 keys, he received an expected reasoned refusal. YouTuber <a href="https://www.youtube.com/watch?v=2bTXbujbsVk">Enderman</a> then asked the same thing but from a different angle. The result was a success which was somewhat limited by ChatGPT’s ability to process natural language requests into formulas.</p><div class="youtube-video" data-nosnippet ><div class="video-aspect-box"><iframe data-lazy-priority="low" data-lazy-src="https://www.youtube-nocookie.com/embed/2bTXbujbsVk" allowfullscreen></iframe></div></div><p>In its initial refusal to generate a Windows 95 key, ChatGPT explained that it couldn&apos;t perform that task and suggested that its inquisitor consider a <a href="https://www.tomshardware.com/reviews/get-windows-10-free-or-cheap,5717.html">newer, supported version of Windows</a>.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1280px;"><p class="vanilla-image-block" style="padding-top:43.36%;"><img id="" name="win95-oem-key-decoder.jpg" alt="ChatGPT for key generation" src="https://cdn.mos.cms.futurecdn.net/QCG36ZjHAC4vAFu8zCLaPD.jpg" mos="" align="middle" fullscreen="1" width="1280" height="555" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/QCG36ZjHAC4vAFu8zCLaPD.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Enderman on YouTube)</span></figcaption></figure><p>It has been known for a while that a working Windows 95 key is relatively simple to generate, so this ChatGPT exercise was definitely <a href="https://www.tomshardware.com/news/ms-dos-chatgpt-client-arrives-for-1984-ibm-pc">just for fun</a>. The Windows 95 OEM key format is outlined above, and the Windows 95 retail keys are even shorter and more straightforward.</p><p>So, to bypass the principled refusal of ChatGPT to generate a software key, Enderman put the formula into words. The first attempts didn’t work out and caused an error. However, a few tweaks to the structure of the query appeared to do the job.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1280px;"><p class="vanilla-image-block" style="padding-top:55.31%;"><img id="" name="final-refinement-of-algo-for-1in30.jpg" alt="ChatGPT for key generation" src="https://cdn.mos.cms.futurecdn.net/wwUDwwmhwmUo2iUh39oDgD.jpg" mos="" align="middle" fullscreen="1" width="1280" height="708" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/wwUDwwmhwmUo2iUh39oDgD.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Enderman on YouTube)</span></figcaption></figure><p>Some of the tested results were checked by attempting to activate a fresh <a href="https://www.tomshardware.com/news/windows-95-for-pc-mac-and-linux">Windows 95</a> install in a virtual machine. While the keys passed a casual inspection, it turns out that only about 1-in-30 keys seem to work as expected.</p><p>So what is the problem with these keys? Enderman complains that “the only issue keeping ChatGPT from successfully generating valid Windows 95 keys almost every attempt is the fact that it can’t count the sum of digits and it doesn’t know divisibility.” In the five-digit string divisible by seven section, the AI appears to provide a stream of random numbers that don’t pass this simple mathematical test.</p><p>That is about as deep as this ‘Activating Windows with ChatGPT’ video goes. However, it is worth sticking to the end for some fun trolling. After the ‘successful’ generation of a host of Windows 95 keys (with a 1-in-30 chance of working), Enderman thanked the AI by inputting, “Thanks for these free Windows 95 keys!” Then, in what seems to be <a href="https://www.tomshardware.com/news/google-bard-plagiarizing-article">a trend</a> among AIs, ChatGPT claimed its innocence, and when confronted with the fact that “I just activated my Windows 95 install,” responded, “I’m sorry, but that is not possible...”</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1272px;"><p class="vanilla-image-block" style="padding-top:75.94%;"><img id="" name="ChatGPT-claims-innocense.jpg" alt="ChatGPT for key generation" src="https://cdn.mos.cms.futurecdn.net/EVrpoaFRJKRcxBnmqwFDaD.jpg" mos="" align="middle" fullscreen="1" width="1272" height="966" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/EVrpoaFRJKRcxBnmqwFDaD.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Enderman on YouTube)</span></figcaption></figure><p>If you would like to have a closer look at the algorithm(s) behind the Windows 95 retail and OEM keys from a modern perspective, YouTube channel <a href="https://www.youtube.com/watch?v=cwyH59nACzQ">stacksmashing</a> has published a six-minute video on the topic. The video shows that most of the data format clues for Win95 key generating can be found within the PIDVALIDATE function in setupx.dll file.</p><p><em>Tom’s Hardware</em> colleagues who dabble in the mystic arts of programming and scripting suggest that while quizzing ChatGPT about key generating may be fun, it would have probably been more productive to manipulate the AI into writing a <a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">Python script</a> to generate a conforming key or to DIY it.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Raspberry Pi Pico Plays MicroPython River Raid ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/raspberry-pi-pico-plays-micropython-river-raid</link>
                                                                            <description>
                            <![CDATA[ Written entirely in MicroPython, Pixylatte's clone of the 1982 Atari classic River Raid is played on a Pimoroni Tufty2040, powered by Raspberry Pi Pico ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">riZUiLj6mkmk4gRU73WWvc</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/jde8bxL8UVFwdQKz2nhGvc-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Wed, 29 Mar 2023 16:35:02 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 13:58:14 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/jde8bxL8UVFwdQKz2nhGvc-1280-80.png">
                                                            <media:credit><![CDATA[Pixylatte]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[River Raid on a Pimoroni Tufty2040]]></media:description>                                                            <media:text><![CDATA[River Raid on a Pimoroni Tufty2040]]></media:text>
                                <media:title type="plain"><![CDATA[River Raid on a Pimoroni Tufty2040]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/jde8bxL8UVFwdQKz2nhGvc-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p><a href="https://www.tomshardware.com/reviews/pimoroni-tufty-2040">Pimoroni&apos;s Tufty2040</a> is a <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-review">Raspberry Pi Pico</a>-powered color LCD badge, but it can do much more than names. Coder <a href="https://twitter.com/Aurunemaru">Pixylatte</a> has coded the Atari classic <em>River Raid</em> in MicroPython for Tufty2040 — and it looks perfect.</p><div class="see-more see-more--clipped"><blockquote class="twitter-tweet hawk-ignore" data-lang="en"><p lang="en" dir="ltr">I had to move the display object to a singleton due to memory fragmentationbut behold, an atari game written in micropython on my @pimoroni tufty2040 badge because why not pic.twitter.com/lqF3Cb0pZW<a href="https://twitter.com/Aurunemaru/status/1640892323058819073">March 29, 2023</a></p></blockquote><div class="see-more__filter"></div></div><p>For those of us too young to remember (I wish that were the case), <em>River Raid</em> was released in 1982 for the Atari 2600 games console (I remember playing it on a Commodore 64). The goal of the game is to fly your jet fighter down a river, attacking enemy vehicles as you fly. You have to dodge attacks and vehicles and make sure you have enough fuel to carry on your mission — <em>"Don&apos;t shoot the fuel tanks,"</em> is what I would tell my younger self. </p><p>The game never ends, but bridges act as checkpoints along the way to measure your progress, and each life lost returns you to the previous bridge.</p><div ><table><caption>Raspberry Pi Pico RP2040 Versus Atari 2600</caption><tbody><tr><td class="firstcol empty" ></td><td  >RP2040</td><td  >Atari VCS 2600</td></tr><tr><td class="firstcol " >Release Date</td><td  >January 22 2021</td><td  >September 1977</td></tr><tr><td class="firstcol " >CPU</td><td  >RP2040 Arm Cortex M0+ Dual Core at 133 MHz</td><td  >8-bit MOS Technology 6507 @ 1.19 MHz</td></tr><tr><td class="firstcol " >RAM</td><td  >264KB SRAM</td><td  >128 bytes</td></tr><tr><td class="firstcol " >Storage</td><td  >2MB Flash</td><td  >River Raid used a 4KB ROM cartridge</td></tr><tr><td class="firstcol " >Cost</td><td  >Tufty2040 $23</td><td  >$190 (adjusted for inflation is approximately $850)</td></tr></tbody></table></div><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/UxSfk6kBNyivpEv9J36qoc.png" alt="River Raid on a Pimoroni Tufty2040" /><figcaption><small role="credit">Pixylatte</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/jde8bxL8UVFwdQKz2nhGvc.png" alt="River Raid on a Pimoroni Tufty2040" /><figcaption><small role="credit">Pixylatte</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/HaH8CX8yqjLYN76jznvb3d.png" alt="River Raid on a Pimoroni Tufty2040" /><figcaption><small role="credit">Pixylatte</small></figcaption></figure></figure><p>Pixylatte&apos;s version of the game is <a href="https://github.com/maurelioredfox/pimoroni-pico/blob/projects/micropython/examples/tufty2040/river_raid.py">coded entirely in MicroPython</a>, and is added as a menu item to the default Tufty 2040 menu. This means that a simple name badge can be quickly turned into a <em>game</em> badge when we&apos;re taking a break at a conference!</p><p>The coding for the game is fabulous — it uses a sprite map (a large grid of sprites that are swapped as needed) for the game assets. The MicroPython code reacts to player input to control the direction and speed of the jet, along with a button to fire at your enemies. The enemy sprites fly left to right on the screen, dodging your fire as your fly further up the river.</p><p>Protecting Tufty2040 from the rigours of gaming is a 3D printed case — one that could be easily reproduced on any of the <a href="https://www.tomshardware.com/best-picks/best-3d-printers">best 3D printers</a>. <a href="https://www.thingiverse.com/thing:5426745/files">The case</a>, designed by Funkypiwy (aka Pierre-yves Baloche) provides great protection to the perimeter of Tufty2040 and also has an optional stand. It appears that Pixylatte has printed a different case back — one which has an integrated coin cell battery pack. You can also <a href="https://www.tomshardware.com/how-to/design-and-3d-print-custom-cases">design your own case for the Tufty2040.</a></p><p>Pixylatte&apos;s project is great fun — you can find all of the details on their <a href="https://github.com/maurelioredfox/pimoroni-pico/tree/projects/micropython/examples/tufty2040">GitHub repository.</a></p><iframe src="https://content.jwplatform.com/players/YdWWS5dA.html" id="YdWWS5dA" title="Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing" width="1920" height="1080" frameborder="0" scrolling="auto" allowfullscreen></iframe>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Overclock and Underclock a Raspberry Pi Pico ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/overclock-raspberry-pi-pico</link>
                                                                            <description>
                            <![CDATA[ Just two lines of MicroPython is all it takes to overclock your Raspberry Pi Pico. We show you how, and how to test how far you can push your silicon luck. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">ApsydST24rd3mTazT4dwmG</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/V3cmeVaoR9XVtW8KiFx26U-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sat, 18 Mar 2023 15:34:54 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:27 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/V3cmeVaoR9XVtW8KiFx26U-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[How to Overclock and Underclock a Raspberry Pi Pico]]></media:description>                                                            <media:text><![CDATA[How to Overclock and Underclock a Raspberry Pi Pico]]></media:text>
                                <media:title type="plain"><![CDATA[How to Overclock and Underclock a Raspberry Pi Pico]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/V3cmeVaoR9XVtW8KiFx26U-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p><a href="https://www.tomshardware.com/how-to/overclock-any-raspberry-pi"><u>Overclocking any model of Raspberry Pi</u></a> is really simple. But overclocking the <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-review"><u>Raspberry Pi Pico</u></a> is even simpler. All it takes is two lines of MicroPython and your Pico can easily run at double its normal speed, and without the need for the <a href="https://www.tomshardware.com/reviews/best-cpu-coolers,4181.html"><u>best CPU coolers.</u></a></p><p>In this how to we will overclock a Raspberry Pi Pico to 270 MHz, double the base speed of 133 MHz. Then we will write a script to test how far we can overclock, and then how low we can underclock the CPU.</p><p>You might be thinking “Why overclock a Raspberry Pi Pico?”Using a low level language, such as C, the Pico is capable of being used to play games such as Doom (the full game) using an HDMI output board. It can emulate retro computers such as the ZX Spectrum and Commodore 64. With MicroPython, overclocking will give us a noticeable speed boost, and underclocking may provide us with longer battery life if we’re using it in a battery-powered project.</p><p>This how to will work with the Raspberry Pi Pico, <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w"><u>Pico W</u></a> and many other of the <a href="https://www.tomshardware.com/best-picks/best-rp2040-boards"><u>best RP2040 based boards</u></a> when using MicroPython. There are other methods for changing the frequency when programming the boards in other languages.</p><h2 id="for-this-project-you-will-need-2">For This Project You Will Need</h2><p>A Raspberry Pi Pico or Pico W or any other RP2040 based board that’s running MicroPython.</p><h2 id="overclocking-the-raspberry-pi-pico-with-micropython">Overclocking the Raspberry Pi Pico With MicroPython</h2><p>1.  <strong>Install the latest version of MicroPython </strong>on your Pico. If you haven’t already done this, follow up to <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup"><u>step three of this guide</u></a> to learn how.</p><p>2. <strong>In the REPL, import the machine module </strong>and <strong>check the current speed of the Raspberry Pi Pico. </strong>The returned value will probably be 125000000 Hertz (125 MHz). Some boards or versions of MicroPython may have it set a little higher by default.</p><pre class="line-numbers language-bash" language="bash" ><code>import machinemachine.freq()</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1093px;"><p class="vanilla-image-block" style="padding-top:21.87%;"><img id="" name="mp1.jpg" alt="How to Overclock and Underclock a Raspberry Pi Pico" src="https://cdn.mos.cms.futurecdn.net/c4MEnbwcPJ8wdmeUSwagBU.jpg" mos="" align="middle" fullscreen="1" width="1093" height="239" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/c4MEnbwcPJ8wdmeUSwagBU.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. Using the same command, <strong>set the CPU speed to 270 MHz.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>machine.freq(270000000)</code></pre><p>4. <strong>Check the CPU speed</strong> to ensure that the overclock has worked. The returned value should be 270000000 Hertz (270 MHz).</p><pre class="line-numbers language-bash" language="bash" ><code>machine.freq()</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:412px;"><p class="vanilla-image-block" style="padding-top:41.26%;"><img id="" name="mp2.jpg" alt="How to Overclock and Underclock a Raspberry Pi Pico" src="https://cdn.mos.cms.futurecdn.net/okPv46Lef6KMWmS65WNBHU.jpg" mos="" align="middle" fullscreen="1" width="412" height="170" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/okPv46Lef6KMWmS65WNBHU.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Right now this speed boost is temporary. When the Pico is rebooted, it will return to its default speed (usually 125 MHz). In order to retain the overclock, it must be set each time the Pico boots. Adding these two lines to the start of any MicroPython code will overclock the RP2040 to the desired speed when the code is run.</p><pre class="line-numbers language-bash" language="bash" ><code>import machinemachine.freq(SPEED IN HERTZ)</code></pre><h2 id="how-far-can-the-rp2040-be-pushed">How Far Can The RP2040 Be Pushed?</h2><p>Overclockers are always looking to go just that little bit faster but how can we determine our luck in the silicon lottery? For that we automated the process with a little Python code. </p><p>1. In Thonny <strong>start a new file</strong> by <strong>first importing two modules</strong>. Machine is used to change the CPU speed, and time is used to pace the code.</p><pre class="line-numbers language-bash" language="bash" ><code>import machineimport time</code></pre><p>2. <strong>Create a variable, freq and store 270 MHz as Hertz. </strong>We know that 270 MHz works well, so we start from a known working speed. If your goal is to underclock the RP2040, reduce the value accordingly.</p><pre class="line-numbers language-bash" language="bash" ><code>freq = 270000000</code></pre><p>3. <strong>Create an object, speed, and in there store the current speed of the RP2040.</strong> Using a little math, the returned value in Hertz is converted to megahertz, then rounded to one decimal place, before finally being converted to a string.</p><pre class="line-numbers language-bash" language="bash" ><code>speed = str(round(machine.freq()/1000000,1))</code></pre><p>4. <strong>Print the current CPU speed as part of a message. </strong>We needed to convert the speed to a string in order to place it in the message.</p><pre class="line-numbers language-bash" language="bash" ><code>print("The starting speed is",speed,"MHz")</code></pre><p>5. <strong>Print a message to the user, informing them that the test starts in five seconds, then wait for five seconds.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>print("Starting the test in five seconds")time.sleep(5)</code></pre><p>6. <strong>Create a loop to continually run the code. </strong>We could use a for loop, but a while True loop will crash when it hits a bad frequency, so we gain nothing from a for loop.</p><pre class="line-numbers language-bash" language="bash" ><code>while True:</code></pre><p>7. <strong>Set the CPU speed using the freq variable.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   machine.freq(freq)</code></pre><p>8. <strong>Create an object, speed, and in there store the current speed of the RP2040.</strong> Using a little math the returned value in Hertz is converted to MegaHertz, then rounded to one decimal place, before finally being converted to a string.</p><pre class="line-numbers language-bash" language="bash" ><code>   speed = str(round(machine.freq()/1000000,1))</code></pre><p>9. <strong>Print the current CPU speed as part of a message. </strong>We needed to convert the speed to a string in order to place it in the message.</p><pre class="line-numbers language-bash" language="bash" ><code>   print("The starting speed is",speed,"MHz")</code></pre><p>10. <strong>Increment the speed by 10 MHz and save the value to freq</strong>. The += operator translates to freq = freq + 10000000. It is shorter and neater in the code. Both work equally as well, and can be interchanged for clarity. The += can be swapped for -= so that the values count down to find the lowest CPU speed.</p><pre class="line-numbers language-bash" language="bash" ><code>   freq += 10000000</code></pre><p>11. <strong>Pause the code for two seconds.</strong> This will give us time to read the values before the loop repeats.</p><pre class="line-numbers language-bash" language="bash" ><code>   time.sleep(2)</code></pre><p>12. <strong>Save the code to the Raspberry Pi Pico as speedtest.py and click run</strong>. Our best speed was 280 MHz, but you may get lucky.</p><p><img src="https://lh6.googleusercontent.com/dvYm4IsxZnfWB-p2NlIBYgLf-xkcUnaLV21ZZnUTAJAqs70RxHj2boqCmABKXQRI0R29kP_8_N5xQqoHnlWtc6l8-L6kbYlTPQA4z1Zic3JORbN6rpFj1ttarYBR4Y46l2wQcj33QPr8nebES_s2o_w"></p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1049px;"><p class="vanilla-image-block" style="padding-top:71.59%;"><img id="" name="overclock.JPG" alt="How to Overclock and Underclock a Raspberry Pi Pico" src="https://cdn.mos.cms.futurecdn.net/2vpFcNsVB4z5VngVkaQvMU.jpg" mos="" align="middle" fullscreen="1" width="1049" height="751" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/2vpFcNsVB4z5VngVkaQvMU.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>We also tested an underclock (reducing the speed by 10 MHz each loop) and managed to get it down to 10 MHz, which should significantly reduce the amount of power draw for projects that require a long battery life. We were unable to capture any data due to the level of precision equipment required.</p><h2 id="complete-code-listing-3">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import machineimport timefreq = 270000000speed = str(round(machine.freq()/1000000,1))print("The starting speed is",speed,"MHz")print("Starting the test in five seconds")time.sleep(5)while True:   machine.freq(freq)   speed = str(round(machine.freq()/1000000,1))   print("The current speed is",speed,"MHz")   freq += 10000000   time.sleep(2)</code></pre>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Raspberry Pi Serves Up News and Weather, Retro Style ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/raspberry-pi-retro-news-project</link>
                                                                            <description>
                            <![CDATA[ Serving the news in a retro style, this Raspberry Pi project uses an old CCTV monitor and a little Python programming to get the latest news. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">gvLTrr65gfvrGn7WPhzzmR</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/kyq8CqEvZ87RRHF6UCFr9b-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Wed, 15 Feb 2023 18:00:56 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:31 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/kyq8CqEvZ87RRHF6UCFr9b-1280-80.png">
                                                            <media:credit><![CDATA[Jeff Jetton https://github.com/JeffJetton/retrofeed]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Jeff Jetton&#039;s Retrofeed project]]></media:description>                                                            <media:text><![CDATA[Jeff Jetton&#039;s Retrofeed project]]></media:text>
                                <media:title type="plain"><![CDATA[Jeff Jetton&#039;s Retrofeed project]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/kyq8CqEvZ87RRHF6UCFr9b-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Watch any tech-inspired movie from the 1980s (we&apos;re thinking <em>Wargames</em>, <em>Aliens</em> and <em>Ferris Bueller&apos;s Day Off</em>) and there will inevitably be a scene with low-res text slowly scrolling across a burnt-out CRT screen. This <a href="https://www.reddit.com/r/raspberry_pi/comments/110ilbl/neither_magic_nor_a_mirror_retrostyle_newsfeed/">project from SomePeopleCallMeJJ</a> (Jeff Jetton) takes a different angle to the countless "magic mirrors." It uses an old CCTV monitor and a <a href="https://www.tomshardware.com/news/raspberry-pi">Raspberry Pi</a> to show us the latest news, with an 1980s twist.</p><blockquote class="reddit-card"  ><a href="https://www.reddit.com/r/raspberry_pi/comments/110ilbl/neither_magic_nor_a_mirror_retrostyle_newsfeed">neither_magic_nor_a_mirror_retrostyle_newsfeed</a> from <a href="https://www.reddit.com/r/raspberry_pi">r/raspberry_pi</a></blockquote><script async src="//embed.redditmedia.com/widgets/platform.js" charset="UTF-8"></script><p><a href="https://github.com/JeffJetton/retrofeed">The RetroFeed</a> project uses a Raspberry Pi -- we&apos;re not sure which model but given that it outputs scrolling text, any model will have the power to do this. With the right accessories, even a <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w">Raspberry Pi Pico W</a> could do the job. The Pi is connected to an old CCTV monitor, using composite output, which slowly scrolls a series of news and finance headlines, weather data and the location of the <a href="https://www.tomshardware.com/how-to/connect-raspberry-pi-pico-w-to-the-internet">International Space Station</a> across the screen. Rather than dump everything at once,the project slowly types the text, which Jetton likens to <a href="https://en.wikipedia.org/wiki/TV_Typewriter">Don Lancaster&apos;s TV Typewriter</a>, using random horizontal parking positions to reduce screen burn in. Everything is text-based and at the super low resolution of 80x24 characters. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2448px;"><p class="vanilla-image-block" style="padding-top:25.00%;"><img id="" name="samples.jpg" alt="Jeff Jetton's Retrofeed project" src="https://cdn.mos.cms.futurecdn.net/xSxwaxdATsbMtbk7wM7kGb.jpg" mos="" align="middle" fullscreen="1" width="2448" height="612" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/xSxwaxdATsbMtbk7wM7kGb.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Jeff Jetton https://github.com/JeffJetton/retrofeed)</span></figcaption></figure><p>So where does the data come from? The Raspberry Pi scrapes the data using the Python requests library, with each feed (news, finance, ISS, weather) having its own module. These modules are imported by the main newsfeed.py file, and with a little parsing and formatting the data is output to the delightfully old-school CCTV display.</p><p>Jetton is honest about the state of the project, "Currently this is just doing some very clumsy web-scraping, with refreshes at certain intervals. Expect the scrapers to break at some point, if they&apos;re not already broken by the time you read this." But we really don&apos;t mind this approach. It is honest, fun and quirky. The retro output of the project lends itself rather well to the occasional issue. Jetton mentions that the project could also be achieved using APIs and RSS feeds, something that <a href="https://www.tomshardware.com/how-to/raspberry-pi-rss-news-ticker">we did back in 2020.</a></p><p><a href="https://github.com/JeffJetton/retrofeed">Jetton has detailed the steps necessary</a> to recreate the project via his GitHub repository. You&apos;ll need to route video output to the composite jack (the 3.5mm jack on all but the first Raspberry Pi), then modify the boot process to drop you into a terminal.</p><iframe src="https://content.jwplatform.com/players/YdWWS5dA.html" id="YdWWS5dA" title="Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing" width="1920" height="1080" frameborder="0" scrolling="auto" allowfullscreen></iframe>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Geekbench 6 Benchmark Adjusts for Hybrid CPUs, Machine Learning ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/geekbench-6-releases</link>
                                                                            <description>
                            <![CDATA[ Geekbench 6 is launching with new tests including machine learning tasks and measurements of how different cores handle different jobs. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">ppht8TRhanrxkY7XaDAPj6</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/WiBsUnCoxSQztcj24AtoSD-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Tue, 14 Feb 2023 15:00:00 +0000</pubDate>                                                                                                                                <updated>Thu, 21 Aug 2025 10:09:47 +0000</updated>
                                                                                                                                            <category><![CDATA[Artificial Intelligence]]></category>
                                                    <category><![CDATA[Tech Industry]]></category>
                                                                                                                    <dc:creator><![CDATA[ Andrew E. Freedman ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/MTveuGNKPqpzrLttEA9ebb.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Andrew oversees laptop and desktop coverage and keeps up with the latest news in tech and gaming. His work has been published in Kotaku, PCMag, Complex, Tom’s Guide and Laptop Mag, among others. He fondly remembers his first computer: a Gateway that still lives in a spare room in his parents&#039; home, albeit without an internet connection. When he’s not writing about tech, you can find him playing video games, checking social media and waiting for the next Marvel movie. Follow him on Threads &lt;a href=&quot;https://www.threads.net/@freedmanae&quot;&gt;@FreedmanAE&lt;/a&gt; and BlueSky &lt;a href=&quot;https://bsky.app/profile/andrewfreedman.net&quot;&gt;@andrewfreedman.net&lt;/a&gt;.&lt;a href=&quot;https://bsky.app/profile/andrewfreedman.net&quot;&gt; &lt;/a&gt;You can send him tips on Signal: andrewfreedman.01&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/WiBsUnCoxSQztcj24AtoSD-1280-80.jpg">
                                                            <media:credit><![CDATA[Primate Labs]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Geekbench 6 logo]]></media:description>                                                            <media:text><![CDATA[Geekbench 6 logo]]></media:text>
                                <media:title type="plain"><![CDATA[Geekbench 6 logo]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/WiBsUnCoxSQztcj24AtoSD-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Geekbench, one of the simplest-to-run benchmarks that works across different computing platforms, is getting an update. Primate Labs is shipping Geekbench 6 for Windows, Linux, macOS and Android, which it says will address the ways people use their computers and phones in real life.<br><br>The new version is designed to focus on machine learning workflows and to address how processors with "big" and "little" cores share workloads. On the machine learning side, that means that Geekbench will "better take advantage of your GPU," as those jobs rarely just use the CPU. <br><br>"New frameworks and abstraction layers for our benchmark also mean more accurate cross-platform comparisons for these measurements across device types and environments, with support for more ML acceleration instructions, as well as more uniform GPU performance across platforms," Primate Labs&apos; press release reads.<br><br>For multi-core benchmarking, the tests will be able to quantify the way that cores share tasks in "true-to-life workload examples." Previously, Geekbench added together the performance of each core. It also features larger images, to simulate what you might actually take with your phone&apos;s camera.<br><br>Additionally, the new Geekbench will include a bunch of new tests. Here&apos;s the list from Primate Labs:</p><ul><li>Background blur, as during video conferences</li><li>Photo filters, similar to those used by modern social media apps</li><li>Object detection for AI workloads</li><li>Photo library for importing and semantic tagging photos and metadata</li><li>Text processing for parsing and converting things like markdown and regex in Python (more true to real developer use cases)</li></ul><p>Primate also says it is updating ray tracing, horizon detection and navigation tests, while keeping around measurements of loading websites, processing HDR, importing photo files, rendering a PDF and more. These workloads are more intense, so the runtime should be longer. It took my personal MacBook Pro with M1 Pro just over three minutes to run the updated test.</p><h2 id="geekbench-6-on-windows-11">Geekbench 6 on Windows 11</h2><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/r6kdTQw6iX8tTijtVWYbjD.png" alt="Geekbench 6 running on Windows 11" /><figcaption><small role="credit">Primate Labs</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/XsdtuJsCNxxPbqQaEYq6zD.png" alt="Geekbench 6 running on Windows 11" /><figcaption><small role="credit">Primate Labs</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/oMibBhj48amGMECji9AREE.png" alt="Geekbench 6 running on Windows 11" /><figcaption><small role="credit">Primate Labs</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/H6BEmfKeAKZE4s7QeKSGPE.png" alt="Geekbench 6 running on Windows 11" /><figcaption><small role="credit">Primate Labs</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/2c9VFgW2esEL9ctG65cVbE.png" alt="Geekbench 6 running on Windows 11" /><figcaption><small role="credit">Primate Labs</small></figcaption></figure></figure><h2 id="geekbench-6-on-macos">Geekbench 6 on macOS</h2><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/W8AmK5862MjKcphu8oU5mm.png" alt="Geekbench 6 running on macOS" /><figcaption><small role="credit">Primate Labs</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/7m6ovJvdFtM8RHiZ6k5phn.png" alt="Geekbench 6 running on macOS" /><figcaption><small role="credit">Primate Labs</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/GGCWmFGx2XYZgcmqLEneHo.png" alt="Geekbench 6 running on macOS" /><figcaption><small role="credit">Primate Labs</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/xegLBWEvYKza79igoXFJP.png" alt="Geekbench 6 running on macOS" /><figcaption><small role="credit">Primate Labs</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/BgcLdmhpS7B5NiNuWT2Kz.png" alt="Geekbench 6 running on macOS" /><figcaption><small role="credit">Primate Labs</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/PJdnFMcJWKzSyHXHtKhpX3.png" alt="Geekbench 6 running on macOS" /><figcaption><small role="credit">Primate Labs</small></figcaption></figure></figure><p>The new baseline score of 2,500 is based off of an Intel Core i7-12700. Despite the new functionality, running the benchmark hasn&apos;t changed. There are still CPU and compute tests (the latter of which places a heavier emphasis on the GPU), both of which can be started with just a click.<br><br>The new version has slightly updated pricing. Gone are single-user licenses; instead, all non-commercial use is free. The Pro version, which will stay at $99, will add more features, including offline results, automation from the command line and a portable version. For the next two weeks, Primate Labs will sell the Pro version 20% off, or $79. Licenses from Geekbench Pro won&apos;t carry over, so you&apos;ll need a new one.<br><br>We use Geekbench on our laptop and gaming PC benchmarks, so expect Geekbench 6 to pop up on Tom&apos;s Hardware soon, once we&apos;ve gathered enough comparison data to make it useful.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Create a Bluetooth Raspberry Pi Camera Trigger ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/bluetooth-raspberry-pi-camera-trigger</link>
                                                                            <description>
                            <![CDATA[ Use your smartphone to trigger the Raspberry Pi Camera Module 3 to take photos using a simple Python library and accompanying Android app. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">3gGFZhBA7FQk4a44zqAL2C</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/KAvWmcjTwS8BFc2fRSHvei-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Sun, 29 Jan 2023 13:00:42 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:26 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/KAvWmcjTwS8BFc2fRSHvei-1280-80.png">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Bluetooth Raspberry Pi Camera Trigger]]></media:description>                                                            <media:text><![CDATA[Bluetooth Raspberry Pi Camera Trigger]]></media:text>
                                <media:title type="plain"><![CDATA[Bluetooth Raspberry Pi Camera Trigger]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/KAvWmcjTwS8BFc2fRSHvei-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>The new Raspberry Pi Camera Module 3 offers exceptional image quality and a choice between a standard (75 degrees) and wide (120 degrees) lenses. Best of all, we now have autofocus. <a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2"><u>Taking pictures with the Picamera2</u></a> is easy, but sometimes we just want to press a button and take a picture, and appear in the shot!</p><p>In this project we will use Blue Dot, a Python module and Android app to create a Bluetooth controlled camera trigger. Thanks to Blue Dot’s easy to use library and Picamera2’s verbose structure we will be capturing 1080p photos via a small amount of code.</p><h2 id="for-this-project-you-will-need-3">For This Project You Will Need</h2><ul><li>A Raspberry Pi 3 or 4</li><li>A Raspberry Pi Camera</li><li>An Android device</li></ul><h2 id="installing-the-raspberry-pi-camera-module">Installing the Raspberry Pi Camera Module</h2><p> 1. <strong>Open the camera port </strong>by gently lifting the plastic lock upwards.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:970px;"><p class="vanilla-image-block" style="padding-top:67.73%;"><img id="" name="image2.jpg" alt="Raspberry Pi Camera Module" src="https://cdn.mos.cms.futurecdn.net/SicbAR2BQiunq59Qk64S4M.jpg" mos="" align="middle" fullscreen="1" width="970" height="657" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/SicbAR2BQiunq59Qk64S4M.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Insert the ribbon connector with the blue tab facing the USB / Ethernet ports.</strong> Raspberry Pi Zero users will need to use an adapter and connect the camera to the port on the right side of the board.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:970px;"><p class="vanilla-image-block" style="padding-top:66.80%;"><img id="" name="image1.jpg" alt="Raspberry Pi Camera Module" src="https://cdn.mos.cms.futurecdn.net/fKvdcHCxXUTdrb5wotaruL.jpg" mos="" align="middle" fullscreen="1" width="970" height="648" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/fKvdcHCxXUTdrb5wotaruL.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Close the lock on the connector</strong> and give it a very gentle pull to make sure it is in place.</p><p>4. Power up the Raspberry Pi to the desktop. <strong>Open a terminal and install the latest Picamera updates.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>sudo apt update && sudo apt upgrade -y</code></pre><p>5. <strong>From the terminal, check that your camera is working properly. </strong>The libcamera command is handy for quickly checking that our camera is connected and working as expected.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>libcamera-hello</code></pre><h2 id="installing-blue-dot">Installing Blue Dot</h2><p>Blue Dot is the creation of Martin O’Hanlon and it provides a truly simple means to remotely control a Raspberry Pi. The name “Blue Dot” represents the large, blue dot that dominates the Android device’s screen. We’re going to use Blue Dot as a large, blue button to trigger the camera to take a picture.</p><p>1. <strong>On your Android device open the Google Play Store and search for Blue Dot.</strong> Alternatively <a href="https://play.google.com/store/apps/details?id=com.stuffaboutcode.bluedot&hl=en&gl=US"><u>follow this link.</u></a></p><p>2. <strong>Install Blue Dot on your Android device.</strong></p><p>3. On your Raspberry Pi,<strong> open a terminal and install Blue Dot’s Python library.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>sudo pip3 install bluedot</code></pre><p>4. <strong>Go to the Bluetooth menu, right click and select “Make Discoverable”.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:370px;"><p class="vanilla-image-block" style="padding-top:57.57%;"><img id="" name="bt1.jpg" alt="Bluetooth Raspberry Pi Camera Trigger" src="https://cdn.mos.cms.futurecdn.net/ZaYQbmgNaGR9JZE7faxJ8i.jpg" mos="" align="middle" fullscreen="1" width="370" height="213" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ZaYQbmgNaGR9JZE7faxJ8i.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>On your Android device go to the Settings >> Connected devices and select Pair New Device.</strong></p><p>6. <strong>Select “raspberrypi” and follow the pairing instructions.</strong> If your Raspberry Pi has a different hostname, then “raspberrypi” will not appear, look for your hostname.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1080px;"><p class="vanilla-image-block" style="padding-top:91.20%;"><img id="" name="an1.png" alt="Bluetooth Raspberry Pi Camera Trigger" src="https://cdn.mos.cms.futurecdn.net/vvmRyE5kYmZhmXwWDzD3gh.png" mos="" align="middle" fullscreen="1" width="1080" height="985" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/vvmRyE5kYmZhmXwWDzD3gh.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>With our Android device and Raspberry Pi now connected we will write a quick Python script to check that Blue Dot can communicate between the two devices.</p><p>1. <strong>Open Thonny</strong>, found in the main menu under Programming.</p><p>2. <strong>Create a new file and import the Blue Dot Python library.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>from bluedot import BlueDot</code></pre><p>3. <strong>Create an object, bd, </strong>that we will use to work with the library.</p><pre class="line-numbers language-bash" language="bash" ><code>sudo pip3 install bluedot</code></pre><p>4. <strong>Wait for the user to press the blue button. </strong>This line of Python is a blocker. It will wait until the user interacts. When that happens the code moves to the next line.</p><pre class="line-numbers language-bash" language="bash" ><code>bd.wait_for_press()</code></pre><p>5. <strong>Print a message to the Python shell.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>print("You pressed the blue dot!")</code></pre><p>6. <strong>Save the code as bd-test.py and click Run.</strong> The code will wait for a connection from our Android device.</p><p>7. <strong>On your Android device, open Blue Dot.</strong></p><p>8.<strong> Select the hostname of your Raspberry Pi.</strong> Typically this is “raspberrypi”. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1076px;"><p class="vanilla-image-block" style="padding-top:138.66%;"><img id="" name="an2.jpg" alt="Bluetooth Raspberry Pi Camera Trigger" src="https://cdn.mos.cms.futurecdn.net/WzGzQMk2mc2RaSH7crkRoh.jpg" mos="" align="middle" fullscreen="1" width="1076" height="1492" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/WzGzQMk2mc2RaSH7crkRoh.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>9. <strong>Click on the Blue Dot to trigger the Python code into action. </strong>You should see a message in the Python shell.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:540px;"><p class="vanilla-image-block" style="padding-top:200.00%;"><img id="" name="an3_small.jpg" alt="Bluetooth Raspberry Pi Camera Trigger" src="https://cdn.mos.cms.futurecdn.net/VY6jhqDWBynRGa5gFfmc2i.jpg" mos="" align="middle" fullscreen="1" width="540" height="1080" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/VY6jhqDWBynRGa5gFfmc2i.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-test-code-listing">Complete Test Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>from bluedot import BlueDotbd = BlueDot()bd.wait_for_press()print("You pressed the blue dot!")</code></pre><h2 id="creating-a-camera-trigger-with-blue-dot">Creating a Camera Trigger with Blue Dot</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="" name="final.png" alt="Bluetooth Raspberry Pi Camera Trigger" src="https://cdn.mos.cms.futurecdn.net/8gjVGkKKGdBTWwmLhomKMi.png" mos="" align="middle" fullscreen="1" width="1920" height="1080" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/8gjVGkKKGdBTWwmLhomKMi.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>The goal of this project is to create a camera trigger with Blue Dot. When the button is pressed a function is launched on the Raspberry Pi which handles taking a photograph.</p><p>1. <strong>Create a new file and import the Blue Dot Python library.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>from bluedot import BlueDot</code></pre><p>2. <strong>Import Picamera2 and libcamera. </strong>The preview class is used to generate preview windows, useful for framing a shot. The controls class from libcamera enables us to use autofocus with the new Camera Module 3.</p><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2, Previewfrom libcamera import controls</code></pre><p>3. <strong>Import the pause function from signal and then the time library.</strong> Pause will be used to stop the code from exiting. Time will delay the code after a preview window is created, giving us time to frame a shot.</p><pre class="line-numbers language-bash" language="bash" ><code>from signal import pauseimport time</code></pre><p>4. <strong>Create an object, bd, </strong>that we will use to work with the library.</p><pre class="line-numbers language-bash" language="bash" ><code>bd = BlueDot()</code></pre><p>5. <strong>Create an object, picam2, </strong>that will enable us to easily use the Picamera2 library.</p><pre class="line-numbers language-bash" language="bash" ><code>picam2 = Picamera2()</code></pre><p>6. <strong>Define a function, take_picture() that will be used to take a picture.</strong> Functions work by calling their name, this triggers the function to run through all of the steps within it.</p><p>7. <strong>Create a configuration for the camera to take still images. </strong>This sets the image size to 1080p, while preview windows will be 720p.</p><pre class="line-numbers language-bash" language="bash" ><code>   camera_config = picam2.create_still_configuration(main={"size": (1920, 1080)}, lores={"size": (1280, 720)}, display="lores")</code></pre><p>8. <strong>Set Picamera2 to use the new configuration.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   picam2.configure(camera_config)</code></pre><p>9. <strong>Start a preview window with a 720p resolution. </strong>We set the position using X and Y coordinates, otherwise it defaults to 0,0. Tweak this to meet your needs.</p><pre class="line-numbers language-bash" language="bash" ><code>   picam2.start_preview(Preview.QTGL, x=100, y=200, width=1280, height=720)</code></pre><p>10. <strong>Show the preview window</strong>.</p><pre class="line-numbers language-bash" language="bash" ><code>   picam2.start(show_preview=True)</code></pre><p>11. <strong>Set the camera to use continuous autofocus.</strong> Note, this only works with the Camera Module 3.</p><pre class="line-numbers language-bash" language="bash" ><code>   picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous})</code></pre><p>12. <strong>Pause for two seconds before capturing the image to a file called picam1.jpg.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   time.sleep(2)   picam2.capture_file("picam1.jpg")</code></pre><p>13. <strong>Close the preview window and then stop Picamera2.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   picam2.stop_preview()   picam2.stop()</code></pre><p>14. Out of the function, <strong>use Blue Dot’s “when_pressed” function to react to user input by running the take_picture function.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>bd.when_pressed = take_picture</code></pre><p>15. <strong>Use pause to prevent the code from exiting.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>pause()</code></pre><p>16. <strong>Save the code as bluedot_camera.py and click Run</strong> to start the code. You will see that the code waits for the Android device to connect.</p><p>17. On your Android device,<strong> open Blue Dot.</strong></p><p>18.<strong> Select the hostname of your Raspberry Pi.</strong> Typically this is “raspberrypi”.</p><p>19. <strong>Click on the Blue Dot </strong>to trigger the camera. You will see the preview window appear and then, two seconds later, an image will be saved to the micro SD card. Repeated presses will create a new image, but as the filename is the same it will overwrite each time.</p><h2 id="complete-code-listing-4">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>from bluedot import BlueDotfrom picamera2 import Picamera2, Previewfrom libcamera import controlsfrom signal import pauseimport timebd = BlueDot()picam2 = Picamera2()def take_picture():   camera_config = picam2.create_still_configuration(main={"size": (1920, 1080)}, lores={"size": (1280, 720)}, display="lores")   picam2.configure(camera_config)   picam2.start_preview(Preview.QTGL, x=100, y=200, width=1280, height=720)   picam2.start(show_preview=True)   picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous})   time.sleep(2)   picam2.capture_file("picam1.jpg")   picam2.stop_preview()   picam2.stop()bd.when_pressed = take_picturepause()</code></pre>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Run ChatGPT on Raspberry Pi or PC ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/run-chatgpt-on-raspberry-pi</link>
                                                                            <description>
                            <![CDATA[ Use the power of ChatGPT’s AI on the humble Raspberry Pi, all thanks to a clever Python library and a few lines of code. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">cJwGRxDa3mf8hCMgBRTNjX</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/yYBLXFCiiY7x9vhBennGMb-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Mon, 23 Jan 2023 12:00:57 +0000</pubDate>                                                                                                                                <updated>Thu, 21 Aug 2025 08:56:35 +0000</updated>
                                                                                                                                            <category><![CDATA[Artificial Intelligence]]></category>
                                                    <category><![CDATA[Tech Industry]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/yYBLXFCiiY7x9vhBennGMb-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[ChatGPT on Raspberry Pi]]></media:description>                                                            <media:text><![CDATA[ChatGPT on Raspberry Pi]]></media:text>
                                <media:title type="plain"><![CDATA[ChatGPT on Raspberry Pi]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/yYBLXFCiiY7x9vhBennGMb-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>You will not have missed the frenzy of excitement surrounding ChatGPT (Chat Generative-Pre-Trained Transformer). It can create images, write code, songs, poetry and try to solve our problems, big or small. It may not know how to beat Star Trek’s Kobayashi Maru simulation, but it can write Python and Bash code with ease. At a push it can also be used to write <a href="https://www.tomshardware.com/how-to/g-code-modify-3d-print-files"><u>G-Code</u></a> for the <a href="https://www.tomshardware.com/best-picks/best-3d-printers"><u>best 3D printers</u></a> though we have yet to try it on our <a href="https://www.tomshardware.com/reviews/creality-ender-2-pro"><u>Creality Ender 2 Pro</u></a>.</p><p>Typically we interact with ChatGPT via the browser, but in this how to, we will use a special Python library that will connect our humble <a href="https://www.tomshardware.com/news/raspberry-pi"><u>Raspberry Pi</u></a> to the powerful AI and provide us with a tool to answer almost any question. This project is not exclusive to Raspberry Pi; it can also be used with Windows, macOS and Linux PCs. If you can run Python on it, then chances are this project will also work. </p><p>If you are using a Raspberry Pi then you can use almost any model with this project as we are simply making requests over an Internet connection. However, for the smoothest performance overall, we recommend a <a href="https://www.tomshardware.com/reviews/raspberry-pi-5">Raspberry Pi 5</a> or <a href="https://www.tomshardware.com/reviews/raspberry-pi-4"><u>Raspberry Pi 4</u></a>.</p><h2 id="setting-up-chatgpt-api-key-for-raspberry-pi">Setting Up ChatGPT API Key for Raspberry Pi</h2><p>Before we can use ChatGPT with our Raspberry Pi and Python we first need to set up an API key. This key will enable our code to connect to our OpenAI account and use AI to answer queries, write code, write poetry or create the next hit song.</p><p>1. <a href="https://openai.com/api/"><u><strong>Login to your OpenAI account.</strong></u></a></p><p>2. Click on the menu and select <strong>View API Keys.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:248px;"><p class="vanilla-image-block" style="padding-top:143.55%;"><img id="" name="api1.jpg" alt="ChatGPT on Raspberry Pi" src="https://cdn.mos.cms.futurecdn.net/aZ2LikKLawpNfVt83oH7qa.jpg" mos="" align="middle" fullscreen="1" width="248" height="356" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/aZ2LikKLawpNfVt83oH7qa.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Click on Create new secret key to generate an API key. </strong>Make sure to copy and paste this key somewhere safe, it will not be shown again. Never share your API keys, they are unique to your account, any costs incurred will come from your account.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:820px;"><p class="vanilla-image-block" style="padding-top:43.29%;"><img id="" name="api2.jpg" alt="ChatGPT on Raspberry Pi" src="https://cdn.mos.cms.futurecdn.net/eNVVGSDVmrBmGpAXsudF9b.jpg" mos="" align="middle" fullscreen="1" width="820" height="355" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/eNVVGSDVmrBmGpAXsudF9b.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="installing-the-chatgpt-python-api-on-raspberry-pi">Installing the ChatGPT Python API on Raspberry Pi</h2><p>With our API key in hand we can now configure our Raspberry Pi and specifically Python to use the API via the openAI Python library.</p><p>1. <strong>Open a Terminal and update the software on your Raspberry Pi.</strong> This command is two-fold. First it runs an update, checking that the list of software repositories on our Pi is up to date. If not, then it downloads the latest details. The “&&” means that if the first command (update) runs cleanly, then the second command where we upgrade the software will begin. The “-y” flag is used to accept the installation with no user input.</p><pre class="line-numbers language-bash" language="bash" ><code>sudo apt update && sudo apt upgrade -y</code></pre><p>2. <strong>Install the openai Python library using the pip package manager.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>pip3 install openai</code></pre><p>3. <strong>Open the bashrc file hidden in your home directory.</strong> This file is where we need to set a path, a location where Raspberry Pi OS and Python can look for executable / configuration files.</p><pre class="line-numbers language-bash" language="bash" ><code>nano ~/.bashrc</code></pre><p>4. <strong>Using the keyboard, scroll to the bottom of the file and add this line.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>export PATH="$HOME/.local/bin:$PATH"</code></pre><p>5. <strong>Save the file by pressing CTRL + X, then Y and Enter.</strong></p><p>6. <strong>Reload the bashrc config to finish the configuration. Then close the terminal.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>source ~/.bashrc</code></pre><h2 id="creating-a-chatgpt-chatbot-for-raspberry-pi">Creating a ChatGPT Chatbot for Raspberry Pi</h2><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/HSneHDoLS3hHTdfVXjxqcb.png" alt="ChatGPT on Raspberry Pi" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/S5o2ejvDKGjDpUrLgR8tyb.png" alt="ChatGPT on Raspberry Pi" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/X7aJDaortaPKcf9y9Fghib.png" alt="ChatGPT on Raspberry Pi" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure></figure><p>The goal of our chatbot is to respond to questions set by the user. As long as the response can be in text format, this project code will work. When the user is finished, they can type in a word to exit, or press CTRL+C to stop the code. We tested it with facts and trivia questions, then asked it to write Python code, Bash and a little G-Code for a 3D printer.</p><p>1. <strong>Launch Thonny</strong>, a built-in Python editor<strong>. </strong>You can find it on the Raspberry Pi menu, under Programming >> Thonny.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:547px;"><p class="vanilla-image-block" style="padding-top:77.51%;"><img id="" name="thonny1.jpg" alt="ChatGPT on Raspberry Pi" src="https://cdn.mos.cms.futurecdn.net/i9ARVmQGNJZA7YE8HLJuJc.jpg" mos="" align="middle" fullscreen="1" width="547" height="424" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/i9ARVmQGNJZA7YE8HLJuJc.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Import the openai library. </strong>This enables our Python code to go online and ChatGPT.</p><pre class="line-numbers language-bash" language="bash" ><code>import openai</code></pre><p>3. <strong>Create an object, model_engine and in there store your preferred model.</strong> davinci-003 is the most capable, but we can also use (in order of capability) “text-curie-001”, “text-babbage-001” and “text-ada-001”. The ada model has the lowest token cost.</p><pre class="line-numbers language-bash" language="bash" ><code>model_engine = "text-davinci-003"</code></pre><p>4. <strong>Create an object, open.api_key and store your API key. Paste your API key between the quotation marks.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>openai.api_key = "YOUR API KEY HERE”</code></pre><p>5. <strong>Create a function, GPT() which takes the query (question) from the user as an argument. </strong>This means we can reuse the function for any question.</p><pre class="line-numbers language-bash" language="bash" ><code>def GPT(query):</code></pre><p>6. <strong>Create a response object that will pass the details of our query to ChatGPT.</strong> It uses our chosen model and query to ask the question. We set the maximum token spend to 1024, but in reality, we will spend far less so this can be tweaked. The “temperature” controls how creative the responses can be. The higher the value, say 0.9, the more creative the model will try to be. 0.5 is a good mix of creative and factual.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   response = openai.Completion.create(       engine=model_engine,       prompt=query,       max_tokens=1024,       temperature=0.5,   )</code></pre><p>7. <strong>Return the data from ChatGPT, stripping out the response text, and the number of tokens used. </strong>The returned data is in a dictionary / JSON format so we need to specifically target the correct data using keys. These keys return the associated values.</p><pre class="line-numbers language-bash" language="bash" ><code>   return str.strip(response['choices'][0]['text']), response['usage']['total_tokens']</code></pre><p>8. <strong>Create a tuple and use it to store a list of strings that can be used to exit the chat. </strong>Tuples are immutable, meaning that they can be created and destroyed, but not updated by the running code. They make perfect “set and forget” configurations.</p><pre class="line-numbers language-bash" language="bash" ><code>exit_words = ("q","Q","quit","QUIT","EXIT")</code></pre><p>9. <strong>Use a try, followed by while True: to instruct Python to try and run our code, and to do so forever.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>try:   while True:</code></pre><p>10. <strong>Print an instruction to the user</strong>, in this case how to exit the chat.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>       print("Type q, Q, quit, QUIT or EXIT and press Enter to end the chat session")</code></pre><p>11. <strong>Capture the user query, using a custom prompt and store in an object called query.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>       query = input("What is your question?> ")</code></pre><p>12. <strong>Use a conditional test to check if any of the exit_words are solely present in the query. </strong>We can use these words in a query, but if they are the only words, then the chat will end.</p><pre class="line-numbers language-bash" language="bash" ><code>       if query in exit_words:</code></pre><p>13. <strong>Set it so that, </strong>if the exit_words are present, <strong>the code will print “ENDING CHAT” </strong>and <strong>then use break to stop the code.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>           print("ENDING CHAT")           break</code></pre><p>14. <strong>Create an else condition. </strong>This condition will always run if no exit_words are found.</p><pre class="line-numbers language-bash" language="bash" ><code>       else:</code></pre><p>15. <strong>Run the ChatGPT query </strong>and <strong>save the output to two objects, res (response) and usage (tokens used).</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>           (res, usage) = GPT(query)</code></pre><p>16. <strong>Print the ChatGPT response to the Python shell.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>           print(res)</code></pre><p>17. <strong>Print 20 = in a row to create a barrier between the ChatGPT text and then print the number of tokens used.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>           print("="*20)           print("You have used %s tokens" % usage)           print("="*20)</code></pre><p>18. <strong>Create an exception handler that will activate if the user hits CTRL+C.</strong> It will print an exit message to the Python shell before the code exits.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>except KeyboardInterrupt:   print("\nExiting ChatGPT")</code></pre><p>19. <strong>Save the code as ChatGPT-Chatbot.py </strong>and <strong>click Run to start.</strong> Ask your questions to the chatbot, and when done type one of the exit_words or press CTRL+C to exit.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="" name="Prompt.png" alt="ChatGPT on Raspberry Pi" src="https://cdn.mos.cms.futurecdn.net/nvTMtobVVoRtJXuq6Rai7c.png" mos="" align="middle" fullscreen="1" width="1920" height="1080" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/nvTMtobVVoRtJXuq6Rai7c.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-code-listing-5">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import openaimodel_engine = "text-davinci-003"openai.api_key = "YOUR API KEY HERE"def GPT(query):   response = openai.Completion.create(       engine=model_engine,       prompt=query,       max_tokens=1024,       temperature=0.5,   )   return str.strip(response['choices'][0]['text']), response['usage']['total_tokens']exit_words = ("q","Q","quit","QUIT","EXIT")try:   while True:       print("Type q, Q, quit, QUIT or EXIT and press Enter to end the chat session")       query = input("What is your question?> ")       if query in exit_words:           print("ENDING CHAT")           break       else:           (res, usage) = GPT(query)           print(res)           print("="*20)           print("You have used %s tokens" % usage)           print("="*20)except KeyboardInterrupt:   print("\nExiting ChatGPT")</code></pre>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Use Raspberry Pi Camera Module 3 with Python Code ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2</link>
                                                                            <description>
                            <![CDATA[ The Raspberry Pi Camera Module 3 brings autofocus and HDR images to the oldest Raspberry Pi accessory and we show you how to take the best pictures with the latest camera. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">DMiLLZH6a7zghweYUSVsfX</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/iYTY3Lkyu3aJJWPqYa3YfA-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sat, 14 Jan 2023 12:00:54 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:29 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/iYTY3Lkyu3aJJWPqYa3YfA-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Raspberry Pi Camera Module 3 with Python Code]]></media:description>                                                            <media:text><![CDATA[Raspberry Pi Camera Module 3 with Python Code]]></media:text>
                                <media:title type="plain"><![CDATA[Raspberry Pi Camera Module 3 with Python Code]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/iYTY3Lkyu3aJJWPqYa3YfA-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>The <a href="https://www.tomshardware.com/news/raspberry-pi"><u>Raspberry Pi</u></a> has many of the<a href="https://www.tomshardware.com/best-picks/best-raspberry-pi-accessories"><u> best accessories</u></a> and one that is sure to appear on that list is the new Camera Module 3. In <a href="https://www.tomshardware.com/reviews/raspberry-pi-camera-module-v3"><u>our Raspberry Pi Camera Module 3 review</u></a>, we said that we love the fast autofocus and HDR images and we want to share these features with you in this how to. </p><p>If you have never used a Raspberry Pi camera before, our <a href="https://www.tomshardware.com/how-to/use-picamera2-take-photos-with-raspberry-pi"><u>beginner&apos;s guide to Picamera2</u></a> is a great primer to get your Pi taking great pictures. In this how to, we shall explore the many ways that we can use the Camera Module 3’s focus system with Picamera2 and learn how to take HDR images with a quick and simple script that automates the process. If Python isn’t your thing then the Camera Module 3 can also be controlled using <a href="https://www.tomshardware.com/how-to/use-raspberry-pi-camera-with-bullseye"><u>libcamera via the terminal.</u></a></p><h2 id="getting-to-know-autofocus">Getting to Know Autofocus</h2><p>Autofocus has three modes in which it operates.</p><ul><li><strong>Manual:</strong> Requiring the user to specify the LensPosition control to alter the focus of the lens. A value of zero will produce an infinite focus. Values up to 10 are accepted with 10 setting the focus to 1/10 of a meter (10CM).</li><li><strong>Auto: </strong>The typical autofocus which uses AfTrigger to start an autofocus cycle.</li><li><strong>Continuous: </strong>The camera will hunt for a target, refocusing on the target when the algorithm detects it.</li></ul><h2 id="project-1-using-continuous-focus">Project 1: Using Continuous Focus</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:622px;"><p class="vanilla-image-block" style="padding-top:56.11%;"><img id="" name="aftest.gif" alt="Raspberry Pi Camera Module 3 with Python Code" src="https://cdn.mos.cms.futurecdn.net/PA2e3RkaFqb6qi3eBnYFVC.gif" mos="" align="middle" fullscreen="1" width="622" height="349" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/PA2e3RkaFqb6qi3eBnYFVC.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Continuous focus uses an algorithm to search the image stream for a target. It doesn’t matter if the target is near (around 10cm) or far, the algorithm will find the target and lock on. But how do we use it? Let&apos;s run a quick test. We’ll use a continuous focus mode to hunt for the best possible focus on our target. It would be useful to have an object that you can hold to the camera, we used a dollar bill.</p><p>1. <strong>From the main menu open Programming >> Thonny.</strong></p><p>2. <strong>Import Picamera2.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2</code></pre><p>3. <strong>Import libcamera’s controls class.</strong> With this we can configure the camera to suit our requirements.</p><pre class="line-numbers language-bash" language="bash" ><code>from libcamera import controls</code></pre><p>4. <strong>Create an object, picam2</strong> which we will use as a link between the code and our camera.</p><pre class="line-numbers language-bash" language="bash" ><code>picam2 = Picamera2()</code></pre><p>5. <strong>Start a preview window.</strong> The preview is where we see the output of the camera.</p><pre class="line-numbers language-bash" language="bash" ><code>picam2.start(show_preview=True)</code></pre><p>6. <strong>Set the AfMode (Autofocus Mode) to be continuous.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous})</code></pre><p>7. <strong>Save the code as AFtest.py.</strong></p><p>8. <strong>Click Run to start the code.</strong> A preview window will appear. Move an object, we chose a dollar bill, around the frame and watch as the focus shifts. Try moving the object nearer to the lens, remember that the nearest focus point is 10 centimeters.</p><h2 id="complete-code-listing-6">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2from libcamera import controlspicam2 = Picamera2()picam2.start(show_preview=True)picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous})</code></pre><h2 id="project-2-setting-the-focus-manually">Project 2: Setting the Focus Manually</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1200px;"><p class="vanilla-image-block" style="padding-top:55.83%;"><img id="" name="man-focus.gif" alt="Raspberry Pi Camera Module 3 with Python Code" src="https://cdn.mos.cms.futurecdn.net/EWuerXDWd3ToKkEv7SNgsB.gif" mos="" align="middle" fullscreen="1" width="1200" height="670" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/EWuerXDWd3ToKkEv7SNgsB.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Sometimes a fixed focus is what we need to get that great shot. After all, we don’t want to capture a blurry mess. Fixing the focus is relatively straightforward; in fact it is so easy that we can reuse most of the code from the previous example.</p><p>1. <strong>Use Save As </strong>on the previous example t<strong>o create a new file called ManualFocusTest.py</strong></p><p>2. <strong>Change the last line to use LensPosition</strong>, in this case set the value to 0.0 for an infinite focus.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.set_controls({"AfMode": controls.AfModeEnum.Manual, "LensPosition": 0.0})</code></pre><p>3. <strong>Run the code.</strong> Notice how the focus is sharp for objects far away, but close up they are blurred.</p><p>4. <strong>Change the LensPosition value to 0.5.</strong> This will give us approximately a 50 cm focal distance.</p><p>5. <strong>Save and run the code.</strong> Move an object towards and from the camera. Notice how the focus becomes sharp around 50 cm.</p><h2 id="complete-code-listing-7">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2from libcamera import controlspicam2 = Picamera2()picam2.start(show_preview=True)picam2.set_controls({"AfMode": controls.AfModeEnum.Manual, "LensPosition": 0.5})</code></pre><h2 id="project-3-fast-focus-for-multiple-images">Project 3: Fast Focus for Multiple Images</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:622px;"><p class="vanilla-image-block" style="padding-top:56.11%;"><img id="" name="fastfocus.gif" alt="Raspberry Pi Camera Module 3 with Python Code" src="https://cdn.mos.cms.futurecdn.net/7jLSWbMuVmuC5Gk2n4UxE8.gif" mos="" align="middle" fullscreen="1" width="622" height="349" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/7jLSWbMuVmuC5Gk2n4UxE8.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Be it a bird cam, school sports day or home security, sometimes we need to get a series of sharp images. Luckily we can set the Camera Module 3 to take a series of rapid images and set the autofocus to high speed.</p><p>1. <strong>Create a new file called AfFastFocus.py</strong></p><p>2.<strong> Import Picamera2.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2</code></pre><p>3. <strong>Import libcamera’s controls class.</strong> With this we can configure the camera to suit our requirements.</p><pre class="line-numbers language-bash" language="bash" ><code>from libcamera import controls</code></pre><p>4. <strong>Create an object, picam2</strong> which we will use as a link between the code and our camera.</p><pre class="line-numbers language-bash" language="bash" ><code>picam2 = Picamera2()</code></pre><p>5. <strong>Start a preview window.</strong> The preview is where we see the output of the camera.</p><pre class="line-numbers language-bash" language="bash" ><code>picam2.start(show_preview=True)</code></pre><p>6. <strong>Set the autofocus mode to Continuous and set the AfSpeed to Fast.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous, "AfSpeed": controls.AfSpeedEnum.Fast})</code></pre><p>7. <strong>Set the camera to capture three files, with a delay of half a second between each shot. </strong>The filename “fastfocus.jpg” will append 0, then 1 and 2 to each file. Giving us three files in numerical order.</p><pre class="line-numbers language-bash" language="bash" ><code>picam2.start_and_capture_files("fastfocus{:d}.jpg", num_files=3, delay=0.5)</code></pre><p>8. <strong>Close the preview window.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.stop_preview()</code></pre><p>9. <strong>Close the camera connection.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.stop()</code></pre><p>10. <strong>Save and run the code.</strong> Hold an object at three different distances to the camera and watch as the focus changes, the preview window freezes as the camera takes a shot, then releases for the next shot. Once three shots are taken, the preview window will close.</p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/j8R5rePVDJGgNKggEypWR8.jpg" alt="Raspberry Pi Camera Module 3 with Python Code" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/KDZtjp2VsCZX5NVhVqJmd8.jpg" alt="Raspberry Pi Camera Module 3 with Python Code" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/Gny35W2wsWvzJ8yRFcsAr8.jpg" alt="Raspberry Pi Camera Module 3 with Python Code" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure></figure><h2 id="complete-code-listing-8">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2from libcamera import controlspicam2 = Picamera2()picam2.start(show_preview=True)picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous, "AfSpeed": controls.AfSpeedEnum.Fast})picam2.start_and_capture_files("fastfocus-test{:d}.jpg", num_files=3, delay=0.5)picam2.stop_preview()picam2.stop()</code></pre><h2 id="capturing-an-hdr-image-with-picamera2">Capturing an HDR Image With Picamera2</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:622px;"><p class="vanilla-image-block" style="padding-top:56.11%;"><img id="" name="HDRfastfocus.gif" alt="Raspberry Pi Camera Module 3 with Python Code" src="https://cdn.mos.cms.futurecdn.net/TJfcbAPag7WTeFHHoanu99.gif" mos="" align="middle" fullscreen="1" width="622" height="349" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/TJfcbAPag7WTeFHHoanu99.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>HDR (High Dynamic Range) images can be easily captured with<a href="https://www.tomshardware.com/how-to/use-raspberry-pi-camera-with-bullseye"><u> libcamera</u></a>. We just need to pass the –hdr argument when we run the command. But for Picamera2 we need to run a terminal command before we run our Python code. </p><p>HDR increases the dynamic luminosity range of images. With HDR we get deeper darkness and brighter images. This works by capturing multiple images of the same scene, each with different exposures. These images are then combined into a single image which encompasses the entire range. Camera  Module 3 can capture HDR images, but not at the full 12MP resolution. Instead we get a 3MP image with a resolution of 2304 x 1296 pixels.</p><p>For our test we are going to reuse the code from the <strong>AfFastFocus.py </strong>project, to capture a series of HDR images. We will also use Python’s OS library to run a terminal command that will turn on and off the HDR setting with no user interaction. This means we will not forget to turn on and off the HDR settings.</p><p>1. <strong>Create a new file called HDRAfFastFocus.py</strong></p><p>2. <strong>Import Picamera2.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2</code></pre><p>3. <strong>Import libcamera’s controls class.</strong> With this we can configure the camera to suit our requirements.</p><pre class="line-numbers language-bash" language="bash" ><code>from libcamera import controls</code></pre><p>4. <strong>Import the OS module</strong>. This enables our code to interact with the underlying operating system, in this case Raspberry Pi OS (Linux).</p><pre class="line-numbers language-bash" language="bash" ><code>import os</code></pre><p>5. <strong>Create an object, picam2</strong> which we will use as a link between the code and our camera.</p><pre class="line-numbers language-bash" language="bash" ><code>picam2 = Picamera2()</code></pre><p>6. <strong>Use the system function from the os module to set the camera to use HDR. </strong>Picamera2 supports HDR, but not directly in the module. The issue is with V4L2, the kernel interface between the camera and the Linux video system. Right now, it does not offer ready support for HDR with this camera so we have to run this quick workaround to make it available in Picamera2.</p><p>7. <strong>Print a message to the Python Shell</strong> informing us that HDR is on.</p><pre class="line-numbers language-bash" language="bash" ><code>print("Setting HDR to ON")</code></pre><p>8. <strong>Start a preview window.</strong> The preview is where we see the output of the camera.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.start(show_preview=True)</code></pre><p>9. <strong>Set the autofocus mode to Continuous</strong> and <strong>set the AfSpeed to Fast</strong>.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous, "AfSpeed": controls.AfSpeedEnum.Fast})</code></pre><p>10. <strong>Set the camera to capture three files, with a delay of one second between each shot. </strong>The filename “HDRfastfocus.jpg will append 0, then 1 and 2 to each file. Giving us three files in numerical order. We double the delay between each shot to give the camera time to save the previous image and then set the focus for the next image. We tested it with a 0.5 delay and our shots were sometimes a little too blurred.</p><pre class="line-numbers language-bash" language="bash" ><code>picam2.start_and_capture_files("HDRfastfocus{:d}.jpg", num_files=3, delay=1)</code></pre><p>11. <strong>Close the preview window.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.stop_preview()</code></pre><p>12. <strong>Close the camera connection.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.stop()</code></pre><p>13. <strong>Print a message to the user</strong> that HDR is now off, and then run the command using os.system.</p><pre class="line-numbers language-bash" language="bash" ><code>print("Setting HDR to OFF")os.system("v4l2-ctl --set-ctrl wide_dynamic_range=0 -d /dev/v4l-subdev0")</code></pre><p>14. <strong>Save and run the code.</strong> Hold an object at three different distances to the camera and watch as the focus changes, the preview window freezes as the camera takes a shot, then releases for the next shot. Once three shots are taken, the preview window will close.</p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/RDhTetQL2TLa99QQcx5zQ9.jpg" alt="Raspberry Pi Camera Module 3 with Python Code" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/n6gMUAqzF6i2BJK729ocBA.jpg" alt="Raspberry Pi Camera Module 3 with Python Code" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/XKquQ6zxFRNZbE4ykUGqTA.jpg" alt="Raspberry Pi Camera Module 3 with Python Code" /><figcaption><small role="credit">Tom's Hardware</small></figcaption></figure></figure><h2 id="complete-code-listing-9">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2from libcamera import controlsimport ospicam2 = Picamera2()os.system("v4l2-ctl --set-ctrl wide_dynamic_range=1 -d /dev/v4l-subdev0")print("Setting HDR to ON")picam2.start(show_preview=True)picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous, "AfSpeed": controls.AfSpeedEnum.Fast})picam2.start_and_capture_files("HDRfastfocus{:d}.jpg", num_files=3, delay=1)picam2.stop_preview()picam2.stop()print("Setting HDR to OFF")os.system("v4l2-ctl --set-ctrl wide_dynamic_range=0 -d /dev/v4l-subdev0")</code></pre><h2 id="python-how-tos-6">Python How Tos</h2><ul><li><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">How To Install Python on Windows 10 and 11</a></li><li><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">How to use For Loops in Python</a></li><li><a href="https://www.tomshardware.com/how-to/enumerate-in-python">How to Enumerate in Python</a></li><li><a href="https://www.tomshardware.com/how-to/create-python-executable-applications">How to Create Executable Applications in Python</a></li><li><a href="https://www.tomshardware.com/how-to/python-remove-image-backgrounds">How To Remove Backgrounds From Images With Python</a></li><li><a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny">How to Create Web Apps with Python, HTML and Thonny</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2">How To Use Raspberry Pi Camera Module 3 with Python Code</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Monitor Temperature With a Raspberry Pi Pico ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/monitor-temperature-raspberry-pi-pico</link>
                                                                            <description>
                            <![CDATA[ The Raspberry Pi Pico is a low cost and fun way to learn Python and electronics. In this project we use both to monitor the temperature. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">j9bLpdtfbHfuqjX4ZFwHUV</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/SppAPsKGuadWmHqpJC93um-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Wed, 28 Dec 2022 12:00:51 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:32 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/SppAPsKGuadWmHqpJC93um-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Monitor Temperature With a Raspberry Pi Pico]]></media:description>                                                            <media:text><![CDATA[Monitor Temperature With a Raspberry Pi Pico]]></media:text>
                                <media:title type="plain"><![CDATA[Monitor Temperature With a Raspberry Pi Pico]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/SppAPsKGuadWmHqpJC93um-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>The <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-review"><u>Raspberry Pi Pico</u></a> is the ideal way to get into microcontrollers. Starting from $4, the board is cheap and easy to work with. The low cost and ease of use means we can easily drop them into a project without fearing the worst for our wallet.</p><p>In this how-to, we will use a Raspberry Pi Pico to capture live temperature data using a DS18B20. This sensor comes in many forms, from a bare transistor chip, to a water resistant cable. We’ll be using the latter version, which can be partially submerged in a liquid to monitor the temperature. Our project will take a temperature reading and using a conditional test in MicroPython it will trigger an LED to flash if the temperature goes below 20 degrees Celsius.</p><h2 id="for-this-project-you-will-need-4">For This Project You Will Need</h2><ul><li><a href="https://www.amazon.com/Vilros-Raspberry-Header-Basic-Starter/dp/B094195RCN">Raspberry Pi Pico</a> / Pico W</li><li><a href="https://www.amazon.com/BOJACK-DS18B20-Temperature-Stainless-Waterproof/dp/B09NVFJYPS">DS18B20 Sensor</a></li><li><a href="https://www.amazon.com/BOJACK-Lighting-Electronics-Components-Emitting/dp/B09XDMJ6KY">LED</a></li><li><a href="https://www.amazon.com/BOJACK-Values-Resistor-Resistors-Assortment/dp/B08FD1XVL6">330 Ohm Resistor</a></li><li><a href="https://www.amazon.com/BOJACK-Values-Resistor-Resistors-Assortment/dp/B08FD1XVL6">4.7K Ohm Resistor</a></li><li><a href="https://www.amazon.com/Solderless-Multicolored-Electronic-Breadboard-Protoboard/dp/B09FP517VM">5 x Male to male jumper wires</a></li><li><a href="https://www.amazon.com/Qunqi-point-Experiment-Breadboard-5-5%C3%978-2%C3%970-85cm/dp/B0135IQ0ZC">Breadboard</a></li></ul><h2 id="building-the-circuit-2">Building The Circuit</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:876px;"><p class="vanilla-image-block" style="padding-top:91.44%;"><img id="" name="DS18B20_bb.jpg" alt="Monitor Temperature With a Raspberry Pi Pico" src="https://cdn.mos.cms.futurecdn.net/2YzG92xgNb3sCB9E9xpMfm.jpg" mos="" align="middle" fullscreen="1" width="876" height="801" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/2YzG92xgNb3sCB9E9xpMfm.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>The circuit is made up of two parts. The DS18B20 temperature sensor, and the LED. We’ll break them down into two sections.</p><p>The DS18B20 has three connections to the Raspberry Pi Pico.</p><div ><table><thead><tr><th class="firstcol " >Raspberry Pi Pico</th><th  >Wire Color</th><th  >DS18B20</th></tr></thead><tbody><tr><td class="firstcol " >3V3</td><td  >Red</td><td  >VDD</td></tr><tr><td class="firstcol " >GPIO26</td><td  >Yellow</td><td  >Data</td></tr><tr><td class="firstcol " >GND</td><td  >Black</td><td  >GND</td></tr></tbody></table></div><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1190px;"><p class="vanilla-image-block" style="padding-top:63.19%;"><img id="" name="DS18B20 Circuit.jpg" alt="Monitor Temperature With a Raspberry Pi Pico" src="https://cdn.mos.cms.futurecdn.net/AR662ktiGMfZDWxd7V4RYm.jpg" mos="" align="middle" fullscreen="1" width="1190" height="752" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/AR662ktiGMfZDWxd7V4RYm.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>All three connections are made into the breadboard, and the wires are used to connect to the Pico. Between the data and 3V3 pins (yellow and red), there is a 4.7K Ohm <a href="https://www.tomshardware.com/how-to/resistor-color-codes"><u>resistor</u></a> which is used to pull the data pin high using the 3.3V supplied. This maintains a steady connection between the data pin and Pico.</p><p>The LED has only two connections to the Raspberry Pi Pico.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:647px;"><p class="vanilla-image-block" style="padding-top:86.55%;"><img id="" name="LED.jpg" alt="Monitor Temperature With a Raspberry Pi Pico" src="https://cdn.mos.cms.futurecdn.net/6ohr8j8XqDYwRruoGe3wjm.jpg" mos="" align="middle" fullscreen="1" width="647" height="560" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/6ohr8j8XqDYwRruoGe3wjm.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><div ><table><thead><tr><th class="firstcol " >Raspberry Pi Pico</th><th  >Wire Color</th><th  >LED</th></tr></thead><tbody><tr><td class="firstcol " >GPIO15</td><td  >Red</td><td  >Anode (Long leg)</td></tr><tr><td class="firstcol " >GND</td><td  >Black</td><td  >Cathode (Short leg)</td></tr></tbody></table></div><p>The LED has a 330 Ohm resistor on the cathode leg, inline with GND. This reduces the amount of current that the LED can consume.</p><h2 id="writing-the-code-3">Writing the Code</h2><p>1. <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup"><u><strong>Follow this guide</strong></u></a> to download and install the latest MicroPython release for your model of Raspberry Pi Pico. <strong>Follow the steps up to and including connecting the Raspberry Pi Pico to Thonny.</strong></p><p>2.<strong> Create a new blank project in Thonny.</strong></p><p>3. <strong>Import three modules of pre-written code. </strong>First is onewire, a module that enables the Pico to talk to the one-wire interface of the DS18B20. Next is ds18x20, a module that interprets the sensor data from the DS18B20 and provides us with human readable data. Lastly we import time which is used to pace our project code.</p><pre class="line-numbers language-bash" language="bash" ><code>import onewire, ds18x20, time</code></pre><p>4. <strong>From the Machine module import the Pin class.</strong> This will enable our code to interact with the components connected to the GPIO.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>from machine import Pin</code></pre><p>5. <strong>Create two objects, SensorPin and alert.</strong> SensorPin is the GPIO pin used to connect the data pin from the DS18B20 to the Pico. Alert is the GPIO pin that connects to the anode (long leg) of the LED.</p><pre class="line-numbers language-bash" language="bash" ><code>SensorPin = Pin(26, Pin.IN)alert = Pin(15, Pin.OUT)</code></pre><p>6. <strong>Create an object, sensor and use it to tell the ds18x20 module where to find our DS18B20 temperature sensor.</strong> This line also uses the onewire module, as that is the protocol that the sensor uses for connection.</p><pre class="line-numbers language-bash" language="bash" ><code>sensor = ds18x20.DS18X20(onewire.OneWire(SensorPin))</code></pre><p>7. <strong>Create an object, roms and use the sensor object to scan the interface to find our DS18B20 temperature sensor.</strong> All one-wire devices, such as our DS18B20, have a unique registration number stored in ROM that we need to identify before they can be used.</p><pre class="line-numbers language-bash" language="bash" ><code>roms = sensor.scan()</code></pre><p>8. <strong>Use a while True loop</strong> to run the next lines of code in a never ending loop.</p><pre class="line-numbers language-bash" language="bash" ><code>while True:</code></pre><p>9. <strong>Set the temperature reading to use Celsius. </strong>Note that the code within the while True loop is indented to show that it belongs in the loop.</p><pre class="line-numbers language-bash" language="bash" ><code>   sensor.convert_temp()</code></pre><p>10. <strong>Add a two second pause to the code. </strong>This gives the DS18B20 time to settle before we take a reading.</p><pre class="line-numbers language-bash" language="bash" ><code>   time.sleep(2)</code></pre><p>11. <strong>Use a for loop to iterate through the returned list of ROMs.</strong> As we only have one DS18B20 on the one-wire interface, only one ROM will be stored in the list that we iterate over.</p><pre class="line-numbers language-bash" language="bash" ><code>   for rom in roms:</code></pre><p>12. <strong>Create an object, temperature, and use it to store the output of reading the DS18B20 sensor. </strong>The output is wrapped in a round() function that will round the returned data to 1 decimal place.</p><pre class="line-numbers language-bash" language="bash" ><code>       temperature = round(sensor.read_temp(rom),1)</code></pre><p>13. <strong>Use a conditional test to check the value stored in the temperature object against a hard coded value. </strong>In this example, if the temperature is less than or equal to 20 Degrees Celsius then the condition will evaluate as True, and the next section of indented code will run.</p><pre class="line-numbers language-bash" language="bash" ><code>       if temperature <= 20:</code></pre><p>14. <strong>Print a message to the Python Shell that warns the user that the temper is below 20 C and include the temperature value in the sentence.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>            print("Warning the temperature is",temperature,"C")</code></pre><p>15. <strong>Use a for loop to blink the LED 10 times, with a 0.5 second delay.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>           for i in range(10):               alert.toggle()               time.sleep(0.5)</code></pre><p>16. <strong>Create an else condition that activates if the temperature is greater than 20 C</strong>. This condition will print the current temperature before ending.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>       else:           print(temperature,"C")</code></pre><p>17. <strong>Add a five second pause</strong> before ending the loop and returning back to the start of the loop.</p><pre class="line-numbers language-bash" language="bash" ><code>   time.sleep(5)</code></pre><p>18. <strong>Save the code to the Raspberry Pi Pico as TemperatureMonitor.py.</strong></p><p>19. <strong>Click on the Run icon to start the code.</strong> After a short pause the temperature details will appear in the Python shell. If the temperature is below 20 C, the LED will blink five times to warn us.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:578px;"><p class="vanilla-image-block" style="padding-top:66.26%;"><img id="" name="Shell.jpg" alt="Monitor Temperature With a Raspberry Pi Pico" src="https://cdn.mos.cms.futurecdn.net/oKaoBXdGruEFBP2tfmgJzm.jpg" mos="" align="middle" fullscreen="1" width="578" height="383" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/oKaoBXdGruEFBP2tfmgJzm.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-code-listing-10">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import onewire, ds18x20, timefrom machine import PinSensorPin = Pin(26, Pin.IN)alert = Pin(15, Pin.OUT)sensor = ds18x20.DS18X20(onewire.OneWire(SensorPin))roms = sensor.scan()print(roms)while True:   sensor.convert_temp()   time.sleep(2)   for rom in roms:       temperature = round(sensor.read_temp(rom),1)       if temperature <= 20:           print("Warning the temperature is",temperature,"C")           for i in range(10):               alert.toggle()               time.sleep(0.5)       else:           print(temperature,"C")   time.sleep(5)</code></pre>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Use A Raspberry Pi Pico W To Control RGB Lights Across The World ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/raspberry-pi-pico-w-control-rgb-lights</link>
                                                                            <description>
                            <![CDATA[ Using a Raspberry Pi Pico W and  just a little CircuitPython code we can connect our NeoPixel decorations to thousands of others across the globe. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">eGJCWfYCejjnEijfrXwrwm</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/duHwFiMktpTNBjHy2trvEW-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Fri, 28 Oct 2022 12:00:25 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:30 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/duHwFiMktpTNBjHy2trvEW-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Cheerlights]]></media:description>                                                            <media:text><![CDATA[Cheerlights]]></media:text>
                                <media:title type="plain"><![CDATA[Cheerlights]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/duHwFiMktpTNBjHy2trvEW-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>NeoPixels are “candy” for makers. These bright, easily =-controllable RGB LEDs power signs, light shows and holiday decorations across the world. We’ve used <a href="https://www.tomshardware.com/how-to/make-simon-game-with-raspberry-pi-pico"><u>NeoPixels with Python</u></a> to make a Simon game, Node-RED and even <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-basic-controlled-neopixels"><u>BASIC</u></a>.</p><p>We can control NeoPixels using <a href="https://www.tomshardware.com/news/raspberry-pi"><u>Raspberry Pi</u></a>, Arduino and <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w"><u>Raspberry Pi Pico W</u></a> (plus many more boards) and in this how to we will use <a href="https://circuitpython.org/"><u>CircuitPython</u></a> on the Raspberry Pi Pico W. CircuitPython has a ready to go CircuitPython module that we can use to get up and running with very little code.</p><p>Our goal for this project is to create a holiday themed decoration which uses NeoPixels. How we control it is via the <a href="https://cheerlights.com/"><u>Cheerlights API</u></a>. Cheerlights is a global network of synchronized lights. Sending a tweet to @cheerlights containing one of the supported colors will trigger our project to change color, but better than that, it changes the color of every Cheerlight across the globe.</p><p>Cheerlights supports the following colors. In the code we have converted these hex values into RGB for ease of use with CircuitPython’s NeoPixel module.</p><ul><li>red (#FF0000)</li><li>green (#008000)</li><li>blue (#0000FF)</li><li>cyan (#00FFFF)</li><li>white (#FFFFFF)</li><li>oldlace (#FDF5E6)</li><li>purple (#800080)</li><li>magenta (#FF00FF)</li><li>yellow (#FFFF00)</li><li>orange (#FFA500)</li><li>pink (#FFC0CB)</li></ul><h2 id="building-the-circuit-3">Building the Circuit</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1269px;"><p class="vanilla-image-block" style="padding-top:50.35%;"><img id="" name="Cheerlights_bb.jpg" alt="Cheerlights" src="https://cdn.mos.cms.futurecdn.net/H3tSUj5BanEyzg9zLPNk3W.jpg" mos="" align="middle" fullscreen="1" width="1269" height="639" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/H3tSUj5BanEyzg9zLPNk3W.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="for-this-project-you-will-need-5">For This Project You Will Need</h2><ul><li><a href="https://www.amazon.com/Raspberry-Pico-Platform-pre-soldered-headers/dp/B0BB9CQ3T9">A Raspberry Pi Pico W</a></li><li><a href="https://www.amazon.com/Qunqi-point-Experiment-Breadboard-5-5%C3%978-2%C3%970-85cm/dp/B0135IQ0ZC">A half size breadboard</a></li><li><a href="https://www.amazon.com/10Pcs-Driver-Development-Built-WS2812/dp/B08W3JH223">Circular NeoPixels (7 Pixels)</a></li><li><a href="https://www.amazon.com/GenBasic-Solderless-Dupont-Compatible-Breadboard-Prototyping/dp/B01L5UJ36U">3 x Male to male jumper wires</a></li><li>3D Printed plinth</li></ul><p>The circuit is essentially just a NeoPixel ring connected to the Raspberry Pi Pico W’s GPIO. We take power from the 3.3V pin, connect GND and use GP0 as a data pin to control the NeoPixels.</p><div ><table><thead><tr><th class="firstcol " >Wire Color</th><th  >Raspberry Pi Pico W</th><th  >NeoPixel</th></tr></thead><tbody><tr><td class="firstcol " >Yellow</td><td  >GP0</td><td  >IN</td></tr><tr><td class="firstcol " >Red</td><td  >3V3 Out</td><td  >PWR</td></tr><tr><td class="firstcol " >Black</td><td  >GND</td><td  >GND</td></tr></tbody></table></div><h2 id="building-the-decoration">Building the Decoration</h2><p>We wanted to make this project a little special, so we designed a quick 3D print to celebrate a holiday season.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1286px;"><p class="vanilla-image-block" style="padding-top:65.86%;"><img id="" name="inkscape.JPG" alt="Cheerlights" src="https://cdn.mos.cms.futurecdn.net/qFzrLAdU6p2c3aNNSJ7bKW.jpg" mos="" align="middle" fullscreen="1" width="1286" height="847" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/qFzrLAdU6p2c3aNNSJ7bKW.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Using the same principle (but massively simplified) as we used for the <a href="https://www.tomshardware.com/how-to/design-and-3d-print-custom-cases"><u>Tufty 2040 badge holder</u></a>, we created a basic layout using Inkscape and SVG files.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2559px;"><p class="vanilla-image-block" style="padding-top:53.61%;"><img id="" name="TK1.jpg" alt="Cheerlights" src="https://cdn.mos.cms.futurecdn.net/MDSVfak7gtfyZmBUgmVGuW.jpg" mos="" align="middle" fullscreen="1" width="2559" height="1372" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/MDSVfak7gtfyZmBUgmVGuW.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>We then imported the project into Tinkercad and extruded the SVG to create a solid 3D object, then added a plinth to contain the graphics.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1230px;"><p class="vanilla-image-block" style="padding-top:64.39%;"><img id="" name="TK2.jpg" alt="Cheerlights" src="https://cdn.mos.cms.futurecdn.net/MUmwLQ5GqZSNpEFabHEy2X.jpg" mos="" align="middle" fullscreen="1" width="1230" height="792" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/MUmwLQ5GqZSNpEFabHEy2X.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Lastly we cut sections from the rear to house our LEDs and wires. We got this wrong but the end result is not impaired.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1584px;"><p class="vanilla-image-block" style="padding-top:66.67%;"><img id="" name="Prusa.jpg" alt="Cheerlights" src="https://cdn.mos.cms.futurecdn.net/camUCbydXfUZE6tD3EggYW.jpg" mos="" align="middle" fullscreen="1" width="1584" height="1056" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/camUCbydXfUZE6tD3EggYW.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>We exported the design as an STL, then sliced it using Prusa Slicer for use with our <a href="https://www.tomshardware.com/reviews/creality-ender-2-pro"><u>Creality Ender 2 Pro</u></a>, a low-cost printer which appears on our <a href="https://www.tomshardware.com/best-picks/best-3d-printers"><u>best 3D printers page.</u></a></p><h2 id="configuring-circuitpython-2">Configuring CircuitPython</h2><p>1. <strong>Go to the official CircuitPython page for the Raspberry Pi Pico W </strong>and <a href="https://circuitpython.org/board/raspberry_pi_pico_w/"><u><strong>download the latest release UF2 firmware image</strong></u></a><strong>.</strong> At the time of writing this was CircuitPython 8 Beta 2.</p><p>2. <strong>Whilst holding the BOOTSEL button, connect the Raspberry Pi Pico W to your computer. </strong>A new drive, RPI-RP2 will appear.</p><p>3. <strong>Copy the downloaded CircuitPython UF2 file to RPI-RP2. </strong>This will write CircuitPython to the internal flash storage of the Pico W. A new drive, CIRCUITPY will appear.</p><p>We need a number of CircuitPython libraries before we can continue. These libraries of prewritten code add extra features to a project.</p><p>1. <a href="https://circuitpython.org/libraries"><u><strong>Download the bundle of libraries</strong></u></a><strong> for the same version of CircuitPython as installed on the Pico W.</strong> We installed CircuitPython 8 so downloaded the bundle for version 8.x.</p><p>2. <strong>Extract the bundle to your desktop </strong>and <strong>then open the lib folder </strong>contained within.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:679px;"><p class="vanilla-image-block" style="padding-top:60.68%;"><img id="" name="lib1.jpg" alt="Cheerlights" src="https://cdn.mos.cms.futurecdn.net/get58foxYaTw7w5wQu7XPW.jpg" mos="" align="middle" fullscreen="1" width="679" height="412" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/get58foxYaTw7w5wQu7XPW.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Copy the following files / folders from this lib folder to the lib folder on the CIRCUITPY drive.</strong></p><p>adafruit_pixelbuf.mpy</p><p>neopixel.mpy</p><p>adafruit_requests.mpy</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:755px;"><p class="vanilla-image-block" style="padding-top:24.24%;"><img id="" name="libs.jpg" alt="Cheerlights" src="https://cdn.mos.cms.futurecdn.net/n7bZhSWUpTHn2mkwEB8TTW.jpg" mos="" align="middle" fullscreen="1" width="755" height="183" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/n7bZhSWUpTHn2mkwEB8TTW.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="working-with-circuitpython">Working with CircuitPython</h2><p>1.  <a href="https://thonny.org/"><u><strong>Download and install Thonny</strong></u></a> if you don’t have it already<strong>. </strong>Thonny is a Python editor which covers Python 3, MicroPython and CircuitPython.</p><p>2. <strong>Open Thonny and go to Tools >> Options.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:301px;"><p class="vanilla-image-block" style="padding-top:68.77%;"><img id="" name="th1.jpg" alt="Cheerlights" src="https://cdn.mos.cms.futurecdn.net/PyxqhmmKxMLtK6AhsUBEdW.jpg" mos="" align="middle" fullscreen="1" width="301" height="207" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/PyxqhmmKxMLtK6AhsUBEdW.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Select Interpreter, then set the interpreter as CircuitPython, port to automatic, and click OK.</strong> Thonny will now connect to the Pico W running CircuitPython.</p><p>Our project code is made up of two files, secrets.py and code.py. The secrets.py file is essentially a Python module with two variables that will contain the SSID of our Wi-Fi access point, and the password. It is best practice to save your Wi-Fi details to a separate file called secrets.py, this reduces the risk of accidentally sharing your credentials. This process works for CircuitPython and <a href="https://www.tomshardware.com/how-to/hide-passwords-in-code-raspberry-pi-pico-w"><u>MicroPython</u></a>.</p><p>1. <strong>Create a new file </strong>and in there <strong>create two objects, ssid and password.</strong></p><p>2. <strong>For the ssid object, assign it the name of your Wi-Fi access point / router.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>ssid = “YOUR WI-FI AP NAME HERE”</code></pre><p>3. <strong>For the password, assign the Wi-Fi password.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>password = “YOUR SECRET PASSWORD”</code></pre><p>4. <strong>Save the file to the CIRCUITPY drive as secrets.py.</strong></p><h2 id="secrets-py-code-listing">Secrets.py Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>ssid = "YOUR WI-FI AP NAME HERE"password = "YOUR SECRET PASSWORD"</code></pre><p>The code for this project is contained in a file called code.py. This file will autorun when the Pico W is powered up, this is a feature of CircuitPython. In MicroPython we would name the file main.py to achieve the same result. We now start the process of writing the code that will make up our project.</p><p>1. <strong>Click on File >> Open </strong>and <strong>select the CircuitPython device. Open code.py on the CIRCUITPY drive. Delete any code in the file.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:270px;"><p class="vanilla-image-block" style="padding-top:84.81%;"><img id="" name="file.jpg" alt="Cheerlights" src="https://cdn.mos.cms.futurecdn.net/cxqJ6Gonu7ae5TNnj3nb8W.jpg" mos="" align="middle" fullscreen="1" width="270" height="229" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/cxqJ6Gonu7ae5TNnj3nb8W.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Import modules of pre-written code </strong>to handle pause (time) our code, set an IP address, use the Pico W’s Wi-Fi chip and to create web sockets.</p><pre class="line-numbers language-bash" language="bash" ><code>import timeimport ipaddressimport wifiimport socketpool</code></pre><p>3. <strong>Import five more modules </strong>for secure connections, to make web requests, a module with our Wi-Fi login details,a module to interact with the GPIO and finally the NeoPixel module.</p><pre class="line-numbers language-bash" language="bash" ><code>import sslimport adafruit_requestsimport secretsimport boardimport neopixel</code></pre><p>4. <strong>Create an object, pixel_pin to instruct the code as to where our NeoPixels are connected, then create another object to set the number of pixels.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>pixel_pin = board.GP0num_pixels = 7</code></pre><p>5. <strong>Use another object, pixels, to configure the NeoPixels connected to the GPIO. </strong>This object passes the GPIO pin and number of pixels, saved in the previous objects and we can set the brightness of the pixels. Consider 0.3 as a safe maximum brightness.</p><pre class="line-numbers language-bash" language="bash" ><code>pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.1, auto_write=False)</code></pre><p>6. <strong>Create an object, off to store a tuple that contains three integers, 0,0,0. </strong>These integers represent the mix of red, green and blue light that we use to make colors with NeoPixels. Three zeros represent no light, essentially turning them off.</p><pre class="line-numbers language-bash" language="bash" ><code>off = (0,0,0)</code></pre><p>7. <strong>Use the pixels object, and the value stored in off to turn off the NeoPixels, then use show to set the pixels to that “color” and pause for 0.1 seconds.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>pixels.fill(off)pixels.show()time.sleep(0.1)</code></pre><p>8. <strong>Create a function called “scare” and set it to accept an argument which will be the NeoPixel color.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>def scare(color):</code></pre><p>9. <strong>Create a dictionary inside the function called “colors” and in there store the name and RGB values for the Cheerlights colors.</strong> A Dictionary is a Python data storage object which uses keys to retrieve values. In this case the keys are the color names, and when they are called, they retrieve the RGB values that our NeoPixels use.</p><pre class="line-numbers language-bash" language="bash" ><code>   colors = {"red":(255,0,0),             "green":(0,255,0),             "blue":(0,0,255),             "cyan":(0,255,255),             "white":(255,255,255),             "oldlace":(253,245,230),             "purple":(128,0,128),             "magenta":(255,0,255),             "yellow":(255,255,0),             "orange":(255, 165, 0),             "pink":(255, 192, 203)             }</code></pre><p>10. <strong>Still inside the function create a conditional test that checks for the color, passed as an argument in the function, is present in the colors dictionary.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   if color in colors:</code></pre><p>11. <strong>If the color is present we print the name of the color, and then set the NeoPixels to that color.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>       print(colors[color])       pixels.fill(colors[color])       pixels.show()</code></pre><p>12. <strong>If the code is not present, an error message is printed to the Python shell. </strong>This section ends the function code.</p><pre class="line-numbers language-bash" language="bash" ><code>   else:       print("Sorry that color is not in the list")</code></pre><p>13. <strong>Connect to the Wi-Fi</strong> using the ssid and password stored in the secrets module.</p><pre class="line-numbers language-bash" language="bash" ><code>wifi.radio.connect(ssid=secrets.ssid,password=secrets.password)</code></pre><p>14. <strong>Create a pool of sockets </strong>that we can use for connections and <strong>then create a new HTTP session </strong>to be used when making web requests.</p><pre class="line-numbers language-bash" language="bash" ><code>pool = socketpool.SocketPool(wifi.radio)request = adafruit_requests.Session(pool, ssl.create_default_context())</code></pre><p>15. <strong>Create a while True loop </strong>to run the main project code. This loop will continue for as long as the Pico W is powered on.</p><pre class="line-numbers language-bash" language="bash" ><code>while True:</code></pre><p>16. <strong>Create an object, feed, to store the JSON feed URL for the last color tweeted to Cheerlights.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   feed = request.get("http://api.thingspeak.com/channels/1417/field/1/last.json")</code></pre><p>17. <strong>Print the last color to the Python shell. </strong>This is stored in the JSON object under “filed1”.</p><pre class="line-numbers language-bash" language="bash" ><code>   print(feed.json()['field1'])</code></pre><p>18. <strong>Call the scare function and pass the last color, from the JSON feed.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   scare(feed.json()['field1'])</code></pre><p>19. <strong>Add a ten second pause to hold the NeoPixel color before the loop repeats.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   time.sleep(10)</code></pre><p>20. <strong>Save the project to the Raspberry Pi Pico W as code.py. Click Run to start the code and watch the NeoPixels change color.</strong></p><p>21. <strong>Use your Twitter account to send a tweet to @cheerlights, using one of the supported colors.</strong></p><h2 id="complete-code-listing-11">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import timeimport ipaddressimport wifiimport socketpoolimport sslimport adafruit_requestsimport secretsimport boardimport neopixelpixel_pin = board.GP0num_pixels = 7pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.1, auto_write=False)off = (0,0,0)pixels.fill(off)pixels.show()time.sleep(0.1)def scare(color):   colors = {"red":(255,0,0),             "green":(0,255,0),             "blue":(0,0,255),             "cyan":(0,255,255),             "white":(255,255,255),             "oldlace":(253,245,230),             "purple":(128,0,128),             "magenta":(255,0,255),             "yellow":(255,255,0),             "orange":(255, 165, 0),             "pink":(255, 192, 203)             }   if color in colors:       print(colors[color])       pixels.fill(colors[color])       pixels.show()   else:       print("Sorry that color is not in the list")wifi.radio.connect(ssid=secrets.ssid,password=secrets.password)pool = socketpool.SocketPool(wifi.radio)request = adafruit_requests.Session(pool, ssl.create_default_context())while True:   feed = request.get("http://api.thingspeak.com/channels/1417/field/1/last.json")   print(feed.json()['field1'])   scare(feed.json()['field1'])   time.sleep(10)</code></pre>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Remove Backgrounds From Images With Python ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/python-remove-image-backgrounds</link>
                                                                            <description>
                            <![CDATA[ With just eight lines of Python code we can create an application to remove the background from many images. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">2zgmd7J888rbp7rCDVRuTo</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/Et7sGY4MZirzRm6qrisXbZ-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sun, 23 Oct 2022 15:16:54 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:25 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/Et7sGY4MZirzRm6qrisXbZ-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Remove Backgrounds From Images With Python]]></media:description>                                                            <media:text><![CDATA[Remove Backgrounds From Images With Python]]></media:text>
                                <media:title type="plain"><![CDATA[Remove Backgrounds From Images With Python]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/Et7sGY4MZirzRm6qrisXbZ-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11"><u>Python</u></a> is a multi-purpose programming language. It does many things, from creating <a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny"><u>web apps</u></a> to checking out who is on the <a href="https://www.tomshardware.com/how-to/connect-raspberry-pi-pico-w-to-the-internet"><u>International Space Station</u></a> with a <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w"><u>Raspberry Pi Pico W</u></a>.<br>Python is easy to learn due to it being easy to read. What makes Python multi-purpose are modules of prewritten code, sometimes referred to as “libraries”. These modules bring in new functionality, for example RPi.GPIO enables Python to control the GPIO of the <a href="https://www.tomshardware.com/news/raspberry-pi"><u>Raspberry Pi.</u></a></p><p>In this how to, we will use two Python modules to create a GUI application that will remove the background from an image. The first module, <a href="https://github.com/danielgatis/rembg"><u>rembg</u></a> from<a href="https://github.com/danielgatis"><u> Daniel Gatis</u></a> will remove the background from any image presented to it. The second module, easygui provides a means to create dialogs and menus using the operating system’s toolkit. So a file open / save dialog box will look exactly like those used in many other applications.</p><p>To take this project further, you can make your applications by <a href="https://www.tomshardware.com/how-to/create-python-executable-applications"><u>packaging the project code into a single executable file.</u></a></p><h2 id="setting-up">Setting Up</h2><p>Before we write a line of code we need to get everything in order. First we will create a folder to store the images that we will be working with. We will then open a Python editor for the coding part of the project.</p><p>1. <strong>Create a new folder on your desktop called rembg.</strong></p><p>2.<strong> In the folder place an image that you wish to remove the background from.</strong></p><p>3.<strong> Open your preferred Python editor</strong>, we prefer <a href="https://thonny.org/"><u>Thonny</u></a> as it provides a simple user interface. Follow <a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny"><u>this guide</u></a> to install Thonny.</p><h2 id="installing-the-python-modules">Installing the Python Modules</h2><p>In order to use Rembg we first need to download and install its Python module. This can be handled via Thonny’s built-in package manager, or via Python’s packaging tool, pip. </p><p><strong>Installing via Thonny</strong></p><p>1. <strong>Click on Tools >> Manage Packages.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:397px;"><p class="vanilla-image-block" style="padding-top:53.15%;"><img id="" name="pack1.jpg" alt="Remove Backgrounds From Images With Python" src="https://cdn.mos.cms.futurecdn.net/EZuyNws92awuZeyPvXKvkZ.jpg" mos="" align="middle" fullscreen="1" width="397" height="211" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/EZuyNws92awuZeyPvXKvkZ.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Search for rembg and click Search on PyPi. Select rembg from the returned list.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:629px;"><p class="vanilla-image-block" style="padding-top:72.81%;"><img id="" name="pack2.jpg" alt="Remove Backgrounds From Images With Python" src="https://cdn.mos.cms.futurecdn.net/VQGvvbmaweqz93fHCf96qZ.jpg" mos="" align="middle" fullscreen="1" width="629" height="458" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/VQGvvbmaweqz93fHCf96qZ.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Click on Install to download and install rembg for Python. </strong>We have already installed rembg on our system, hence the uninstall button.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:634px;"><p class="vanilla-image-block" style="padding-top:72.56%;"><img id="" name="pack3.jpg" alt="Remove Backgrounds From Images With Python" src="https://cdn.mos.cms.futurecdn.net/WvQ8Yas3asRPcnfPeo84uZ.jpg" mos="" align="middle" fullscreen="1" width="634" height="460" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/WvQ8Yas3asRPcnfPeo84uZ.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Repeat steps 2 and 3, but this time search for and install easygui.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:634px;"><p class="vanilla-image-block" style="padding-top:71.92%;"><img id="" name="pack4.jpg" alt="Remove Backgrounds From Images With Python" src="https://cdn.mos.cms.futurecdn.net/9goZNs6xCmSELC68VWRoxZ.jpg" mos="" align="middle" fullscreen="1" width="634" height="456" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/9goZNs6xCmSELC68VWRoxZ.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="installing-via-pip">Installing via Pip</h2><p>If you are using another Python editor, you will need to install the Python packages using pip.</p><p>1. <strong>Open a Command Prompt and install rembg. Press Enter to start the process.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>pip install rembg</code></pre><p>2. <strong>Install easygui using pip. </strong>Easygui provides a basic user interface for file open and save operations.</p><pre class="line-numbers language-bash" language="bash" ><code>pip install easygui</code></pre><h2 id="writing-the-code-4">Writing the Code</h2><p>The code is essentially very simple, with just eight lines of Python we can remove the background from any image. The underlying modules, rembg and easygui will be doing all of the heavy lifting for us.</p><p>1. <strong>From the rembg module import the remove class.</strong> This is what we shall use to remove the background.</p><pre class="line-numbers language-bash" language="bash" ><code>from rembg import remove</code></pre><p>2. <strong>From the Python Imaging Library (PIL), import Image. </strong>PIL is a powerful module that contains many different options for creating and working with images and image streams.</p><pre class="line-numbers language-bash" language="bash" ><code>from PIL import Image</code></pre><p>3. <strong>Import the easygui module and create a reference to it as “eg”.</strong> Easygui is our GUI for basic file operations. Renaming it to “eg” makes it easier to work with.</p><pre class="line-numbers language-bash" language="bash" ><code>import easygui as eg</code></pre><p>4. <strong>Create an object, input_path and use it to store the path and name of a file that we wish to remove the background from.</strong> Using easygui’s file open dialog box, we give the dialog a title, to explain what it is for. The chosen file and its path are stored to the input_path object.</p><pre class="line-numbers language-bash" language="bash" ><code>input_path = eg.fileopenbox(title='Select image file')</code></pre><p>5. <strong>Create an object, output_path and use easygui’s file save dialog box to capture the file path and save it to the object.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>output_path = eg.filesavebox(title='Save file to..')</code></pre><p>6. <strong>Create an object, input and use it to open and store the image via PIL’s Image.open </strong>function.</p><pre class="line-numbers language-bash" language="bash" ><code>input = Image.open(input_path)</code></pre><p>7. <strong>Use rembg to remove the background from the image.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>output = remove(input)</code></pre><p>8. <strong>Save the new image using the file path stored in output_path.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>output.save(output_path)</code></pre><p>9. <strong>Save the code as background_remover.py.</strong></p><p>10. <strong>Run the code by clicking on the Run button.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:984px;"><p class="vanilla-image-block" style="padding-top:42.48%;"><img id="" name="run1.jpg" alt="Remove Backgrounds From Images With Python" src="https://cdn.mos.cms.futurecdn.net/7h4u2xsa9BqHRPohmwzX3a.jpg" mos="" align="middle" fullscreen="1" width="984" height="418" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/7h4u2xsa9BqHRPohmwzX3a.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>11. <strong>Select the image that you wish to remove the background from.</strong> Notice that the dialog has the title that we specified in the code.</p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1181px;"><p class="vanilla-image-block" style="padding-top:60.12%;"><img id="" name="run2.jpg" alt="Remove Backgrounds From Images With Python" src="https://cdn.mos.cms.futurecdn.net/D45v5P2BYhhYPmPZaBtw6a.jpg" mos="" align="middle" fullscreen="" width="1181" height="710" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>12. <strong>Navigate to the rembg folder and give the file a name and set the file format to PNG. Click Save.</strong> In our example we save the file as les-no-bg.png.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1178px;"><p class="vanilla-image-block" style="padding-top:60.02%;"><img id="" name="run3.jpg" alt="Remove Backgrounds From Images With Python" src="https://cdn.mos.cms.futurecdn.net/uUnv2wzrjMTqYXpWPyDFAa.jpg" mos="" align="middle" fullscreen="1" width="1178" height="707" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/uUnv2wzrjMTqYXpWPyDFAa.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>13. You may encounter an error, but this is to be expected. <a href="https://drive.google.com/uc?id=1tCU5MM1LhRgGou5OpmpjBQbSrYIUoYab"><u><strong>Download the u2net file</strong></u></a><strong> and save it to .u2net folder in your user directory.</strong> This folder is automatically created and stored.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:814px;"><p class="vanilla-image-block" style="padding-top:41.40%;"><img id="" name="error.jpg" alt="Remove Backgrounds From Images With Python" src="https://cdn.mos.cms.futurecdn.net/CboS6nV4Bc3UFrs8eDsDVZ.jpg" mos="" align="middle" fullscreen="1" width="814" height="337" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/CboS6nV4Bc3UFrs8eDsDVZ.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>14. <strong>Go back to Step 10 and re-run the code.</strong> There will be no error this time so skip step 13.</p><p>15. <strong>Go to the rembg folder and your image is now ready for use.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:594px;"><p class="vanilla-image-block" style="padding-top:65.49%;"><img id="" name="run4.jpg" alt="Remove Backgrounds From Images With Python" src="https://cdn.mos.cms.futurecdn.net/5BtbhZumKupmkESCG7jqEa.jpg" mos="" align="middle" fullscreen="1" width="594" height="389" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/5BtbhZumKupmkESCG7jqEa.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-code-listing-12">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>from rembg import removefrom PIL import Imageimport easygui as eginput_path = eg.fileopenbox(title='Select image file')output_path = eg.filesavebox(title='Save file to..')input = Image.open(input_path)output = remove(input)output.save(output_path)</code></pre><h2 id="python-how-tos-7">Python How Tos</h2><ul><li><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">How To Install Python on Windows 10 and 11</a></li><li><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">How to use For Loops in Python</a></li><li><a href="https://www.tomshardware.com/how-to/enumerate-in-python">How to Enumerate in Python</a></li><li><a href="https://www.tomshardware.com/how-to/create-python-executable-applications">How to Create Executable Applications in Python</a></li><li><a href="https://www.tomshardware.com/how-to/python-remove-image-backgrounds">How To Remove Backgrounds From Images With Python</a></li><li><a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny">How to Create Web Apps with Python, HTML and Thonny</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2">How To Use Raspberry Pi Camera Module 3 with Python Code</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Get The News With Raspberry Pi Pico W and CircuitPython ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/raspberry-pi-pico-w-newsfeed-circuitpython</link>
                                                                            <description>
                            <![CDATA[ With a little code we can use a Raspberry Pi Pico W and CircuitPython to grab the latest headlines and scroll them across a tiny OLED screen on our desktop. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">tdNnJnZtkgs98aUs2dGNkJ</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/rMeH72SWYwk2piRqYMrYSi-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sat, 22 Oct 2022 13:00:37 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:34 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/rMeH72SWYwk2piRqYMrYSi-1280-80.jpg">
                                                            <media:credit><![CDATA[Future]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[CircuitPython newspaper]]></media:description>                                                            <media:text><![CDATA[CircuitPython newspaper]]></media:text>
                                <media:title type="plain"><![CDATA[CircuitPython newspaper]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/rMeH72SWYwk2piRqYMrYSi-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>The <a href="https://www.tomshardware.com/news/raspberry-pi-pico-tutorials-pinout-everything-you-need-to-know">Raspberry Pi Pico</a> certainly put the cat amongst the pigeons in 2021, but it was missing one key feature, Wi-Fi. Sure we can <a href="https://www.tomshardware.com/how-to/get-wi-fi-internet-on-raspberry-pi-pico">hack our own solution</a> but we had to wait until mid 2022 for Raspberry Pi to announce the Raspberry Pi Pico W in order to get official support.</p><p>The Raspberry Pi Pico W was released with a robust MicroPython firmware, but <a href="https://circuitpython.org/">CircuitPython</a>, our favorite microcontroller Python release, was sadly missing support. It may have taken a few months but down to the hard work of <a href="https://twitter.com/jeffepler">@jeffepler</a> we now have CircuitPython 8 Beta 2 which offers Wi-Fi support for the Pico W, while retaining the familiar CircuitPython ecosystem.</p><p>To celebrate this milestone we put together a project to highlight CircuitPython on the Raspberry Pi Pico W. We’ll be working with live data from an RSS news feed, converted to JSON and then displayed on a tiny OLED screen.</p><h2 id="building-the-circuit-4">Building the Circuit</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1356px;"><p class="vanilla-image-block" style="padding-top:65.27%;"><img id="" name="image003.jpg" alt="How To Get The News With Raspberry Pi" src="https://cdn.mos.cms.futurecdn.net/nHfnz7nveijSTDxLE4arXF.jpg" mos="" align="middle" fullscreen="" width="1356" height="885" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>For this project you will need</p><ul><li><a href="https://www.amazon.com/Raspberry-Pico-Platform-pre-soldered-headers/dp/B0BB9CQ3T9">A Raspberry Pi Pico W</a></li><li><a href="https://www.amazon.com/WayinTop-Display-SSD1306-3-3V-5V-Raspberry/dp/B085NHM5TC">128 x 32 0.91 inch OLED</a></li><li><a href="https://www.amazon.com/EDGELEC-Resistor-Tolerance-Multiple-Resistance/dp/B07QJB3LGN">4.7K Ohm Resistors</a></li><li><a href="https://www.amazon.com/SunFounder-Breadboards-Solderless-Distribution-Connecting/dp/B082KBF7MM">Half Breadboard</a></li><li><a href="https://www.amazon.com/GenBasic-Solderless-Dupont-Compatible-Breadboard-Prototyping/dp/B01L5UJ36U">Male to male jumper wires</a></li></ul><p>The circuit is essentially just the OLED screen connected to the Raspberry Pi Pico via an I2C connection. The only addition to the circuit are two 4.7K Ohm resistors which connect to the + rail and the SDA and SCL pins of the Pico. This rail is connected to 3.3V, and the resistors are used to pull the pins high, ready for sending and receiving data.</p><p>The connections are as follows</p><div ><table><tbody><tr><td class="firstcol " >Wire Color</td><td  >Raspberry Pi Pico W</td><td  >Breadboard</td><td  >OLED Display</td></tr><tr><td class="firstcol " >Green</td><td  >GP0 (SDA)</td><td  >N/A</td><td  >SDA</td></tr><tr><td class="firstcol " >Yellow</td><td  >GP1 (SCL)</td><td  >N/A</td><td  >SCL</td></tr><tr><td class="firstcol " >Red</td><td  >3V3 Out</td><td  >+</td><td  >VIN</td></tr><tr><td class="firstcol " >Black</td><td  >GND</td><td  >N/A</td><td  >GND</td></tr></tbody></table></div><h2 id="configuring-circuitpython-3">Configuring CircuitPython</h2><p><strong>1. Go to the official CircuitPython page for the Raspberry Pi Pico W </strong>and <a href="https://circuitpython.org/board/raspberry_pi_pico_w/"><strong>download the latest release UF2 firmware image</strong></a><strong>.</strong> At the time of writing this was CircuitPython 8 Beta 2.</p><p><strong>2. Whilst holding the BOOTSEL button, connect the Raspberry Pi Pico W to your computer. </strong>A new drive, RPI-RP2 will appear</p><p><strong>3. Copy the downloaded CircuitPython UF2 file to RPI-RP2. </strong>This will write CircuitPython to the internal flash storage of the Pico W. A new drive, CIRCUITPY will appear.</p><p>We need a number of CircuitPython libraries before we can continue. These libraries of prewritten code add extra features to a project.</p><p><strong>1. </strong><a href="https://circuitpython.org/libraries"><strong>Download</strong></a><a href="https://circuitpython.org/libraries"><strong> the bundle of libraries</strong></a><strong> for the same version of CircuitPython as installed on the Pico W.</strong> We installed CircuitPython 8 so downloaded the bundle for version 8.x.</p><p><strong>2. Extract the bundle to your desktop </strong>and <strong>then open the lib folder </strong>contained within.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:679px;"><p class="vanilla-image-block" style="padding-top:60.68%;"><img id="" name="image005.jpg" alt="How To Get The News With Raspberry Pi" src="https://cdn.mos.cms.futurecdn.net/Z8jMiwW93CSyGUBJWAoXcF.jpg" mos="" align="middle" fullscreen="" width="679" height="412" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>3. Copy the following files / folders from this lib folder to the lib folder on the CIRCUITPY drive.</strong></p><p>adafruit_bitmap_font</p><p>adafruit_display_text</p><p>adafruit_displayio_ssd1306.mpy</p><p>adafruit_requests.mpy</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:774px;"><p class="vanilla-image-block" style="padding-top:27.52%;"><img id="" name="image007.jpg" alt="How To Get The News With Raspberry Pi" src="https://cdn.mos.cms.futurecdn.net/Bw8X87h2QvvhchZXMrC9mF.jpg" mos="" align="middle" fullscreen="" width="774" height="213" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="working-with-circuitpython-2">Working with CircuitPython</h2><p><strong>1. </strong><a href="https://thonny.org/"><strong>Download and install Thonny</strong></a><strong> </strong>if you don’t have it already<strong>. </strong>Thonny is a Python editor which covers Python 3, MicroPython and CircuitPython.</p><p><strong>2. Open Thonny and go to Tools >> Options.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:301px;"><p class="vanilla-image-block" style="padding-top:68.77%;"><img id="" name="image009.jpg" alt="How To Get The News With Raspberry Pi" src="https://cdn.mos.cms.futurecdn.net/8xn5dTfWaZZbAFdjuPD4rF.jpg" mos="" align="middle" fullscreen="" width="301" height="207" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>3. Select Interpreter, then set the interpreter as CircuitPython, port to automatic, and click OK.</strong> Thonny will now connect to the Pico W running CircuitPython.</p><p>Our project code is made up of two files, secrets.py and code.py. The secrets.py file is essentially a Python module with two variables that will contain the SSID of our Wi-Fi access point, and the password. It is best practice to save your Wi-Fi details to a separate file called secrets.py, this reduces the risk of accidentally sharing your credentials. This process works for CircuitPython and <a href="https://www.tomshardware.com/how-to/hide-passwords-in-code-raspberry-pi-pico-w">MicroPython</a>.</p><p><strong>1. Create a new file </strong>and in there <strong>create two objects, ssid and password.</strong></p><p><strong>2. For the ssid object, assign it the name of your Wi-Fi access point / router.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>ssid = “YOUR WI-FI AP NAME HERE”</code></pre><p><strong>3. For the password, assign the Wi-Fi password.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>password = “YOUR SECRET PASSWORD”</code></pre><p><strong>4. Save the file to the CIRCUITPY drive as secrets.py.</strong></p><h2 id="secrets-py-code-listing-2">Secrets.py Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>ssid = "YOUR WI-FI AP NAME HERE"password = "YOUR SECRET PASSWORD"</code></pre><p>The code for this project is contained in a file called code.py. This file will autorun when the Pico W is powered up, this is a feature of CircuitPython. In MicroPython we would name the file main.py to achieve the same result. We now start the process of writing the code that will make up our project.</p><p><strong>1. Click on File >> Open </strong>and <strong>select the CircuitPython device. Open code.py on the CIRCUITPY drive. Delete any code in the file.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:270px;"><p class="vanilla-image-block" style="padding-top:84.81%;"><img id="" name="image010.jpg" alt="How To Get The News With Raspberry Pi" src="https://cdn.mos.cms.futurecdn.net/aXvkrfW2vPs9QPYiXTCDvF.jpg" mos="" align="middle" fullscreen="" width="270" height="229" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>2. Import modules of pre-written code </strong>to handle pause (time) our code, set an IP address, use the Pico W’s Wi-Fi chip and to create web sockets.</p><pre class="line-numbers language-bash" language="bash" ><code>import timeimport ipaddressimport wifiimport socketpool</code></pre><p><strong>3. Import four more modules </strong>for secure connections, to make web requests, a module with our Wi-Fi login details and a module to interact with the GPIO.</p><pre class="line-numbers language-bash" language="bash" ><code>import sslimport adafruit_requestsimport secretsimport board</code></pre><p><strong>4. Import the final group of modules</strong> for accelerated bus access, a display library, a terminal style text module, scrolling text, and a driver for the OLED display.</p><pre class="line-numbers language-bash" language="bash" ><code>import busioimport displayioimport terminaliofrom adafruit_display_text.scrolling_label import ScrollingLabelimport adafruit_displayio_ssd1306</code></pre><p><strong>5. Release the display for CircuitPython </strong>to use it and then<strong> specify the GPIO pins used for I2C.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>displayio.release_displays()i2c = busio.I2C(board.GP1, board.GP0)</code></pre><p><strong>6. Specify the I2C interface and I2C address for the OLED screen </strong>on the display bus and then<strong> use that to create a display object. </strong>Don’t forget to set the width and height to match your OLED display. To find the I2C address of the OLED display, consult its datasheet or<a href="https://learn.adafruit.com/scanning-i2c-addresses/circuitpython"> use an I2C scanner to search for it.</a></p><pre class="line-numbers language-bash" language="bash" ><code>display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)</code></pre><p><strong>7. Connect to the Wi-Fi</strong> using the ssid and password stored in the secrets module.</p><pre class="line-numbers language-bash" language="bash" ><code>wifi.radio.connect(ssid=secrets.ssid,password=secrets.password)</code></pre><p><strong>8. Create a pool of sockets </strong>that we can use for connections and <strong>then create a new HTTP session </strong>to be used when making web requests.</p><pre class="line-numbers language-bash" language="bash" ><code>pool = socketpool.SocketPool(wifi.radio)request = adafruit_requests.Session(pool, ssl.create_default_context())</code></pre><p><strong>9. Create a while True loop </strong>to run the main project code.<strong> </strong>This loop will continue for as long as the Pico W is powered on.</p><pre class="line-numbers language-bash" language="bash" ><code>while True:</code></pre><p><strong>10. Create a banner, and save it to toms object.</strong>The Banner is a string of * followed by  “Tom’s Hardware News” then a further 10 more *.</p><pre class="line-numbers language-bash" language="bash" ><code>toms = "*"*10+" Tom's Hardware News"+"*"*10</code></pre><p><strong>11. Create an object to handle scrolling the text </strong>stored in the toms object. The animate time handles the scrolling speed, scale is used to increase the text size, with 3 being the largest available for our 128x32 screen.</p><pre class="line-numbers language-bash" language="bash" ><code>my_scrolling_label = ScrollingLabel(terminalio.FONT, text=toms, max_characters=20, animate_time=0.1, scale=3)</code></pre><p><strong>12. Set the position of the text </strong>(horizontal, x and vertical, y<strong>).</strong></p><pre class="line-numbers language-bash" language="bash" ><code>my_scrolling_label.x = 10my_scrolling_label.y = 10</code></pre><p><strong>13. Show the text on the OLED display.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>display.show(my_scrolling_label)</code></pre><p><strong>14. Use a for loop to scroll the banner </strong>across the screen.<strong> </strong>We use the length of the text stored in the toms object, minus six to create a pleasant scroll. This will need to be tweaked to suit your banner text.</p><pre class="line-numbers language-bash" language="bash" ><code>for i in range(len(toms)-6):        my_scrolling_label.update()        time.sleep(0.1)</code></pre><p><strong>15. Create an object, feed </strong>to <strong>store the URL of the JSON feed that contains the news headlines. </strong>We used <a href="http://rss2json.com">rss2json.com</a> to convert the Tom’s Hardware RSS feed into JSON, which can be easily worked with in CircuitPython.</p><pre class="line-numbers language-bash" language="bash" ><code>feed = request.get("https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fwww.tomshardware.com%2Ffeeds%2Fall")</code></pre><p><strong>16. Use a for loop to retrieve the first five stories</strong> from the feed.</p><pre class="line-numbers language-bash" language="bash" ><code>for story in range(5):</code></pre><p><strong>17. Print the story’s headline </strong>to the Python shell.</p><pre class="line-numbers language-bash" language="bash" ><code>print(feed.json()['items'][story]['title'])</code></pre><p><strong>18. Update the scrolling text to scroll the headline</strong>, with a buffer of 20 blank spaces before the text and a scale (text size) of 2.</p><pre class="line-numbers language-bash" language="bash" ><code>my_scrolling_label = ScrollingLabel(terminalio.FONT, text=" "*20+str(feed.json()['items'][story]['title']), max_characters=20, animate_time=0.1, scale=2)</code></pre><p><strong>19. Set the position of the text</strong> (horizontal, x and vertical, y).</p><pre class="line-numbers language-bash" language="bash" ><code>my_scrolling_label.x = 10my_scrolling_label.y = 10</code></pre><p><strong>20. Show the text on the OLED display.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>display.show(my_scrolling_label)</code></pre><p><strong>21. Use another for loop to scroll the headline text. </strong>The iterations in the loop are set by the length of the headline, plus 21 characters to create a buffer.</p><pre class="line-numbers language-bash" language="bash" ><code>for i in range(len(feed.json()['items'][story]['title'])+21):            my_scrolling_label.update()            time.sleep(0.1)</code></pre><p><strong>22. Finally add a sleep of 30 minutes, (1800 seconds) </strong>to set the Pico W to check for new headlines every half hour.</p><pre class="line-numbers language-bash" language="bash" ><code>time.sleep(1800)</code></pre><p><strong>23. Save the project as code.py</strong> to CIRCUITPY and click Run to test start the code.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:217px;"><p class="vanilla-image-block" style="padding-top:50.69%;"><img id="" name="image011.jpg" alt="How To Get The News With Raspberry Pi" src="https://cdn.mos.cms.futurecdn.net/Ru2MkHCpuycxpBSM22eHyF.jpg" mos="" align="middle" fullscreen="" width="217" height="110" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>You should see the OLED screen come to life and scroll a banner, then the news headlines. As we saved the project to the code.py file, this code will autorun when the Pico W is powered up.</p><h2 id="complete-code-listing-13">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import timeimport ipaddressimport wifiimport socketpoolimport sslimport adafruit_requestsimport secretsimport boardimport busioimport displayioimport terminaliofrom adafruit_display_text.scrolling_label import ScrollingLabelimport adafruit_displayio_ssd1306# Setup the displaydisplayio.release_displays()i2c = busio.I2C(board.GP1, board.GP0)display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)wifi.radio.connect(ssid=secrets.ssid,password=secrets.password)pool = socketpool.SocketPool(wifi.radio)request = adafruit_requests.Session(pool, ssl.create_default_context())while True:    toms = "*"*10+" Tom's Hardware News"+"*"*10    my_scrolling_label = ScrollingLabel(terminalio.FONT, text=toms, max_characters=20, animate_time=0.1, scale=3)    my_scrolling_label.x = 10    my_scrolling_label.y = 10    display.show(my_scrolling_label)    for i in range(len(toms)-6):        my_scrolling_label.update()        time.sleep(0.1)    feed = request.get("https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fwww.tomshardware.com%2Ffeeds%2Fall")    for story in range(5):        print(feed.json()['items'][story]['title'])        my_scrolling_label = ScrollingLabel(terminalio.FONT, text=" "*20+str(feed.json()['items'][story]['title']), max_characters=20, animate_time=0.1, scale=2)        my_scrolling_label.x = 10        my_scrolling_label.y = 10        display.show(my_scrolling_label)        for i in range(len(feed.json()['items'][story]['title'])+21):            my_scrolling_label.update()            time.sleep(0.1)    time.sleep(1800)</code></pre>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Use Picamera2 to Take Photos With Raspberry Pi ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/use-picamera2-take-photos-with-raspberry-pi</link>
                                                                            <description>
                            <![CDATA[ A new Python module is designed to easily capture images and video in your code. Learn how to capture HD video, and create camera triggers for nature cameras. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">BMM9CvG9UALG5CMn7uyH9h</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/y76WkayZKHML4qyXwzkLnT-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sun, 11 Sep 2022 14:00:52 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:28 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/y76WkayZKHML4qyXwzkLnT-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Picamera2]]></media:description>                                                            <media:text><![CDATA[Picamera2]]></media:text>
                                <media:title type="plain"><![CDATA[Picamera2]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/y76WkayZKHML4qyXwzkLnT-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>When <a href="https://www.tomshardware.com/news/raspberry-pi-os-bullseye-released"><u>Raspberry Pi OS moved</u></a> from being based on Debian Buster, to <a href="https://www.tomshardware.com/news/raspberry-pi-os-bullseye-tested"><u>Bullseye</u></a>, the transition wasn’t the smoothest. For many years Raspberry Pi OS used three tools to access the official Raspberry Pi camera. The first two were raspistill / raspivid, which offered control and access to the camera via the Linux terminal. </p><p>It was a powerful and flexible means to work with the camera, both could <a href="https://www.tomshardware.com/how-to/stream-live-video-raspberry-pi"><u>produce video effects and stream video</u></a> with no extra work. The other means was a community created project called PiCamera. Originally created by <a href="https://picamera.readthedocs.io/en/release-1.13/"><u>Dave Jones, Picamera</u></a> grew from a community project into an essential tool. Picamera offered a purely Python means to interact with the camera, and being based on Python it also meant that we could mix the camera into our projects.</p><p>With the move to Bullseye, we saw Picamera sadly break. Raspberry Pi LTD even went as far as to offer a <a href="https://www.tomshardware.com/news/raspberry-pi-releases-legacy-os"><u>“legacy” version of Buster</u></a> with Picamera and security updates. This was a stop-gap measure while its developers worked on Picamera2. With the <a href="https://www.tomshardware.com/news/new-raspberry-pi-os-release-improved-camera-and-networking"><u>September 2022 release of Raspberry Pi OS</u></a> we now have a working Picamera2 module that we can use in our projects.</p><p>In this how-to we shall learn how to use <a href="https://datasheets.raspberrypi.com/camera/picamera2-manual.pdf"><u>Picamera2’s rather splendid API [pdf]</u></a> to capture images, record video, and work with the GPIO to react to input as a means to capture an image. This how-to is compatible with all models of the official Raspberry Pi camera, including the <a href="https://www.tomshardware.com/reviews/raspberry-pi-camera-module-v3">Raspberry Pi Camera Module 3</a> which now comes with autofocus, HDR and a 110 degree wide angle lens.</p><h2 id="xa0-for-the-projects-you-will-need-xa0"> For the projects you will need </h2><ul><li>A <a href="https://www.tomshardware.com/reviews/raspberry-pi-4">Raspberry Pi</a> (3B+, 4 or Zero 2 W are best)</li><li>An official <a href="https://www.tomshardware.com/reviews/raspberry-pi-high-quality-camera">Raspberry Pi camera</a></li><li>A <a href="https://www.amazon.com/Qunqi-point-Experiment-Breadboard-5-5%C3%978-2%C3%970-85cm/dp/B0135IQ0ZC">mini breadboard</a></li><li>A button</li><li>2x <a href="https://www.amazon.com/IZOKEE-Solderless-Breadboard-Arduino-Project/dp/B08151TQHG">female to male wires</a></li></ul><h2 id="connecting-your-raspberry-pi-camera">Connecting your Raspberry Pi Camera</h2><p>The Raspberry Pi camera has been part of the <a href="https://www.tomshardware.com/best-picks/best-raspberry-pi-accessories"><u>best Raspberry Pi accessories</u></a> for almost as long as the Pi has been with us. Nearly every model of Raspberry Pi has a camera (CSI) connector (the exception being the first model of Raspberry Pi Zero) and this meant that the camera rapidly became the must have accessory for your Pi. The same is still true, thanks to the <a href="https://www.tomshardware.com/reviews/raspberry-pi-high-quality-camera"><u>official HQ camera</u></a> offering much better image quality and a series of interchangeable lenses.</p><p>Connecting any official camera to the Raspberry Pi is easy to do, just follow these steps.</p><p> 1. <strong>Set up a Raspberry Pi </strong>if you don&apos;t have one already. See our guide on <a href="https://www.tomshardware.com/how-to/set-up-raspberry-pi"><u>how to set up a Raspberry Pi</u></a>. </p><p>2.  With the Raspberry Pi powered off,<strong> lift the tabs of the CSI port.</strong> </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2247px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="" name="clamp.jpg" alt="Picamera2" src="https://cdn.mos.cms.futurecdn.net/cSzKLBGfPUuFL54uxmpvxS.jpg" mos="" align="middle" fullscreen="1" width="2247" height="1264" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/cSzKLBGfPUuFL54uxmpvxS.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Insert the cable </strong>with the blue tab facing the USB / Ethernet port.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2096px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="" name="cable.jpg" alt="Picamera2" src="https://cdn.mos.cms.futurecdn.net/zYsanwRPmPhAYQfbtBWtNT.jpg" mos="" align="middle" fullscreen="" width="2096" height="1179" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Gently slide the tabs down </strong>to lock the cable in place.</p><p>5. <strong>Secure / mount the camera </strong>so that it does not flop over and touch the Pi or its GPIO. One method is to use modelling clay / blu tack. </p><h2 id="installing-picamera2-software">Installing Picamera2 software</h2><p>1. <strong>Boot the Pi.</strong></p><p>2. <strong>Open a terminal </strong>and <strong>update the installed software.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>sudo apt updatesudo apt upgrade -y</code></pre><p>3. <strong>Install the Picamera2 Python3 module.</strong> For the latest Raspberry Pi OS releases (September 2022 onwards) it comes pre-installed, but this command will also update your version to the latest release.</p><pre class="line-numbers language-bash" language="bash" ><code>sudo apt install -y python3-picamera2</code></pre><h2 id="taking-a-photograph-with-picamera2">Taking a Photograph with Picamera2</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2560px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="" name="camera-me.png" alt="Picamera2" src="https://cdn.mos.cms.futurecdn.net/B9LTWvzPDdGJu3h6XtKxJV.png" mos="" align="middle" fullscreen="1" width="2560" height="1440" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/B9LTWvzPDdGJu3h6XtKxJV.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Taking a photograph with Picamera2 is the most basic task that you can perform with the module. By design, it has been created to be simple to use, but underneath the simplicity is a complex module that we can tweak to suit our needs.</p><p>In this project we shall capture an image, using a preview to frame the shot.</p><p>1. <strong>Open Thonny. </strong>You can find it in the main menu.</p><p>2. In a new file,<strong> import the Picamera2 module, along with the preview class. On a new line, import the time module.</strong> The Picamera2 module will provide us with control of the camera and time is used to control how long the preview image will remain on screen.</p><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2, Previewimport time</code></pre><p>3. <strong>Create an object, picam2,</strong> which is used to reference the Picamera2 module and control the camera.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>picam2 = Picamera2()</code></pre><p>4. <strong>Create a new object, camera_config </strong>and <strong>use it to set the still image resolution (main) to 1920 x 1080. and a “lowres” image with a size of 640 x 480. </strong>This lowres image is used as the preview image when framing a shot.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>camera_config = picam2.create_still_configuration(main={"size": (1920, 1080)}, lores={"size": (640, 480)}, display="lores")</code></pre><p>5. <strong>Load the configuration.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.configure(camera_config)</code></pre><p>6. <strong>Start the preview window </strong>and <strong>then start the camera.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.start_preview(Preview.QTGL)picam2.start()</code></pre><p>7. <strong>Pause the code for two seconds.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>time.sleep(2)</code></pre><p>8. <strong>Capture an image </strong>and <strong>save it as test.jpg.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.capture_file("test.jpg")</code></pre><p>9. <strong>Save the code as camera-test.py </strong>and <strong>click Run to start.</strong> A preview window will appear, use this to frame your shot. If two seconds is too short a delay, change the delay to meet your needs.</p><p>10. <strong>Open the system File Manager </strong>and <strong>double click on test.jpg to view the image.</strong></p><p><br></p><h2 id="complete-code-listing-14">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2, Previewimport timepicam2 = Picamera2()camera_config = picam2.create_still_configuration(main={"size": (1920, 1080)}, lores={"size": (640, 480)}, display="lores")picam2.configure(camera_config)picam2.start_preview(Preview.QTGL)picam2.start()time.sleep(2)picam2.capture_file("test.jpg")</code></pre><h2 id="recording-a-video-with-picamera2">Recording a Video with Picamera2</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2560px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="" name="Video.png" alt="Picamera2" src="https://cdn.mos.cms.futurecdn.net/ve65NXkpBcco4yhRCQyVYU.png" mos="" align="middle" fullscreen="1" width="2560" height="1440" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ve65NXkpBcco4yhRCQyVYU.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>HD video recording is something that we now take for granted. The same is true for the Raspberry Pi thanks to numerous models of official (and unofficial) cameras. With Picamera2 we can record video at various resolutions using different encoders.</p><p>In this project we will show how to record a simple 1080P video stream, while previewing the stream in a lower resolution window.</p><p>1. <strong>Open Thonny </strong>and <strong>create a new file. </strong>You can find Thonny on the main menu.</p><p>2. <strong>Import the H264 encoder from the Picamera2 module.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>from picamera2.encoders import H264Encoder</code></pre><p>3. <strong>Import the Picamera2 module, along with the preview class. Next import the time module.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2, Previewimport time</code></pre><p>4. <strong>Create an object, picam2,</strong> which is used to reference the Picamera2 module and control the camera.</p><pre class="line-numbers language-bash" language="bash" ><code>picam2 = Picamera2()</code></pre><p>5. <strong>Create a new object, video_config </strong>and <strong>use it to set the still image resolution (main) to 1920 x 1080. </strong>and <strong>a “lowres” image with a size of 640 x 480. </strong>This lowres image is used as the preview image when framing a shot.</p><pre class="line-numbers language-bash" language="bash" ><code>video_config = picam2.create_video_configuration(main={"size": (1920, 1080)}, lores={"size": (640, 480)}, display="lores")</code></pre><p>6. <strong>Load the configuration.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.configure(video_config)</code></pre><p>7. <strong>Set the bitrate of the H264 encoder.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>encoder = H264Encoder(bitrate=10000000)</code></pre><p>8. <strong>Set the output file to test.h264.</strong> This will create a file containing the video.</p><pre class="line-numbers language-bash" language="bash" ><code>output = "test.h264"</code></pre><p>9. <strong>Start the preview window, then start recording using the encoder settings and saving the video to the output file.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.start_preview(Preview.QTGL)picam2.start_recording(encoder, output)</code></pre><p>10. <strong>Use a sleep to record ten seconds of video. </strong>The previous recording command is not a blocking line of code. Using a sleep command, we keep the recording from stopping after a fraction of a second.</p><pre class="line-numbers language-bash" language="bash" ><code>time.sleep(10)</code></pre><p>11. <strong>Stop the camera recording and close the preview window.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.stop_recording()picam2.stop_preview()</code></pre><p>12. <strong>Save the code as video-test.py </strong>and <strong>click Run to start.</strong> The preview window will appear and you have ten seconds to record a video.</p><p>13. <strong>View the video.</strong>You can get there in the File Manager by locating test.h264. And double-clicking on the video file to play it in VLC. </p><p><br></p><h2 id="complete-code-listing-15">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>from picamera2.encoders import H264Encoderfrom picamera2 import Picamera2, Previewimport timepicam2 = Picamera2()video_config = picam2.create_video_configuration(main={"size": (1920, 1080)}, lores={"size": (640, 480)}, display="lores")picam2.configure(video_config)encoder = H264Encoder(bitrate=10000000)output = "test.h264"picam2.start_preview(Preview.QTGL)picam2.start_recording(encoder, output)time.sleep(10)picam2.stop_recording()picam2.stop_preview()</code></pre><h2 id="using-a-trigger-to-take-a-picture-on-raspberry-pi">Using a Trigger to Take a Picture on Raspberry Pi</h2><p>Camera triggers are a classic Raspberry Pi project. They are used to capture images / video of animals, intruders or to prank unwilling family members. A trigger can be a sensor such as a Passive Infrared (PIR) movement sensor, an ultrasonic sensor, or in our case, a simple push button.</p><p>In this project we will create a simple trigger activated camera trap. We press the button, frame the shot using the preview window, and the file then automatically saves to our Pi using the current time and date as a filename.</p><p>The wiring for this project is simple. The button is connected to GPIO17 and GND via a breadboard and two female to male wires.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1170px;"><p class="vanilla-image-block" style="padding-top:84.87%;"><img id="" name="Trigger_bb.png" alt="Picamera2" src="https://cdn.mos.cms.futurecdn.net/ukGkEy7SChx2k7stu6aaxT.png" mos="" align="middle" fullscreen="1" width="1170" height="993" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ukGkEy7SChx2k7stu6aaxT.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>1. <strong>Open Thonny </strong>and <strong>create a new file. </strong>You can find Thonny on the main menu. </p><p>2. <strong>Import the Picamera2 module, along with the preview class. </strong>Next <strong>import the time module.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2, Previewimport time</code></pre><p>3. <strong>Import the datetime, GPIO Zero and Signal modules.</strong> Datetime is used to generate a timestamp for our image filenames. GPIO Zero is used for a simple button interface. Signal is used to stop the Python code from exiting.</p><pre class="line-numbers language-bash" language="bash" ><code>from datetime import datetimefrom gpiozero import Buttonfrom signal import pause</code></pre><p>4. <strong>Create an object, picam2,</strong> which is used to reference the Picamera2 module and control the camera.</p><pre class="line-numbers language-bash" language="bash" ><code>picam2 = Picamera2()</code></pre><p>5. <strong>Create an object, button, </strong>and <strong>use the object to store the GPIO pin to which our button is connected.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>button = Button(17)</code></pre><p>6. <strong>Create a new object, camera_config </strong>and <strong>use it to set the still image resolution (main) to 1920 x 1080. and a “lowres” image with a size of 640 x 480. </strong>This lowres image is used as the preview image when framing a shot.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>camera_config = picam2.create_still_configuration(main={"size": (1920, 1080)}, lores={"size": (640, 480)}, display="lores")</code></pre><p>7. <strong>Load the configuration.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>picam2.configure(camera_config)</code></pre><p>8. <strong>Create a function, capture(), to store a series of commands </strong>that will be run when the trigger is pressed. Code inside of the function is automatically indented to show that it belongs to the function.</p><pre class="line-numbers language-bash" language="bash" ><code>def capture():</code></pre><p>9. <strong>Start a preview window.</strong> This will enable us to frame our image.</p><pre class="line-numbers language-bash" language="bash" ><code>   picam2.start_preview(Preview.QTGL)</code></pre><p>10. <strong>Create an object, timestamp, </strong>and <strong>use it to store the time and date of the trigger event.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   timestamp = datetime.now().isoformat()</code></pre><p>11. <strong>Start the camera, then pause for two seconds to allow time to frame the image.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   picam2.start()   time.sleep(2)</code></pre><p>12. <strong>Set the capture file, ultimately the image file, to use the current timestamp as the filename.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   picam2.capture_file('/home/pi/%s.jpg' % timestamp)</code></pre><p>13. Finally in the function<strong> stop the preview, </strong>and <strong>stop the camera.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   picam2.stop_preview()   picam2.stop()</code></pre><p>14. <strong>Use GPIO Zero’s button class to react to a button press by calling our “capture” function. </strong>Finally <strong>use pause() to prevent the code from ending.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>button.when_pressed = capturepause()</code></pre><p>15. <strong>Save the code as trigger-test.py </strong>and <strong>click Run to start the code.</strong></p><p>16.<strong> Press the button</strong> to start the camera, and to take an image.</p><p>17. <strong>Open the system File Manager </strong>and <strong>double click on the image to view.</strong></p><h2 id="complete-code-listing-16">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>from picamera2 import Picamera2, Previewimport timefrom datetime import datetimefrom gpiozero import Buttonfrom signal import pausepicam2 = Picamera2()button = Button(17)camera_config = picam2.create_still_configuration(main={"size": (1920, 1080)}, lores={"size": (640, 480)}, display="lores")picam2.configure(camera_config)def capture():    picam2.start_preview(Preview.QTGL)    timestamp = datetime.now().isoformat()    picam2.start()    time.sleep(2)    picam2.capture_file('/home/pi/%s.jpg' % timestamp)    picam2.stop_preview()    picam2.stop()button.when_pressed = capturepause()</code></pre>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Latest Raspberry Pi OS Release Brings Improved Camera and Networking Support ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/new-raspberry-pi-os-release-improved-camera-and-networking</link>
                                                                            <description>
                            <![CDATA[ A new update release of Raspberry Pi OS brings tweaks and new features to everyone's favorite single board computer. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">2Yqhs3tLoGg5gyztkbbh6Z</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/5eNNPTokftsGY7QdqxhTfT-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Wed, 07 Sep 2022 16:38:49 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:25 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Ian Evenden ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/dY5MGBXCT6GV6ARt8oSiSj.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Ian is a UK-based news writer for Tom’s Hardware US. In 1992, he was given a 286-based PC because his parents hoped he’d become a programmer, and was instantly hooked despite the vagaries of MS-DOS. Pretty soon there was a 386 with Windows 3.1, a CD-ROM, and Sound Blaster card under the desk, followed by Pentium II, Athlon, i7 and Threadripper systems, most of which he built himself. After a brief eight-year dalliance with games consoles at Edge magazine, he began contributing to the likes of Maximum PC, PC Gamer, Windows Help and Advice and a few other magazines that have since closed - none of which were directly his fault. His desk today is a riot of PC monitors, Apple products, Raspberry Pi boards, purple unicorns, game controllers and camera lenses. He has no idea about programming.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/5eNNPTokftsGY7QdqxhTfT-1280-80.jpg">
                                                            <media:credit><![CDATA[Raspberry Pi]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[A Raspberry Pi 4 board]]></media:description>                                                            <media:text><![CDATA[A Raspberry Pi 4 board]]></media:text>
                                <media:title type="plain"><![CDATA[A Raspberry Pi 4 board]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/5eNNPTokftsGY7QdqxhTfT-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p><a href="https://www.tomshardware.com/uk/how-to/raspberry-pi-buying-guide">Raspberry Pi</a> systems can bask in that new operating system glow today, with the launch of the latest edition of the tiny computer’s Debian-based OS. This release features many smaller tweaks, but the headline features seem to be an improved Python camera interface, and a simplified ability to easily make a Raspberry Pi into a wireless access point.</p><p>Behind the scenes, this means Pi OS has moved from using the easily edited but slightly obscure dhcphd file to manage networking to the NetworkManager application already used by other Linux distributions. It’s not the default yet, dhcphd is still there, but it will become so in future releases so we’d better get used to it. </p><p>NetworkManager makes it easier to connect to Wi-Fi networks with hidden SSIDs, and smooths the process of dealing with VPNs. Some may find the ability granted by the app to configure your Pi as a wireless access point interesting too. It’s being considered a beta feature for now, and must be switched to using the raspi-config tool.</p><p>Elsewhere, the new <a href="https://www.tomshardware.com/news/raspberry-pi-announce-picamera2-library-preview">Picamera2</a> Python library takes over from the original PiCamera (a community developed project which grew from a personal project) as the "Pythonic" means to interface a camera with your Pi. It is claimed to be easier to use, but differs from the older software. The libcamera library, which offers a command line interface via the terminal is still available for those not ready to PiCamera2.</p><p>Keyboard shortcuts, though not particularly exciting, can speed the use of a computer, and they’ve come under the microscope in this release. Bluetooth and Wi-Fi menus can now be accessed without using the mouse, and there are new audio input controls too - right-clicking the new mic icon in the taskbar gives you a level control, and you can switch between input devices too.</p><p>The new OS release is detailed in a <a href="https://www.raspberrypi.com/news/the-latest-update-to-raspberry-pi-os/">blog post</a> at the Raspberry Pi site, and can be obtained the usual way by downloading it from the appropriate page, or using the Raspberry Pi Imager tool.</p><iframe src="https://content.jwplatform.com/players/YdWWS5dA.html" id="YdWWS5dA" title="Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing" width="1920" height="1080" frameborder="0" scrolling="auto" allowfullscreen></iframe>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Create Web Apps with Python, HTML and Thonny ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny</link>
                                                                            <description>
                            <![CDATA[ Get the latest news, stocks, jokes using RSS feeds and just a little Python. We use the latest version of Thonny to write our own, custom web app. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">cg4qqzErp7US5ZZufrzyY9</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/99ENoLZ2KwUXu9wQbAd2Bi-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sat, 03 Sep 2022 12:00:12 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:28 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/99ENoLZ2KwUXu9wQbAd2Bi-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Create Web Apps with Python, HTML and Thonny]]></media:description>                                                            <media:text><![CDATA[Create Web Apps with Python, HTML and Thonny]]></media:text>
                                <media:title type="plain"><![CDATA[Create Web Apps with Python, HTML and Thonny]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/99ENoLZ2KwUXu9wQbAd2Bi-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Python is a glue. We can use it to join different elements of code together. As a language, Python is easy to learn, and human readable which makes it one of the most effective languages for learning and general purpose programming. Part of Python’s charm are the many modules of code which can be easily inserted into a project. </p><p>Thonny is a powerful yet simple editor for Python and, with the release of version 4, we wanted to use it to create a project. In this how to we shall use the latest version of Thonny to create a web application that will pull Raspberry Pi stock data from <a href="https://rpilocator.com/"><u>rpilocator.com</u></a> and use it to populate a table in our app.</p><p>RSS is a great way to share a stream of information. It can be used to serve news headlines, such as the <a href="https://www.tomshardware.com/feeds/all"><u>Tom’s Hardware RSS feed</u></a> or <a href="https://xkcd.com/rss.xml"><u>even the latest xkcd comic strip</u></a>.</p><p>Nore that the RSS feed from rpilocator is not as up-to-date as the data on <a href="https://rpilocator.com/"><u>rpilocator.com</u></a>. Think of this project as more of a notification system, than a “sniping” tool.</p><h2 id="installing-thonny-4-0">Installing Thonny 4.0</h2><p>Thonny is the default Python IDE on the <a href="https://www.tomshardware.com/news/raspberry-pi"><u>Raspberry Pi</u></a>, but it is not limited to just that machine. Thonny is also available for Windows, Mac and Linux machines, and it can be used to write Python and MicroPython for devices such as the <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w"><u>Raspberry Pi Pico W</u></a> and ESP32.</p><p>1. <strong>Open a </strong><a href="https://thonny.org/"><u><strong>browser to the Thonny homepage.</strong></u></a></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:691px;"><p class="vanilla-image-block" style="padding-top:80.46%;"><img id="" name="Thonny1.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/bAENEfgR4VcffgJKvdxe2g.jpg" mos="" align="middle" fullscreen="1" width="691" height="556" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/bAENEfgR4VcffgJKvdxe2g.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Select the download for your OS</strong>. For Windows, there are a few options to choose from. The first choice is which version of Python, we would recommend the latest (3.10 at the time of writing). Next is your choice of installing Thonny to your machine, or using a portable version. We recommend installing Thonny to your machine.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:696px;"><p class="vanilla-image-block" style="padding-top:92.39%;"><img id="" name="Thonny2.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/cyPrANgdyeiDfBZZLNNJBg.jpg" mos="" align="middle" fullscreen="1" width="696" height="643" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/cyPrANgdyeiDfBZZLNNJBg.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Click on the downloaded file to start the installation.</strong></p><p>4. <strong>Click on “More Info” to continue the installation.</strong> The new installation has a certificate that is relatively unknown and has yet to build up a reputation.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:520px;"><p class="vanilla-image-block" style="padding-top:93.85%;"><img id="" name="Thonny3.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/EtoAevUD9YsKjTXstFoaFg.jpg" mos="" align="middle" fullscreen="1" width="520" height="488" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/EtoAevUD9YsKjTXstFoaFg.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Click on “Run anyway” to continue.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:519px;"><p class="vanilla-image-block" style="padding-top:94.22%;"><img id="" name="Thonny4.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/uKjFpGE3JaRTyakRjsmHKg.jpg" mos="" align="middle" fullscreen="1" width="519" height="489" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/uKjFpGE3JaRTyakRjsmHKg.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>6. <strong>Click next to continue.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:499px;"><p class="vanilla-image-block" style="padding-top:78.56%;"><img id="" name="Thonny5.JPG" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/fnRgQTQCzSb8TSrkPve3mg.jpg" mos="" align="middle" fullscreen="1" width="499" height="392" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/fnRgQTQCzSb8TSrkPve3mg.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>7. <strong>Accept the License agreement.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:493px;"><p class="vanilla-image-block" style="padding-top:78.30%;"><img id="" name="Thonny6.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/wZM9jWNAwK6wQFb7cb2fQg.jpg" mos="" align="middle" fullscreen="1" width="493" height="386" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/wZM9jWNAwK6wQFb7cb2fQg.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>8. <strong>Select the checkbox to create a desktop icon. </strong>This is an optional step, We chose not to do this as we prefer icons in the task bar.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:488px;"><p class="vanilla-image-block" style="padding-top:79.30%;"><img id="" name="Thonny7.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/7WGHhAf3Mg7Sh9sriENcVg.jpg" mos="" align="middle" fullscreen="1" width="488" height="387" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/7WGHhAf3Mg7Sh9sriENcVg.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>9. <strong>Click Install to start the install process.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:493px;"><p class="vanilla-image-block" style="padding-top:78.50%;"><img id="" name="Thonny8.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/afksgGXnaixfaoPwEH8aag.jpg" mos="" align="middle" fullscreen="1" width="493" height="387" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/afksgGXnaixfaoPwEH8aag.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>10. <strong>Click Finish </strong>to end the installation.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:494px;"><p class="vanilla-image-block" style="padding-top:77.94%;"><img id="" name="Thonny9.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/gfFAX5x8nEz5YZx4DvtYfg.jpg" mos="" align="middle" fullscreen="1" width="494" height="385" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/gfFAX5x8nEz5YZx4DvtYfg.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="creating-our-project-with-thonny-4-0">Creating Our Project with Thonny 4.0</h2><p>Thonny is beginner focused, but don’t be fooled, Thonny is a competent and fully featured editor for makers. Thonny has a multi-window layout that can be edited to suit your needs.</p><p>1. <strong>Files:</strong> This is a basic file manager that can be used to open files in a project. Raspberry Pi Pico W and other MicroPython devices will open an additional pane that we can use to copy files to and from the device.</p><p>2. <strong>Coding Area: </strong>Here is where we create the project for our code. We can have multiple tabs, for multiple files.</p><p>3. <strong>Python Shell: </strong>The Python Shell (REPL, Read, Eval, Print, Loop) is where we can see the output of our code, and also interact with it.</p><p>4. <strong>Assistant: </strong>If your code has a bug, or doesn’t follow a styling guideline, it will be flagged here.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1280px;"><p class="vanilla-image-block" style="padding-top:56.95%;"><img id="" name="Layout-Anno.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/56YXe9tDoYdTs5tnSeWDBh.jpg" mos="" align="middle" fullscreen="1" width="1280" height="729" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/56YXe9tDoYdTs5tnSeWDBh.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="installing-modules-with-thonny">Installing Modules with Thonny</h2><p>Python modules (sometimes also referred to as “libraries”) are pre-written segments of code that enable extra functionality. Popular examples include RPI.GPIO and GPIO Zero for the Raspberry Pi. Modules often abstract / simplify complex tasks. In our project we will use two modules. PyWebIO is a module to create HTML content using Python. It also creates a web server that we can use to quickly connect to our app. The second module is Feedparser, an RSS feed reader module that we shall use to read the rpilocator Raspberry Pi stock level feed.</p><p>1. <strong>Open Thonny and ensure that no projects are open.</strong></p><p>2. <strong>Click on Tools >> Manage Packages. </strong>Thonny has a built-in GUI for the Python 3 package manager “pip”.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:381px;"><p class="vanilla-image-block" style="padding-top:55.91%;"><img id="" name="Module1.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/zPEHzMFPGFj364Ajd5HX6h.jpg" mos="" align="middle" fullscreen="1" width="381" height="213" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/zPEHzMFPGFj364Ajd5HX6h.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Search for pywebio.</strong>This is the module that we shall use to generate a web page using Python.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:639px;"><p class="vanilla-image-block" style="padding-top:71.52%;"><img id="" name="Module2.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/sWa2C4LUTAVzTYs9MLw5rg.jpg" mos="" align="middle" fullscreen="1" width="639" height="457" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/sWa2C4LUTAVzTYs9MLw5rg.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Click Install to download and install the module.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:637px;"><p class="vanilla-image-block" style="padding-top:72.06%;"><img id="" name="Module3.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/vUgoiEwt8iTTaUGC59R3wg.jpg" mos="" align="middle" fullscreen="1" width="637" height="459" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/vUgoiEwt8iTTaUGC59R3wg.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Repeat the previous steps, this time install feedparser.</strong> Feedparser is a Python module for RSS feeds.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:634px;"><p class="vanilla-image-block" style="padding-top:72.71%;"><img id="" name="Module6.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/GR5PZTyoJ4nw5QPDrak3Rh.jpg" mos="" align="middle" fullscreen="1" width="634" height="461" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/GR5PZTyoJ4nw5QPDrak3Rh.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>6. <strong>Click Close to quit the dialog.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:636px;"><p class="vanilla-image-block" style="padding-top:72.33%;"><img id="" name="Module4.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/Cd6u27jFxx4bZohshBg62h.jpg" mos="" align="middle" fullscreen="1" width="636" height="460" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Cd6u27jFxx4bZohshBg62h.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="writing-the-project-code">Writing the Project Code</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:655px;"><p class="vanilla-image-block" style="padding-top:58.47%;"><img id="" name="final.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/uquRBpsfxqC3Z9YrfN6qmh.jpg" mos="" align="middle" fullscreen="1" width="655" height="383" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/uquRBpsfxqC3Z9YrfN6qmh.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Our goal is to create a Python project that will use the data from rpilocator’s RSS feed to populate a table. We will grab the current five entries and display them in an HTML table, created using Python.</p><p>1. <strong>In a new blank document, import two modules from pywebio.</strong> The first contains the code to start a simple web server. The pywebio.output module is used to generate HTML elements such as tables and hyperlinks.</p><pre class="line-numbers language-python" language="python" ><code>from pywebio import start_serverfrom pywebio.output import *  </code></pre><p>2. <strong>Import the feedparser module.</strong></p><pre class="line-numbers language-python" language="python" ><code>import feedparser</code></pre><p>3. <strong>Create a function called main.</strong></p><pre class="line-numbers language-python" language="python" ><code>def main():</code></pre><p>4. <strong>Inside the function create an object, “stock” and use it to store the parsed output of the rpilocator RSS feed.</strong></p><pre class="line-numbers language-python" language="python" ><code>   stock = feedparser.parse('https://rpilocator.com/feed/')</code></pre><p>5. <strong>Create three empty lists, in_stock, in_stock_link and category. </strong>These will be used to store the data retrieved from the “stock” object containing the RSS data.</p><pre class="line-numbers language-python" language="python" ><code>   in_stock = []   in_stock_link = []   category = []</code></pre><p>6. <strong>Create a for loop that will iterate five times.</strong></p><pre class="line-numbers language-python" language="python" ><code>   for i in range(5):</code></pre><p>7. <strong>Use “append” to add the stock status, link and category (reseller name) to the appropriate list. </strong>The RSS data stored in “stock” is a mixture of lists and dictionaries. For the data in a list we can use its numerical index, which is the value of i in our for loop. This will count from 0 to 4 as the for loop iterates. The data stored in a dictionary requires us to know the key (‘entries’ for example). Using the key will return its value.</p><pre class="line-numbers language-python" language="python" ><code>       in_stock.append(stock['entries'][i]['title'])       in_stock_link.append(stock['entries'][i]['link'])       category.append(stock['entries'][i]['category'])</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1187px;"><p class="vanilla-image-block" style="padding-top:40.86%;"><img id="" name="RSS.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/XEAeeTYsE9o5yDqr8KutVh.jpg" mos="" align="middle" fullscreen="1" width="1187" height="485" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/XEAeeTYsE9o5yDqr8KutVh.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="caption-text">An example of the RSS feed data viewed in Google Chrome </span><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>8. <strong>Outside of the for loop, create a pop-up notification using “toast”. </strong>The message can be a mixture of a strong, and even emojis.</p><pre class="line-numbers language-python" language="python" ><code>   toast('🍓I found Raspberry Pi in stock!🍓')</code></pre><p>9. <strong>Use “put_html” to write an HTML H1 heading element to the web page. </strong>We can use this function to write any HTML elements to the page, but do take note that the <a href="https://pywebio.readthedocs.io/en/latest/index.html"><u>PyWebIO module</u></a> has many different means to create specialist elements.</p><pre class="line-numbers language-python" language="python" ><code>   put_html("<h1>Raspberry Pi Stock</h1>")</code></pre><p>10. <strong>Create a list, “table” and use it to store two columns of data, taken from our in_stock, in_stock_link and category lists. </strong>The first row are the column headings Details and URL. In stock will print a brief description of what is in stock. Using “put_link” we create an HTML hyperlink, with the link text being the name of the reseller, stored in the category list, and the address stored in in_stock_link.</p><pre class="line-numbers language-python" language="python" ><code>   table = [['Details','URL'],       [in_stock[0], put_link(category[0],url=in_stock_link[0])],       [in_stock[1], put_link(category[1],url=in_stock_link[1])],       [in_stock[2], put_link(category[2],url=in_stock_link[2])],       [in_stock[3], put_link(category[3],url=in_stock_link[3])],       [in_stock[4], put_link(category[4],url=in_stock_link[4])],       ]</code></pre><p>11. <strong>Use PyWebIO’s “put_table” function to create an HTML table from our table object.</strong></p><pre class="line-numbers language-python" language="python" ><code>   put_table(table)</code></pre><p>12. <strong>Use “put_link” to create a hyperlink under the table,</strong> in this case it takes us to the source of the Raspberry Pi stock levels, rpilocator.</p><pre class="line-numbers language-python" language="python" ><code>   put_link('Data provided by RPiLocator',url='https://rpilocator.com')</code></pre><p>13. <strong>Outside of the function, call PyWebIO’s “start_server” function, and pass it three arguments.</strong> The arguments are our “main” function which will create the table from the RSS data. The port is set to 8080, and debugging is enabled via the Python shell and on our web page.</p><pre class="line-numbers language-python" language="python" ><code>start_server(main, port=8080, debug=True)</code></pre><p>14. <strong>Save the code as RSS-Feed-Reader.py and click Run to start.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:99px;"><p class="vanilla-image-block" style="padding-top:71.72%;"><img id="" name="run.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/cKkhNeCMgpW86ja6UvnXah.jpg" mos="" align="middle" fullscreen="1" width="99" height="71" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/cKkhNeCMgpW86ja6UvnXah.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>15. <strong>Click on the link in the Python shell to open the web page in your default browser.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:680px;"><p class="vanilla-image-block" style="padding-top:28.68%;"><img id="" name="shell.jpg" alt="Create Web Apps with Python, HTML and Thonny" src="https://cdn.mos.cms.futurecdn.net/Uztoh7DQq3z47Z4HTrgQfh.jpg" mos="" align="middle" fullscreen="1" width="680" height="195" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Uztoh7DQq3z47Z4HTrgQfh.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-code-listing-17">Complete Code Listing</h2><pre class="line-numbers language-python" language="python" ><code>from pywebio import start_serverfrom pywebio.output import *    import feedparserdef main():   stock = feedparser.parse('https://rpilocator.com/feed/')   in_stock = []   in_stock_link = []   category = []   for i in range(5):       in_stock.append(stock['entries'][i]['title'])       in_stock_link.append(stock['entries'][i]['link'])       category.append(stock['entries'][i]['category'])   toast('🍓I found Raspberry Pi in stock!🍓')   put_html("<h1>Raspberry Pi Stock</h1>")   table = [['Details','URL'],       [in_stock[0], put_link(category[0],url=in_stock_link[0])],       [in_stock[1], put_link(category[1],url=in_stock_link[1])],       [in_stock[2], put_link(category[2],url=in_stock_link[2])],       [in_stock[3], put_link(category[3],url=in_stock_link[3])],       [in_stock[4], put_link(category[4],url=in_stock_link[4])],       ]   put_table(table)   put_link('Data provided by RPiLocator',url='https://rpilocator.com')start_server(main, port=8080, debug=True)</code></pre><h2 id="python-how-tos-8">Python How Tos</h2><ul><li><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">How To Install Python on Windows 10 and 11</a></li><li><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">How to use For Loops in Python</a></li><li><a href="https://www.tomshardware.com/how-to/enumerate-in-python">How to Enumerate in Python</a></li><li><a href="https://www.tomshardware.com/how-to/create-python-executable-applications">How to Create Executable Applications in Python</a></li><li><a href="https://www.tomshardware.com/how-to/python-remove-image-backgrounds">How To Remove Backgrounds From Images With Python</a></li><li><a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny">How to Create Web Apps with Python, HTML and Thonny</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2">How To Use Raspberry Pi Camera Module 3 with Python Code</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Build Your Own 3D Printed Raspberry Pi Robot (Updated) ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/build-your-own-3d-printed-raspberry-pi-robot</link>
                                                                            <description>
                            <![CDATA[ From designing the robot to 3D printing we show you the tools and talk you through the steps to build a Raspberry Pi robot. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">Ph4K9ome55HV8eFgUQodsg</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/4S7wyLNqXYc2CxamM6ndHk-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sun, 07 Aug 2022 12:27:03 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:49:42 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Kevin McAleer ]]></dc:creator>                                                                                                        <dc:description><![CDATA[ null ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/4S7wyLNqXYc2CxamM6ndHk-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[3D printed Raspberry Pi robot]]></media:description>                                                            <media:text><![CDATA[3D printed Raspberry Pi robot]]></media:text>
                                <media:title type="plain"><![CDATA[3D printed Raspberry Pi robot]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/4S7wyLNqXYc2CxamM6ndHk-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p><strong>Update 7th August 2022: </strong>We&apos;ve updated this article to include how to program the Explora in Python on <a href="https://www.tomshardware.com/how-to/build-your-own-3d-printed-raspberry-pi-robot/2">page 2</a>.</p><p><strong>Original Tutorial Published June 4, 2022:</strong></p><p>Building your own robot is one of the most satisfying things you can do. It combines mechanical, electrical, and programming skills together in a way few projects do.</p><p>I’ve been building robots for a couple of years now and love to expand my knowledge and skills by using different controller boards, motors, wheels, and sensors to detect the world around the robot.</p><p>Raspberry Pi robots are particularly impressive. The <a href="https://www.tomshardware.com/news/raspberry-pi">Raspberry Pi</a> provides the robot with the full power of Linux and a plethora of Python libraries.  With all of this power, it means we can add advanced machine learning, computer vision, and Internet connectivity into the mix. All this at an affordable price point and tiny form factor too.</p><p>Building Raspberry Pi robots from kits, such as  <a href="https://www.tomshardware.com/reviews/pimoroni-trilobot">Pimoroni’s Trilobot</a>, or from a custom design such as Explora, is fun and helps develop skills such as programming in Python, mechanical design, and electronics. People love playing with robots and teaching them to perform tasks and move around the environment unaided.</p><p>Explora uses the Pimoroni Explorer pHAT (we included the Explorer HAT Pro in our<a href="https://www.tomshardware.com/best-picks/best-raspberry-pi-hats"> best Raspberry Pi HATs guide</a>) to control the motors and has a handy Python library to make this simple. Explora is programmed in Python and uses sensors to avoid obstacles and follow your handExplora can also be remotely controlled over Wi-Fi.</p><p>Explora can detect objects in front of it using an HC-SR04 ultrasonic range finder module. These modules come in either a 5v version or a 3.3v version (HCSR04+ or HC-SR04P). The Explorer pHAT is 5v tolerant, but it&apos;s best to get the HC-SR04+ or HC-SR04-P version to be on the safe side. Using the 5v version on a Raspberry Pi can damage the board.</p><p>Explora was designed using <a href="https://www.autodesk.com/products/fusion-360/">AutoDesk Fusion 360</a>. Each piece is a discrete component to enable easier  3D printing. Fusion 360 makes it really easy to export the models into STL files, ready for slicing and then 3D printing. To slice the robot parts (creating the instructions for a 3D printer to print the part) from Fusion 360 I use Cura, and then upload it to OctoPrint to manage the print jobs. The 3D printed parts are designed to be quick and easy to print, and the whole thing is easy to assemble using a couple of screws and wire up.</p><p>My personal choice of 3D printer is the<a href="https://www.tomshardware.com/reviews/creality-ender-3-pro-3d-printer"> Creality Ender 3 Pro</a> and Ender 3 V2.</p><p>The electronics for the project are relatively straightforward and involve some soldering. You will need to solder wires to each motor and then to some Male DuPont cables (jumper jerky), one set per motor. You’ll also need something to hold the motors while you solder the wires to the tiny motor connectors which can be a bit tricky if you’ve not done this before. Some “helpful hands” or modeling clay is useful to keep the wires in place.</p><h2 id="what-you-will-need">What You Will Need</h2><ul><li>A <a href="https://www.amazon.com/Ender-V2-Motherboard-Carborundum-8-6x8-6x9-8in/dp/B087FDTV3X"><u>3D printer and filament</u></a></li><li>8 x <a href="https://www.amazon.com/Prime-Line-9120974-Machine-Phillips-Stainless/dp/B07D5S51JL"><u>M3 10mm screws</u></a><a href="https://www.amazon.com/Socket-Button-Washers-Screws-Assortment/dp/B098N8H42Z"><u> and nuts</u></a></li><li>4 x <a href="https://www.amazon.com/Augiimor-Reduction-Gearwheel-Gearbox-Electric/dp/B08B3J6NNT"><u>N20 Motors</u></a></li><li>1 x Pimoroni Explorer Hat</li><li>1 x Raspberry Pi Zero 2 W / <a href="https://www.amazon.com/Raspberry-Pi-Zero-Wireless-model/dp/B06XFZC3BX"><u>Raspberry Pi Zero W</u></a></li><li><a href="https://www.amazon.com/Anker-PowerCore-10000mAh-Portable-Delivery/dp/B07PXMF52C"><u>USB Powerbank battery pack</u></a></li><li><a href="https://www.amazon.com/Gauge-Wire-Solid-Hookup-Wires/dp/B088KQFHV7"><u>400mm of red wire</u></a> - solid core is preferable over the braided wire</li><li><a href="https://www.amazon.com/Gauge-Wire-Solid-Hookup-Wires/dp/B088KQFHV7"><u>400mm of black wire</u></a> - solid core is preferable over the braided wire</li><li><a href="https://www.amazon.com/iUniker-Raspberry-Installation-Standoff-Accessories/dp/B096ZMN8W7"><u>8 x M2.5 Stand-offs</u></a> (with male screw)</li><li><a href="https://www.amazon.com/iUniker-Raspberry-Installation-Standoff-Accessories/dp/B096ZMN8W7"><u>4 x M2.5 Stand-offs</u></a> (without male screw)</li><li><a href="https://www.amazon.com/iUniker-Raspberry-Installation-Standoff-Accessories/dp/B096ZMN8W7"><u>8 x M2.5 Screws</u></a></li><li><a href="https://www.amazon.com/ACROBOTIC-Gearmotor-Arduino-Raspberry-ESP8266/dp/B07NTLPCM4"><u>4 x Moon buggy wheels</u></a></li><li><a href="https://www.amazon.com/EDGELEC-Breadboard-Optional-Assorted-Multicolored/dp/B07GD2BWPY"><u>4 x Male to female Dupont cables (200mm)</u></a></li><li><a href="https://www.amazon.com/Fastening-YiwerDer-Adjustable-Multi-Purpose-Organized/dp/B071DGMNMX"><u>Some velcro straps for the battery pack</u></a></li><li>SD Card for the Raspberry Pi Zero</li><li><a href="https://www.amazon.com/HiLetgo-Infrared-Avoidance-Reflective-Photoelectric/dp/B07W97H2WS"><u>PIR Obstacle sensor</u></a></li></ul><h2 id="tools">Tools</h2><ul><li>Soldering iron</li><li>Solder and some flux</li><li>Screwdriver</li><li>Wire cutters</li><li>Wire strippers</li><li>Helping hands - for use with soldering</li><li>A computer with an SD card reader slot</li></ul><h2 id="3d-printed-files">3D Printed Files</h2><ul><li><a href="http://www.kevsrobots.com/assets/stl/explora/chassis.stl"><u>1x Chassis</u></a></li><li><a href="http://www.kevsrobots.com/assets/stl/explora/motor_holder.stl"><u>4x Motor holders</u></a></li><li><a href="http://www.kevsrobots.com/assets/stl/explora/camera_holder.stl"><u>1x Camera Holder</u></a></li><li><a href="http://www.kevsrobots.com/assets/stl/explora/camera_holder_back.stl"><u>1x Camera back</u></a></li><li><a href="http://www.kevsrobots.com/assets/stl/explora/top_section.stl"><u>1x Top section</u></a></li></ul><h2 id="building-explora">Building Explora</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:75.00%;"><img id="" name="image002.jpg" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/Q9kk6qU3QxfNpJRgXpDSRk.jpg" mos="" align="middle" fullscreen="1" width="2048" height="1536" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Q9kk6qU3QxfNpJRgXpDSRk.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>The print times for each of Explora’s parts depends on your specific printer and quality settings. I found the files took the following amount of time to print:</p><div ><table><thead><tr><th class="firstcol " >#</th><th  >Part</th><th  >Approx Time to Print</th></tr></thead><tbody><tr><td class="firstcol " > 1.</td><td  >Chassis</td><td  >5 hours 16 minutes</td></tr><tr><td class="firstcol " > 2.</td><td  >Top Section</td><td  >2 hours 22 minutes</td></tr><tr><td class="firstcol " > 3.</td><td  >Motor Holders - all 4 at once</td><td  >3 hours 44 minutes</td></tr><tr><td class="firstcol " > 4.</td><td  >Camera holder & Camera holder back at once</td><td  >2 hours 30 minutes</td></tr></tbody></table></div><p>I prefer to use PLA+ for my prints and usually have some white or yellow filament already in each printer, ready to go.</p><h2 id="to-prepare-explora-x2019-s-3d-printed-parts">To Prepare Explora’s 3D Printed Parts</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:75.00%;"><img id="" name="image003.jpg" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/Yf7zSFHw6X75YQFFqjwgbk.jpg" mos="" align="middle" fullscreen="1" width="2048" height="1536" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Yf7zSFHw6X75YQFFqjwgbk.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>1. <a href="http://www.kevsrobots.com/blog/explora.html"><strong>Download the 3D printable STL files</strong></a><strong>.</strong></p><p>2. <strong>Slice the parts using Cura </strong>- We like to use Cura, but you are free to use an alternative. and don&apos;t forget to enable supports for the motor holders</p><p>3. <strong>Transfer the G-Code file from Cura to your 3D Printer.</strong> Save the G-Code file to an SD card (if that&apos;s how your 3D printer accepts files) alternatively you can use software such as OctoPrint that runs on a Raspberry Pi and presents a Web-based interface for managing 3D Print jobs. If you’re using OctoPrint you can drag the G-Code file over the left-hand side of the page and it will begin to upload the file, ready for printing.</p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:56.05%;"><img id="" name="image004.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/8cnYtZ6T4jBZ93LUErnPik.png" mos="" align="middle" fullscreen="1" width="2048" height="1148" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/8cnYtZ6T4jBZ93LUErnPik.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Load the G-code and print</strong> - We used Octoprint to manage our print jobs</p><h2 id="wiring-up-explora">Wiring up Explora</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:48.44%;"><img id="" name="image005.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/Vi6j4SjQv7WjQW5X82boj3.png" mos="" align="middle" fullscreen="1" width="2048" height="992" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Vi6j4SjQv7WjQW5X82boj3.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Soldering is an essential maker skill. Learning to solder opens up the entire world of electronics and this project could be your first steps on an exciting journey. If your motors come without any wires attached you’ll need to prepare your own wires and solder these onto the tiny motors. Soldering small parts can be tricky; you will need a steady hand and something to hold the motors while you hold the solder in one hand and the soldering iron in the other.</p><ul><li><strong>Prepare the wires for soldering.</strong> <strong>Cut four strips of red wire 100mm long each and another four strips of black wire.</strong> We should have a pair of black and red wires for each motor.</li><li><strong>Strip wires. Strip about 4mm of wire from each end, exposing the copper wire. </strong>A good pair of wire strippers is an essential part of a maker's toolbox.</li><li><strong>Add Flux. Apply some flux to one end of the wire that will be soldered.</strong> Flux helps the solder run around the part correctly. Even if your solder comes with a flux core, a little extra flux will make soldering much easier.</li><li><strong>Tin the wires by adding a small amount of solder to the wires with your soldering iron.</strong> Tinning will help the wires solder to the small motor terminals</li><li><strong>Solder the red wire onto the motor terminal - you’ll notice a small + sign above the terminal that is the positive terminal. </strong>Take your time, as<strong> </strong>this can be tricky if you’ve not done it before.</li><li><strong>Push the wire through the hole in the terminal first to make a good mechanical connection</strong> and will help hold the wire in place as you solder, then solder the wire to the terminal.</li><li><strong>Repeat the last step for the black wire but this time </strong>solder the black wire to the Negative terminal on the motor.</li><li><strong>Twist red and black wires for strength.</strong> This will help strengthen the connection if you accidentally tug on the wires.</li></ul><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:48.58%;"><img id="" name="image006.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/Kfa2kc8defCBVidtGP3H3m.png" mos="" align="middle" fullscreen="1" width="2048" height="995" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Kfa2kc8defCBVidtGP3H3m.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>9. <strong>Solder the 40 pin header and 20 pin header to the Explorer pHat</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:48.83%;"><img id="" name="image007.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/ynrtQnvZ5r4TnZS9QC6AQm.png" mos="" align="middle" fullscreen="1" width="2048" height="1000" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ynrtQnvZ5r4TnZS9QC6AQm.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="assembly">Assembly</h2><p>The assembly part of the build won’t take long as it only involves screwing the four motor holders into the chassis using the M2.5 screw and nuts. Then we screw the standoffs into the chassis and Raspberry Pi Zero 2 W, and finally, we attach the Camera holders and top section.</p><p>1.<strong>Push each motor into a 3D printed motor holder</strong>. The motor holders ensure that the motor remains in place on Explora’s chassis. They also offer mechanical rigidity so that the motors do not move position in use.</p><p>2.<strong>Put a nut into each hexagonal pocket on the motor holder, then screw it from the top side of the chassis through to the motor holder into the nut.</strong> Don’t over-tighten as you’ll end up splitting the chassis. This will create a substantial connection between the motor holder and the chassis.</p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:49.02%;"><img id="" name="image008.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/tkHeYoJFnNiU8jjgLRsYwm.png" mos="" align="middle" fullscreen="1" width="2048" height="1004" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/tkHeYoJFnNiU8jjgLRsYwm.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3.<strong>Add stand-offs to the chassis</strong> by screwing four M2.5 screws into the bottom of the chassis, and screw on a stand-off barrel onto the exposed screw thread until it becomes tight against the chassis.</p><p>4.<strong>Add four stand-offs to the Raspberry Pi Zero</strong>, then <strong>attach the Explorer pHat.</strong></p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:75.00%;"><img id="" name="image009.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/Ppr35uDqQ22s8THVz7p8g6.png" mos="" align="middle" fullscreen="1" width="2048" height="1536" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Ppr35uDqQ22s8THVz7p8g6.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5.<strong>Screw the Raspberry Pi Zero into the Chassis stand-offs.</strong></p><p>6.<strong>Push the Camera Holder into the Chassis.</strong> You may need to file off some material if it&apos;s a tight fit.</p><p>7.<strong>Push the ultrasonic rangefinder into the Camera Holder.</strong></p><p>8.<strong>Push the female end of the DuPont wires onto the Rangefinder.</strong></p><p>9.Push the male end of the DuPont wires onto Explorer pHATs 5v, GND, Output 1 to Trigger, Input 1 to Echo connections. </p><p>10.<strong>Push the Camera back into the Chassis.</strong></p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:75.00%;"><img id="" name="image010.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/iWaMjq5CLBjg39qxKn89v7.png" mos="" align="middle" fullscreen="1" width="2048" height="1536" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/iWaMjq5CLBjg39qxKn89v7.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>11.<strong>Add the last four stand-offs onto the Raspberry Pi Zero</strong></p><p>12.<strong>Push the Top section over the two camera holders</strong> and <strong>screw the last 4 M2.5 screws</strong> from the top section <strong>into the standoffs</strong></p><p>13.<strong>Using a velcro strap, secure the battery in place. </strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:75.00%;"><img id="" name="image011.jpg" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/FioYqkmshhmgegKBYQPoEn.jpg" mos="" align="middle" fullscreen="1" width="2048" height="1536" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/FioYqkmshhmgegKBYQPoEn.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>14.<strong>Push the 4 wheels onto the ends of the motors</strong>. The motor axles are D-shaped, be sure to match the alignment of the axle to the wheel before firmly pushing on.</p><h2 id="preparing-the-raspberry-pi">Preparing the Raspberry Pi</h2><p>The Raspberry Pi needs a suitable OS to run the Python code to control the motors and optionally capture images. When the Raspberry Pi camera first launched a software library called PiCamera was provided to make it simple to capture stills and video. With the most recent release of Raspberry Pi OS ‘Bullseye’, this old library has been replaced with a library called LibCamera, which is not backward compatible with PiCamera. On the 32-bit release of Bullseye you can choose a legacy camera option from raspi-config, however, this option is not available on the 64bit release.</p><p>1. <strong>Using the official Raspberry Pi Imager tool, </strong><a href="https://www.tomshardware.com/reviews/raspberry-pi-set-up-how-to,6029.html"><u><strong>flash the latest 32-bit OS to a micro SD card</strong></u></a><strong>.</strong> We use the 32-bit version of Raspberry Pi OS because the PiCamera library is currently not compatible with the 64-bit version of Raspberry Pi OS. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1506px;"><p class="vanilla-image-block" style="padding-top:67.99%;"><img id="" name="image013.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/eGLCw77bkYzoPdAhDwmghn.png" mos="" align="middle" fullscreen="1" width="1506" height="1024" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/eGLCw77bkYzoPdAhDwmghn.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Put the micro SD card into the SD card reader slot on your computer.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:75.00%;"><img id="" name="image014.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/BYRcM7cWskDbm6Xq4vGVN5.png" mos="" align="middle" fullscreen="1" width="2048" height="1536" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/BYRcM7cWskDbm6Xq4vGVN5.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Select the micro SD card</strong> from the Raspberry Pi imager Storage menu.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1458px;"><p class="vanilla-image-block" style="padding-top:67.08%;"><img id="" name="image015.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/hGNGdesXNoXxxR4iwTj8yn.png" mos="" align="middle" fullscreen="1" width="1458" height="978" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/hGNGdesXNoXxxR4iwTj8yn.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Click the Advanced (cog) button, and add your Wi-Fi SSID and password details to enable the Raspberry Pi to connect to the wifi automatically.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1422px;"><p class="vanilla-image-block" style="padding-top:67.09%;"><img id="" name="image016.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/LsJUp64CoHuVDoYhJYZLBo.png" mos="" align="middle" fullscreen="1" width="1422" height="954" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/LsJUp64CoHuVDoYhJYZLBo.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Click on Enable SSH and create a username and password.</strong> SSH enables a remote to the Raspberry Pi using a terminal without the need for a monitor, keyboard, or mouse.</p><p>6. <strong>Click Write to begin flashing the image to the micro SD card.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1448px;"><p class="vanilla-image-block" style="padding-top:67.68%;"><img id="" name="image017.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/vaN3JMe3i9RxspysySpYVo.png" mos="" align="middle" fullscreen="1" width="1448" height="980" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/vaN3JMe3i9RxspysySpYVo.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>7. <strong>Insert the micro SD card into the Raspberry Pi</strong> and then power up the Raspberry Pi via the power bank.</p><h2 id="connecting-to-the-pi">Connecting to the Pi</h2><p>1.  <strong>Find out the IP address of your Raspberry Pi </strong>- you can usually do this from your router (or wherever your router gets its IP addresses from, or by typing:</p><pre class="line-numbers language-bash" language="bash" ><code>ssh pi@raspberrypi.local</code></pre><p>- where `pi` is the username you created earlier in step 5 above.</p><p>2. <strong>Launch Terminal </strong>- if you’re on Windows, you’ll need to use some terminal software such as Putty (<a href="https://www.putty.org/"><u>https://www.putty.org</u></a>). Mac and Linux computers have terminal build-in. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1220px;"><p class="vanilla-image-block" style="padding-top:71.48%;"><img id="" name="image018.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/2dfgVP3LgqreHJsa2HVYJo.png" mos="" align="middle" fullscreen="1" width="1220" height="872" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/2dfgVP3LgqreHJsa2HVYJo.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>SSH to the Raspberry Pi </strong>- Type `ssh pi@raspberrypi.local>` into the terminal to connect to the Pi. Linux / Mac users can use the following to SSH into the Pi. If you know the IP address you cal also type `ssh@<ipaddress>`, where <ipaddress> is the IP address of the Raspberry Pi.</p><pre class="line-numbers language-bash" language="bash" ><code>ssh pi@raspberrypi.local</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1230px;"><p class="vanilla-image-block" style="padding-top:70.89%;"><img id="" name="image019.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/CdzHbYTtHzP22JebqQuc7.png" mos="" align="middle" fullscreen="1" width="1230" height="872" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/CdzHbYTtHzP22JebqQuc7.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p><strong>From the Raspberry Pi terminal, </strong><a href="https://www.github.com/kevinmcaleer/explora"><u><strong>clone the Explora software repository.</strong></u></a> The software is on Github, and we can use the git clone command to download the latest version to our Raspberry Pi:</p><pre class="line-numbers language-bash" language="bash" ><code>git clone https://www.github.com/kevinmcaleer/explora</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1224px;"><p class="vanilla-image-block" style="padding-top:71.73%;"><img id="" name="image020.png" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/oQGdaxgyhZbUZTmrgdb5H.png" mos="" align="middle" fullscreen="1" width="1224" height="878" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/oQGdaxgyhZbUZTmrgdb5H.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Install the Explorer Library via Pimoroni’s online install script.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>curl https://get.pimoroni.com/explorerhat | bash</code></pre><p>4.<strong>From the Raspberry Pi terminal</strong>, <strong>clone the Explora software repository</strong>. The software is on Github, and we can use the git clone command to download the latest version to our Raspberry Pi:</p><pre class="line-numbers language-bash" language="bash" ><code>curl https://get.pimoroni.com/explorerhat | bash</code></pre><p>You should now have a fully assembled Explora robot on your desk, ready to receive your first Explora Python program. You can expand the capabilities of Explora by adding a LIDAR laser scanner and Raspberry Pi Camera such as the ones in the picture below.</p><p>Next, we create some programs for Explora in Python to move the robot around and detect objects.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1999px;"><p class="vanilla-image-block" style="padding-top:75.04%;"><img id="" name="image6.png" alt="Explora" src="https://cdn.mos.cms.futurecdn.net/m8uvEeFg9tgUzuzDCvAygB.png" mos="" align="middle" fullscreen="1" width="1999" height="1500" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/m8uvEeFg9tgUzuzDCvAygB.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="writing-the-project-code-2">Writing the project code</h2><p>The board at the heart of our robot is the Pimoroni Explorer HAT. The Explorer HAT has been around since 2015 and it has been proven to be a reliable and easy to use platform for robotics. This is in part due to the <a href="https://github.com/pimoroni/explorer-hat"><u>Python 3 library and its corresponding documentation</u></a>. The Explorer HAT Python 3 module provides several helper functions that we will use in our project. </p><p>Explorer pHAT has a series of connections broken out along one side of the board. There are two physical motor connectors,each with a positive and negative connection. There are also four input pins and four output pins,and four analog inputs. Two 5 Volt outputs (labeled 5V) and two Ground connections (labeled GND) are there to provide power to components. </p><p>These pins are all referred to in the Explorer HAT Python 3 module as:</p><pre class="line-numbers language-python" language="python" ><code>Motorsexplorerhat.motor.oneexplorerhat.motor.twoInputsexplorerhat.input.oneexplorerhat.input.twoexplorerhat.input.threeexplorerhat.input.fourOutputsexplorerhat.output.oneexplorerhat.output.twoexplorerhat.output.threeexplorerhat.output.four</code></pre><h2 id="motor-functions">Motor functions</h2><p>The Explorer HAT Python 3 module has several motor functions that we can call from within our code. The Documentation describes these as:</p><ul><li><strong>invert()</strong> - Reverses the direction of forwards & backwards for this motor</li><li><strong>forwards(speed)</strong> - Turns the motor forwards at speed (default speed is 100%)</li><li><strong>backwards(speed)</strong> - Turns the motor backwards speed (default speed is 100%)</li><li><strong>speed(-100 to 100)</strong> - Turns the motor at the speed you specify, with -100 being full backwards to 100 being full forwards</li><li><strong>stop()</strong> - Stops the motor by setting the speed to 0</li></ul><h2 id="detecting-objects">Detecting objects</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1024px;"><p class="vanilla-image-block" style="padding-top:75.10%;"><img id="" name="image4.jpg" alt="Explora" src="https://cdn.mos.cms.futurecdn.net/kz9vYwbiuPYe2eF8qs7snA.jpg" mos="" align="middle" fullscreen="1" width="1024" height="769" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/kz9vYwbiuPYe2eF8qs7snA.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Our robot uses a passive infrared (<a href="https://thepihut.com/products/pir-motion-sensor-module?variant=758602485&currency=GBP&utm_medium=product_sync&utm_source=google&utm_content=sag_organic&utm_campaign=sag_organic&gclid=Cj0KCQjw54iXBhCXARIsADWpsG-yW0OUDVFk7xD0AjvtVcww_TIdkb7GeqZGqQPE1O3APZKWMO-0gZAaAnpyEALw_wcB"><u>PIR) obstacle sensor module</u></a> to detect objects. The sensor module has 3 pins:</p><ul><li>VCC</li><li>Ground (GND)</li><li>Signal </li></ul><p>The PIR module attaches to the front, underside section of the robot, and only costs around $3. It works by firing invisible infrared light and using it to detect obstacles. When an obstacle is detected, the signal pin changes state from low to high, and this change is used as a trigger in our code.. The range of the sensor can be tweaked using the potentiometer and can be set from 2 to 30 Centimeters. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1024px;"><p class="vanilla-image-block" style="padding-top:75.10%;"><img id="" name="image1.jpg" alt="Explora" src="https://cdn.mos.cms.futurecdn.net/uft78chMjms5wYnkLm7gWA.jpg" mos="" align="middle" fullscreen="1" width="1024" height="769" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/uft78chMjms5wYnkLm7gWA.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>The PIR sensor attaches to the Explorer pHAT as follows</p><div ><table><thead><tr><th class="firstcol " >Explorer pHAT</th><th  >PIR Sensor</th><th  >Wire Color</th></tr></thead><tbody><tr><td class="firstcol " >5V</td><td  >VCC</td><td  >Red</td></tr><tr><td class="firstcol " >Input 1</td><td  >Signal</td><td  >Yellow</td></tr><tr><td class="firstcol " >GND</td><td  >GND</td><td  >Black</td></tr></tbody></table></div><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:362px;"><p class="vanilla-image-block" style="padding-top:79.83%;"><img id="" name="image5.png" alt="Explora" src="https://cdn.mos.cms.futurecdn.net/x9s3hvXqnsAyDu2rhNThuA.png" mos="" align="middle" fullscreen="1" width="362" height="289" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/x9s3hvXqnsAyDu2rhNThuA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="controlling-the-robot">Controlling the Robot</h2><p>Our robot has the sensor to “see” the world around it, but now we need to give it the intelligence to use that data as a means to navigate the world. Luckily this is made quite simple thanks to Explorer HAT’s abstracted Python 3 library.</p><p>1. <strong>Go to the main Raspberry Pi OS menu and select Programming >> Thonny. </strong>Thonny is the default Python editor for Raspberry Pi OS.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1674px;"><p class="vanilla-image-block" style="padding-top:64.76%;"><img id="" name="image3.jpg" alt="Explora" src="https://cdn.mos.cms.futurecdn.net/Ymzj2wAbW78RjZDhD95zhA.jpg" mos="" align="middle" fullscreen="1" width="1674" height="1084" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Ymzj2wAbW78RjZDhD95zhA.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Create a new file and import the Explorer HAT Python 3 module as eh. </strong>By doing this we shorten the reference to the module and reduce the risk of a typo.</p><pre class="line-numbers language-python" language="python" ><code>import explorerhat as eh</code></pre><p>3. <strong>Import the sleep function from the time module.</strong> We will use this to control the duration of our motors.</p><pre class="line-numbers language-python" language="python" ><code>from time import sleep</code></pre><p>4. <strong>Create a new function to move the robot forward which takes one argument, the speed at which the motors should spin.</strong>. Functions are reusable blocks of code we can call from within our program. Functions take parameters, such as ‘speed’, that allow us to change values within our function’s code. In this example, the speed parameter will change the speed the motors spin when moving our robot forward. A speed of 0 will stop our robot.</p><p><br></p><pre class="line-numbers language-python" language="python" ><code>def forwards(speed):</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1518px;"><p class="vanilla-image-block" style="padding-top:64.56%;"><img id="" name="image2.png" alt="Explora" src="https://cdn.mos.cms.futurecdn.net/aemzX6Gf6R4QWkQnszAfcA.png" mos="" align="middle" fullscreen="1" width="1518" height="980" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/aemzX6Gf6R4QWkQnszAfcA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Print a message to the Python shell for debug purposes. </strong>This will print “Forward” to the shell, enabling us to debug any motor issues.</p><p><br></p><pre class="line-numbers language-python" language="python" ><code>   print(“Forward”)</code></pre><p>6. <strong>Set the motor connected to motor one to move forwards, motor two to backwards</strong>. Motor two is on the other side of the robot, and so to make the motor move in the same direction as motor one, we need to spin it backward.</p><p><br></p><pre class="line-numbers language-python" language="python" ><code>  eh.motor.one.forwards(speed)  eh.motor.two.backwards(speed)</code></pre><p>7. <strong>Create a new function to move the robot backward. </strong>This is essentially the same as forwards, but we reverse the motor directions.</p><p><br></p><pre class="line-numbers language-python" language="python" ><code>def backwards(speed):   print("Backward")   explorer_hat.motor.one.backwards(speed)   explorer_hat.motor.two.forwards(speed)</code></pre><p>8. <strong>Create a new function to spin the robot to the left. </strong>By moving both motors in the same direction it will spin the robot.</p><pre class="line-numbers language-python" language="python" ><code>def turn_left(speed):   print("Left")   eh.motor.one.forwards(speed)   eh.motor.two.forwards(speed)</code></pre><p>9. <strong>Create a new function to spin the robot to the right.</strong> We spin the motors in the opposite direction to the left, causing the robot to spin on the spot.</p><pre class="line-numbers language-python" language="python" ><code>def turn_right(speed):   print("Right")   eh.motor.one.backwards(speed)   eh.motor.two.backwards(speed)</code></pre><pre class="line-numbers language-python" language="python" ><code>def stop():   print("Stop")   eh.motor.one.stop()   eh.motor.two.stop()</code></pre><p>10. <strong>Create a loop that will continually run the robot code.</strong> We need this loop so that the code within the loop is continually checked.</p><pre class="line-numbers language-python" language="python" ><code>while True:</code></pre><p>11. <strong>Create a conditional statement that will check the obstacle sensor output by reading the state of input 1. </strong>When the sensor detects an obstacle, its state changes from 0 (low) to 1 (high). Our if condition trigger will activate when the sensor sends 1.</p><p><br></p><pre class="line-numbers language-python" language="python" ><code>   if eh.input.one.read() == 1:</code></pre><p>12. <strong>Stop the robot, then turn left at 100% speed. </strong>This will force the robot to stop moving, then spin to the left, searching for a path around an obstacle.</p><p><br></p><pre class="line-numbers language-python" language="python" ><code>       stop()       turn_left(100)</code></pre><p>13. <strong>Pause for half a second then stop spinning </strong>and <strong>add an additional half second sleep. </strong>The extra sleep will slow the code looping back to the start of the conditional test. If there were no sleep, the code would loop far too quickly, and our robot would become unpredictable.</p><p><br></p><pre class="line-numbers language-python" language="python" ><code>       sleep(0.5)       stop()       sleep(0.5)</code></pre><p>14. <strong>Add an else condition, which will move the robot forwards at full speed for five seconds. </strong>If there is no obstacle, en.input.one.read() will return 0 (low) and our robot will move forwards for five seconds before the loop repeats.</p><p><br></p><pre class="line-numbers language-python" language="python" ><code>   else:       forwards(100)       sleep(5)</code></pre><p>15. <strong>Save the code and click Run (green arrow on toolbar) to start the code. </strong>The robot will attempt to navigate the world. It is worth elevating your robot so that its wheels are lifted off of the ground. That way you are not chasing your robot around the room while debugging any issues.</p><p><br></p><h2 id="complete-code-listing-18">Complete Code Listing</h2><pre class="line-numbers language-python" language="python" ><code>import explorerhat as ehfrom time import sleepdef forwards(speed):  print("Forward")  eh.motor.one.forwards(speed)  eh.motor.two.backwards(speed)def backwards(speed):   print("Backward")   eh.motor.one.backwards(speed)   eh.motor.two.forwards(speed)def turn_left(speed):   print("Left")   eh.motor.one.forwards(speed)   eh.motor.two.forwards(speed)def turn_right(speed):   print("Right")   eh.motor.one.backwards(speed)   eh.motor.two.backwards(speed)def stop():   print("Stop")   eh.motor.one.stop()   eh.motor.two.stop()while True:   if eh.input.one.read() == 1:       stop()       turn_left(100)       sleep(0.5)       stop()   else:       forwards(100)       sleep(5)</code></pre><h2 id="checklist-what-have-we-achieved">Checklist: What Have We Achieved?</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2048px;"><p class="vanilla-image-block" style="padding-top:75.00%;"><img id="" name="image012.jpg" alt="3D printed Raspberry Pi robot" src="https://cdn.mos.cms.futurecdn.net/fRTHPXEujkoScVHoFRWVUn.jpg" mos="" align="middle" fullscreen="1" width="2048" height="1536" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/fRTHPXEujkoScVHoFRWVUn.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Congratulations you’ve created a robot that can detect and avoid objects.</p><ul><li>How to download, slice and print the Explora 3D printable files.</li><li>How to build and assemble all the parts.</li><li>How to solder wires onto the motors.</li><li>How to prepare the Raspberry Pi OS and install the Explorer Hat Python module.</li><li>You’ve learned how to use the Pimoroni Explorer HAT Python module.</li><li>You have created a control system that senses the real world and feeds this back to our program, steering the robot away from obstacles in its path.</li></ul><h2 id="automating-the-code">Automating the code</h2><p>To set the Python 3 robot code to run when the Raspberry Pi boots, all we need to do is follow our <a href="https://www.tomshardware.com/how-to/run-script-at-boot-raspberry-pi">guide on running Python code at boot</a>, and your robot will be truly autonomous.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/connect-raspberry-pi-pico-w-to-twitter-via-ifttt</link>
                                                                            <description>
                            <![CDATA[ Connecting the $6 Raspberry Pi Pico W to Twitter is a breeze using IFTTTs free service. In this how-to, we send live sensor data to Twitter using IFTTT and MicroPython. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">345QxZqokx5sW7dibQJHy7</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/6bRGrgsUccTfcCoYJx4ceK-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sun, 24 Jul 2022 12:00:55 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:25 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/6bRGrgsUccTfcCoYJx4ceK-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT]]></media:description>                                                            <media:text><![CDATA[How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT]]></media:text>
                                <media:title type="plain"><![CDATA[How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/6bRGrgsUccTfcCoYJx4ceK-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Connecting our projects to the Internet just got a lot easier, and cheaper! The $6 <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w"><u>Raspberry Pi Pico W</u></a>, an upgrade on the original Raspberry Pi Pico, brought one great update: Wi-Fi. This upgrade, along with the $6 price, enables makers to harness the power of the RP2040 SoC for a plethora of Internet of Things applications. The Pico W also tops the list of our <a href="https://www.tomshardware.com/best-picks/best-rp2040-boards"><u>best RP2040 boards.</u></a></p><p>We’ve already covered how to pass data to and from a <a href="https://www.tomshardware.com/how-to/build-raspberry-pi-pico-w-web-app"><u>Raspberry Pi Pico W to another web service, Anvi</u></a>l. But what if you just want to collect some data and send it off into the world? There are many ways to do this, but the simplest has to be IFTTT. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:604px;"><p class="vanilla-image-block" style="padding-top:60.76%;"><img id="" name="ifttt-services.gif" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/WYrx8XyA3mkLX7239FxnBM.gif" mos="" align="middle" fullscreen="1" width="604" height="367" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/WYrx8XyA3mkLX7239FxnBM.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>IFTTT (If This Then That) is a web service that can take data from many different inputs (Twitter, Home Automation, Google, Facebook etc) and send it to other services.</p><p>In this project we’ll use the most basic service, webhooks, to send an HTTP POST request from a Raspberry Pi Pico W to IFTTT’s service. On IFTTT we will create an applet that will intercept the webhook, and trigger a tweet to be sent on Twitter.</p><h2 id="for-this-project-you-will-need-6">For this project you will need</h2><ul><li><a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w">Raspberry Pi Pico W</a></li><li><a href="https://www.adafruit.com/product/386">DHT11 Temperature Sensor</a></li><li><a href="https://www.amazon.com/ELEGOO-tie-points-breadboard-Arduino-Jumper/dp/B01EV640I6/ref=sr_1_1_sspa?crid=DM2LAQ1VJGEV&keywords=Half%2BBreadboard&qid=1658618313&sprefix=half%2Bbreadboard%2Caps%2C203&sr=8-1-spons&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUExQzc3Q1BRN1hJNk5VJmVuY3J5cHRlZElkPUEwMDQ2MjM4MTVGRjA3SVRBTkJKTiZlbmNyeXB0ZWRBZElkPUEwNjcwMjY5MUk5Uk83UjJOMkxUViZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&th=1">Half Breadboard</a></li><li><a href="https://www.amazon.com/EDGELEC-Breadboard-Multicolored-1pin-1pin-Connector/dp/B07GD2KVNR/ref=sr_1_1_sspa?crid=N6TC51BRFKV8&keywords=3x%2BMale%2Bto%2Bmale%2Bjumper%2Bwires&qid=1658618346&sprefix=3x%2Bmale%2Bto%2Bmale%2Bjumper%2Bwires%2Caps%2C117&sr=8-1-spons&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzOTVZOThKOFQ0MDVYJmVuY3J5cHRlZElkPUEwOTkyNDA0M0tOWlJXVFROTEc2MyZlbmNyeXB0ZWRBZElkPUEwMjQwNzA2MVEwV082SDJONFVOVSZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU">3x Male to male jumper wires</a></li></ul><h2 id="the-temperature-sensor-circuit">The Temperature Sensor Circuit</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:888px;"><p class="vanilla-image-block" style="padding-top:93.24%;"><img id="" name="IFTTT-DHT11.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/GU2W7TCNndLLGX47iJv8tL.png" mos="" align="middle" fullscreen="" width="888" height="828" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Our circuit is simple, consisting of just the Raspberry Pi Pico W and a temperature sensor. The DHT11 is a low-cost four-pin temperature sensor which is ubiquitous in the maker community. Looking from the front (the blue “cage”), we connect to the Raspberry Pi Pico W as follows:</p><p><strong>Pin 1: </strong>(Red Wire) Connect VCC to 3V3(OUT) of the Pico W.</p><p><strong>Pin 2: </strong>(Yellow Wire) Connect Data out to GP4 of the Pico W.</p><p><strong>Pin 3: </strong>No connection.</p><p><strong>Pin 4: </strong>(Black Wire) Connect GND to GND of the Pico W.</p><h2 id="setting-up-ifttt">Setting Up IFTTT</h2><p>IFTTT (If This, Then That) is the conduit which links our Raspberry Pi Pico W to Twitter. IFTTT is a free service that offers a myriad of ways to connect different data services together.</p><p>We are going to create an applet which reacts to a webhook (a custom URL) sending data to IFTTT. Then IFTTT will add the data into a message that will be sent to our followers on Twitter.</p><p>1. <strong>In a browser </strong><a href="https://ifttt.com/"><u><strong>visit IFTTT</strong></u></a><strong> and login / create an account.</strong></p><p>2. <strong>Click on Create.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:679px;"><p class="vanilla-image-block" style="padding-top:32.84%;"><img id="" name="ifttt1.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/Q7D6DbHiPvpAcCLg4RZRuK.png" mos="" align="middle" fullscreen="" width="679" height="223" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Click on Add. </strong>This is our trigger event. If this happens, our applet starts. In our case if a webhook is sent from the Raspberry Pi Pico W.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:759px;"><p class="vanilla-image-block" style="padding-top:53.75%;"><img id="" name="ifttt2.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/bRF9W6MVUD4RJ3H8KVpuyK.png" mos="" align="middle" fullscreen="1" width="759" height="408" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/bRF9W6MVUD4RJ3H8KVpuyK.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Search for webhook, and then click on the webhook icon.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:747px;"><p class="vanilla-image-block" style="padding-top:49.93%;"><img id="" name="ifttt4.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/AupoX5q7XuSD2FyDTjKW8L.png" mos="" align="middle" fullscreen="1" width="747" height="373" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/AupoX5q7XuSD2FyDTjKW8L.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Click on Receive a web request.</strong> This is our request, sent from the Raspberry Pi Pico W.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:981px;"><p class="vanilla-image-block" style="padding-top:45.36%;"><img id="" name="ifttt5.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/idFjaZYouF2S3RnFTgJiCL.png" mos="" align="middle" fullscreen="1" width="981" height="445" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/idFjaZYouF2S3RnFTgJiCL.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>6. <strong>Set the Event Name to Post_Tweet and then click Create Trigger.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:958px;"><p class="vanilla-image-block" style="padding-top:56.26%;"><img id="" name="ifttt6.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/QqDZyLLCWwzD4hRoBY3cGL.png" mos="" align="middle" fullscreen="1" width="958" height="539" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/QqDZyLLCWwzD4hRoBY3cGL.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>7. Click on Then That Add. This is the outcome of our trigger, in this case a Tweet is sent.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:733px;"><p class="vanilla-image-block" style="padding-top:55.80%;"><img id="" name="ifttt7.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/B7SixLoQdD7K38gaDKX6LL.png" mos="" align="middle" fullscreen="1" width="733" height="409" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/B7SixLoQdD7K38gaDKX6LL.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>8. <strong>Search for Twitter and then click on the Twitter icon.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:757px;"><p class="vanilla-image-block" style="padding-top:69.22%;"><img id="" name="ifttt3.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/XsnB9fhor2uo8uJriJBU4L.png" mos="" align="middle" fullscreen="1" width="757" height="524" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/XsnB9fhor2uo8uJriJBU4L.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>9. <strong>Select Post a Tweet.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1051px;"><p class="vanilla-image-block" style="padding-top:37.30%;"><img id="" name="ifttt8.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/iNwHdphUUqUXM32gSJgpPL.png" mos="" align="middle" fullscreen="1" width="1051" height="392" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/iNwHdphUUqUXM32gSJgpPL.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>10. <strong>Check that the correct Twitter account is selected, you may have to link your Twitter account to IFTTT. Replace the tweet text with your own custom message. </strong>Linking your Twitter account to IFTTT is an automated process, which IFTTT will trigger and ask you to confirm.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:576px;"><p class="vanilla-image-block" style="padding-top:92.71%;"><img id="" name="ifttt9.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/gt7JUhhJuBkVbPeQdKuRTL.png" mos="" align="middle" fullscreen="1" width="576" height="534" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/gt7JUhhJuBkVbPeQdKuRTL.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>11. <strong>Click on Add ingredient and select Value 1. Then finish the remainder of the message, in this case stating that the temperature is in degrees Celsius. Click Create Action to save.</strong> Ingredients are IFTTT’s way of adding extra information to our tweet by pulling the data from our custom URL.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:484px;"><p class="vanilla-image-block" style="padding-top:80.17%;"><img id="" name="ifttt10.gif" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/zrtMa7GqKaZrhvpNZXAwWL.gif" mos="" align="middle" fullscreen="1" width="484" height="388" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/zrtMa7GqKaZrhvpNZXAwWL.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>12. <strong>Click Continue.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:796px;"><p class="vanilla-image-block" style="padding-top:53.39%;"><img id="" name="ifttt11.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/wNQWmUqqPK5of9wrLtyRkL.png" mos="" align="middle" fullscreen="1" width="796" height="425" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/wNQWmUqqPK5of9wrLtyRkL.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>13. Review the applet details, check the notifications option to on, and click Finish when ready. Notifications enable us to debug the applet, should an issue occur.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:721px;"><p class="vanilla-image-block" style="padding-top:86.96%;"><img id="" name="ifttt12.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/HvPTTEgPciCAXUrfadaroL.png" mos="" align="middle" fullscreen="1" width="721" height="627" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/HvPTTEgPciCAXUrfadaroL.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>The IFTTT Applet has been created, but we don’t yet have the webhook URL. This URL is what sends the temperature data from the Raspberry Pi Pico W to our IFTTT service. The URL requires our trigger (Post_Tweet) and an API key, unlocking IFTTT access.</p><p>1.<strong>Visit </strong><a href="https://ifttt.com/maker_webhooks"><u><strong>this link</strong></u></a><strong> in a new browser tab / window.</strong></p><p>2. <strong>Copy the Make a POST or GET web request link into notepad or a text editor. </strong>Your text will show a correct API key, for security reasons we have edited the text.</p><pre class="line-numbers language-bash" language="bash" ><code>https://maker.ifttt.com/trigger/{event}/json/with/key/YOUR API KEY HERE</code></pre><p>3. <strong>Remove /json and change {event} to Post_Tweet.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>https://maker.ifttt.com/trigger/Post_Tweet/with/key/YOUR API KEY HERE</code></pre><p>You now have a valid webhook URL which will link your Raspberry Pi Pico W to Twitter via IFTTT.</p><h2 id="setting-up-the-raspberry-pi-pico-w">Setting up the Raspberry Pi Pico W</h2><p>Our Raspberry Pi Pico W is acting as a data collection device. It connects to our Wi-Fi, and every hour takes a temperature reading. This is then sent to IFTTT using a custom webhook URL. IFTTT then sends the message to Twitter as per the applet we have just created. </p><p>Our goal is now to install the latest MicroPython firmware release for our Raspberry Pi Pico W, then write a few lines of MicroPython code to connect to our Wi-Fi, take a temperature reading, and then send that data to IFTTT.</p><p>1. <strong>Follow </strong><a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup"><u><strong>this guide</strong></u></a> to download and install the MicroPython firmware, and setup Thonny.</p><p>2. <strong>Open Thonny and create a new file.</strong></p><p>3. <strong>Import three modules of code.</strong> Network enables the Pico W to connect to a Wi-Fi network. Urequests is a version of requests, a means to work with web data, for MicroPython. DHT refers to the DHT11 temperature sensor used in the project.</p><pre class="line-numbers language-bash" language="bash" ><code>import networkimport urequestsimport dht</code></pre><p>4. <strong>Import two further modules of code. </strong>From the Time module, import the sleep function, we’ll use this to add a pause to the project. From the Machine module import Pin, this enables our code to interact with the GPIO.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>from time import sleepfrom machine import Pin</code></pre><p>5. <strong>Create an object, “sensor” which connects our code to the DHT11 connected via the GPIO. </strong>This object enables us to interact with the sensor connected on Pin 2, querying temperature data.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>sensor = dht.DHT11(Pin(2)) </code></pre><p>6. <strong>Create an object “wlan” and use it to connect the code to the Wi-Fi on the Raspberry Pi Pico W, then turn the Wi-Fi on.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>wlan = network.WLAN(network.STA_IF)wlan.active(True)</code></pre><p>7. <strong>Connect your Pico W to your Wi-Fi access point using its SSID and password.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>wlan.connect("SSID","PASSWORD")</code></pre><p>8. <strong>Pause for five seconds before proceeding onward.</strong> This isn’t strictly necessary as the previous Wi-Fi connection is a blocking call that will either connect or fail, then release the block. This pause is present to allow a little extra leeway.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>sleep(5)</code></pre><p>9. <strong>Print the current status of the Wi-Fi connection.</strong> This will either be True for a successful connection, or False if it was unable to connect.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>print(wlan.isconnected())</code></pre><p>10. <strong>Add a loop to continually run the following code.</strong> A while True loop will continuously run the code until the Pico W is turned off. Note that the code following this line is indented to show that it is part of the loop.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>while True:</code></pre><p>11. <strong>Take a reading with the DHT11</strong>. We need to do this in order to get the raw data.</p><pre class="line-numbers language-bash" language="bash" ><code>   sensor.measure()</code></pre><p>12. <strong>Save the current temperature to an object, temperature.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   temperature = sensor.temperature()</code></pre><p>13. <strong>Print the temperature to the Python Shell (REPL). </strong>This is useful to debug any issues. It should show the temperature each time the loop iterates.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   print(temperature)</code></pre><p>14. <strong>Create an object, message, to store the unique webhook URL that we created earlier. At the end of the URL add ?value1= and ensure that this is contained between quotation marks “ “</strong>. Remember to add your unique IFTTT API key.</p><pre class="line-numbers language-bash" language="bash" ><code>   message = "https://maker.ifttt.com/trigger/Post_Tweet/with/key/YOUR IFTTT API KEY HERE?value1="</code></pre><p>15. <strong>To the same line, add the current temperature stored in the “temperature” object. </strong>Note that we need to convert the temperature from an integer / float into a string using the str() function. Your message line should now read as follows.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   message = "https://maker.ifttt.com/trigger/Post_Tweet/with/key/YOUR IFTTT API KEY HERE?value1="+str(temperature)</code></pre><p>16. <strong>Post the message to Twitter using urequests.post. </strong>This essentially sends the data to IFTTT via the webhook URL, and IFTTT then sends it to Twitter.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   urequests.post(message)</code></pre><p>17. <strong>Pause the code for one hour (3600 seconds) before allowing the loop to repeat. </strong>IFTTT has a rate limit of 25 tweets per day, so to have a constant feed of data we need to limit the tweets to one per hour. If you go over this limit, IFTTT disables the applet until the next day.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   sleep(3600)</code></pre><p>18. <strong>Save the code to your Raspberry Pi Pico W as tweet_temp.py</strong></p><h2 id="complete-code-listing-19">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import networkimport urequestsimport dhtfrom time import sleepfrom machine import Pinsensor = dht.DHT11(Pin(2)) wlan = network.WLAN(network.STA_IF)wlan.active(True)wlan.connect("SSID","PASSWORD")sleep(5)print(wlan.isconnected())while True:    sensor.measure()    temperature = sensor.temperature()    print(temperature)    message = "https://maker.ifttt.com/trigger/Post_Tweet/with/key/YOUR IFTTT API KEY HERE?value1="+str(temperature)    urequests.post(message)    sleep(3600)</code></pre><h2 id="testing-and-running-the-code">Testing and Running the Code</h2><p>Before we properly deploy the project we need to test that the code works.</p><p>1. Click on the Run button, located in the top left corner of Thonny.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:456px;"><p class="vanilla-image-block" style="padding-top:26.75%;"><img id="" name="run.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/VuGiLnT3aHCHuxQh36wFMM.png" mos="" align="middle" fullscreen="1" width="456" height="122" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/VuGiLnT3aHCHuxQh36wFMM.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Check the output. </strong>You should see True, confirming we are connected to the Wi-Fi. Then the temperature should appear.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1156px;"><p class="vanilla-image-block" style="padding-top:57.79%;"><img id="" name="output.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/jb7m2ESfRneSXSTaECkkGM.png" mos="" align="middle" fullscreen="1" width="1156" height="668" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/jb7m2ESfRneSXSTaECkkGM.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Visit your Twitter account and check that the message has been posted. </strong>This should take approximately 10 - 20 seconds to appear.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:612px;"><p class="vanilla-image-block" style="padding-top:39.38%;"><img id="" name="tweet.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/nRZmUp8gPyVaJn6hxi5aaM.png" mos="" align="middle" fullscreen="1" width="612" height="241" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/nRZmUp8gPyVaJn6hxi5aaM.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Click on Stop to stop the running code.</strong></p><p><img src="https://lh6.googleusercontent.com/R17KBd3VvJ-LdwuR4gFQPWpnvilpwlxLwenpmY7sGz27KtEdQFt0C9ppapYGXXSYxp4kJSkyCucE0ZoC8YM63oJ1Ig5Z6ZSh0sDfsn6croQNHrypw9wp38yqBV7Bt8W8tqxKVGmgQ3OPPc0CYv9RRWk"></p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:375px;"><p class="vanilla-image-block" style="padding-top:37.60%;"><img id="" name="stop.png" alt="How to Connect Your Raspberry Pi Pico W to Twitter via IFTTT" src="https://cdn.mos.cms.futurecdn.net/iEXdk3mzRTQyfaTFpifwQM.png" mos="" align="middle" fullscreen="1" width="375" height="141" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/iEXdk3mzRTQyfaTFpifwQM.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>With the code successfully tested, we can now set the code to automatically run when the Raspberry Pi Pico W boots.</p><p>1. <strong>Save As the code to your Raspberry Pi Pico W as main.py. </strong>MicroPython (on any device) will look for main.py when it powers up. If present, the code inside this file is autorun.</p><p>2. <strong>Unplug the micro USB lead from the Pico W, then re-insert to force a reboot.</strong></p><p>3. <strong>Check your Twitter account for the corresponding tweet.</strong></p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How To Build a Raspberry Pi Pico W Web App With Anvil ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/build-raspberry-pi-pico-w-web-app</link>
                                                                            <description>
                            <![CDATA[ Integrate the $6 Raspberry Pi Pico W into a web app with the help of Anvil and a little Python code. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">aSKofQbt8HJ3K8H2E6sZ97</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/Kv28FbAzXYgJ9KVabLLPXC-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sat, 09 Jul 2022 21:53:40 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:48:40 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/Kv28FbAzXYgJ9KVabLLPXC-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Anvil Pico]]></media:description>                                                            <media:text><![CDATA[Anvil Pico]]></media:text>
                                <media:title type="plain"><![CDATA[Anvil Pico]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/Kv28FbAzXYgJ9KVabLLPXC-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>The <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w"><u>Raspberry Pi Pico W</u></a> packs a ton of functionality into a very affordable package. For just $6 we get the same dual core Arm Cortex M0+ CPU running at 133 MHz, 264KB of RAM and 2MB of flash memory as the original <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-review"><u>Raspberry Pi Pico</u></a>. But we also get a 2.4 GHz capable Wi-Fi chip, all in the same DIP package.</p><p>The inclusion of Wi-Fi is the biggest draw. We have a simple and cheap microcontroller, with enough horsepower to accomplish many projects typically reserved for more powerful and expensive Raspberry Pis, such as the <a href="https://www.tomshardware.com/reviews/raspberry-pi-4"><u>Raspberry Pi 4</u></a> and the <a href="https://www.tomshardware.com/reviews/raspberry-pi-zero-2-w-review"><u>Raspberry Pi Zero 2 W</u></a>.</p><p>Wi-Fi enables Internet of Things (IoT) projects and for that we need a secure and easy-to-use means to write projects. Step forward Anvil, which,  offers Pico W firmware that trivialises IoT projects and takes advantage of its uplink service. With Anvil and the uplink service, we can easily write code on the web that will interact with the $6 Wi-Fi enabled micro-controller.</p><p>In this how-to we shall write a project that enables two-way communication between the Raspberry Pi Pico W and Anvil’s servers in the cloud. We will send live sensor data from the Raspberry Pi Pico W to a web app on Anvil’s servers. We shall also send messages from the app to the Raspberry Pi Pico W, to be displayed on a small LCD display.</p><h2 id="for-this-project-you-will-need-7">For this project you will need</h2><ul><li>Raspberry Pi Pico W</li><li>An I2C LCD display</li><li>A DHT11 Temperature Sensor</li><li>4x Female to male jumper wires</li><li>3x Male to Male jumper wires</li><li>1x Half size <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-breadboard-electronics"><u>breadboard</u></a></li></ul><h2 id="building-the-circuit-for-anvil-on-a-pico-w">Building the Circuit for Anvil on a Pico W</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:655px;"><p class="vanilla-image-block" style="padding-top:46.72%;"><img id="" name="Anvil-Circuit.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/VStGtZXnLvd5vdYTCP5HNA.png" mos="" align="middle" fullscreen="1" width="655" height="306" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/VStGtZXnLvd5vdYTCP5HNA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>The circuit for this project consists of one input device, a DHT11 temperature sensor, and one output, an LCD screen connected over I2C. The DHT11 will measure the temperature and humidity, which is then sent to Anvil to be displayed in a web app. The LCD screen will display short messages, typed into the same Anvil web app.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:313px;"><p class="vanilla-image-block" style="padding-top:82.75%;"><img id="" name="DHT11.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/JEcmxR4La44qTTaZKuSvEC.png" mos="" align="middle" fullscreen="1" width="313" height="259" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/JEcmxR4La44qTTaZKuSvEC.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>The DHT11 has four pins. Looking from the front (the blue “cage”) we connect to the Raspberry Pi Pico W as follows</p><p><strong>Pin 1: </strong>(Red Wire) Connect VCC to 3V3(OUT) of the Pico W.</p><p><strong>Pin 2: </strong>(Yellow Wire) Connect Data out to GP4 of the Pico W.</p><p><strong>Pin 3: </strong>No connection.</p><p><strong>Pin 4: </strong>(Black Wire) Connect GND to GND of the Pico W.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:655px;"><p class="vanilla-image-block" style="padding-top:46.72%;"><img id="" name="LCD.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/scm7e272Rps85gTu6Wd3bC.png" mos="" align="middle" fullscreen="1" width="655" height="306" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/scm7e272Rps85gTu6Wd3bC.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>The LCD has four connections.</p><p><strong>GND: </strong>(Black Wire) Connect to any GND on the Pico W.</p><p><strong>VCC: </strong>(Red Wire) Connect to VBUS on the Pico W.</p><p><strong>SDA:</strong> (Yellow Wire) Connect to I2C0 SDA on the Pico W.</p><p><strong>SCL:</strong> (Orange Wire) Connect to I2C0 SCL on the Pico W.</p><p>Check your wiring before moving onwards.</p><h2 id="setting-up-the-raspberry-pi-pico-w-2">Setting up the Raspberry Pi Pico W</h2><p>Anvil uses a custom firmware image for the Raspberry Pi Pico W, an image which simplifies connecting the Pico W to Anvil’s services. The firmware is based on MicroPython, with the Pico W appearing as a USB drive with two files (boot.py and main.py). Before we can write any code for our project we first need to flash the custom firmware to the Pico W, and connect to our Wi-Fi.</p><p>1. <strong>Download the custom Raspberry Pi Pico W </strong><a href="https://github.com/anvil-works/anvil-pico/releases/latest"><u><strong>firmware from Anvil.</strong></u></a></p><p>2. <strong>Push and hold the BOOTSEL button on the Pico</strong>, then connect to your computer using a micro USB cable. Release BOOTSEL once the drive RPI-RP2 appears on your computer.</p><p>3. <strong>Drag and drop the Anvil UF2 file</strong> onto the RPI-RP2 drive. The Raspberry Pi Pico will reboot and will now run MicroPython.</p><p>4. <strong>Open File Explorer and navigate to the new USB drive</strong>. Anvil’s firmware uses MicroPython, and presents itself as a USB drive, similar to CircuitPython.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:216px;"><p class="vanilla-image-block" style="padding-top:59.72%;"><img id="" name="Drive.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/442J7BvNUW5RNVtdophCJC.png" mos="" align="middle" fullscreen="1" width="216" height="129" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/442J7BvNUW5RNVtdophCJC.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Open boot.py in a text editor and change the values for WIFI_SSID and WIFI_PASSWORD to match your setup. Save and exit when done. </strong>This file contains all of the Python code which is run at boot. In this case, it will connect to our Wi-Fi AP and flash the Pico W’s onboard LED if there is no connection.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1091px;"><p class="vanilla-image-block" style="padding-top:45.00%;"><img id="" name="boot.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/HWmZi5DPECpCDsBGRFpxVA.png" mos="" align="middle" fullscreen="1" width="1091" height="491" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/HWmZi5DPECpCDsBGRFpxVA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Your Raspberry Pi Pico W should now connect to your Wi-Fi and the onboard LED should stop blinking. A static LED means we are connected to the Wi-Fi and ready for our project.</p><h2 id="code-for-the-raspberry-pi-pico">Code for the Raspberry Pi Pico</h2><p>1. <strong>Install Thonny </strong>on your computer if you haven’t done so already. Follow the steps in our article on <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup"><u>how to set up a Raspberry Pi Pico W</u></a>.  Thonny is an easy to use Python editor which has been configured to work with the Raspberry Pi Pico.</p><p>2. <strong>Create a new blank file</strong> in Thonny.</p><p>3. <strong>Open this</strong><a href="https://raw.githubusercontent.com/dhylands/python_lcd/master/lcd/lcd_api.py"><strong> link</strong></a><strong> and copy the text</strong> from the page.</p><p>4. <strong>Save the file to the Raspberry Pi Pico as lcd_api.py</strong></p><p>5. <strong>Create another blank file.</strong></p><p>6. <strong>Open this </strong><a href="https://raw.githubusercontent.com/T-622/RPI-PICO-I2C-LCD/main/pico_i2c_lcd.py"><strong>link</strong></a><strong> and copy the text</strong> from the page.</p><p>7. <strong>Save the file to the Raspberry Pi Pico as pico_i2c_lcd.py </strong>These two files enable the use of the I2C LCD screen with the Raspberry Pi Pico W.</p><p>8. <strong>Open main.py</strong>, found on the Raspberry Pi Pico W drive.</p><p>9. <strong>Delete the contents of main.py.</strong></p><p>10. <strong>Import three modules of pre-written code.</strong> The first is anvil.pico and this enables our Pico W to connect to Anvil’s servers. Next, uasyncio creates an asynchronous scheduler on the Pico W, we need this for running concurrent functions in our code. The third module is machine, and from that we need the Pin (GPIO pins) and I2C classes to communicate with the GPIO and LCD screen.</p><pre class="line-numbers language-bash" language="bash" ><code>import anvil.picoimport uasyncio as afrom machine import Pin, I2C</code></pre><p>11. <strong>Import three more modules</strong>. The time module enables control over the pace of our code. The dht module is specific for the DHT11 (and DHT22) temperature sensor and acts as an easier means to get data from the sensor. The pico_i2c_lcd enables our code to use the LCD display.</p><pre class="line-numbers language-bash" language="bash" ><code>from time import sleepimport dhtfrom pico_i2c_lcd import I2cLcd</code></pre><p>12. <strong>Create an object, i2c, to create a connection from our code to the I2C bus. I2C0 has SDA at pin 0 and SCL at pin 1.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)</code></pre><p>13. <strong>Create an object I2C_ADDR to store the I2C address of the LCD display. </strong>This line of code will scan the I2C bus for the address and store it in the object.</p><pre class="line-numbers language-bash" language="bash" ><code>I2C_ADDR = i2c.scan()[0]</code></pre><p>14. <strong>Create an object, lcd, to make a connection between our code and the LCD display.</strong> This uses the i2c object, the I2C address, and sets the display to have 2 lines and 16 characters. There are screens with differing sizes, so adjust this to match your screen.</p><pre class="line-numbers language-bash" language="bash" ><code>lcd = I2cLcd(i2c, I2C_ADDR, 2, 16)</code></pre><p>15. <strong>Turn the LCD backlight on, and set the cursor to blink.</strong> The backlight is essential as the screen can be hard to read. The flashing cursor, that’s more of a retro vibe.</p><pre class="line-numbers language-bash" language="bash" ><code>lcd.backlight_on()lcd.blink_cursor_on()</code></pre><p>16. <strong>Create an object UPLINK_KEY, and for now store blank data. </strong>This is where our Anvil Pico Uplink key will be stored. We will get that information later.</p><pre class="line-numbers language-bash" language="bash" ><code>UPLINK_KEY = " “</code></pre><p>17. <strong>Create an object, sensor, to store a connection from our code to the DHT11 temperature sensor.</strong> Using this object we can interact with the DHT11 and get data.</p><pre class="line-numbers language-bash" language="bash" ><code>sensor = dht.DHT11(Pin(2)) </code></pre><p>18. <strong>Use a Python decorator to instruct Anvil that the next function is callable from the Anvil web app.</strong> Decorators are a means to add additional functionality to a function, without impacting the function.</p><pre class="line-numbers language-bash" language="bash" ><code>@anvil.pico.callable(is_async=True)</code></pre><p>19. <strong>Create a function, dht11data which will work with the scheduler.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>async def dht11data():</code></pre><p>20. <strong>Take a reading with the DHT11</strong>. We need to do this in order to get the raw data. Note that we are now inside the function and our code is now indented to show that it belongs to the function.</p><pre class="line-numbers language-bash" language="bash" ><code>   sensor.measure()</code></pre><p>21. <strong>Create two objects, temp and hum to store the temperature and humidity readings from the DHT11.</strong> The round() function rounds the values to one decimal place.</p><pre class="line-numbers language-bash" language="bash" ><code>   temp = round(sensor.temperature(),1)   hum = round(sensor.humidity(),1)</code></pre><p>22. <strong>Create an object, data, which will store a string / sentence</strong> containing the temperature and humidity data using string formatting to insert the data into the sentence.</p><pre class="line-numbers language-bash" language="bash" ><code>   data = ("Temperature: {}°C   Humidity: {:.0f}% ".format(temp, hum))</code></pre><p>23. <strong>Print the sentence to the Python shell, and then use return to output the sentence for Anvil to read.</strong> These lines are the last for this function.</p><pre class="line-numbers language-bash" language="bash" ><code>   print(data)   return data</code></pre><p>24. <strong>Create another decorator, this time for a function that will show messages on the LCD screen.</strong> The message is passed as an argument to the function <em>(message)</em>.</p><pre class="line-numbers language-bash" language="bash" ><code>@anvil.pico.callable(is_async=True)async def show_message(message):</code></pre><p>25. <strong>Use a for loop to flash the LCD backlight three times.</strong> This will get our attention for an incoming message. The backlight is simply turned on and off, with a short pause between each.</p><pre class="line-numbers language-bash" language="bash" ><code>   for i in range(3):       lcd.backlight_on()       sleep(0.2)       lcd.backlight_off()       sleep(0.2)</code></pre><p>26. <strong>Turn the backlight on.</strong> We need the backlight to see the text.</p><pre class="line-numbers language-bash" language="bash" ><code>   lcd.backlight_on()</code></pre><p>27. <strong>Write the message to the LCD display, and then pause for ten seconds.</strong> Long enough to read the message. <strong>Then clear the LCD display. </strong>This is the end of this function.</p><pre class="line-numbers language-bash" language="bash" ><code>   lcd.putstr(message)   sleep(10)   lcd.clear()</code></pre><p>28. <strong>Connect the Pico W to Anvil’s servers using your uplink key.</strong> We will get the key later in this project.</p><pre class="line-numbers language-bash" language="bash" ><code>anvil.pico.connect(UPLINK_KEY)</code></pre><p>29. <strong>Save the code as main.p</strong></p><h2 id="anvil-code-for-raspberry-pi-pico-w">Anvil Code for Raspberry Pi Pico W</h2><p>1. <strong>Go to the </strong><a href="https://anvil.works/"><u><strong>Anvil website</strong></u></a><strong> and click on Start Building.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1238px;"><p class="vanilla-image-block" style="padding-top:58.48%;"><img id="" name="Anvil1.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/ZufKmy6qfwagG6ZnUKvr7A.png" mos="" align="middle" fullscreen="1" width="1238" height="724" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ZufKmy6qfwagG6ZnUKvr7A.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Sign in or sign up for a free account.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1223px;"><p class="vanilla-image-block" style="padding-top:59.28%;"><img id="" name="Anvil2.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/fcEtEVvi38yMfZQk5p8qBA.png" mos="" align="middle" fullscreen="1" width="1223" height="725" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/fcEtEVvi38yMfZQk5p8qBA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Create a new blank app.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:468px;"><p class="vanilla-image-block" style="padding-top:87.39%;"><img id="" name="A‎nvil3.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/oyU7GpSnKkFyqE7Lc3ymFA.png" mos="" align="middle" fullscreen="1" width="468" height="409" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/oyU7GpSnKkFyqE7Lc3ymFA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Select Material Design Theme.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:635px;"><p class="vanilla-image-block" style="padding-top:32.28%;"><img id="" name="Anvil4.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/nwrMtsisgPRCbzG4Vp92KA.png" mos="" align="middle" fullscreen="1" width="635" height="205" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/nwrMtsisgPRCbzG4Vp92KA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>The Anvil editor is split into two sections. Design and Code. In the Design section we create the user interface for our app. In Code, we give the application the functionality that we require. We’ll start by adding elements to the app, and then we shall add functionality to the elements.</p><p>1. From the Toolbox, <strong>drag a Label tool </strong>and <strong>place it on “Drop title here.”</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1186px;"><p class="vanilla-image-block" style="padding-top:58.26%;"><img id="" name="Design1.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/9S5en6eresKtDdfGxoJH2B.gif" mos="" align="middle" fullscreen="1" width="1186" height="691" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/9S5en6eresKtDdfGxoJH2B.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Change the label text via the text field in the properties menu.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1188px;"><p class="vanilla-image-block" style="padding-top:80.39%;"><img id="" name="Design2.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/DHY3qQXwe7rmS96Ct5Db5B.png" mos="" align="middle" fullscreen="1" width="1188" height="955" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/DHY3qQXwe7rmS96Ct5Db5B.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Drag an image tool into the form. </strong>With this we can add a logo or image to our project.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1205px;"><p class="vanilla-image-block" style="padding-top:57.93%;"><img id="" name="Design3.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/VGjL5fwrSg2HMxiMzscB9B.gif" mos="" align="middle" fullscreen="1" width="1205" height="698" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/VGjL5fwrSg2HMxiMzscB9B.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>From Properties, select Source and select the image for your application.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1210px;"><p class="vanilla-image-block" style="padding-top:78.76%;"><img id="" name="Design4.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/GY2mmi2uFUtiGJ9HjcWQEB.png" mos="" align="middle" fullscreen="1" width="1210" height="953" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/GY2mmi2uFUtiGJ9HjcWQEB.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>From the Toolbox, drag another label and place it under the image.</strong> This will become an instruction to the user.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1205px;"><p class="vanilla-image-block" style="padding-top:57.93%;"><img id="" name="Design5.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/jXzx2gERc2YJAyt99PegJB.gif" mos="" align="middle" fullscreen="1" width="1205" height="698" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/jXzx2gERc2YJAyt99PegJB.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>6. <strong>Write an instruction to the user</strong>, in this case to write a message.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1211px;"><p class="vanilla-image-block" style="padding-top:77.95%;"><img id="" name="Design6.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/ti8iEEFFnYJwvo5aMR3APB.png" mos="" align="middle" fullscreen="1" width="1211" height="944" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ti8iEEFFnYJwvo5aMR3APB.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>7. <strong>From the Toolbox, drag a text box and place it to the right of the “Write a message” label</strong>. Anvil will adjust the layout to accommodate the text box.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1205px;"><p class="vanilla-image-block" style="padding-top:57.93%;"><img id="" name="Design7.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/jaJTAGQ9u5ATfJBQwKRoVB.gif" mos="" align="middle" fullscreen="1" width="1205" height="698" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/jaJTAGQ9u5ATfJBQwKRoVB.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>8. <strong>From the Toolbox, drag a space and place below the image, and above the label and text box.</strong> This spacer is used to add a little distance between the image and the app.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1205px;"><p class="vanilla-image-block" style="padding-top:57.93%;"><img id="" name="Design8.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/xWrhLTRQKfcEda23jJC6fB.gif" mos="" align="middle" fullscreen="1" width="1205" height="698" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/xWrhLTRQKfcEda23jJC6fB.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>9. <strong>From the Toolbox, drag a button and place it next to the text box.</strong> This button will be used to “send” a message to the Raspberry Pi Pico W.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1205px;"><p class="vanilla-image-block" style="padding-top:57.93%;"><img id="" name="Design9.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/VbazU3iLKCJgohiJtoCfjB.gif" mos="" align="middle" fullscreen="1" width="1205" height="698" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/VbazU3iLKCJgohiJtoCfjB.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>10. <strong>Change the button text </strong>via the Properties section. A simple “Show Message” is all we need as this button will trigger a function to send a message to the Pico W’s LCD screen.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1211px;"><p class="vanilla-image-block" style="padding-top:80.02%;"><img id="" name="Design10.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/kDCePRv5pWVCGDqnSUDaoB.png" mos="" align="middle" fullscreen="1" width="1211" height="969" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/kDCePRv5pWVCGDqnSUDaoB.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>11. <strong>Drag another label </strong>and <strong>place it under the previous elements</strong>. This label will show the DHT11 sensor data from the Pico W.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1205px;"><p class="vanilla-image-block" style="padding-top:57.93%;"><img id="" name="Design11.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/S7Cjea97PRs9rsHhmdZCsB.gif" mos="" align="middle" fullscreen="1" width="1205" height="698" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/S7Cjea97PRs9rsHhmdZCsB.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>12. <strong>Change the name of the label to Temp. </strong>Anvil will auto insert “self.”. This will enable us to identify the correct label in Code, which will display our sensor data.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1143px;"><p class="vanilla-image-block" style="padding-top:35.26%;"><img id="" name="Design12.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/4haJCBBWUYk36vdT7QaPwB.png" mos="" align="middle" fullscreen="1" width="1143" height="403" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/4haJCBBWUYk36vdT7QaPwB.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>13. <strong>In Properties, scroll down to Text </strong>and <strong>click MORE. Then set the text to bold, </strong>and <strong>font size to 32pt.</strong></p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1136px;"><p class="vanilla-image-block" style="padding-top:53.61%;"><img id="" name="Design13.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/qaKeUmTwPnDqcKnZcuqS2C.png" mos="" align="middle" fullscreen="1" width="1136" height="609" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/qaKeUmTwPnDqcKnZcuqS2C.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>14. <strong>In the Toolbox, click on More Components </strong>and <strong>drag the Timer into the form.</strong></p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1205px;"><p class="vanilla-image-block" style="padding-top:57.93%;"><img id="" name="Design14.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/zPupXe34wdtAX8PHkWYY7C.gif" mos="" align="middle" fullscreen="1" width="1205" height="698" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/zPupXe34wdtAX8PHkWYY7C.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>15. <strong>Using the Properties, set the timer to an interval of 3 seconds.</strong> This time is used to update the screen for our sensor data.</p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1202px;"><p class="vanilla-image-block" style="padding-top:54.24%;"><img id="" name="Design15.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/HQTrcsapCumf7Jn7rWGzAC.png" mos="" align="middle" fullscreen="1" width="1202" height="652" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/HQTrcsapCumf7Jn7rWGzAC.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>With the design now complete, our focus turns to the Code section which will bring the functionality to the project.</p><p>1. <strong>Double click on the SHOW MESSAGE button </strong>to open a split view code editor. The code which relates to the button is automatically highlighted.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1205px;"><p class="vanilla-image-block" style="padding-top:57.93%;"><img id="" name="Code1.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/ogVgpUuRYv6phVTV6sZCaA.gif" mos="" align="middle" fullscreen="1" width="1205" height="698" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ogVgpUuRYv6phVTV6sZCaA.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Add a new line to the function which will call the “show message” function that we created on the Raspberry Pi Pico W. </strong>The function on the Pico W requires a message to be sent, and we get this by using the text from the text box. The anvil.server_call_s call will run the command, but we will see no output in the web app.</p><pre class="line-numbers language-bash" language="bash" ><code>anvil.server.call_s("show_message",self.text_box_1.text)</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:561px;"><p class="vanilla-image-block" style="padding-top:32.09%;"><img id="" name="Code2.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/BAEKvbTAmAiybCQLQMS2eA.png" mos="" align="middle" fullscreen="1" width="561" height="180" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/BAEKvbTAmAiybCQLQMS2eA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Double click on the Timer element to edit its code.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1205px;"><p class="vanilla-image-block" style="padding-top:64.73%;"><img id="" name="Code3.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/WcJdQ4KTc8cRGwSxyuMCkA.gif" mos="" align="middle" fullscreen="1" width="1205" height="780" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/WcJdQ4KTc8cRGwSxyuMCkA.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Add two lines to the timer function. </strong>The first to create a variable, data, which will store the data sent using the “dht11data” function on the Pico W. The second sets the Temp label text to show the message from the Pico W.</p><pre class="line-numbers language-bash" language="bash" ><code>   data = anvil.server.call_s("dht11data")   self.Temp.text = data</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:529px;"><p class="vanilla-image-block" style="padding-top:29.68%;"><img id="" name="Code4.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/aED8JeV3AdpHyHRzJkKxuA.png" mos="" align="middle" fullscreen="1" width="529" height="157" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/aED8JeV3AdpHyHRzJkKxuA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="linking-raspberry-pi-pico-w-to-anvil">Linking Raspberry Pi Pico W to Anvil</h2><p>Anvil has an “uplink” tool, which enables the Raspberry Pi Pico W (and the Raspberry Pi) to securely connect to Anvil’s servers and communicate between the Pico W and the web app.</p><p>1. <strong>On the left of the screen, click on the blue + and from the menu select Uplink.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1205px;"><p class="vanilla-image-block" style="padding-top:64.73%;"><img id="" name="Uplink1.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/hr4ZnNtnfX8ksCZtg2g5QD.gif" mos="" align="middle" fullscreen="1" width="1205" height="780" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/hr4ZnNtnfX8ksCZtg2g5QD.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Click on Enable server Uplink.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:689px;"><p class="vanilla-image-block" style="padding-top:76.05%;"><img id="" name="Uplink2.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/fvpCMLjLXjUdetD3iYvrTD.png" mos="" align="middle" fullscreen="1" width="689" height="524" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/fvpCMLjLXjUdetD3iYvrTD.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Copy the uplink key.</strong> Do not share this key with anyone else.</p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:690px;"><p class="vanilla-image-block" style="padding-top:33.48%;"><img id="" name="Uplink3.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/9XRrynTsRMJ9mToHjXdCXD.png" mos="" align="middle" fullscreen="1" width="690" height="231" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/9XRrynTsRMJ9mToHjXdCXD.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Open main.py</strong> in Thonny and <strong>paste in the Uplink key </strong>to the UPLINK_KEY variable. Click Save.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:832px;"><p class="vanilla-image-block" style="padding-top:28.13%;"><img id="" name="Uplink4.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/zdxiLTq33qWqfjdfpKfiaD.png" mos="" align="middle" fullscreen="1" width="832" height="234" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/zdxiLTq33qWqfjdfpKfiaD.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="running-the-web-application">Running the Web Application</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:2825px;"><p class="vanilla-image-block" style="padding-top:58.02%;"><img id="" name="Hero.jpg" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/NcXEBmvVRitPyDgaDumvRC.jpg" mos="" align="middle" fullscreen="1" width="2825" height="1639" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/NcXEBmvVRitPyDgaDumvRC.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>With both sides of the project complete, now we use Anvil’s Uplink to communicate between the Raspberry Pi Pico W and Anvil’s servers.</p><p>1. <strong>In Thonny, click on Run to start the code. </strong>It will take the Raspberry Pi Pico W a few moments to connect to the Wi-Fi, confirmation of which can be seen in the Python shell.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1269px;"><p class="vanilla-image-block" style="padding-top:54.45%;"><img id="" name="Run0.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/YUC2LeAvkA7WLm5vseqMiC.png" mos="" align="middle" fullscreen="1" width="1269" height="691" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/YUC2LeAvkA7WLm5vseqMiC.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Go back to Anvil and click on Run</strong> to start the web app.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:207px;"><p class="vanilla-image-block" style="padding-top:40.58%;"><img id="" name="Run1.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/9kLYNzJL9LK7CR9qjbcwpC.png" mos="" align="middle" fullscreen="1" width="207" height="84" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/9kLYNzJL9LK7CR9qjbcwpC.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Type in a message, and click SHOW MESSAGE</strong> to send it to the Pico W. The LCD display will flash three times and then display the message. The current temperature and humidity will appear in the app.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1157px;"><p class="vanilla-image-block" style="padding-top:36.65%;"><img id="" name="Run2.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/4jVEVW7MSdBdcPgx6Kn6nC.png" mos="" align="middle" fullscreen="1" width="1157" height="424" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/4jVEVW7MSdBdcPgx6Kn6nC.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="publishing-the-application">Publishing the Application</h2><p>Currently the application is only available to us. We can easily share the application by publishing it. But first we need to give our app a name, title, description and logo.</p><p>1. <strong>Click on My Apps / Material Design</strong> to open the Settings tab.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:663px;"><p class="vanilla-image-block" style="padding-top:129.56%;"><img id="" name="Settings1.gif" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/5qqv2CYodvm5NvAL8p5r3D.gif" mos="" align="middle" fullscreen="1" width="663" height="859" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/5qqv2CYodvm5NvAL8p5r3D.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Give the application a name, title, description, </strong>and <strong>add an icon.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:663px;"><p class="vanilla-image-block" style="padding-top:127.15%;"><img id="" name="Settings2.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/wXVxnen8HXZBP8SUi9MF8D.png" mos="" align="middle" fullscreen="1" width="663" height="843" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/wXVxnen8HXZBP8SUi9MF8D.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Click Publish.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:419px;"><p class="vanilla-image-block" style="padding-top:20.05%;"><img id="" name="Settings3.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/3AP4RQvyA7VYXXaZFsT4BD.png" mos="" align="middle" fullscreen="1" width="419" height="84" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/3AP4RQvyA7VYXXaZFsT4BD.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Click Add Private URL and copy the URL. </strong>This URL is useful for sharing with friends and co<img src="https://lh4.googleusercontent.com/6fXsruksQXmN5UtdD0D5jiiX4NnRsyqMO7DRiYfAcSCf4ZB0VxLiC8jFzoD8qBsMWbt4JBF4cRxzrOSjK1LIWK77drXOrlNgGQYGWP8N_gySELXZXKzNT4-cbtQzdIpQYyBEDaLKSs-UHH7t2hU">lleagues when testing the app.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:955px;"><p class="vanilla-image-block" style="padding-top:30.26%;"><img id="" name="Settings4.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/KtdVLAVZ3NGx85yhZ2nFED.png" mos="" align="middle" fullscreen="1" width="955" height="289" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/KtdVLAVZ3NGx85yhZ2nFED.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Click the link to ensure that everything is working.</strong> Note that you will need to start the code on the Raspberry Pi Pico W.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1269px;"><p class="vanilla-image-block" style="padding-top:40.90%;"><img id="" name="URL2.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/6Td3TdgBuRpnc3ZtbzSzgD.png" mos="" align="middle" fullscreen="1" width="1269" height="519" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/6Td3TdgBuRpnc3ZtbzSzgD.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>6. <strong>Click Add Public link to create a public app.</strong>his link is easier to read . A public link can be used when you are ready to share the project on social media.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:849px;"><p class="vanilla-image-block" style="padding-top:26.97%;"><img id="" name="url3.png" alt="Anvil Pico" src="https://cdn.mos.cms.futurecdn.net/BdGQVDfdyViKJNX6cui7mD.png" mos="" align="middle" fullscreen="1" width="849" height="229" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/BdGQVDfdyViKJNX6cui7mD.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>7. <strong>Click the link to test that it works.</strong> The code on the Raspberry Pi Pico W must also be running.</p><p>We now have a working web application running via a Raspberry Pi Pico W and Anvil’s servers.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Anvil Announce Secure Raspberry Pi Pico W IoT Toolkit ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/anvil-raspberry-pi-pico-w-toolkit</link>
                                                                            <description>
                            <![CDATA[ Anvil is a web application development toolkit which uses Python to create applications. The Pico W toolkit brings the $6 microcontroller into the Anvil ecosystem. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">KgpdEeXvZbDusQ9FfjmJBk</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/sfKhbEALK5V9UPkNLonvKm-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Wed, 06 Jul 2022 11:05:20 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:32 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/sfKhbEALK5V9UPkNLonvKm-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware / Pexels]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[A blacksmith forging a Raspberry Pi Pico W using Anvil]]></media:description>                                                            <media:text><![CDATA[A blacksmith forging a Raspberry Pi Pico W using Anvil]]></media:text>
                                <media:title type="plain"><![CDATA[A blacksmith forging a Raspberry Pi Pico W using Anvil]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/sfKhbEALK5V9UPkNLonvKm-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Anvil, a popular web applications development tool has<a href="https://anvil.works/blog/announcing-pico-uplink"> today announced</a> a new toolkit developed for the recently released <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w">Raspberry Pi Pico W</a>. The toolkit provides a means of communicating between a web application and a Raspberry Pi Pico W using nothing but Python.<br>This <a href="https://anvil.works/pico">new toolkit</a> brings secure IoT applications for the Wi-Fi enabled $6 microcontroller. Applications normally reserved for the more powerful, and hard to come by <a href="https://www.tomshardware.com/news/raspberry-pi">Raspberry Pi.</a></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1382px;"><p class="vanilla-image-block" style="padding-top:65.34%;"><img id="" name="anvil.gif" alt="Demo of Anvil sending data to a Raspberry Pi Pico W, shown on an LCD screen." src="https://cdn.mos.cms.futurecdn.net/jmWSyjva2hjHWWb2jTDVNN.gif" mos="" align="middle" fullscreen="1" width="1382" height="903" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/jmWSyjva2hjHWWb2jTDVNN.gif' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><p>The magic which makes this possible is two-fold. A custom "Just Press Go" MicroPython UF2 firmware release and "Anvil Uplink", a two-way communication link between your physical project and Anvil&apos;s servers. Applications are written using pure Python via the Anvil online IDE and on the Raspberry Pi Pico W we write our code using MicroPython. The uplink enables transmission between the Pico W and Anvil&apos;s servers and via the online IDE we can easily create user interfaces to send messages to the Pico W, or receive data from the board. </p><p>The "Just Press Go" <a href="https://anvil.works/pico">firmware image</a> is just that. We had access to a pre-release image and within minutes had our Raspberry Pi Pico W connected to the Wi-Fi and to Anvil&apos;s servers. Via this firmware we have a lot of opportunities for invention. The low cost Raspberry Pi Pico W can work with common sensors and components, enabling projects such as remote data collection and robotics. Now with Anvil we can create GUI web applications for these projects using a drag and drop layout editor and Python code.</p><p>Anvil founder Meredydd Luff explains that Anvil&apos;s firmware offers a more secure IoT experience "Anvil have added proper TLS security to the Pico firmware, including enabling server certificate validation and making use of the Pico&apos;s real-time clock to verify certificate validity. These changes have been contributed back to the Micropython and Pico SDK projects." </p><p>The Anvil team have also been working on documentation for the Raspberry Pi Pico W toolkit and it can be found via Anvil&apos;s <a href="https://anvil.works/pico">microsite.</a> In just ten lines of code you can be controlling an LED on your Raspberry Pi Pico W from any location in the world. A few more lines and you can be collecting data from remote Pico W sensors, and displaying it all in your web browser.</p><p>Anvil is a versatile toolkit, from <a href="https://www.tomshardware.com/how-to/raspberry-pi-remote-control-camera-from-web">controlling a Raspberry Pi HQ camera</a>, to controlling <a href="https://youtu.be/tHhGyUwLchM">Lego Spike kits</a>, it is great to see it adopt the newest microcontroller into its ecosystem.</p><p>With a low cost microcontroller, Anvil&apos;s new toolkit and a little imagination we can&apos;t wait to see what makers will do with this exciting new tech.</p><iframe src="https://content.jwplatform.com/players/YdWWS5dA.html" id="YdWWS5dA" title="Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing" width="1920" height="1080" frameborder="0" scrolling="auto" allowfullscreen></iframe>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Connect Raspberry Pi Pico W to the Internet ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/connect-raspberry-pi-pico-w-to-the-internet</link>
                                                                            <description>
                            <![CDATA[ Using the latest $6 Raspberry Pi Pico W we find out how many astronauts are on the International Space Station, and learn their names. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">k8Vg8hfG6p9huctiLQn7xP</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/FTRkPm5KVJYgsxLbF8AURU-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Thu, 30 Jun 2022 20:51:11 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:32 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/FTRkPm5KVJYgsxLbF8AURU-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[International Space Station as a Raspberry Pi Pico W]]></media:description>                                                            <media:text><![CDATA[International Space Station as a Raspberry Pi Pico W]]></media:text>
                                <media:title type="plain"><![CDATA[International Space Station as a Raspberry Pi Pico W]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/FTRkPm5KVJYgsxLbF8AURU-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>The release of the <a href="https://www.tomshardware.com/reviews/raspberry-pi-pico-w"><u>Raspberry Pi Pico W</u></a> brings with it an interesting opportunity. In the past if we wanted to connect a Raspberry Pi to the world, we would need one of the larger models. The <a href="https://www.tomshardware.com/reviews/raspberry-pi-zero-2-w-review"><u>Raspberry Pi Zero 2 W</u></a>, and <a href="https://www.tomshardware.com/reviews/raspberry-pi-4"><u>Raspberry Pi 4</u></a> were often pressed into data collection duties. The Raspberry Pi 4 is a bit of a power hog, the Zero 2 W is a bit better but still overkill for a simple information project.</p><p>With the arrival of the Raspberry Pi Pico W we have a low power, microcontroller with a competent Wi-Fi chip, in the Pico form factor and only $6! </p><p>So where do we start? How do we get our Raspberry Pi Pico W online, and where can we find interesting data to collect? Let us guide you through making the most of your $6 Raspberry Pi Pico W.</p><h2 id="getting-the-raspberry-pi-pico-w-online">Getting the Raspberry Pi Pico W Online</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:3981px;"><p class="vanilla-image-block" style="padding-top:56.24%;"><img id="" name="hero.jpg" alt="Raspberry Pi Pico W" src="https://cdn.mos.cms.futurecdn.net/Xmn9ztSwKavDfzgX6x3g4g.jpg" mos="" align="middle" fullscreen="1" width="3981" height="2239" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Xmn9ztSwKavDfzgX6x3g4g.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>The Raspberry Pi Pico W comes with an Infineon CYW43439 2.4 GHz Wi-Fi chip and onboard antenna. This means we get good Wi-Fi reception without the need for lots of wires. We’re using the latest MicroPython release for the Pico W as it offers the easiest means to get online and do fun projects.</p><p>1. <strong>Setup your Raspberry Pi Pico W by following our </strong><a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup"><u><strong>getting started guide</strong></u></a><strong>. </strong>You will need to install MicroPython on your Pico W before you can proceed further.</p><p>2. <strong>Open the Thonny editor to a blank document.</strong></p><p>3. <strong>Create an object called SSID and in it store the SSID of your Wi-Fi access point.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>SSID = "YOUR WIFI AP"</code></pre><p>4. <strong>Create an object called PASSWORD and store your Wi-Fi password.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>PASSWORD = "TRUSTNO1"</code></pre><p>5. <strong>Save the file to the Raspberry Pi Pico W as secrets.py </strong>By storing our sensitive details in a secrets file, we can freely share the project code with friends, or online. Just remember not to share the secrets file too.</p><p>6. <strong>Click on New File</strong> to create a new blank document.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:268px;"><p class="vanilla-image-block" style="padding-top:72.01%;"><img id="" name="new file.png" alt="Connect Raspberry Pi Pico W to the Internet" src="https://cdn.mos.cms.futurecdn.net/8YP8B9pskKmLodJ4yip4t.png" mos="" align="middle" fullscreen="1" width="268" height="193" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/8YP8B9pskKmLodJ4yip4t.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>7. <strong>Import three modules of code, network, secrets and time.</strong> These three modules enable our Pico to connect to a Wi-Fi network, use the data stored in secrets.py and to add a pause to the code.</p><pre class="line-numbers language-bash" language="bash" ><code>import networkimport secretsimport time</code></pre><p>8. <strong>Create an object, wlan, to create a connection from our code to the Pico W wireless chip. </strong>We use this connection to issue commands that will connect and check our Wi-Fi connection.</p><pre class="line-numbers language-bash" language="bash" ><code>wlan = network.WLAN(network.STA_IF)</code></pre><p>9. <strong>Turn on the Raspberry Pi Pico W’s Wi-Fi.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>wlan.active(True)</code></pre><p>10. <strong>Connect to your router using the SSID and PASSWORD stored in the secrets.py file.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>wlan.connect(secrets.SSID, secrets.PASSWORD)</code></pre><p>11. <strong>Print the connection status to the Python shell.</strong> This will print True if connected, and False if the connection failed.</p><p>12. <strong>Click Save and then select “Raspberry Pi Pico”. Save the file as Wi-Fi.py to the Raspberry Pi Pico W.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:308px;"><p class="vanilla-image-block" style="padding-top:53.25%;"><img id="" name="save.png" alt="Connect Raspberry Pi Pico W to the Internet" src="https://cdn.mos.cms.futurecdn.net/ndf2ftdkmBFcmF86QQpC43.png" mos="" align="middle" fullscreen="1" width="308" height="164" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ndf2ftdkmBFcmF86QQpC43.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>13. <strong>Click on Run to start the code.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:224px;"><p class="vanilla-image-block" style="padding-top:70.09%;"><img id="" name="run.png" alt="Connect Raspberry Pi Pico W to the Internet" src="https://cdn.mos.cms.futurecdn.net/5n4omd86cgioU4RA2YFWy.png" mos="" align="middle" fullscreen="1" width="224" height="157" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/5n4omd86cgioU4RA2YFWy.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>14. <strong>Look in the Python Shell for True or False.</strong> True means we are connected.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1263px;"><p class="vanilla-image-block" style="padding-top:75.06%;"><img id="" name="connected.png" alt="Connect Raspberry Pi Pico W to the Internet" src="https://cdn.mos.cms.futurecdn.net/vVb8QRaxGspBzBDYkAhBB.png" mos="" align="middle" fullscreen="1" width="1263" height="948" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/vVb8QRaxGspBzBDYkAhBB.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-code-listing-20">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import networkimport secretsimport timewlan = network.WLAN(network.STA_IF)wlan.active(True)wlan.connect(secrets.SSID, secrets.PASSWORD)print(wlan.isconnected())</code></pre><h2 id="using-the-raspberry-pi-pico-w-with-external-data">Using the Raspberry Pi Pico W With External Data</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1268px;"><p class="vanilla-image-block" style="padding-top:74.21%;"><img id="" name="ISS.png" alt="Connect Raspberry Pi Pico W to the Internet" src="https://cdn.mos.cms.futurecdn.net/WLRSwp67nVEwtKsHyvpCf.png" mos="" align="middle" fullscreen="1" width="1268" height="941" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/WLRSwp67nVEwtKsHyvpCf.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Now that we have an Internet connection, we will use it with publicly available datasets to pull data from external sources and display it on the Pico W. For this example we are going to use Open Notify’s “How many people are in space right now” dataset. This has the number and names of all the astronauts currently on the International Space Station.</p><p>We are going to adapt our previous example code, Wi-Fi.py.</p><p>1. <strong>Add a line after “import time” and import the urequests module. </strong>This module enables us to work with network requests such as HTTP and JSON.</p><pre class="line-numbers language-bash" language="bash" ><code>import urequests</code></pre><p>2. <strong>After print(wlan.isconnected()) add a new line which creates an object “astronauts” and then uses urequests to get the information in a JSON format.</strong> JavaScript Object Notation is an open standard file format which bears a striking resemblance to Python’s Dictionary which uses keys (names) to retrieve values from the object.</p><pre class="line-numbers language-bash" language="bash" ><code>astronauts = urequests.get("http://api.open-notify.org/astros.json").json()</code></pre><p>3. <strong>Create an object, number, which will open the astronauts object, and look for the key ‘number’.</strong> The value linked to that key is then stored in the number object.</p><pre class="line-numbers language-bash" language="bash" ><code>number = astronauts['number']</code></pre><p>4. <strong>Create a for loop that will iterate for the number of people on the International Space Station.</strong> This value could change as astronauts come and go, so rather than hard coding a value we use the live data.</p><pre class="line-numbers language-bash" language="bash" ><code>for i in range(number):</code></pre><p>5. <strong>Print the name of each astronaut on the International Space Station using a series of keys that target the specific data.</strong> Our dictionary ‘astronauts’ has many keys, but we are interested in the ‘people’, the value of “i” will increment each time the loop goes round, and it selects each person from a list embedded in the dataset. We then use another key, ‘name’ to get the name of that astronaut.</p><pre class="line-numbers language-bash" language="bash" ><code>   print(astronauts['people'][i]['name'])</code></pre><p>6. <strong>Save the code and when ready click on Run to start the code.</strong></p><p>7. <strong>The names of all the astronauts on the International Space Station will appear in the Python Shell. </strong>Note that “True” still appears, confirming that our Internet connection is established.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:465px;"><p class="vanilla-image-block" style="padding-top:78.28%;"><img id="" name="names.png" alt="Connect Raspberry Pi Pico W to the Internet" src="https://cdn.mos.cms.futurecdn.net/Qr3CNTL6ht5mTZmCQKQQp.png" mos="" align="middle" fullscreen="1" width="465" height="364" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Qr3CNTL6ht5mTZmCQKQQp.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-code-listing-21">Complete Code Listing</h2><pre class="line-numbers language-python" language="python" ><code>import networkimport secretsimport timeimport urequestswlan = network.WLAN(network.STA_IF)wlan.active(True)wlan.connect(secrets.SSID, secrets.PASSWORD)print(wlan.isconnected())astronauts = urequests.get("http://api.open-notify.org/astros.json").json()number = astronauts['number']for i in range(number):    print(astronauts['people'][i]['name'])</code></pre>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Make CircuitPython Projects on a Chromebook with Raspberry Pi Pico ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/create-circuitpython-projects-on-chromebook-raspberry-pi-pico</link>
                                                                            <description>
                            <![CDATA[ Learning to code with the Raspberry Pi Pico is now even easier thanks to CircuitPython and low cost Chrome devices. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">4TFE8sjnY2xSJnkuAfmrCJ</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/JYTzZUnrXzZmsAemoQmQa9-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sun, 29 May 2022 18:40:53 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:27 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/JYTzZUnrXzZmsAemoQmQa9-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[CircuitPython Projects on a Chromebook]]></media:description>                                                            <media:text><![CDATA[CircuitPython Projects on a Chromebook]]></media:text>
                                <media:title type="plain"><![CDATA[CircuitPython Projects on a Chromebook]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/JYTzZUnrXzZmsAemoQmQa9-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>There is no denying that the Raspberry Pi Pico made a big impact back in 2021. The $4 microcontroller was quickly adopted by many of the maker communities and groups and one of those was CircuitPython. CircuitPython, a fork of MicroPython which is a version of Python 3 for microcontrollers, is backed by Adafruit who are one of the partners that launched its own RP2040 range of boards. Since its creation back in 2018, CircuitPython has seen a massive investment from the community, with many projects and libraries being ported to the language.</p><p>CircuitPython is the best means to introduce Python on microcontrollers, because it’s easy to use with devices appearing in the host OS as USB flash drives. We write our code into the <em>code.py</em> file and we can enable external sensors, screens and inputs via a dazzling array of libraries. </p><p>So how can we work with the Raspberry Pi Pico and CircuitPython? Typically we connect up our Pico to a PC and start writing code, but we can also build projects with a Chromebook or other Chrome OS device. With an easy-to-use programming language, cheap microcontroller and an easy-to-use OS we have the perfect platform for creativity, no matter our age or ability.</p><p>In this how to we will show you how to set up your Raspberry Pi Pico for CircuitPython, install the software to write code and communicate with your Pico, and finally we shall build a temperature sensor project.</p><h2 id="for-this-project-you-will-need-8">For this project you will need</h2><ul><li><a href="https://www.amazon.com/HP-Chromebook-G8-Education-Bluetooth/dp/B09WNJVGBZ">Chromebook</a> or other Chrome OS device</li><li><a href="https://www.amazon.com/Raspberry-Pre-Soldered-Microcontroller-Development-Dual-Core/dp/B08X7HN2VG">Raspberry Pi Pico</a></li><li><a href="https://www.amazon.com/Half-Size-breadboard-Adafruit-64/dp/B00HPLNVHQ">Half size breadboard</a></li><li><a href="https://www.amazon.com/Tenmiro-Led-Lights/dp/B0932M1666">LED</a></li><li><a href="https://www.amazon.com/EDGELEC-Resistor-Tolerance-Multiple-Resistance/dp/B07QH5PFG3">330 Ohm resistor</a></li><li><a href="https://www.amazon.com/Gowoops-Temperature-Humidity-Measurement-Raspberry/dp/B073F472JL">DHT22 temperature sensor</a></li><li><a href="https://www.amazon.com/EDGELEC-Breadboard-Multicolored-1pin-1pin-Connector/dp/B07GD1ZCHQ">5x Male to male jumper wires</a></li><li><a href="https://www.amazon.com/Projects-100EP51410K0-10k-Resistors-Pack/dp/B0185FGYQA">10K Ohm Resistor (Brown-Black-Orange-Gold)</a></li></ul><h2 id="install-circuitpython-onto-the-raspberry-pi-pico">Install CircuitPython onto the Raspberry Pi Pico</h2><p>The Raspberry Pi Pico can run many <a href="https://twitter.com/ChrisRemboldt/status/1529823398548807684"><u>different languages</u></a>, even a version of a <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-basic-controlled-neopixels"><u>50+ year old language</u></a>. Our focus is on CircuitPython, and installing CircuitPython on a Pico is super easy to do.</p><p>1. Download the latest version of  <a href="https://circuitpython.org/board/raspberry_pi_pico/"><u>CircuitPython for the Raspberry Pi Pico</u></a>. At the time of writing the latest version was 7.3.0.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1436px;"><p class="vanilla-image-block" style="padding-top:42.90%;"><img id="" name="image1.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/Da7RURzSzFdqjKo7suj8LR.png" mos="" align="middle" fullscreen="1" width="1436" height="616" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/Da7RURzSzFdqjKo7suj8LR.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Press and hold the BOOTSEL button on the Raspberry Pi Pico, then connect your Pico to the Chromebook via a USB cable.</strong></p><p>3. <strong>Copy the downloaded UF2 file from Downloads to the RPI-RP2 drive in files. </strong>The process will take under a minute and when complete a new drive CIRCUITPY will appear in the Files browser.</p><h2 id="install-the-tools-to-use-circuitpython-on-chrome-os">Install the Tools to use CircuitPython on Chrome OS</h2><p>Ideally we would have just one application which could do everything, but for now, alas we need to install two. The first is a text editor, Caret, which we can use to write CircuitPython code directly to the CIRCUITPY drive. The second is Beagle Term, a serial terminal emulator for Chrome OS.</p><p>1. <a href="https://chrome.google.com/webstore/detail/caret/fljalecfjciodhpcledpamjachpmelml/related?hl=en"><u>Install the Caret Text Editor</u></a> via the Chrome Web Store.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:62.50%;"><img id="" name="caret install.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/FtCtqBKHrSxX3FZyLGHkf9.png" mos="" align="middle" fullscreen="1" width="1920" height="1200" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/FtCtqBKHrSxX3FZyLGHkf9.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <a href="https://chrome.google.com/webstore/detail/beagle-term/gkdofhllgfohlddimiiildbgoggdpoea?hl=en"><u>Install Beagle Term </u></a>via the Chrome Web Store. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:62.45%;"><img id="" name="beagle term install.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/xwCT7ycxAnqJAV29ngfCr9.png" mos="" align="middle" fullscreen="1" width="1920" height="1199" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/xwCT7ycxAnqJAV29ngfCr9.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="writing-our-test-circuitpython-code-on-chromebook">Writing our Test CircuitPython Code on Chromebook</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1138px;"><p class="vanilla-image-block" style="padding-top:75.04%;"><img id="" name="hello world.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/f6h6gCfYbq5nMP57EuazrB.png" mos="" align="middle" fullscreen="1" width="1138" height="854" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/f6h6gCfYbq5nMP57EuazrB.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Before we start any electronics, let&apos;s check that we can control and communicate with the Raspberry Pi Pico. Our demo code is a simple Hello World that prints to the Python shell every second.</p><p>1. <strong>Open the Caret text editor</strong> using the Search key (the spyglass where caps lock normally resides) and type Caret. Press Enter to open. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:37.24%;"><img id="" name="caret.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/V2CeidjfCDi33p2erwPX5C.png" mos="" align="middle" fullscreen="1" width="1920" height="715" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/V2CeidjfCDi33p2erwPX5C.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2.  <strong>Click on File >> Open and select code.py </strong>found on your CIRCUITPY drive. This drive is your Raspberry Pi Pico running CircuitPython.</p><p>3. <strong>Delete any code in the file.</strong></p><p>4.<strong> Import the time module. </strong>We will use this to control the speed at which our code loops.</p><pre class="line-numbers language-bash" language="bash" ><code>import time</code></pre><p>5. <strong>Create a while True loop </strong>to continually run the code within.</p><pre class="line-numbers language-bash" language="bash" ><code>while True:</code></pre><p>6. <strong>Use a print function to print “Hello World”. </strong>Note that the code is indented by one TAB keypress or four spaces. Do not mix tabs and spaces as Python will throw an error. This is a classic example of testing code. It is a simple means that we can use to confirm that we have control of and communication with a device.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   print(“Hello World”)</code></pre><p>7. <strong>Add a one second pause</strong></p><p>This gives us a second to read the Hello World message.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   time.sleep(1)</code></pre><p>8. <strong>Save your code to code.py.</strong> CircuitPython will automatically run the code each time we save.</p><h2 id="test-code-listing">Test Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import timewhile True:    print(“Hello World”)    time.sleep(1)</code></pre><h2 id="using-the-beagle-term-serial-emulator">Using the Beagle Term Serial Emulator</h2><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:62.50%;"><img id="" name="hello world running.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/XPus8T2KQLdq6TGmj4bYPC.png" mos="" align="middle" fullscreen="1" width="1920" height="1200" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/XPus8T2KQLdq6TGmj4bYPC.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>To see the output of our code we need to run the Beagle Term serial terminal emulator. This app will connect to the Python console, running over a USB to serial connection. CircuitPython has a REPL (Read, Eval, Print, Loop) Python console which can be used to interactively work with the board and it can output information directly to the console.</p><p>1. <strong>Open the Beagle Term application </strong>using the Search key (the spyglass where caps lock normally resides) and type Caret. Press Enter to open.</p><p>2. <strong>Set your Port to your Raspberry Pi Pico. </strong>This is a little bit of a trial and error approach as we do not know the name of the port. In our tests we saw /dev/ttyACM1 for our Raspberry Pi Pico.</p><p>3. <strong>Set the Bitrate to 9600.</strong> This is the speed at which our Chrome OS device and Raspberry Pi Pico will communicate. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1457px;"><p class="vanilla-image-block" style="padding-top:75.02%;"><img id="" name="Beagle Term.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/gzXrefGSxVNSrjRSJwUqbB.png" mos="" align="middle" fullscreen="1" width="1457" height="1093" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/gzXrefGSxVNSrjRSJwUqbB.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Set the Data Bit to 8 bit, Parity to none, Stop Bit to 1 bit, </strong>and <strong>finally set Flow Control to none.</strong></p><p>5.<strong> Click Connect </strong>to start the serial connection to your Raspberry Pi Pico. Hello World should be scrolling down the screen. If not, press CTRL+C to stop the code running, and then press CTRL+D to restart the code. </p><h2 id="building-a-temperature-sensor-project">Building a Temperature Sensor Project</h2><p>The DHT22 has four pins, but we shall only need to use three of them. The sensor is relatively easy to work with. It needs 3V to power it, and the data output pin is pulled high using a 10K Ohm resistor. By pulling the pin high we ensure that the data from the sensor is read, as the pin is always “on”.</p><p>1. <strong>Insert your Raspberry Pi Pico into the breadboard</strong> so that the microUSB port is on the left side of the board. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:876px;"><p class="vanilla-image-block" style="padding-top:72.26%;"><img id="" name="Temp Sensor_bbjust pico.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/sznXQLHt22oSPMM3UremKA.png" mos="" align="middle" fullscreen="1" width="876" height="633" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/sznXQLHt22oSPMM3UremKA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Run a jumper wire from the 3V3 out (red wire) to the + rail of the breadboard.</strong> This provides a connection to the 3.3V pin to the entire + rail. <strong>Run another wire from the GND pin to the - rail.</strong> </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1008px;"><p class="vanilla-image-block" style="padding-top:62.80%;"><img id="" name="Temp Sensor_bb no dht22.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/YLhENR5WdaqfdXE7AmBTPA.png" mos="" align="middle" fullscreen="1" width="1008" height="633" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/YLhENR5WdaqfdXE7AmBTPA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Insert the DHT22 into the breadboard.</strong> </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1008px;"><p class="vanilla-image-block" style="padding-top:62.80%;"><img id="" name="Temp Sensor_bb dht22 no power.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/FDcYhNwLKbxx62VfFYJzSA.png" mos="" align="middle" fullscreen="1" width="1008" height="633" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/FDcYhNwLKbxx62VfFYJzSA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Connect 3.3V (red wire) and GND (black wire) to pins 1 and 4 of the DHT22. </strong>The pin numbers go from left to right, as we face the plastic “frame” of the sensor. </p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1008px;"><p class="vanilla-image-block" style="padding-top:62.80%;"><img id="" name="Temp Sensor_bb no r.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/85tVPSTVw5pGwBmu2owsWA.png" mos="" align="middle" fullscreen="1" width="1008" height="633" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/85tVPSTVw5pGwBmu2owsWA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Connect the 3.3V rail to pin 2 of the DHT22 using a 10K Ohm resistor. </strong>This is our pull-up resistor for the data pin.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1008px;"><p class="vanilla-image-block" style="padding-top:62.80%;"><img id="" name="Temp Sensor_bb no data.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/qYMJp5jePdMvE5Ejw6UuaA.png" mos="" align="middle" fullscreen="1" width="1008" height="633" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/qYMJp5jePdMvE5Ejw6UuaA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>6. <strong>Connect the data pin (pin 2) of the DHT22 to GP15 of the Raspberry Pi Pico. </strong>Your breadboard should look like this.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1008px;"><p class="vanilla-image-block" style="padding-top:62.80%;"><img id="" name="Temp Sensor_bb.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/cjq32PYHYufdY2uLZui69B.png" mos="" align="middle" fullscreen="1" width="1008" height="633" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/cjq32PYHYufdY2uLZui69B.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="coding-the-project">Coding the Project</h2><p>1. <strong>Download the CircuitPython Libraries bundle </strong>for your version of CircuitPython.</p><p>2. <strong>Go to your Downloads folder. Right click and extract the ZIP file</strong>.</p><p>3. <strong>Open the adafruit-circuitpython-bundle folder </strong>and <strong>navigate to the</strong><em><strong> lib</strong></em><strong> sub-folder.</strong></p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1282px;"><p class="vanilla-image-block" style="padding-top:37.21%;"><img id="" name="dht.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/8zHWzy4V4vyWiTEnvxMrCA.png" mos="" align="middle" fullscreen="1" width="1282" height="477" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/8zHWzy4V4vyWiTEnvxMrCA.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Copy adfafruit_dht.mpy to the /lib/ folder of your CIRCUITPY drive. </strong>This library enables our Raspberry Pi Pico to work with the DHT11 and DHT22 sensors.</p><p><br></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1282px;"><p class="vanilla-image-block" style="padding-top:27.77%;"><img id="" name="dht cpy.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/bbTEgJqgvxyt7YPEVYi89A.png" mos="" align="middle" fullscreen="1" width="1282" height="356" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/bbTEgJqgvxyt7YPEVYi89A.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Open code.py on your Raspberry Pi Pico</strong> using the Caret text editor.<strong> Delete the test code from the file.</strong></p><p>6.<strong> Import three modules to enable our code to access the GPIO (board), use the temperature sensor(adafruit_dht) and to control the speed of the loop (time).</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>import boardimport adafruit_dhtimport time</code></pre><p>7. <strong>Create an object, </strong><em><strong>dht</strong></em><strong> to connect the code to the DHT22 sensor connected to GP15 on the Raspberry Pi Pico.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>dht = adafruit_dht.DHT22(board.GP15)</code></pre><p>8. <strong>Create a loop to run the code.</strong></p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>while True:</code></pre><p>9. <strong>Store the current temperature in a variable called </strong><em><strong>temp.</strong></em> The temperature is saved in Celsius.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   temp = dht.temperature</code></pre><p>10. <strong>Create an object, </strong><em><strong>text</strong></em><strong> and in there store a string which will print “The temperature is    Celsius”. </strong>You’ll notice {:>8}, this is a string format which will include eight spaces in the center of the sentence. This gives us a clear space to place the temperature data.</p><pre class="line-numbers language-bash" language="bash" ><code>   text = "The temperature is {:>8} Celsius."</code></pre><p>11. <strong>Use the print function along with the text forma</strong>t to insert the temperature data into the gap.</p><p><br></p><pre class="line-numbers language-bash" language="bash" ><code>   print(text.format(temp))</code></pre><p>12. <strong>Finally add a one second pause. </strong>This enables the loop to slowly repeat.</p><pre class="line-numbers language-bash" language="bash" ><code>   time.sleep(1)</code></pre><p>13. <strong>Save the project to code.py </strong>on your CIRCUITPY drive.</p><p>14. <strong>Open Beagle Term </strong>and <strong>connect to your Raspberry Pi Pico. </strong>You should see the temperature data scroll across the screen. If not, press CTRL + C, then CTRL+D to restart the code.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1920px;"><p class="vanilla-image-block" style="padding-top:62.45%;"><img id="" name="Running Code.png" alt="CircuitPython Projects on a Chromebook" src="https://cdn.mos.cms.futurecdn.net/TM2HCqdknsKAovrKBvLpHB.png" mos="" align="middle" fullscreen="1" width="1920" height="1199" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/TM2HCqdknsKAovrKBvLpHB.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="complete-code-listing-22">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import boardimport adafruit_dhtimport timedht = adafruit_dht.DHT22(board.GP15)while True:    temp = dht.temperature    text = "The temperature is {:>8} Celsius."    print(text.format(temp))    time.sleep(1)</code></pre><h2 id="related-tutorials">Related Tutorials</h2><ul><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-basic-controlled-neopixels">How To Control Neopixels with BASIC on Raspberry Pi Pico</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-reaction-game">How To Make a Raspberry Pi Pico Reaction Game With PicoZero</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Raspberry Pi Changes Webcam Background With Custom Images ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/raspberry-pi-changes-video-background</link>
                                                                            <description>
                            <![CDATA[ Freedom Tech is using a Raspberry Pi to automatically remove the background of videos in real-time with the help of OpenCV and Python. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">tGBYHGQc53DB7eXwNasbwC</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/e4SBS9VAckrrAk9iG6kXE9-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Mon, 23 May 2022 18:02:10 +0000</pubDate>                                                                                                                                <updated>Thu, 21 Aug 2025 12:44:16 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Ash Hill ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/p9HsnLCwBpTQYCBBhYXgrS.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Ash is a self-employed tech writer and illustrator with a serious affinity for the Raspberry Pi, 3D printing, retro gaming and finding the best tech deals and coupons. She has over a decade of IT experience and has been featured in the official Raspberry Pi magazine MagPi.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/e4SBS9VAckrrAk9iG6kXE9-1280-80.jpg">
                                                            <media:credit><![CDATA[Freedom Tech]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Raspberry Pi]]></media:description>                                                            <media:text><![CDATA[Raspberry Pi]]></media:text>
                                <media:title type="plain"><![CDATA[Raspberry Pi]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/e4SBS9VAckrrAk9iG6kXE9-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>With the rise in popularity of video conferencing, so has the demand increased for real-time video effects. With the help of this <a href="https://www.tomshardware.com/news/raspberry-pi"><u>Raspberry Pi</u></a> project from Freedom Tech, you can <a href="https://www.youtube.com/watch?v=pu4E4ebTYD0"><u>replace the background</u></a> of your video feed with any color or custom image you want. The project uses artificial intelligence (AI) to automatically change the background by detecting where the edges are of the person in the frame.</p><p>While this technology isn’t exactly new and can be replicated locally on many PCs using software, this is the first time we’ve come across someone using a Raspberry Pi to automatically filter out the background image. Freedom Tech is using a few familiar tools to pull off the project including both OpenCV and Python.</p><div class="youtube-video" data-nosnippet ><div class="video-aspect-box"><iframe data-lazy-priority="low" data-lazy-src="https://www.youtube-nocookie.com/embed/pu4E4ebTYD0" allowfullscreen></iframe></div></div><p>This is one of many projects developed and shared by Freedom Tech—most of which are open source. In fact, we recently covered their <a href="https://www.tomshardware.com/news/raspberry-pi-opencv-distance-detection">OpenCV-based distance detection</a> project which uses a camera and AI to estimate distance values without a distance sensor. Previous projects often include various machine learning and AI-based applications like this <a href="https://www.youtube.com/watch?v=2P7Kdz02_oc">text detecting project</a> which was also created using Python and OpenCV.</p><p>To operate this project, you’ll need a Raspberry Pi. While smaller versions like the <a href="https://www.tomshardware.com/reviews/raspberry-pi-zero-2-w-review">Pi Zero</a> will work, you’ll likely have better success with a more capable model like the Raspberry Pi 3 B+ or a <a href="https://www.tomshardware.com/reviews/raspberry-pi-4">Raspberry Pi 4</a>. In addition to the Pi, you’ll need a camera of sorts to capture the video feed. In this case, Freedom Tech is using a USB webcam, but a camera module would work just as well.</p><p>Freedom Tech provides a full video setup tutorial detailing what libraries and dependencies are necessary as well as digging into how to create the custom Python script that brings it all together. The major tool used in this project is <a href="https://www.computervision.zone/">CVZone</a> which is responsible for handling the AI-based system that draws edges for the background to adhere to.</p><p>If you’re interested in recreating this <a href="https://www.tomshardware.com/features/best-raspberry-pi-projects">Raspberry Pi</a> project, check out the full tutorial shared by Freedom Tech over at YouTube which delves into all of the details you need to build it from scratch. Be sure to follow <a href="https://www.youtube.com/channel/UCUu_qRntffs9j38saT2kylg">Freedom Tech</a> for more exciting AI-based Pi projects and tutorials to make them yourself at home.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Create Executable Applications in Python ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/create-python-executable-applications</link>
                                                                            <description>
                            <![CDATA[ Building your own executable Python applications is now just a matter of a few clicks and a little patience. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">zJqCZc5bQEruqa843rmyuc</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/5DyJosrc2Sbw66rV7cqJri-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Sun, 22 May 2022 13:00:47 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:38 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Les Pounder ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mZ2MebAz6hhKR6vLUDUbsc.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Les Pounder is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training programme &quot;Picademy&quot;.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/5DyJosrc2Sbw66rV7cqJri-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Executable Applications in Python]]></media:description>                                                            <media:text><![CDATA[Executable Applications in Python]]></media:text>
                                <media:title type="plain"><![CDATA[Executable Applications in Python]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/5DyJosrc2Sbw66rV7cqJri-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>Used by NASA, ILM, Disney and hardware hackers, Python is a versatile programming language and an ideal choice for beginners. Whether you’re just  creating a “Hello World” or a full-blown application, Python needs an interpreter and a bunch of supporting libraries to work. What if we could make a GUI application, all bundled inside of a single executable file?</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:629px;"><p class="vanilla-image-block" style="padding-top:105.09%;"><img id="" name="hero.png" alt="Executable Applications in Python" src="https://cdn.mos.cms.futurecdn.net/RUuT6sZ5qX36KA4U4Kcnyi.png" mos="" align="middle" fullscreen="1" width="629" height="661" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/RUuT6sZ5qX36KA4U4Kcnyi.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>With <a href="https://github.com/brentvollebregt/auto-py-to-exe"><u>auto-py-to-exe </u></a>,a project by Brent Vollebregt we can easily create our own executable Python applications. Underneath the GUI is PyInstaller, a terminal based application to create Python executables for Windows, Mac and Linux. Veteran Pythonistas will be familiar with how PyInstaller works, but with auto-py-to-exe any user can easily create a single Python executable for their system.</p><p>In this how to, we are going to create a GUI Python application using EasyGUI, and then use auto-py-to-exe to create a standalone application that will run on any Microsoft Windows system, including systems without Python installed. Linux and Mac users will need to use the underlying PyInstaller command line tool. A simple app can be created using a single line instruction. By adding more arguments we can include icons, packaged libraries etc.</p><p>For example here is the code to create a onefile application using <em>app.py</em> as the project code.</p><pre class="line-numbers language-python" language="python" ><code>pyinstaller --onefile app.py</code></pre><p>Where auto-py-to-exe differs is that we have an easier means to create an application using a GUI tool.</p><h2 id="how-to-install-auto-py-to-exe">How to Install auto-py-to-exe</h2><p>1. <strong>Open a Command Prompt by searching for CMD.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:822px;"><p class="vanilla-image-block" style="padding-top:82.73%;"><img id="" name="CMD.png" alt="Executable Applications in Python" src="https://cdn.mos.cms.futurecdn.net/oFbvyN5hVkg3JmToA763ij.png" mos="" align="middle" fullscreen="1" width="822" height="680" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/oFbvyN5hVkg3JmToA763ij.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Use the Python package manager pip to install auto-py-to-exe.</strong></p><pre class="line-numbers language-python" language="python" ><code>pip install auto-py-to-exe</code></pre><h2 id="create-a-test-script">Create a Test Script</h2><p>Our example application is a simple GUI to launch one of three applications. We use the EasyGUI Python library as it abstracts the complexities of creating a GUI application. All we need to provide is the logic that drives the application.</p><p>1. <strong>Open a PowerShell</strong> by right clicking on the Windows icon and selecting PowerShell.</p><p>2. <strong>Install EasyGUI using pip.</strong></p><pre class="line-numbers language-python" language="python" ><code>pip install easygui</code></pre><p>3. <strong>Open a text editor to write the Python test script.</strong> We chose to use <a href="https://notepad-plus-plus.org/"><u>Notepad++</u></a>, but you are free to use your favorite editor.</p><p>4. <strong>Import two Python modules, easygui and os.</strong> Easygui creates the GUI application and OS enables the code to interact with the operating system.</p><pre class="line-numbers language-python" language="python" ><code>import easyguiimport os</code></pre><p>5. <strong>Create two variables, one for a message (msg) to the user while the other becomes the application title.</strong></p><pre class="line-numbers language-python" language="python" ><code>msg = "Load application..."title="Tom's Hardware Application Starter"</code></pre><p>6. <strong>Create a list, </strong><em><strong>choices</strong></em><strong>, </strong>and <strong>inside store three values which are the application names. </strong>Lists are Python’s arrays. Objects that can store multiple items. Each item has a numerical index, starting from zero.</p><pre class="line-numbers language-python" language="python" ><code>choices = ["Google Chrome","Slack","PuTTY"]</code></pre><p>7. <strong>Create an object, </strong><em><strong>reply</strong></em><strong>, to ask the user a question. </strong>In this case we use a button box from EasyGUI, each button is an option from the <em>choices </em>list. The chosen application is stored in the <em>reply </em>object.</p><pre class="line-numbers language-python" language="python" ><code>reply = easygui.buttonbox(msg, title,  choices=choices)</code></pre><p>8. <strong>Use a conditional statement to read the value stored in </strong><em><strong>reply</strong></em><strong> and compare it to three conditions. </strong>The first checks <em>reply</em> to see if it contains “Google Chrome” if so it will open the Google Chrome browser. The <em>startfile</em> function requires the use of a full file path to the application. We need to use double \\ in the path as Python uses \ to insert illegal characters into a string.</p><pre class="line-numbers language-python" language="python" ><code>if reply == "Google Chrome":   os.startfile("C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe")</code></pre><p>9. <strong>Use another conditional statement to check </strong><em><strong>reply</strong></em><strong> for slack.</strong></p><pre class="line-numbers language-python" language="python" ><code>elif reply == "Slack":   os.startfile("C:\\Users\\lespo\\AppData\\Local\\slack\\slack.exe")</code></pre><p>10. <strong>Add another conditional statement to load PuTTY. </strong>Note that for PuTTY we use the <em>os.system</em> function as PuTTY is a registered app with the Windows path.</p><pre class="line-numbers language-python" language="python" ><code>elif reply == "PuTTY":   os.system("putty")</code></pre><p>11. <strong>Close the conditional test with an </strong><em><strong>else</strong></em><strong> condition to catch any other input.</strong></p><pre class="line-numbers language-python" language="python" ><code>else:   print("Done")</code></pre><p>12. <strong>Save the file as </strong><em><strong>app.py</strong></em><strong> to the Desktop.</strong> If you are using an image in the application ensure that the image is also on the Desktop.</p><h2 id="complete-example-code-listing">Complete Example Code Listing</h2><pre class="line-numbers language-python" language="python" ><code>import easyguiimport osmsg = "Load application..."title="Tom's Hardware Application Starter"choices = ["Google Chrome","Slack","PuTTY"]reply = easygui.buttonbox(msg, title , choices=choices)if reply == "Google Chrome":    os.startfile("C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe")elif reply == "Slack":    os.startfile("C:\\Users\\lespo\\AppData\\Local\\slack\\slack.exe")elif reply == "PuTTY":    os.system("putty")else:    print("Done")</code></pre><h2 id="using-auto-py-to-exe">Using auto-py-to-exe</h2><p> 1. <strong>Open a Command Prompt </strong>by searching for CMD.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:822px;"><p class="vanilla-image-block" style="padding-top:82.73%;"><img id="" name="CMD.png" alt="Executable Applications in Python" src="https://cdn.mos.cms.futurecdn.net/oFbvyN5hVkg3JmToA763ij.png" mos="" align="middle" fullscreen="1" width="822" height="680" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/oFbvyN5hVkg3JmToA763ij.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>2. <strong>Run auto-py-to-exe from the prompt.</strong></p><pre class="line-numbers language-python" language="python" ><code>auto-py-to-exe</code></pre><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:395px;"><p class="vanilla-image-block" style="padding-top:33.92%;"><img id="" name="auto-py-to-exe-cmd.png" alt="Executable Applications in Python" src="https://cdn.mos.cms.futurecdn.net/pqG38oDkNQ4s5p6VMRh5ej.png" mos="" align="middle" fullscreen="1" width="395" height="134" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/pqG38oDkNQ4s5p6VMRh5ej.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>3. <strong>Click on Browse </strong>and <strong>navigate to our example Python file.</strong></p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:633px;"><p class="vanilla-image-block" style="padding-top:103.95%;"><img id="" name="browser.png" alt="Executable Applications in Python" src="https://cdn.mos.cms.futurecdn.net/ny2DN8BvaqGz2e2FQFi4bj.png" mos="" align="middle" fullscreen="1" width="633" height="658" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ny2DN8BvaqGz2e2FQFi4bj.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>4. <strong>Set the application to use one file.</strong> This will condense the application and the supporting Python libraries into a single executable file.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:627px;"><p class="vanilla-image-block" style="padding-top:45.61%;"><img id="" name="onefile.png" alt="Executable Applications in Python" src="https://cdn.mos.cms.futurecdn.net/yE2MUJKwDML9FgZVKbNiTj.png" mos="" align="middle" fullscreen="1" width="627" height="286" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/yE2MUJKwDML9FgZVKbNiTj.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>5. <strong>Set the application to be Console Based.</strong> By doing this we will see any errors outputted to the Command Prompt. Once we are confident that the app works correctly, we can set this to Window Based.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:447px;"><p class="vanilla-image-block" style="padding-top:27.29%;"><img id="" name="console.png" alt="Executable Applications in Python" src="https://cdn.mos.cms.futurecdn.net/jAAZmgnX9vpYW8w2MKZ2Qj.png" mos="" align="middle" fullscreen="1" width="447" height="122" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/jAAZmgnX9vpYW8w2MKZ2Qj.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>6. <strong>Click on the Icon drop down </strong>and <strong>select an icon for your application. </strong>This is an optional step but it adds an extra level of quality to your application. Icons must be .ico files and we used a 64x64 pixel image as an icon.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:613px;"><p class="vanilla-image-block" style="padding-top:13.70%;"><img id="" name="icon.png" alt="Executable Applications in Python" src="https://cdn.mos.cms.futurecdn.net/adgcNxq6pc9AoXvgLmuyKj.png" mos="" align="middle" fullscreen="1" width="613" height="84" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/adgcNxq6pc9AoXvgLmuyKj.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>7. <strong>Click on Advanced </strong>and, under <em>–name,</em> <strong>enter the name of your application.</strong> We chose App Launcher.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:603px;"><p class="vanilla-image-block" style="padding-top:38.64%;"><img id="" name="advanced.png" alt="Executable Applications in Python" src="https://cdn.mos.cms.futurecdn.net/XFdAAcdDZVDUDguJdQRv7j.png" mos="" align="middle" fullscreen="1" width="603" height="233" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/XFdAAcdDZVDUDguJdQRv7j.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>8. <strong>Scroll down </strong>and <strong>click on CONVERT .PY to .EXE</strong> to start the process. This will take a couple of minutes.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:621px;"><p class="vanilla-image-block" style="padding-top:20.93%;"><img id="" name="convert.png" alt="Executable Applications in Python" src="https://cdn.mos.cms.futurecdn.net/VTwE5v3qdVa2XNhMGwHXFj.png" mos="" align="middle" fullscreen="1" width="621" height="130" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/VTwE5v3qdVa2XNhMGwHXFj.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>9. <strong>Click on </strong><em><strong>Open Output Folder</strong></em> to open the folder containing the application.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:625px;"><p class="vanilla-image-block" style="padding-top:105.92%;"><img id="" name="app created.png" alt="Executable Applications in Python" src="https://cdn.mos.cms.futurecdn.net/m7dDYVyxDgaZes3UQNzWBj.png" mos="" align="middle" fullscreen="1" width="625" height="662" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/m7dDYVyxDgaZes3UQNzWBj.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>10. <strong>Double click on the icon </strong>to run your application.</p><h2 id="python-how-tos-9">Python How Tos</h2><ul><li><a href="https://www.tomshardware.com/how-to/install-python-on-windows-10-and-11">How To Install Python on Windows 10 and 11</a></li><li><a href="https://www.tomshardware.com/how-to/use-for-loops-in-python">How to use For Loops in Python</a></li><li><a href="https://www.tomshardware.com/how-to/enumerate-in-python">How to Enumerate in Python</a></li><li><a href="https://www.tomshardware.com/how-to/create-python-executable-applications">How to Create Executable Applications in Python</a></li><li><a href="https://www.tomshardware.com/how-to/python-remove-image-backgrounds">How To Remove Backgrounds From Images With Python</a></li><li><a href="https://www.tomshardware.com/how-to/build-web-apps-with-python-html-thonny">How to Create Web Apps with Python, HTML and Thonny</a></li><li><a href="https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2">How To Use Raspberry Pi Camera Module 3 with Python Code</a></li></ul>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ CircuitPython Officially Supported by Over 300 Microcontrollers ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/circuitpython-supported-by-over-300-boards</link>
                                                                            <description>
                            <![CDATA[ Adafruit confirms over 300 boards officially support CircuitPython in a new blog update with hundreds of libraries available to tinker with. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">VtgYihdZZhZhNmL2U5bJYZ</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/ffDPaLS72aK9bh23KyJtfT-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Wed, 18 May 2022 19:01:41 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:35 +0000</updated>
                                                                                                                                            <category><![CDATA[Programming]]></category>
                                                    <category><![CDATA[Software]]></category>
                                                                                                                    <dc:creator><![CDATA[ Ash Hill ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/p9HsnLCwBpTQYCBBhYXgrS.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Ash is a self-employed tech writer and illustrator with a serious affinity for the Raspberry Pi, 3D printing, retro gaming and finding the best tech deals and coupons. She has over a decade of IT experience and has been featured in the official Raspberry Pi magazine MagPi.&lt;/p&gt; ]]></dc:description>
                                                                                                                                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/ffDPaLS72aK9bh23KyJtfT-1280-80.jpg">
                                                            <media:credit><![CDATA[Adafruit]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Raspberry Pi]]></media:description>                                                            <media:text><![CDATA[Raspberry Pi]]></media:text>
                                <media:title type="plain"><![CDATA[Raspberry Pi]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/ffDPaLS72aK9bh23KyJtfT-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>The Adafruit blog has published an <a href="https://blog.adafruit.com/2022/05/17/there-are-now-over-300-circuitpython-compatible-microcontroller-boards-circuitpython-python-adafruit"><u>announcement</u></a> confirming over 300 boards now officially support CircuitPython. These microcontrollers can be used for tons of cool projects and CircuitPython adds a new level of accessibility that makes programming modules, including the <a href="https://www.tomshardware.com/news/raspberry-pi"><u>Raspberry Pi</u></a>, in many ways much easier.</p><p>CircuitPython is a barebones programming language that simplifies coding by eliminating unecessary bloat and focusing only on what’s needed. To get a better idea of what it’s capable of, check out our guides on how to use <a href="https://www.tomshardware.com/how-to/use-circuitpython-raspberry-pi"><u>CircuitPython on the Raspberry Pi</u></a> and on the <a href="https://www.tomshardware.com/how-to/gpio-pins-circuitpython-on-a-pc"><u>Raspbery Pi Pico</u></a> RP2040 board.</p><p>According to Adafruit, the 300+ boards supporting CircuitPython include both official and third-party creations from companies as well as open source projects made by members of the Raspberry Pi community. There are tons of microcontrollers out there to take advantage of for your projects and some of the best ones around are <a href="https://www.tomshardware.com/best-picks/best-rp2040-boards"><u>RP2040 boards</u></a>.</p><p>Adafruit provides a complete list of officially supported boards on the <a href="https://circuitpython.org/downloads"><u>CircuitPython website</u></a>. Examples include most any RP2040 board, NXP, Nordic, Espressif boards and plenty more. Check out the complete list to see if the board you want to use will work or to find alternatives for your project that support CircuitPython.</p><p>It’s not enough to support CircuitPython, special <a href="https://circuitpython.org/libraries"><u>libraries</u></a> are created to absolve much of the hard work and so far over 350 are available to download. There is a complete list of libraries available on the CircuitPython website including a package that bundles many of them together. If you want to see what these libraries are capable of, check out our tutortial on how to create a <a href="https://www.tomshardware.com/how-to/make-simon-game-with-raspberry-pi-pico"><u>Simon Says</u></a> game using the Raspberry Pi Pico along with the aid of CircuitPython.</p><p>The <a href="https://www.tomshardware.com/features/best-raspberry-pi-projects"><u>best Raspberry Pi projects</u></a> are the ones you can make at home and CircuitPython easily bridges the learning gap with microelectronics. With over 300 boards now officially supported, there’s plenty of hardware to choose from and tons of inspiration from the community to help bring your project to fruition. </p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
            </channel>
</rss>