<?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"
     xmlns:cf="https://www.futureplc.com/rss/content-flags"
>
    <channel>
                    <atom:link href="https://www.tomshardware.com/feeds/tag/micropython" rel="self" type="application/rss+xml" />
                            <title><![CDATA[ Latest from Tom's Hardware in Micropython ]]></title>
                <link>https://www.tomshardware.com/tag/micropython</link>
        <description><![CDATA[ All the latest micropython content from the Tom's Hardware team ]]></description>
                                    <lastBuildDate>Sun, 15 Sep 2024 15:00:36 +0000</lastBuildDate>
                            <language>en</language>
                                <item>
                                                            <title><![CDATA[ How to install MicroPython for RISC-V on the Raspberry Pi Pico 2 ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/raspberry-pi/raspberry-pi-pico/how-to-install-micropython-for-risc-v-on-the-raspberry-pi-pico-2</link>
                                                                            <description>
                            <![CDATA[ Try out the latest preview version of MicroPython for the RISC-V CPU onboard the latest Raspberry Pi Pico 2. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">b3tUqSEWknTUQGM9BPsrnZ</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/8Xf4xSeXWJYiaufjCAfyN7-1280-80.gif" type="image/gif" length="0"></enclosure>
                                                                        <pubDate>Sun, 15 Sep 2024 15:00:36 +0000</pubDate>                                                                                                                                <updated>Wed, 09 Apr 2025 13:17: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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <media:content type="image/gif" url="https://cdn.mos.cms.futurecdn.net/8Xf4xSeXWJYiaufjCAfyN7-1280-80.gif">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[RISCV MicroPython Pico 2]]></media:description>                                                            <media:text><![CDATA[RISCV MicroPython Pico 2]]></media:text>
                                <media:title type="plain"><![CDATA[RISCV MicroPython Pico 2]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/8Xf4xSeXWJYiaufjCAfyN7-1280-80.gif" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>The freshly released Raspberry Pi Pico 2 comes with two different CPUs onboard. A dual core Arm cortex M33 or a Dual Core RISC-V Hazard3, yes the first RISC-V product from Raspberry Pi! The latter CPU has a performance that falls somewhere between the older Raspberry Pi Pico’s dual core Arm Cortex M0+ and the new Arm Cortex M33. The RISC-V CPU was developed by Raspberry Pi employee Luke Wren as an interesting side project.</p><div ><table><thead><tr><th class="firstcol " >Feature</th><th  >Raspberry Pi Pico 2</th><th  >Raspberry Pi Pico</th></tr></thead><tbody><tr><td class="firstcol " ><strong>SoC</strong></td><td  >RP2350, Dual Core Arm Cortex M33 or Dual Core RISC-V Hazard3 running at up to 150 Mhz</td><td  >RP2040, Dual Core Arm Cortex M0+ running at up to 133 MHz</td></tr><tr><td class="firstcol " ><strong>SRAM</strong></td><td  >520 KB</td><td  >264 KB</td></tr><tr><td class="firstcol " ><strong>Flash Storage</strong></td><td  >4MB QSPI</td><td  >2MB QSPI</td></tr><tr><td class="firstcol " ><strong>Security</strong></td><td  >Arm TrustZone, 8KB OTP, Secure Boot</td><td  >None</td></tr><tr><td class="firstcol " ><strong>Wi-Fi / Bluetooth</strong></td><td  >None</td><td  >None (Pico W has this)</td></tr><tr><td class="firstcol " ><strong>Language Support</strong></td><td  >MicroPython, CircuitPython, C, C++</td><td  >MicroPython, CircuitPython, C, C++</td></tr><tr><td class="firstcol " ><strong>USB Interface</strong></td><td  >USB 1.1 Device and Host</td><td  >USB 1.1 Device and Host</td></tr><tr><td class="firstcol " ><strong>GPIO Logic Level</strong></td><td  >3.3V</td><td  >3.3V</td></tr><tr><td class="firstcol " ><strong>GPIO</strong></td><td  >26 x Digital IO</td><td  >26 x Digital IO</td></tr><tr><td class="firstcol " ><strong></strong></td><td  >4 x 12-bit ADC (Analog pins)</td><td  >3 x 12-bit ADC (Analog pins)</td></tr><tr><td class="firstcol " ><strong></strong></td><td  >2 x UART, 2 x I2C, 2 x SPI, 24 x PWM</td><td  >2 x UART, 2 x I2C, 2 x SPI, 16 x PWM</td></tr><tr><td class="firstcol " ><strong>Programmable IO</strong></td><td  >12 PIO State Machines</td><td  >8 PIO State Machines</td></tr><tr><td class="firstcol " ><strong>Onboard LED</strong></td><td  >GPIO 25</td><td  >GPIO 25</td></tr><tr><td class="firstcol " ><strong>Power</strong></td><td  >1.8 to 5.5V via Micro USB or VSYS</td><td  >1.8 to 5.5V via Micro USB or VSYS</td></tr><tr><td class="firstcol " ><strong>MCU Sleep Mode</strong></td><td  ><10uA</td><td  >100uA</td></tr><tr><td class="firstcol " ><strong>Dimensions</strong></td><td  >21 x 51mm</td><td  >21 x 51mm</td></tr><tr><td class="firstcol " ><strong>Price</strong></td><td  >$5</td><td  >$4</td></tr></tbody></table></div><p>Right now there are two ways to use this new CPU, via the C++ workflow, and using a preview of the latest MicroPython firmware. We’re going to use the latest MicroPython firmware for RISC-V to show that it is as easy as the version of MicroPython used for the Arm CPU.</p><p>The goal of the project is to create a WS2812B “NeoPixel” light sequence, demonstrating that the RISC-V CPU is capable of handling the timing critical WS2812B protocol and producing a rather splendid “disco light” effect for the office.</p><h2 id="for-this-how-to-you-will-need">For this how to you will need</h2><ul><li><a href="https://www.tomshardware.com/reviews/red-robotics-pico-2-pi-review-use-hats-with-raspberry-pi-pico">Raspberry Pi Pico 2</a></li><li>Good quality micro USB cable</li><li>Half-size breadboard</li><li>WS2812B “NeoPixel” stick</li><li>3 x Male to male jumper wires</li></ul><h2 id="installing-micropython-for-risc-v-on-the-raspberry-pi-pico-2">Installing MicroPython for RISC-V on the Raspberry Pi Pico 2</h2><p>1. <strong>Download the RISC-V MicroPython UF2 file</strong> from the <a href="https://micropython.org/download/RPI_PICO2/"><u>MicroPython resource.</u></a> Ensure that you download the RISC-V preview. Note that as this is a preview, things are liable to break, so do not build any mission critical projects with this firmware.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:461px;"><p class="vanilla-image-block" style="padding-top:32.97%;"><img id="6KSa3noiaPP7opHXoh5745" name="dl.jpg" alt="RISCV MicroPython Pico 2" src="https://cdn.mos.cms.futurecdn.net/6KSa3noiaPP7opHXoh5745.jpg" mos="" align="middle" fullscreen="1" width="461" height="152" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/6KSa3noiaPP7opHXoh5745.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>Push and hold the BOOTSEL button</strong> on the Pico 2, then connect to your computer using a micro USB cable. Release BOOTSEL once the drive RP2350 appears on your computer.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1465px;"><p class="vanilla-image-block" style="padding-top:56.25%;"><img id="jP2bnTrgkVa7b7siJ5w6y4" name="BOOTSEL.JPG" alt="RISCV MicroPython Pico 2" src="https://cdn.mos.cms.futurecdn.net/jP2bnTrgkVa7b7siJ5w6y4.jpg" mos="" align="middle" fullscreen="1" width="1465" height="824" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/jP2bnTrgkVa7b7siJ5w6y4.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>Drag and drop the UF2 file </strong>onto the RP2350 drive. The Raspberry Pi Pico 2 will reboot and will now run MicroPython.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:196px;"><p class="vanilla-image-block" style="padding-top:55.10%;"><img id="dhBE6FnyNMn3kBsjiaTxS5" name="RP2350.jpg" alt="RISCV MicroPython Pico 2" src="https://cdn.mos.cms.futurecdn.net/dhBE6FnyNMn3kBsjiaTxS5.jpg" mos="" align="middle" fullscreen="1" width="196" height="108" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/dhBE6FnyNMn3kBsjiaTxS5.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>If you have never used MicroPython, it is a version of Python 3 developed for microcontrollers. If you can write Python, then you can write MicroPython. To write MicroPython code, we need to use a dedicated editor and the default, basic editor is Thonny which is what we shall use for this tutorial.</p><p>4. <strong>Download and install </strong><a href="https://thonny.org/"><u><strong>Thonny</strong></u></a> for your OS.</p><p>5. <strong>Open Thonny.</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:85.55%;"><img id="WXnZdkVxVof9nzkvkj4Tr5" name="thonny.JPG" alt="RISCV MicroPython Pico 2" src="https://cdn.mos.cms.futurecdn.net/WXnZdkVxVof9nzkvkj4Tr5.jpg" mos="" align="middle" fullscreen="1" width="1280" height="1095" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/WXnZdkVxVof9nzkvkj4Tr5.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>Connect the Raspberry Pi Pico</strong> 2 to your computer and in <strong>Thonny go to Tools > Options</strong> and <strong>click on the Interpreter tab</strong>. From the interpreter, dropdown list select MicroPython (Raspberry Pi Pico). The port dropdown menu can be left to automatically detect the Pico. <strong>Click Ok</strong> to close.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:553px;"><p class="vanilla-image-block" style="padding-top:99.46%;"><img id="WfyJMopYcnqKBc47PXQu85" name="options.jpg" alt="RISCV MicroPython Pico 2" src="https://cdn.mos.cms.futurecdn.net/WfyJMopYcnqKBc47PXQu85.jpg" mos="" align="middle" fullscreen="1" width="553" height="550" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/WfyJMopYcnqKBc47PXQu85.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>Check the Python Shell (REPL) for “Raspberry Pi Pico2 with RP2350-RISCV” </strong>to confirm that it has been installed correctly.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1208px;"><p class="vanilla-image-block" style="padding-top:12.67%;"><img id="HhW4ycHE2LYjjTmbt3yZW5" name="repl.jpg" alt="RISCV MicroPython Pico 2" src="https://cdn.mos.cms.futurecdn.net/HhW4ycHE2LYjjTmbt3yZW5.jpg" mos="" align="middle" fullscreen="1" width="1208" height="153" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/HhW4ycHE2LYjjTmbt3yZW5.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="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:877px;"><p class="vanilla-image-block" style="padding-top:95.90%;"><img id="cBwriKwSLGgf5k9rxk5xN5" name="circuit.jpg" alt="RISCV MicroPython Pico 2" src="https://cdn.mos.cms.futurecdn.net/cBwriKwSLGgf5k9rxk5xN5.jpg" mos="" align="middle" fullscreen="1" width="877" height="841" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/cBwriKwSLGgf5k9rxk5xN5.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 a simple connection between the Pico 2 and the WS2812B “NeoPixels” that uses only three wires. We need connections for power and data.</p><div ><table><thead><tr><th class="firstcol " >Raspberry Pi Pico 2</th><th  >NeoPixels</th><th  >Wire Color</th></tr></thead><tbody><tr><td class="firstcol " >3V3 OUT</td><td  >+5V (VIN)</td><td  >Red</td></tr><tr><td class="firstcol " >GND (Any)</td><td  >GND</td><td  >Black</td></tr><tr><td class="firstcol " >GPIO 16</td><td  >DIN (Data In)</td><td  >Orange</td></tr></tbody></table></div><p>You may need to solder header pins to your Neopixels, for that you will need the best <a href="https://www.tomshardware.com/best-picks/best-soldering-irons">soldering iron or soldering station</a>, and a quick refresher on <a href="https://www.tomshardware.com/how-to/solder-pins-raspberry-pi-pico">how to solder.</a></p><h2 id="writing-the-code">Writing the code</h2><p>The goal of the code is to create a pseudo random light sequence along the full length of NeoPixels.</p><p>1. <strong>Create a new blank file in Thonny (File >> New).</strong></p><p>2. <strong>Import a series of modules (pre-written code.) </strong>The first is machine, this enables the code to talk to the Pico 2’s GPIO. Next is NeoPixel, an abstraction that makes working with the WS2812B RGB LEDs much easier. Then we import time, used to add delays to the code. Finally we import the random integer generator from the random module. This is used to generate random numbers in our code.</p><pre class="line-numbers language-bash" language="bash" ><code>import machineimport neopixelimport timefrom random import randint</code></pre><p>3. <strong>Create an object, np, and use it to tell the code that we have NeoPixels connected to pin 16, and that we have 8 “pixels” (individual LEDs) in the chain.</strong> Change this value to match how many you have.</p><pre class="line-numbers language-bash" language="bash" ><code>np = neopixel.NeoPixel(machine.Pin(16),8)</code></pre><p>4. <strong>Create a try, exception handling sequence. </strong>Essentially this tells the Pico 2 to try and run the code that is indented inside of it. If it fails, an exception is raised, and we will catch that later.</p><pre class="line-numbers language-bash" language="bash" ><code>try:</code></pre><p>5. <strong>Indented to show that this is the code to “try” and run, add a while True loop </strong>to run the code forever. Thonny will auto-indent the code as we type.</p><pre class="line-numbers language-bash" language="bash" ><code>   while True:</code></pre><p>6. <strong>Create four objects, r,g,b and n to store randomly generated numbers between a range of 0 and 128 (r,g,b) and 0 to 7 </strong>(n, the number of NeoPixels in our chain, we have eight, but Python starts counting from zero.) The value 128 is half brightness for the NeoPixels. You <strong>can</strong> set this to be 255 for full brightness, but it does consume more power, and could affect those with photosensitivity.</p><pre class="line-numbers language-bash" language="bash" ><code>       r = randint(0,128)       g = randint(0,128)       b = randint(0,128)       n = randint(0,7)</code></pre><p>7. <strong>Print the current color mix values to the Python Shell. </strong>This is the mix of R,G and B that makes up the randomly chosen color.</p><pre class="line-numbers language-bash" language="bash" ><code>       print("This color is: ","{} {} {}".format(r,g,b))</code></pre><p>8. <strong>Set the value of the randomly chosen pixel (n) to the color mix stored as r,g,b using the np object that we created earlier.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>       np[n] = (r,g,b)</code></pre><p>9. <strong>Write the changes to the NeoPixels, and then wait for 0.1 seconds.</strong> This adds a short delay before the code goes back to the start of the while True loop and repeats the process.</p><pre class="line-numbers language-bash" language="bash" ><code>       np.write()       time.sleep(0.1)</code></pre><p>10. <strong>Create the exception handler part of the code to detect when the user clicks Stop, or press CTRL + C.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>except KeyboardInterrupt:</code></pre><p>11. <strong>Print a message “EXIT” to the Python Shell. </strong>This tells the user that the exception has been successfully raised and the handler process is now in control.</p><pre class="line-numbers language-bash" language="bash" ><code>   print("EXIT")</code></pre><p>12. <strong>Using a for loop, iterating through all of the NeoPixels (8 for us). Set all of them to off, and write the changes to take effect.</strong></p><pre class="line-numbers language-bash" language="bash" ><code>   for i in range(8):       np[i] = (0,0,0)       np.write()</code></pre><p>13. <strong>Save the code to the Raspberry Pi Pico 2 as pixels.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:567px;"><p class="vanilla-image-block" style="padding-top:61.38%;"><img id="rvUgDpXdDw8G3Awc93gRd5" name="save.jpg" alt="RISCV MicroPython Pico 2" src="https://cdn.mos.cms.futurecdn.net/rvUgDpXdDw8G3Awc93gRd5.jpg" mos="" align="middle" fullscreen="1" width="567" height="348" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/rvUgDpXdDw8G3Awc93gRd5.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>Click on Run > Run Current Script, or click on the green run button 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:468px;"><p class="vanilla-image-block" style="padding-top:42.95%;"><img id="YSemKsm4JyNyT9WDXAwDa5" name="run.jpg" alt="RISCV MicroPython Pico 2" src="https://cdn.mos.cms.futurecdn.net/YSemKsm4JyNyT9WDXAwDa5.jpg" mos="" align="middle" fullscreen="1" width="468" height="201" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/YSemKsm4JyNyT9WDXAwDa5.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 of the NeoPixels in the chain should soon be a random color, changing every 0.1 seconds. The Python Shell will show the current color as an RGB value.</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:412px;"><p class="vanilla-image-block" style="padding-top:53.16%;"><img id="v37H7RMwK9iiSANAYmHGC5" name="colors.jpg" alt="RISCV MicroPython Pico 2" src="https://cdn.mos.cms.futurecdn.net/v37H7RMwK9iiSANAYmHGC5.jpg" mos="" align="middle" fullscreen="1" width="412" height="219" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/v37H7RMwK9iiSANAYmHGC5.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>When you want to stop, click on the stop button, or press CTRL + C on the keyboard.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1271px;"><p class="vanilla-image-block" style="padding-top:60.58%;"><img id="n9B2kf7R3nEc4uJ2Txgej5" name="stop.jpg" alt="RISCV MicroPython Pico 2" src="https://cdn.mos.cms.futurecdn.net/n9B2kf7R3nEc4uJ2Txgej5.jpg" mos="" align="middle" fullscreen="1" width="1271" height="770" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/n9B2kf7R3nEc4uJ2Txgej5.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">Complete Code Listing</h2><pre class="line-numbers language-bash" language="bash" ><code>import machineimport neopixelimport timefrom random import randintnp = neopixel.NeoPixel(machine.Pin(16),8)try:    while True:        r = randint(0,128)        g = randint(0,128)        b = randint(0,128)        n = randint(0,7)        print("This color is: ","{} {} {}".format(r,g,b))        np[n] = (r,g,b)        np.write()        time.sleep(0.1)except KeyboardInterrupt:    print("EXIT")    for i in range(8):        np[i] = (0,0,0)        np.write()</code></pre>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ New Waveshare IoT board uses Raspberry Pi Zero form factor, brings cellular connectivity and a custom version of MicroPython ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/raspberry-pi/raspberry-pi-zero/new-waveshare-iot-board-uses-raspberry-pi-zero-form-factor-brings-cellular-connectivity-and-a-custom-version-of-micropython</link>
                                                                            <description>
                            <![CDATA[ Waveshare offers a development kit that provides cellular connectivity and compatibility with Raspberry Pi Zero HATs in a small form factor. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">ErLzuMA8csBYQPBAYCMXNo</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/9Wh29LqQRHqh9DbgvNKpwQ-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Wed, 22 May 2024 15:59:05 +0000</pubDate>                                                                                                                                <updated>Wed, 09 Apr 2025 13:02:09 +0000</updated>
                                                                                                                                            <category><![CDATA[Raspberry Pi]]></category>
                                                                                                                    <dc:creator><![CDATA[ Jeff Butts ]]></dc:creator>                                                                                    <dc:source><![CDATA[ https://cdn.mos.cms.futurecdn.net/mu8yfvXw9Ut4an84MVDhs9.jpg ]]></dc:source>
                                                                <dc:description><![CDATA[ &lt;p&gt;Jeff Butts began tinkering with computers in the early 1980s and worked as an IT and networking consultant for 15 years before engaging in any “formal” training. Throughout his career, he worked with and supported nearly every commonly used operating system, including Windows, OS/2, Linux, and macOS. He eventually earned a Master of Information and Computing Systems and taught university English and computer science for several years before pivoting to professional writing. He’s written and edited for such outlets as The Mac Observer, How-To Geek, Hot Hardware, groovyPost, and geekRumor. When not writing, he bounces between 3D printing projects, fiddling with Raspberry Pi and the like, and Microsoft Flight Simulator.&lt;/p&gt; ]]></dc:description>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/9Wh29LqQRHqh9DbgvNKpwQ-1280-80.jpg">
                                                            <media:credit><![CDATA[Shutterstock]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Waveshare BG95-M3 Zero]]></media:description>                                                            <media:text><![CDATA[Waveshare BG95-M3 Zero]]></media:text>
                                <media:title type="plain"><![CDATA[Waveshare BG95-M3 Zero]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/9Wh29LqQRHqh9DbgvNKpwQ-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p><a href="https://www.tomshardware.com/news/waveshares-rp2040-pi-zero-morphs-raspberry-pi-pico-into-zero">Waveshare</a> has announced its <a href="https://www.waveshare.com/bg95-m3-zero.htm">BG95-M3 Zero</a>, a single-board computer (SBC) that offers cellular connectivity as well as compatibility with <a href="https://www.tomshardware.com/best-picks/best-raspberry-pi-hats">Raspberry Pi HAT</a> add-ons. It features its own processor and ships with Quectel’s QuecPython MicroPython firmware for easy programming.</p><p>The BG95-M3 Zero is in a Raspberry Pi Zero form factor (65 x 30 mm) and integrates an <a href="https://www.tomshardware.com/news/cortex-a32-32-bit-wearables-iot,31259.html">Arm Cortex-A7</a> processor running ThreadX RTOS. Most Quectel modules for cellular Internet of Things (IoT) usage depend on another board for a host processor. This allows hobbyists and IoT manufacturers to develop smaller smart products with cellular capabilities since there’s no need for an additional SBC to run the show.</p><p>This development board is equipped with a BG95-M3 module, which supports LTE Cat M1, LTE Cat NB2, and EGPRS cellular networking worldwide. It also supports GNSS positioning using GPS, GLONASS, BDS,  Galileo, and QZSS. The SBC includes an onboard nano SIM card slot positioned near the edge of the board for easy insertion and removal.</p><div ><table><caption>Cellular Frequency Bands for Waveshare Boards</caption><thead><tr><th class="firstcol empty" ></th><th  >BG95-M3 Zero</th><th  >EC200U-EU</th><th  >EC200U-AU</th></tr></thead><tbody><tr><td class="firstcol " >LTE-FDD</td><td  >Cat M1: B1, B2, B3, B4, B5, B8, B12, B13, B18, B19, B20, B25, B26, B27, B28, B66, B85</td><td  >B1, B3, B5, B7, B8, B20, B28</td><td  >B1, B2, B3, B4, B5, B7, B8, B28, B66</td></tr><tr><td class="firstcol empty" ></td><td  >Cat NB2: B1, B2, B3, B4, B5, B8, B12, B13, B18, B19, B20, B25, B28, B66, B71, B85</td><td  ></td><td  ></td></tr><tr><td class="firstcol " >LTE-TDD</td><td  >N/A</td><td  >B38, B40, B41</td><td  >B38, B40, B41</td></tr><tr><td class="firstcol " >GSM/GPRS/EDGE</td><td  >850, 900, 1800, 1900 MHz</td><td  >GSM: B2, B3, B5, B8</td><td  >GSM: B2, B3, B5, B8</td></tr><tr><td class="firstcol " >Maximum Downlink/Uplink Speeds (LTE)</td><td  >Cat M1: DL: 588Kbps; UL: 1119Kbps</td><td  >LTE-FDD: DL 10 Mbps; UL 5 Mbps</td><td  >LTE-FDD: DL 10 Mbps; UL 5 Mbps</td></tr><tr><td class="firstcol empty" ></td><td  >Cat NB1: DL 32 Kbps; UL 70 Kbps</td><td  >LTE-TDD: DL 8.96 Mbps; UL 3.1 Mbps</td><td  >LTE-TDD: DL 8.96 Mbps; UL 3.1 Mbps</td></tr><tr><td class="firstcol empty" ></td><td  >Cat NB2 – DL: 127 Kbps; UL: 158.5 Kbps</td><td  ></td><td  ></td></tr><tr><td class="firstcol " >Maximum Downlink/Uplink Speeds (GSM/GPRS/EDGE)</td><td  >EDGE: DL 296 Kbps; UL 236.8 Kbps</td><td  >GSM: DL 85.6 Kbps; UL 85.6 Kbps</td><td  >GSM: DL 85.6 Kbps; UL 85.6 Kbps</td></tr><tr><td class="firstcol empty" ></td><td  >GPRS: DL 107 Kbps; UL 85.6 Kbps</td><td  ></td><td  ></td></tr><tr><td class="firstcol " >GNSS</td><td  >GPS, GLONASS, BDS, Galileo, QZSS</td><td  >GPS, GLONASS, BDS, Galileo, QZSS</td><td  >GPS, GLONASS, BDS, Galileo, QZSS</td></tr><tr><td class="firstcol " >Bluetooth</td><td  >N/A</td><td  >Bluetooth 4.2 (BR/EDR)</td><td  >Bluetooth 4.2 (BR/EDR)</td></tr><tr><td class="firstcol " >Wi-Fi Scan</td><td  >N/A</td><td  >2.4 GHz 11b (Rx)</td><td  >2.4 GHz 11b (Rx)</td></tr></tbody></table></div><p>A group of five LEDs on the board indicate operating status. These include power, sleep, and network indicators. There’s also an LED that illuminates when a SIM card is inserted as well as a PWM function indicator.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:800px;"><p class="vanilla-image-block" style="padding-top:100.00%;"><img id="ntHQuuFw5mBJr3nzboStaD" name="bg95-m3-zero-1.jpg" alt="Waveshare BG95-M3 Zero SBC" src="https://cdn.mos.cms.futurecdn.net/ntHQuuFw5mBJr3nzboStaD.jpg" mos="" align="middle" fullscreen="" width="800" height="800" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="caption-text">The Waveshare BG95-M3 Zero SBC </span><span class="credit" itemprop="copyrightHolder">(Image credit: Waveshare)</span></figcaption></figure><p>The Waveshare BG95-M3 Zero has a 40-pin GPIO header and a USB Type-C port for flashing the firmware. The BG95-M3 Zero integrates an onboard MIPI interface for connecting to MIPI displays and Raspberry Pi peripheral devices. The board also has an onboard camera interface to support customized SPI cameras up to 30MP.</p><figure class="van-image-figure  inline-layout" data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:960px;"><p class="vanilla-image-block" style="padding-top:90.83%;"><img id="2Ch8AChkJwUt5EMJ5DzGqd" name="BG95-M3-Zero-pinout.jpeg" alt="Pinout definition for Waveshare BG95-M3 Zero board" src="https://cdn.mos.cms.futurecdn.net/2Ch8AChkJwUt5EMJ5DzGqd.jpg" mos="" align="middle" fullscreen="" width="960" height="872" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=" inline-layout"><span class="caption-text">Pinout definition for Waveshare BG95-M3 Zero board </span><span class="credit" itemprop="copyrightHolder">(Image credit: Waveshare)</span></figcaption></figure><p>While the BG95-M3 Zero doesn’t offer Bluetooth or Wi-Fi support, Waveshare does produce larger boards with expanded networking capabilities. The <a href="https://www.waveshare.com/EC200U-EU-C4-P01.htm">EC200U-EU</a> is available in Europe, the Middle East, Africa, Australia, New Zealand, and Brazil. There’s also the <a href="https://www.waveshare.com/EC200U-AU-C4-P01.htm">EC200U-AU</a> available in Australia and Latin America.</p><div ><table><caption>Additional specifications for Waveshare BG95-M3 development boards</caption><thead><tr><th class="firstcol empty" ></th><th  >BG95-M3 Zero</th><th  >EC200U-EU, EC200U-AU</th></tr></thead><tbody><tr><td class="firstcol " >Type-C USB Port</td><td  >Supports AT commands testing, GNSS positioning, firmware upgrading, etc.</td><td  >Supports AT commands testing, GNSS positioning, firmware upgrading, etc.</td></tr><tr><td class="firstcol " >Communication protocol</td><td  >PPP, TCP, UDP, SSL, TLS, FTP(S), HTTP(S), NITZ, PING, MQTT, LwM2M, CoAP, IPv6</td><td  >TCP, UDP, PPP, NITZ, PING, FILE, MQTT, NTP, HTTP, HTTPS, SSL, FTP, FTPS, CMUX, MMS</td></tr><tr><td class="firstcol " >SIM card</td><td  >Nano SIM card (supports 1.8V only)</td><td  >Nano SIM and eSIM, dual card single standby</td></tr><tr><td class="firstcol " >Indicator</td><td  >SIM_CHK: lights up when a SIM card is inserted into the card slot</td><td  >P01: Module Pin 1, default as EC200A-XX PWM0</td></tr><tr><td class="firstcol empty" ></td><td  >NET: Network indicator</td><td  >P05: Module Pin 5, NET_MODE indicator</td></tr><tr><td class="firstcol empty" ></td><td  >PSM: Sleep indicator</td><td  >SCK1: SIM1 detection indicator, lights up when SIM1 card is inserted</td></tr><tr><td class="firstcol empty" ></td><td  >PWM: PWM function indicator</td><td  >SCK2: SIM2 detection indicator, lights up when SIM2 card is inserted</td></tr><tr><td class="firstcol empty" ></td><td  >PWR: Power indicator</td><td  >PWR: Power indicator</td></tr><tr><td class="firstcol " >Buttons</td><td  >PWK: Power ON/OFF</td><td  >PWK: Power ON/OFF</td></tr><tr><td class="firstcol empty" ></td><td  >PON: PSM wake-up</td><td  >RST: Reset</td></tr><tr><td class="firstcol empty" ></td><td  >BOOT: Forcing into firmware burning mode</td><td  >BOOT: Forcing into firmware burning mode</td></tr><tr><td class="firstcol empty" ></td><td  >USB ON/OFF: USB power consumption detection switch</td><td  >USB ON/OFF: USB power consumption detection switch</td></tr><tr><td class="firstcol " >Antenna Connectors</td><td  >LTE main antenna + DIV antenna + GNSS antenna</td><td  >LTE main antenna + DIV / WIFI (scanning only) / Bluetooth antenna + GNSS antenna</td></tr><tr><td class="firstcol " >Operating Temperature</td><td  >-30 ~ 75°C</td><td  ></td></tr><tr><td class="firstcol " >Storage Temperature</td><td  >-45 ~ 90°C</td><td  ></td></tr></tbody></table></div><p>Programming the SBC is done <a href="https://python.quectel.com/doc/Getting_started/en/tools_prepare.html">through QPYcom</a>, a specialized development and debugging tool for QuecPython. QPYcom is Windows-only, but Waveshare notes that you can use plugins for Thonny IDE. VSCode, and other IDEs to program the board.</p>
                                                            </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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <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 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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <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">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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <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[ 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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <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="high" 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[ 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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <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">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-2">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[ 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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <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-2">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-3">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[ CircuitPython Libraries Slither Into MicroPython on the Raspberry Pi Pico ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/circuitpython-libraries-come-to-micropython-on-pico</link>
                                                                            <description>
                            <![CDATA[ Adafruit's latest guide covers everything you need to use CircuitPython libraries with MicroPython on the Raspberry Pi Pico. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">8pFd388L6YJobZh2v3ZdbS</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/JhexAp7TbAz2ivnHD5t7o5-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Fri, 21 May 2021 09:35:46 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:27 +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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/JhexAp7TbAz2ivnHD5t7o5-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></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/JhexAp7TbAz2ivnHD5t7o5-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p><a href="https://learn.adafruit.com/circuitpython-libraries-on-micropython-using-the-raspberry-pi-pico">Adafruit has shared a new guide</a> detailing the process for using CircuitPython libraries with MicroPython using our favorite microcontroller, the <a href="https://www.tomshardware.com/news/raspberry-pi"><u>Raspberry Pi Pico</u></a>.</p><p>The layer between CircuitPython and MicroPython is known as Blinka. It&apos;s a compatibility library designed to work with Linux SBCs like the Raspberry Pi Pico and the <a href="https://www.tomshardware.com/how-to/use-circuitpython-raspberry-pi">Raspberry Pi</a>. However, the Raspberry Pi Pico microcontroller proved to be a unique challenge and hasn&apos;t been able to make use of this support until now.</p><p>Getting started is easy enough as Adafruit has supplied a full guide detailing everything you need to do. You will need the latest version of MicroPython. The instructions recommend using Thonny for this but when testing it ourselves, we opted to manually install MicroPython as Thonny had an out-of-date version listed. </p><p>Once you&apos;ve ensured your copy of MicroPython is truly the latest, you&apos;re free to go ahead and complete the guide steps which demonstrate how to use the libraries with a BME280 sensor. At this time not every library will work, we tested with a NeoPixel ring and found that it was not supported. <a href="https://twitter.com/adafruit/status/1395512650390458368">Adafruit advised us</a> that at the time of writing there is support for basic digital IO, I2C, SPI, UART but anything that needs a custom hardware API, including NeoPixels will not currently work. But this will change over time.</p><p>We&apos;re excited to see this new development bridge the gap between CircuitPython and MicroPython for the Pico which will hopefully save developers plenty of hassle going forward. Check out the full overview at the <a href="https://learn.adafruit.com/circuitpython-libraries-on-micropython-using-the-raspberry-pi-pico/overview"><u>Adafruit website</u></a> and guide to get an idea of how this new configuration works and start brainstorming your next microcontroller project. </p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ Snake Slithers Onto Raspberry Pi Pico ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/play-snake-on-raspberry-pi-pico</link>
                                                                            <description>
                            <![CDATA[ Nokia's Snake lives again thanks to some clever programming skills and Raspberry Pi's tiny microcontroller. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">RkMN2BAqtMPBqWwkVE4oEc</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/fpBZZQUymGUaX5eavxtstk-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Wed, 12 May 2021 12:55:29 +0000</pubDate>                                                                                                                                <updated>Thu, 30 Jan 2025 13:21:53 +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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/fpBZZQUymGUaX5eavxtstk-1280-80.jpg">
                                                            <media:credit><![CDATA[Hari Wiguna]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Snake playing on a tiny OLED screen]]></media:description>                                                            <media:text><![CDATA[Snake playing on a tiny OLED screen]]></media:text>
                                <media:title type="plain"><![CDATA[Snake playing on a tiny OLED screen]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/fpBZZQUymGUaX5eavxtstk-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>The worst thing about modern smartphones and handheld videogame consoles is the lack of Snake. If you can’t play a quick game of Snake during meetings, then what’s the point? Enter Hari Wiguna, who has, <a href="https://hackaday.com/2021/05/11/play-your-favorite-nokia-game-on-the-raspberry-pi-pico/" target="_blank">via Hackaday</a>, got the game running on a <a href="https://www.tomshardware.com/news/raspberry-pi-pico-tutorials-pinout-everything-you-need-to-know">Raspberry Pi Pico</a> and a tiny OLED screen.</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/5r_6mbYlLVo" allowfullscreen></iframe></div></div><p>The Raspberry Pi Pico, a $4 programmable microcontroller board from the Raspberry Pi Foundation, features a  a dual-core Arm Cortex-M0+ processor with 264KB internal RAM (compared to 1KB on the Nokia 3310, the home of Nokia’s Snake II). And of course, what else could you code Snake in but MicroPython?</p><p>Wiguna’s code is fully <a href="https://github.com/hwiguna/HariFun_203_PicoSnake" target="_blank">available on Github</a> for anyone who fancies having a go themselves. Along with the Raspberry Pi Pico, Wiguna used an <a href="https://www.tomshardware.com/how-to/oled-display-raspberry-pi-pico">I2C 128 x 64 OLED</a> screen and five buttons - four for movement and the fifth to start a new game. </p><p>The snake’s slithery undulating movement is a fine showcase for both the Pico’s abilities and Wiguna’s coding ability - and the design drawings documented <a href="https://hackaday.io/project/179669-harifun-203-pico-snake" target="_blank">on the site</a> give an insight into the amount of work it takes just to chase apples across 8,000 pixels.</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[ Your Raspberry Pi Pico Could Soon Be Online ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/raspberry-pi-pico-wireless-pimoroni</link>
                                                                            <description>
                            <![CDATA[ Pimoroni's Pico Wireless connects to the GPIO of a Raspberry Pi Pico and brings WiFi and Bluetooth to the $4 micro-controller. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">5sz5pafqdWjotX24EHBQ5Y</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/TDnEeCzVGYiEGMvk8KovbE-1280-80.jpeg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Wed, 05 May 2021 16:43:21 +0000</pubDate>                                                                                                                                <updated>Wed, 05 May 2021 20:15:05 +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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/TDnEeCzVGYiEGMvk8KovbE-1280-80.jpeg">
                                                            <media:credit><![CDATA[Phil Howard @Gadgetoid]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Raspberry Pi Pico Wireless]]></media:description>                                                            <media:text><![CDATA[Raspberry Pi Pico Wireless]]></media:text>
                                <media:title type="plain"><![CDATA[Raspberry Pi Pico Wireless]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/TDnEeCzVGYiEGMvk8KovbE-1280-80.jpeg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>The $4 <a href="https://www.tomshardware.com/news/raspberry-pi-pico-tutorials-pinout-everything-you-need-to-know">Raspberry Pi Pico</a> may be great value, but it had to lose something in order to keep the price low, and that was WiFi. Sure, <a href="https://www.tomshardware.com/how-to/get-wi-fi-internet-on-raspberry-pi-pico">we can hack our own solution</a>, but <a href="https://shop.pimoroni.com/">Pimoroni&apos;s</a> upcoming Pico Wireless board, demonstrated by Pimoroni employee Phil Howard (better known as <a href="https://twitter.com/Gadgetoid/status/1389964360613761024">@Gadgetoid</a>), is shaping up to serve all of our WiFi needs.</p><div class="see-more see-more--clipped"><blockquote class="twitter-tweet hawk-ignore" data-lang="en"><p lang="en" dir="ltr">Armed with a chonky @TPLINKUK access point, some borrowed code and a little glue, magic and wishes…. I’ve got Pico Wireless serving an HTML file from an SD card! pic.twitter.com/cXf4cUytmj<a href="https://twitter.com/Gadgetoid/status/1389964360613761024">May 5, 2021</a></p></blockquote><div class="see-more__filter"></div></div><p>Pico Wireless is an ESP32 powered "pack," a term coined by Pimoroni to identify a board that connects to all 40 of the GPIO pins of a Pico, as if it were a backpack. In reality, it requires only a few GPIO pins for an SPI interface and others for basic connectivity.  In the tweet we see Howard using the Pico Wireless next to a Raspberry Pi Pico via a Pico Omnibus, a board that breaks out the GPIO for use with <a href="https://www.tomshardware.com/best-picks/best-raspberry-pi-pico-accessories">multiple add ons at once</a>. Howard is using the boards to set up a basic web server, which is serving a static HTML page.</p><p>The ESP32 at the heart of Pico Wireless is itself a powerful micro-controller, with a dual-core 32-bit LX6 microprocessor running at up to 240 MHz. For Pico Wireless, its sole purpose is to provide wireless communication, and for this it provides WiFi 802.11b/g/n and up to 150 Mbps (802.11n) and Bluetooth 4.2, including Bluetooth LE. The PCB antenna is more than capable of providing good communications over a fair distance. </p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/qpC8EzcnkSCVRUys9XRZ9L.jpg" alt="Raspberry Pi Pico Wireless Pack from Pimoroni" /><figcaption><small role="credit">Phil Howard @Gadgetoid</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/bnhK9vTSigcc2FSEutAyzK.jpg" alt="Raspberry Pi Pico Wireless Pack from Pimoroni" /><figcaption><small role="credit">Phil Howard @Gadgetoid</small></figcaption></figure></figure><p>Interfacing between the Raspberry Pi Pico and Pico Wireless happens via SPI, and it&apos;s highly likely that Pimoroni will add a module to its <a href="https://github.com/pimoroni/pimoroni-pico/releases">custom MicroPython firmware</a>, just as the company has done for previous accessories. CircuitPython users already have this feather, as Adafruit has its own <a href="https://www.tomshardware.com/how-to/get-wi-fi-internet-on-raspberry-pi-pico">Featherwing board that provides this functionality.</a></p><p>Pico Wireless also has three extra features: a micro SD card slot, an RGB LED and a push button. The micro SD card slot should also be an SPI device, and it can be used to store files and record data that can be served by Pico Wireless as if it were a micro web server. The RGB LED is most likely the same as that used on <a href="https://www.tomshardware.com/reviews/pimoroni-pico-display-raspberry-pi">Pico Display</a>, a simple RGB LED that uses PWM (Pulse Width Modulation) to mix red, green and blue to produce a variety of colors, useful as a status LED for a project and to show that your Pico Wireless is working. The final feature, the push button, could be a reset button, something omitted from the Pico, but added via another Pimoroni add-on. Or it could be a user-programmable button.</p><p>How much will it be, and how soon will it arrive? Right now we have no idea, but looking at the Pico Wireless board, it already has the correct silkscreen printing and no "bodge wires" used to fix mistakes, so it could be with us very soon. </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 Pico Machine Boots Straight Into MicroPython ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/news/raspberry-pi-pico-orange-python-by-picosoft</link>
                                                                            <description>
                            <![CDATA[ Picosoft's newly designed Orange-Python machine boots straight into MicroPython, so you get started coding immediately. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">hQ7RBAaFrwn7P7P7Kde3d6</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/RehtrtXK5nEHsp5KQ4PthV-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Mon, 29 Mar 2021 16:40:08 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:31 +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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/RehtrtXK5nEHsp5KQ4PthV-1280-80.jpg">
                                                            <media:credit><![CDATA[Picosoft]]></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/RehtrtXK5nEHsp5KQ4PthV-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>This <a href="https://www.tomshardware.com/news/raspberry-pi"><u>Raspberry Pi Pico</u></a> creation comes to us from a company called Picosoft. The Japan-based dev team has designed a Python machine known as <a href="http://www.picosoft.co.jp/Python/index.html"><u>Orange-Python</u></a> that boots directly into a MicroPython interface.</p><p>Some of the <a href="https://www.tomshardware.com/features/best-raspberry-pi-projects"><u>best Raspberry Pi projects</u></a> we&apos;ve come across use a custom interface. The MicroPython program developed for the Orange-Python is very small—small enough to be flashed onto the Pico and stored locally.  </p><figure role="gallery"><figure><img src="https://cdn.mos.cms.futurecdn.net/9xrcH5tdVyqpnJxLaMwKKg.jpg" alt="Raspberry Pi" /><figcaption><small role="credit">Picosoft</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/uv4MehU2NdUoe5vzSnyiQh.jpg" alt="Raspberry Pi" /><figcaption><small role="credit">Picosoft</small></figcaption></figure><figure><img src="https://cdn.mos.cms.futurecdn.net/536UDme6xj9vaaBK6tATGj.jpg" alt="Raspberry Pi" /><figcaption><small role="credit">Picosoft</small></figcaption></figure></figure><p>The whole operation is powered by an RP2040 on a Raspberry Pi Pico. The only extra accessories you need are a keyboard, VGA monitor and something to supply power via microUSB.</p><p>When the Orange-Python system boots, it loads into a mode called Read Evaluate Print Loop (or REPL). This is an interactive interface that works like programming on an old BASIC computer. You can see it in action on <a href="https://twitter.com/picocircuit/status/1376361534041939969">Twitter</a>. The team even managed to program a Tetris-style demo.</p><figure class="van-image-figure " data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:1786px;"><p class="vanilla-image-block" style="padding-top:60.47%;"><img id="" name="1617034936.jpg" alt="Raspberry Pi" src="https://cdn.mos.cms.futurecdn.net/vGQ3kTyxe9YTKnc8bFuPBm.jpg" mos="" align="middle" fullscreen="" width="1786" height="1080" attribution="" endorsement="" class=""></p></div></div><figcaption itemprop="caption description" class=""><span class="credit" itemprop="copyrightHolder">(Image credit: Picosoft)</span></figcaption></figure><p>The DIY kit is planned to retail for $34, ideal for makers who want to assemble the Orange-Python themselves. Pre-built kits will be sold for around $50. Check out the <a href="https://store.shopping.yahoo.co.jp/orangepicoshop">Orange Pico Shop</a> for more products and updates in this one.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Use a 7-Segment Display with Raspberry Pi Pico ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/raspberry-pi-pico-7-segment-display</link>
                                                                            <description>
                            <![CDATA[ Control a 7-segment display with your Pico and MicroPython ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">qWr9nWxtb7g89aGetqKs9d</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/CvvwQ5PhBsvBVoaqQbTMrf-1280-80.jpg" type="image/jpeg" length="0"></enclosure>
                                                                        <pubDate>Wed, 03 Feb 2021 23:28:57 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:34 +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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <media:content type="image/jpeg" url="https://cdn.mos.cms.futurecdn.net/CvvwQ5PhBsvBVoaqQbTMrf-1280-80.jpg">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[7 Segment Display Pi Pico]]></media:description>                                                            <media:text><![CDATA[7 Segment Display Pi Pico]]></media:text>
                                <media:title type="plain"><![CDATA[7 Segment Display Pi Pico]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/CvvwQ5PhBsvBVoaqQbTMrf-1280-80.jpg" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>7-segment displays, the kind found on old digital alarm clocks, can be great for Raspberry Pi projects, including those you make with Raspberry Pi Pico. You can use a 7-segment display to keep score in a game, show sensor data like temperature or distance numbers or to keep track of time. You can even show some letters.</p><p>There are many kinds of 7-segment displays on the market and they vary not only based on the number of digits and the color, but also on the controller board or lack thereof.  Some cheap 7-segment displays have no controller and use separate pins for every single light. When you consider that each digit has seven different lights (hence the name “7-segment display”), that’s a lot of pins. </p><p>However, better 7-segment displays have controller boards which employ an I2C connection that uses just four pins, powered by a TM1637 controller board. Below, we’ll show you how to use one of these TM1637-powered 7-segment displays with a Raspberry Pi Pico.</p><h2 id="what-you-x2019-ll-need">What You’ll Need</h2><ul><li><strong>7-segment display.</strong> There are so many models, but we used <a href="https://www.amazon.com/HiLetgo-Digital-Segment-Display-Arduino/dp/B01DKISMXK">this one</a>.</li><li><strong>Raspberry Pi Pico </strong>with soldered pin headers and MicroPython.</li><li><strong>Four female-to-female jumper cables</strong></li></ul><p>If you haven’t used your Pico before, see our article on <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup">how to set up a Raspberry Pi Pico</a> and <a href="https://www.tomshardware.com/how-to/solder-pins-raspberry-pi-pico">how to solder pins to your Raspberry Pico</a>.   </p><h2 id="how-to-connect-a-7-segment-display-to-raspberry-pi-pico">How to Connect a 7-Segment Display to Raspberry Pi Pico</h2><p>The 7-segment display has four pins: CLK, DIO, GND and VCC. If you use female-to-female jumper wires, you don’t need a breadboard to do the connections.</p><figure class="van-image-figure " data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:823px;"><p class="vanilla-image-block" style="padding-top:70.96%;"><img id="" name="image001.png" alt="7 Segment Display Pi Pico" src="https://cdn.mos.cms.futurecdn.net/bXniSH9icRageJx4PGwred.png" mos="" align="middle" fullscreen="1" width="823" height="584" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/bXniSH9icRageJx4PGwred.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=""><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Connect the following pins from the 7-segment display to the PIco.</p><ol><li><strong>VCC pin to 3V3 </strong>on the Pico (physical pin 36, the fifth on the right side).</li><li><strong>GND pin to GND </strong>on the Pico (physical pin 34, the third on the right side).</li><li><strong>CLK pin to GP16 </strong>on the Pico (last pin on the right side).</li><li><strong>DIO pin to GP17</strong> on the Pico (next-to-last pin on the right side).</li></ol><p>You could choose to connect the CLK and DIO pins to any two GPIO pins on the Pico which support I2C SCL and SDA respectively and you can connect the GND pin to any of the Pico’s 8 GND pins. See the <a href="https://www.tomshardware.com/news/raspberry-pi-pico-tutorials-pinout-everything-you-need-to-know">Raspberry Pi Pico pinout</a> for details.</p><figure class="van-image-figure " data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:4032px;"><p class="vanilla-image-block" style="padding-top:75.00%;"><img id="" name="PXL_20210203_202525785.jpg" alt="7 Segment Display Pi Pico" src="https://cdn.mos.cms.futurecdn.net/9qCPsLKHGJRWKGHgkX4Lxe.jpg" mos="" align="middle" fullscreen="1" width="4032" height="3024" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/9qCPsLKHGJRWKGHgkX4Lxe.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=""><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><h2 id="how-to-code-a-7-segment-display-in-micropython">How to Code a 7-Segment Display in MicroPython</h2><p>We’re going to rely heavily on the excellent <a href="https://github.com/mcauser/micropython-tm1637">TM1637 MicroPython library</a> from Mike Causer and create a script which shows a variety of display options, which you can use in your own projects later on. </p><p>5. <strong>Download the </strong><a href="https://github.com/mcauser/micropython-tm1637"><strong>tm1637.py file</strong></a> from Mike Causer’s TM1637 github project. You don’t need the other files. </p><p>6. <strong>Copy tm1637.py to your Pico’s </strong>root directory. Since the Pico with MicroPython doesn’t appear as a drive letter, the easiest way to do this is to open tm1637.py in Thonny or the IDE or your choice and save it from there. </p><p>7. <strong>Create a new MicroPython script</strong> in Thonny or the MicroPython IDE of your choice. </p><p>8. <strong>Import the necessary libraries.</strong></p><pre class="line-numbers language-python" language="python" ><code>import tm1637from machine import Pinfrom utime import sleep</code></pre><p>We will use the utime library to put a one-second “sleep” delay between each function so you have time to watch them on the display. </p><p>9. <strong>Create an instance of the tm1637.TM1637 object</strong> called “mydisplay” and enter the correct pin numbers for the CLK and DIO pins as parameters.</p><pre class="line-numbers language-python" language="python" ><code>mydisplay = tm1637.TM1637(clk=Pin(16), dio=Pin(17))</code></pre><p>10. <strong>Use the “show” method</strong> to display any four characters. These can be letters or numbers, but note that many letters, W for example, will look awkward. If you enter more than four characters, only the first four will be shown. Be sure to put the parameter string in quotes.</p><pre class="line-numbers language-python" language="python" ><code>mydisplay.show(“Pico”)sleep(1)</code></pre><p>11. <strong>Blank the screen</strong> by using “show” with four blank spaces (assuming you have four digits on your screen).</p><pre class="line-numbers language-python" language="python" ><code>mydisplay.show(“    “)sleep(1)</code></pre><p>Note that if you don’t blank the display, it will remain on when your program is finished executing. You don’t need to blank the display when changing it, but if you use another show command with less than the maximum number of characters, any characters you don’t replace will stay on the screen. For example, if you do show(“halo”) and then show(“20”), the screen will read 20lo. </p><p>12. <strong>Use the “number” method</strong> to show an integer. Do not put quotes around the parameter. You can display a negative or positive number, but if it’s a negative number, it has to reserve one character for the minus sign. Note that, if you enter a larger number than the available number of digits (ex: entering 12345 on four-digit display), the screen will read “9999” or “-999” for negative numbers.</p><pre class="line-numbers language-python" language="python" ><code>mydisplay.number(-123)sleep(1)</code></pre><figure class="van-image-figure " data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:4032px;"><p class="vanilla-image-block" style="padding-top:75.00%;"><img id="" name="PXL_20210203_202623708.jpg" alt="7 Segment Display Pi Pico" src="https://cdn.mos.cms.futurecdn.net/uYKyfLqvjnTFwxk4wU5Frg.jpg" mos="" align="middle" fullscreen="1" width="4032" height="3024" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/uYKyfLqvjnTFwxk4wU5Frg.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=""><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>Use the “numbers” method to show a time with the color visible. Enter two, two-digit numbers as parameters and the colon, provided your screen has one, will show in between them. This example will appear as 12:59.</p><p>13. Considering that you can use the “show” method to show numbers or letters, you might wonder why you’d want to employ the number method instead. One reason is that you don’t need to convert integers to strings and another is that the screen will only use the necessary amount of digits so you don’t need to enter blank spaces to align your number to the right.</p><p> </p><pre class="line-numbers language-python" language="python" ><code>mydisplay.numbers(12,59)sleep(1)</code></pre><p>14. Adjust the brightness using the brightness method. You can enter a number that ranges from 0 (lowest) to 7 (highest) as the parameter.</p><pre class="line-numbers language-python" language="python" ><code>#adjust the brightness to make it loewrmydisplay.brightness(0)sleep(1)</code></pre><p>15. Use the “scroll” method to display scrolling text. Enter a string (in quotes) as the first parameter and add, “delay=” and a number of milliseconds to control the speed of the scroll. If you skip the delay parameter, it will default to 250ms.</p><pre class="line-numbers language-python" language="python" ><code>mydisplay.scroll("Hello World 123", delay=200)sleep(1)</code></pre><figure class="van-image-figure " data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:4032px;"><p class="vanilla-image-block" style="padding-top:75.00%;"><img id="" name="PXL_20210203_202627148.jpg" alt="7 Segment Display Pi Pico" src="https://cdn.mos.cms.futurecdn.net/ca6eq2LALkDqYBzWscfbei.jpg" mos="" align="middle" fullscreen="1" width="4032" height="3024" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/ca6eq2LALkDqYBzWscfbei.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=""><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>16. Use the “temperature” method to show a temperature in Celsius. This method adds the degree symbol and letter C after your digits. You enter either a one or two digit integer as the temperature and you can do negative temperatures but these can only be one digit.</p><pre class="line-numbers language-python" language="python" ><code>mydisplay.temperature(99)sleep(1)</code></pre><figure class="van-image-figure " data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:4032px;"><p class="vanilla-image-block" style="padding-top:75.00%;"><img id="" name="PXL_20210203_202631662.jpg" alt="7 Segment Display Pi Pico" src="https://cdn.mos.cms.futurecdn.net/kRmTCgBW5DBcTVjZJyYUcj.jpg" mos="" align="middle" fullscreen="1" width="4032" height="3024" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/kRmTCgBW5DBcTVjZJyYUcj.jpg' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=""><span class="credit" itemprop="copyrightHolder">(Image credit: Tom's Hardware)</span></figcaption></figure><p>17. Blank the screen again so it doesn’t stay lit when the program is over.</p><pre class="line-numbers language-python" language="python" ><code>mydisplay.show(“    “)</code></pre><p><strong>Here’s the final code</strong></p><pre class="line-numbers language-python" language="python" ><code>import tm1637from machine import Pinfrom utime import sleepmydisplay = tm1637.TM1637(clk=Pin(16), dio=Pin(17)) # Show a wordmydisplay.show("Pico")sleep(1) #blank the screenmydisplay.show("    ")sleep(1) #show numbersmydisplay.number(-123)sleep(1) #show a time with colonmydisplay.numbers(12,59)sleep(1) #adjust the brightness to make it loewrmydisplay.brightness(0)sleep(1) #show scrolling textmydisplay.scroll("Hello World 123", delay=200)sleep(1) #show temperaturemydisplay.temperature(99)sleep(1) #blank the screen againmydisplay.show("    ")</code></pre><p>There are other methods that Causer documents on his github page, including one that will convert numbers to hexadecimal format for you or take hex input. However, these are the main methods we think most people will need to get use with a 7-segment display and Raspberry Pi Pico.</p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
                                <item>
                                                            <title><![CDATA[ How to Connect an Analog Joystick to Raspberry Pi Pico ]]></title>
                                                                                                                                                                                                <link>https://www.tomshardware.com/how-to/raspberry-pi-pico-joystick</link>
                                                                            <description>
                            <![CDATA[ Learn to connect a five-pin joystick and program it in MicroPython. ]]>
                                                                                                            </description>
                                                                                                                                <guid isPermaLink="false">34Pf4BzAPsUEBbyD7p35fg</guid>
                                                                                                <enclosure url="https://cdn.mos.cms.futurecdn.net/qsn5DZfJWvVCjUnt3gzM7H-1280-80.png" type="image/png" length="0"></enclosure>
                                                                        <pubDate>Wed, 27 Jan 2021 15:46:42 +0000</pubDate>                                                                                                                                <updated>Wed, 05 Feb 2025 14:55:26 +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>
                                                                                                                                <cf:isSponsored>false</cf:isSponsored>
                <cf:hasAffiliateLinks>false</cf:hasAffiliateLinks>
                <cf:isPaid>false</cf:isPaid>
                                                                                                                                <media:content type="image/png" url="https://cdn.mos.cms.futurecdn.net/qsn5DZfJWvVCjUnt3gzM7H-1280-80.png">
                                                            <media:credit><![CDATA[Tom&#039;s Hardware]]></media:credit>
                                                                                                                                                                                                                                    <media:description><![CDATA[Joystick to Raspberry Pi Pico]]></media:description>                                                            <media:text><![CDATA[Joystick to Raspberry Pi Pico]]></media:text>
                                <media:title type="plain"><![CDATA[Joystick to Raspberry Pi Pico]]></media:title>
                                                    </media:content>
                                                    <media:thumbnail url="https://cdn.mos.cms.futurecdn.net/qsn5DZfJWvVCjUnt3gzM7H-1280-80.png" />
                                                                                                                                                                    <content:encoded >
                            <![CDATA[
                            <article>
                                <p>There are many reasons you might want to use an analog joystick in your <a href="https://www.tomshardware.com/news/raspberry-pi-pico-tutorials-pinout-everything-you-need-to-know"><u>Raspberry Pi Pico </u></a>project. Perhaps you’re creating a game or maybe you need an input device for navigating. Whatever the case, connecting an analog stick to your Raspberry Pi Pico is really easy and coding for it in MicroPython is also a snap. </p><h2 id="what-you-x2019-ll-need-xa0">What you’ll need </h2><ul><li><strong>Raspberry Pi Pico</strong> with pins. See <a href="https://www.tomshardware.com/how-to/solder-pins-raspberry-pi-pico">how to solder pins to Raspberry Pi Pico</a>.</li><li><strong>Analog thumb joystick</strong> with 5-pin interface. There are many models. We used <a href="https://www.amazon.com/SainSmart-JoyStick-Breakout-Module-Arduino/dp/B00CO2N18A">one of these</a>.</li><li><strong>Breadboard</strong> (optional). You can also connect your joystick directly to the pins.</li><li><strong>Five jumper cables</strong>: female-to-female. If you’re using a breadboard, you’ll need female-to-male.</li></ul><p>If you haven’t programmed your Pico before, see our tutorial on <a href="https://www.tomshardware.com/how-to/raspberry-pi-pico-setup"><u>how to set up Raspberry Pi Pico</u></a>. </p><figure class="van-image-figure " data-bordeaux-image-check ><div class='image-full-width-wrapper'><div class='image-widthsetter' style="max-width:564px;"><p class="vanilla-image-block" style="padding-top:130.85%;"><img id="" name="Analog_Input_bb.png" alt="Raspberry Pi Pico connected to an analog thumbstick" src="https://cdn.mos.cms.futurecdn.net/69LxgDAdydmMnfxw6RLynZ.png" mos="" align="middle" fullscreen="1" width="564" height="738" attribution="" endorsement="" class="expandable"><a href='https://cdn.mos.cms.futurecdn.net/69LxgDAdydmMnfxw6RLynZ.png' target='_blank' class='expand-button icon-expand-image icon' ></a></p></div></div><figcaption itemprop="caption description" class=""><span class="credit" itemprop="copyrightHolder">(Image credit: Future)</span></figcaption></figure><h2 id="wiring-a-joystick-to-raspberry-pi-pico">Wiring a Joystick to Raspberry Pi Pico</h2><p>1. <strong>Wire the joystick’s 5 pins </strong>to the Pico as follows:</p><ul><li><strong>GND to GND</strong> (Any GND pin)</li><li><strong>+5V to 3V3 Out</strong> (physical pin 36). Yes, a 5V joystick will work with the 3V3 power of Pico.</li><li><strong>VRx to GP27 / ADC1</strong> (physical pin 32)</li><li><strong>VRy to GP26 / ADC0</strong> (physical pin 31)</li><li><strong>SW to GP16</strong> (physical pin 21). This would work with most of the GPIo pins.</li></ul><h2 id="coding-a-joystick-in-micropython-for-raspberry-pi-pico-xa0">Coding a Joystick in MicroPython for Raspberry Pi Pico </h2><p>An analog thumbstick is effectively three devices in one: a potentiometer for the X axis, a potentiometer for the Y axis and a digital momentary button when you press down. Below, we’ll write some simple code to help us see where the joystick is pointing. </p><p>2. <strong>Start a blank program</strong> in your MicroPython IDE, most likely Thonny.</p><p>3. <strong>Import the necessary modules:</strong> Pin, ADC from machine and utime </p><pre class="line-numbers language-python" language="python" ><code>from machine import Pin, ADCimport utime</code></pre><p>We’ll use the utime.sleep function later to put a necessary delay into a loop which reads the button state. </p><p>4. <strong>Create xAxis and yAxis variables and assign them </strong>to the GP pins for each, 27 and 26. </p><pre class="line-numbers language-python" language="python" ><code>xAxis = ADC(Pin(27))yAxis = ADC(Pin(26))</code></pre><p>5. <strong>Create a button variable </strong>and assign it to a Pin object. </p><pre class="line-numbers language-python" language="python" ><code>button = Pin(16,Pin.IN, Pin.PULL_UP)</code></pre><p>Note that the Pin object has three arguments, the GP number, the mode (which is input in our case) and whether it has a pull-up or pull-down resistor (see <a href="https://www.tomshardware.com/how-to/resistor-color-codes">resistor color codes</a> to identify different types). We want it to be in input mode and pull up.  </p><p>6.  <strong>Create a continuous loop</strong> that checks and prints values for x, y and button.</p><pre class="line-numbers language-python" language="python" ><code>while True:    xValue = xAxis.read_u16()    yValue = yAxis.read_u16()    buttonValue= button.value()    print(str(xValue) +", " + str(yValue) + " -- " + str(buttonValue))    utime.sleep(0.1)</code></pre><p>7.  <strong>Run the code and observe the results</strong> in the MicroPython shell as you move the joystick and press the button. What you’ll likely see is that, if the joystick isn’t moved or pressed, the X and Y values will be around 32,000 to 33,000 and the button value will be 1. Moving to the left will put the X value in the 300 to 500 range and to the right will be around 65,000. Pointing up will put the 300 to 500 range and pointing down will be around 65,000. Pressing the button will give it a value of 0 while you hold it down.</p><p>8. <strong>Stop the execution</strong> and erase the print statement to save space. </p><p>9. <strong>Create variables for the plain English status of X, Y and button. </strong>Place them within the loop and give them default values that an untouched joystick.</p><pre class="line-numbers language-python" language="python" ><code>    xStatus = "middle"    yStatus = "middle"    buttonStatus = "not pressed"</code></pre><p>10. <strong>Use if / then statements to correctly label </strong>the joystick and button status within the loop. </p><pre class="line-numbers language-python" language="python" ><code> if xValue <= 600:        xStatus = "left"    elif xValue >= 60000:        xStatus = "right"    if yValue <= 600:        yStatus = "up"    elif yValue >= 60000:        yStatus = "down"    if buttonValue == 0:        buttonStatus = "pressed"</code></pre><p>11.  <strong>Use a print statement to print</strong> the variables and place it above the sleep command.</p><pre class="line-numbers language-python" language="python" ><code>print("X: " + xStatus + ", Y: " + yStatus + " -- button " + buttonStatus)</code></pre><p> Your final code should look like this: </p><pre class="line-numbers language-python" language="python" ><code>from machine import Pin, ADCimport utimexAxis = ADC(Pin(27))yAxis = ADC(Pin(26))button = Pin(16,Pin.IN, Pin.PULL_UP)while True:    xValue = xAxis.read_u16()    yValue = yAxis.read_u16()    buttonValue = button.value()    xStatus = "middle"    yStatus = "middle"    buttonStatus = "not pressed"    if xValue <= 600:        xStatus = "left"    elif xValue >= 60000:        xStatus = "right"    if yValue <= 600:        yStatus = "up"    elif yValue >= 60000:        yStatus = "down"    if buttonValue == 0:        buttonStatus = "pressed"    print("X: " + xStatus + ", Y: " + yStatus + " -- button " + buttonStatus)    utime.sleep(0.1)</code></pre><p>Now that you know how to identify what your joystick is doing, you can incorporate it into your MicroPython programs for Raspberry Pi Pico. See our list of <a href="https://www.tomshardware.com/news/raspberry-pi-pico-tutorials-pinout-everything-you-need-to-know"><u>Raspberry Pi Pico tutorials</u></a> for more ideas. </p>
                                                            </article>
                            ]]>
                        </content:encoded>
                                                </item>
            </channel>
</rss>