{"id":130865,"date":"2023-06-28T15:24:52","date_gmt":"2023-06-28T15:24:52","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=130865"},"modified":"2024-05-06T10:59:34","modified_gmt":"2024-05-06T10:59:34","slug":"getting-started-raspberry-pi-pico-w","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/getting-started-raspberry-pi-pico-w\/","title":{"rendered":"Getting Started with Raspberry Pi Pico (and Pico W)"},"content":{"rendered":"\n<p>This article is a getting-started guide for the Raspberry Pi Pico W microcontroller board. It was built around the RP2040 chip, provides many GPIOs to connect peripherals, and can be programmed using C\/C++ programming language or Micropython. Let&#8217;s explore the features of the Raspberry Pi Pico and learn how to run your first program.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Getting-Started.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Getting Started with Raspberry Pi Pico and Raspberry Pi Pico W\" class=\"wp-image-130915\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Getting-Started.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Getting-Started.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Getting-Started.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Getting-Started.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p class=\"rntbox rntclgreen\">You may also like: <a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-micropython-ebook\/\" title=\"\">Learn Raspberry Pi Pico with MicroPython (eBook)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introducing the Raspberry Pi Pico<\/h2>\n\n\n\n<p>The Raspberry Pi Pico is a low-cost microcontroller board developed around the RP2040 chip by the Raspberry Pi Foundation. Unlike previous versions of the Raspberry Pi, the Raspberry Pi Pico is not meant to run an operating system. It is a microcontroller board like the Arduino, or ESP32, whose main purpose is to control electronic components through its GPIOs. If you&#8217;re familiar with the ESP32 or ESP8266 board, the Raspberry Pi Pico is not much different.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-W.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico W board\" class=\"wp-image-130912\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-W.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-W.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Variants of the Raspberry Pi Pico board<\/h3>\n\n\n\n<p>There are two main variants of the Raspberry Pi Pico board:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Raspberry Pi Pico: no wireless connectivity (no Wi-Fi, no Bluetooth)<\/li>\n\n\n\n<li>Raspberry Pi Pico W: comes with wireless connectivity (Wi-Fi and Bluetooth)<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"356\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/raspberry-pi-pico-family.jpg?resize=750%2C356&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico Family\" class=\"wp-image-130910\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/raspberry-pi-pico-family.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/raspberry-pi-pico-family.jpg?resize=300%2C142&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><figcaption class=\"wp-element-caption\">Raspberry Pi Pico, Pico H, Pico W, Pico WH (<a href=\"https:\/\/www.raspberrypi.com\/documentation\/microcontrollers\/raspberry-pi-pico.html\" target=\"_blank\" rel=\"noopener\" title=\"\">Image source<\/a>)<\/figcaption><\/figure>\n\n\n\n<p>You may also see those versions referenced with an H, like Raspberry Pi Pico H, or Raspberry Pi Pico WH, which means they come with soldered header pins.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Should you get a Raspberry Pi Pico or Raspberry Pi Pico W?<\/h4>\n\n\n\n<p>The Raspberry Pi Pico W comes with wireless connectivity, which is essential if you need to use Wi-Fi or Bluetooth in IoT or home automation projects. We recommend getting a Raspberry Pi Pico W, as the price difference is not significant and you&#8217;ll have the flexibility to use Wi-Fi or Bluetooth if needed.<\/p>\n\n\n\n<p>Throughout this tutorial, we&#8217;ll use the Raspberry Pi Pico W, but everything also applies to the Raspberry Pi Pico, except the wireless connectivity features.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Where to Buy Raspberry Pi Pico?<\/h4>\n\n\n\n<p>The Raspberry Pi Pico W board is widely available on many different stores. Check the following link to compare its price on different stores:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/raspberry-pi-pico-w\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Buy Raspberry Pi Pico W<\/a><\/li>\n<\/ul>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Raspberry Pi Pico W Specs<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-processor.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico Processor Specs\" class=\"wp-image-130909\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-processor.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-processor.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Here&#8217;s a list of the Raspberry Pi Pico W main specs:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>RP2040 microcontroller with 2MB flash\n<ul class=\"wp-block-list\">\n<li>CPU: Dual-core Arm Cortex-M0+ at 133MHz<\/li>\n\n\n\n<li>264kB multi-bank high-performance SRAM<\/li>\n\n\n\n<li>2MB onboard QSPI Flash<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>2.4GHz wireless interfaces (802.11n) using the Infineon CYW43439 (on the W models)<\/li>\n\n\n\n<li>Micro-USB B port (for power and programming)<\/li>\n\n\n\n<li>3-pin ARM Serial Wire Debug (SWD) port<\/li>\n\n\n\n<li>40 pins<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Raspberry Pi Pico GPIO Interfaces<\/h2>\n\n\n\n<p>The Raspberry Pi Pico comes with 40 pins, 26 of which are programmable GPIOs that you can use to connect peripherals.<\/p>\n\n\n\n<p>The Raspberry Pi Pico supports the following peripheral interfaces on its GPIOs:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>2x UART<\/li>\n\n\n\n<li>2x I2C<\/li>\n\n\n\n<li>2x SPI<\/li>\n\n\n\n<li>16x PWM channels<\/li>\n\n\n\n<li>4x ADC pins (12-bit 500ksps)<\/li>\n<\/ul>\n\n\n\n<p>The Raspberry Pi Pico GPIOs run at 3.3V.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Raspberry Pi Pico Pinout<\/h2>\n\n\n\n<p>The following picture shows the Raspberry Pi Pico pinout (which functions are supported by each pin).  For a more detailed description of the Raspberry Pi Pico Pinout, check out this tutorial: <a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-pinout-gpios\/\" title=\"\">Raspberry Pi Pico and Pico W Pinout Guide: GPIOs Explained<\/a>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-pinout.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"842\" height=\"642\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-pinout.png?resize=842%2C642&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico Pinout\" class=\"wp-image-130916\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-pinout.png?w=842&amp;quality=100&amp;strip=all&amp;ssl=1 842w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-pinout.png?resize=300%2C229&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-pinout.png?resize=768%2C586&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 842px) 100vw, 842px\" \/><\/a><figcaption class=\"wp-element-caption\">Image source: <a href=\"https:\/\/raspberrypi.com\" target=\"_blank\" rel=\"noopener\" title=\"\">raspberrypi.com<\/a><\/figcaption><\/figure><\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-W-Pinout.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"861\" height=\"620\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-W-Pinout.png?resize=861%2C620&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico W pinout\" class=\"wp-image-130917\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-W-Pinout.png?w=861&amp;quality=100&amp;strip=all&amp;ssl=1 861w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-W-Pinout.png?resize=300%2C216&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-W-Pinout.png?resize=768%2C553&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 861px) 100vw, 861px\" \/><\/a><\/figure><\/div>\n\n\n<p>The pins marked in red are power pins that output 3.3V. The black pins are GND pins. All pins in light green can be used as &#8220;regular&#8221; GPIOs (input and output) and all can generate PWM signals.<\/p>\n\n\n\n<p>SPI, I2C, UART communication protocols, and ADC are supported on the pins with the corresponding labels.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Program the Raspberry Pi Pico?<\/h2>\n\n\n\n<p>The Raspberry Pi Pico can be programmed using<a href=\"https:\/\/randomnerdtutorials.com\/programming-raspberry-pi-pico-w-arduino-ide\/\" title=\"\"> C\/C++ programming language (using Arduino IDE)<\/a> or MicroPython. Currently, MicroPython is the most popular way to program the Raspberry Pi Pico and Thonny IDE is the recommended IDE to use with the Raspberry Pi Pico.<\/p>\n\n\n\n<p>The Raspberry Pi Pico comes with a micro USB port that can be used for both power and programming. To program the Raspberry Pi Pico, you just need to use a USB cable to connect the board to your computer. Most Raspberry Pi Pico kits include the proper USB cable.<\/p>\n\n\n\n<p>If you want to start programming the Raspberry Pi Pico using Arduino IDE instead, read the following tutorial:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/programming-raspberry-pi-pico-w-arduino-ide\/\" title=\"\">Programming Raspberry Pi Pico with Arduino IDE<\/a><\/li>\n<\/ul>\n\n\n\n<p>If you want to use MicroPython, continue reading.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is MicroPython?<\/h3>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"250\" height=\"254\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/Micropython-logo.svg-Copy.png?resize=250%2C254&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"MicroPython Logo\" class=\"wp-image-75088\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/Micropython-logo.svg-Copy.png?w=250&amp;quality=100&amp;strip=all&amp;ssl=1 250w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/Micropython-logo.svg-Copy.png?resize=80%2C80&amp;quality=100&amp;strip=all&amp;ssl=1 80w\" sizes=\"(max-width: 250px) 100vw, 250px\" \/><\/figure><\/div>\n\n\n<p>MicroPython is a Python 3 programming language re-implementation targeted for microcontrollers and embedded systems. MicroPython is very similar to regular Python. Apart from a few exceptions, the language features of Python are also available in MicroPython. The most significant difference between Python and MicroPython is that MicroPython was designed to work under constrained conditions.<\/p>\n\n\n\n<p>Because of that, MicroPython does not come with the entire pack of standard libraries. It only includes a small subset of the Python standard libraries, but it includes modules to easily control and interact with the GPIOs, use Wi-Fi, and other communication protocols.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"install-thonny-ide\">Installing Thonny IDE<\/h2>\n\n\n\n<p>Thonny IDE is the recommended software to program the Raspberry Pi Pico board using MicroPython, and that&#8217;s the one we&#8217;ll use in this tutorial.<\/p>\n\n\n\n<p class=\"rntbox rntclgreen\">Thonny IDE can also be used to program the ESP32 and ESP8266 using MicroPython firmware. Learn more here: <a href=\"https:\/\/randomnerdtutorials.com\/getting-started-thonny-micropython-python-ide-esp32-esp8266\/\" title=\"\">Getting Started with Thonny MicroPython (Python) IDE for ESP32 and ESP8266<\/a>.<\/p>\n\n\n\n<p>Go to this link <a href=\"https:\/\/thonny.org\/\" target=\"_blank\" rel=\"noopener\" title=\"\">https:\/\/thonny.org\/<\/a> and click on the right link to download the package for your operating system.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"625\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Download-Thonny-IDE.png?resize=695%2C625&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Download Thonny IDE\" class=\"wp-image-130867\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Download-Thonny-IDE.png?w=695&amp;quality=100&amp;strip=all&amp;ssl=1 695w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Download-Thonny-IDE.png?resize=300%2C270&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 695px) 100vw, 695px\" \/><\/figure><\/div>\n\n\n<p>Run the downloaded executable file and follow the installation procedure (use all the default settings).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Flashing MicroPython Firmware on Raspberry Pi Pico<\/h2>\n\n\n\n<p>Connect the Raspberry Pi Pico to your computer while holding the BOOTSEL button at the same time so that it goes into bootloader mode to flash the firmware.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Bottloader-mode.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico Bootloader Mode\" class=\"wp-image-130903\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Bottloader-mode.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Bottloader-mode.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p class=\"rntbox rntclgray\">It will open a new window on your computer as a new USB device, you can ignore and close that window.<\/p>\n\n\n\n<p>Open Thonny IDE. <\/p>\n\n\n\n<p>Go to <strong>Tools <\/strong>&gt; <strong>Options<\/strong>. Select the <strong>Interpreter <\/strong>tab on the new window that opens.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"220\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Thonny-IDE-Options.png?resize=723%2C220&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Thonny IDE Tools Options\" class=\"wp-image-130905\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Thonny-IDE-Options.png?w=723&amp;quality=100&amp;strip=all&amp;ssl=1 723w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Thonny-IDE-Options.png?resize=300%2C91&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 723px) 100vw, 723px\" \/><\/figure><\/div>\n\n\n<p>Select MicroPython (Raspberry Pi Pico) for the interpreter, and the<strong> Try to detect port automatically<\/strong> for the Port. Then, click on Install or update MicroPython. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"561\" height=\"528\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Interpreter-Thonny.png?resize=561%2C528&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Thonny IDE Select Interpreter\" class=\"wp-image-130891\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Interpreter-Thonny.png?w=561&amp;quality=100&amp;strip=all&amp;ssl=1 561w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Interpreter-Thonny.png?resize=300%2C282&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 561px) 100vw, 561px\" \/><\/figure><\/div>\n\n\n<p>The following window will open.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"561\" height=\"528\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Install-MicroPython-Raspberry-Pi-Pico.png?resize=561%2C528&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Install MicroPython Raspberry Pi Pico Thonny IDE\" class=\"wp-image-130892\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Install-MicroPython-Raspberry-Pi-Pico.png?w=561&amp;quality=100&amp;strip=all&amp;ssl=1 561w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Install-MicroPython-Raspberry-Pi-Pico.png?resize=300%2C282&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 561px) 100vw, 561px\" \/><\/figure><\/div>\n\n\n<p>Select the MicroPython variant accordingly to the board you&#8217;re using. In our case, we&#8217;re using the Pico W. Select a different option if you&#8217;re using the Pico.<\/p>\n\n\n\n<p>Finally, click <strong>Install<\/strong>.<\/p>\n\n\n\n<p>After a few seconds, the installation should be completed.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"467\" height=\"420\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/raspberry-pi-pico-done-installing.png?resize=467%2C420&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Installing MicroPython Raspberry Pi Pico Thonny IDE\" class=\"wp-image-130893\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/raspberry-pi-pico-done-installing.png?w=467&amp;quality=100&amp;strip=all&amp;ssl=1 467w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/raspberry-pi-pico-done-installing.png?resize=300%2C270&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 467px) 100vw, 467px\" \/><\/figure><\/div>\n\n\n<p>You can close the window. You should get the following message on the Shell, and at the bottom right corner, it should have the Interpreter it&#8217;s using and the COM port.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"725\" height=\"569\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/message-after-installing-micropython-Raspberry-Pi-Pico.png?resize=725%2C569&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"running executing MicroPython Raspberry Pi Pico Thonny IDE\" class=\"wp-image-130894\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/message-after-installing-micropython-Raspberry-Pi-Pico.png?w=725&amp;quality=100&amp;strip=all&amp;ssl=1 725w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/message-after-installing-micropython-Raspberry-Pi-Pico.png?resize=300%2C235&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 725px) 100vw, 725px\" \/><\/figure><\/div>\n\n\n<p>If it doesn&#8217;t recognize the device, and you have a message saying &#8220;no backend&#8221; on the bottom-right corner, it may be the case that it is not detecting the COM port automatically. If that&#8217;s the case, go to <strong>Tools <\/strong>&gt; <strong>Options <\/strong>&gt; <strong>Interpreter <\/strong>and select the COM port manually. After that, it should recognize the MicroPython device, and you should get the previous message.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Testing the Installation<\/h3>\n\n\n\n<p>Type help() in the Shell and see if your device responds back.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"725\" height=\"569\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/raspberry-pi-pico-help-menu-thonny-ide.png?resize=725%2C569&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico Thonny IDE MicroPython help\" class=\"wp-image-130895\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/raspberry-pi-pico-help-menu-thonny-ide.png?w=725&amp;quality=100&amp;strip=all&amp;ssl=1 725w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/raspberry-pi-pico-help-menu-thonny-ide.png?resize=300%2C235&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 725px) 100vw, 725px\" \/><\/figure><\/div>\n\n\n<p>It should print some useful information about programming the Raspberry Pi Pico board using MicroPython.<\/p>\n\n\n\n<p>Type the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print('Hello')<\/code><\/pre>\n\n\n\n<p>It should print Hello on the Shell. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"309\" height=\"69\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Pi-Pico-Testing-Hello-Shell-Thonny-IDE.png?resize=309%2C69&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Thonny IDE Testing Shell\" class=\"wp-image-130896\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Pi-Pico-Testing-Hello-Shell-Thonny-IDE.png?w=309&amp;quality=100&amp;strip=all&amp;ssl=1 309w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Pi-Pico-Testing-Hello-Shell-Thonny-IDE.png?resize=300%2C67&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 309px) 100vw, 309px\" \/><\/figure><\/div>\n\n\n<p>If you&#8217;ve followed until this step, you should have Thonny IDE successfully installed, as well as MicroPython firmware on your Raspberry Pi Pico board.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Running Your First Script<\/h2>\n\n\n\n<p>To get you familiar with the process of writing a file and executing code on the Raspberry Pi Pico board, we\u2019ll upload a new script that simply blinks the on-board LED.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Blinking an LED Script<\/h3>\n\n\n\n<p>When you open Thonny IDE for the first time, the Editor shows an untitled file. Copy one of the following scripts to that file:<\/p>\n\n\n\n<p><strong>Raspberry Pi Pico<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>from machine import Pin\nfrom time import sleep\nled = Pin(25, Pin.OUT)\nwhile True:\n  led.value(not led.value())\n  sleep(0.5)<\/code><\/pre>\n\n\n\n<p><strong>Raspberry Pi Pico W<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>from machine import Pin\nfrom time import sleep\nled = Pin('LED', Pin.OUT)\nwhile True:\n  led.value(not led.value())\n  sleep(0.5)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Running the Script<\/h3>\n\n\n\n<p>To run that script on your board, simply click on the <strong>Run <\/strong>icon on Thonny IDE.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"513\" height=\"84\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Thonny-Run-Current-File.png?resize=513%2C84&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Thonny IDE Run File\" class=\"wp-image-130898\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Thonny-Run-Current-File.png?w=513&amp;quality=100&amp;strip=all&amp;ssl=1 513w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Thonny-Run-Current-File.png?resize=300%2C49&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 513px) 100vw, 513px\" \/><\/figure><\/div>\n\n\n<p>The onboard LED will start blinking.<\/p>\n\n\n\n<div class=\"wp-block-jetpack-tiled-gallery aligncenter is-style-rectangular\"><div class=\"tiled-gallery__gallery\"><div class=\"tiled-gallery__row\"><div class=\"tiled-gallery__col\" style=\"flex-basis:50.00000%\"><figure class=\"tiled-gallery__item\"><img decoding=\"async\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Blinking-LED-Off.jpg?strip=info&#038;w=600&#038;ssl=1 600w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Blinking-LED-Off.jpg?strip=info&#038;w=750&#038;ssl=1 750w\" alt=\"Raspberry Pi Pico W onboard LED off\" data-height=\"422\" data-id=\"130908\" data-link=\"https:\/\/randomnerdtutorials.com\/?attachment_id=130908#main\" data-url=\"https:\/\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Blinking-LED-Off.jpg\" data-width=\"750\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Blinking-LED-Off.jpg?ssl=1\" data-amp-layout=\"responsive\"\/><\/figure><\/div><div class=\"tiled-gallery__col\" style=\"flex-basis:50.00000%\"><figure class=\"tiled-gallery__item\"><img decoding=\"async\" srcset=\"https:\/\/i2.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Blinking-LED-On.jpg?strip=info&#038;w=600&#038;ssl=1 600w, https:\/\/i2.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Blinking-LED-On.jpg?strip=info&#038;w=750&#038;ssl=1 750w\" alt=\"Raspberry Pi Pico W onboard LED on\" data-height=\"422\" data-id=\"130907\" data-link=\"https:\/\/randomnerdtutorials.com\/?attachment_id=130907#main\" data-url=\"https:\/\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Blinking-LED-On.jpg\" data-width=\"750\" src=\"https:\/\/i2.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Blinking-LED-On.jpg?ssl=1\" data-amp-layout=\"responsive\"\/><\/figure><\/div><\/div><\/div><\/div>\n\n\n\n<p>To stop the execution of the program you can hit the STOP button or simply press <strong>CTRL<\/strong>+<strong>C<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"29\" height=\"28\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Thonny-IDE-stop-button.png?resize=29%2C28&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Thonny IDE Stop button\" class=\"wp-image-130897\"\/><\/figure><\/div>\n\n\n<p><strong>Important note<\/strong>: just running the file with Thonny doesn&#8217;t copy it permanently to the board&#8217;s filesystem. This means that if you unplug it from your computer and apply power to the board, nothing will happen because it doesn&#8217;t have any Python file saved on its filesystem. The Thonny IDE <em>Run <\/em>function is useful to test the code, but if you want to upload it permanently to your board, you need to create and save a file to the board filesystem. See the next section.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Saving the Script to the Raspberry Pi Pico Board<\/h3>\n\n\n\n<p>Stop the execution of the previous program by clicking on the <strong>Stop <\/strong>button if you haven&#8217;t already.<\/p>\n\n\n\n<p>With the code copied to the file, click on the <strong>Save <\/strong>icon. Then, select <strong>Raspberry Pi Pico<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"214\" height=\"203\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Save-file-to-Raspberry-Pi-Pico.png?resize=214%2C203&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Thonny IDE Save File to Raspberry Pi Pico\" class=\"wp-image-130899\"\/><\/figure><\/div>\n\n\n<p>Save the file with the following name: <span class=\"rnthl rntliteral\">main.py<\/span>.<\/p>\n\n\n\n<p><strong>Note<\/strong>: When you name a file <span class=\"rnthl rntliteral\">main.py<\/span>, the Raspberry Pi Pico will run that file automatically on boot. If you call it a different name, it will still be saved on the board filesystem, but it will not run automatically on boot.<\/p>\n\n\n\n<p>Finally, click <strong>OK <\/strong>to proceed.<\/p>\n\n\n\n<p>Now, you can remove and apply power again to the board, or you can even power it using a different power supply that is not your computer. You&#8217;ll notice that the board will automatically start blinking the LED when it starts.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Blinking-LED-On.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico W onboard LED on\" class=\"wp-image-130907\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Blinking-LED-On.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Blinking-LED-On.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>This tutorial was a quick introduction to the Raspberry Pi Pico board. The Raspberry Pi Pico is a cheap microcontroller board developed by the Raspberry Pi Foundation.<\/p>\n\n\n\n<p>The board can be programmed using <a href=\"https:\/\/randomnerdtutorials.com\/programming-raspberry-pi-pico-w-arduino-ide\/\" title=\"\">C\/C++ programming language (using Arduino IDE)<\/a> or MicroPython. The most popular method to program this board is using MicroPython firmware. In this tutorial, you learned how to run your first MicroPython script on the board and how to save it as a file.<\/p>\n\n\n\n<p>If you&#8217;re serious about learning about the Raspberry Pi Pico, make sure you check our eBook:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-micropython-ebook\/\" title=\"\">Learn Raspberry Pi Pico with MicroPython (eBook)<\/a><\/li>\n<\/ul>\n\n\n\n<p>If you also want to learn how to program the Raspberry Pi Pico using Arduino IDE, read the following tutorial:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/programming-raspberry-pi-pico-w-arduino-ide\/\">Programming Raspberry Pi Pico with Arduino IDE (Pico W compatible)<\/a><\/li>\n<\/ul>\n\n\n\n<p>You can check all our Raspberry Pi Pico projects and tutorials on the following link:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-raspberry-pi-pico\/\">Check out all our Raspberry Pi Pico Guides \u00bb<\/a><\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p>Most MicroPython scripts for the ESP32 and ESP8266 boards should also be compatible with the Raspberry Pi Pico with a few modifications on the pin definition.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32-esp8266-micropython\/\" title=\"\">ESP32\/ESP8266 MicroPython Projects<\/a><\/li>\n<\/ul>\n\n\n\n<p>You may also like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-raspberry-pi\/\" title=\"\">Getting Started with the Raspberry Pi<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/smart-home-ebook\/\" title=\"\">SMART HOME with Raspberry Pi, ESP32, and ESP8266<\/a><\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<p>Thanks for reading<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article is a getting-started guide for the Raspberry Pi Pico W microcontroller board. It was built around the RP2040 chip, provides many GPIOs to connect peripherals, and can be &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Getting Started with Raspberry Pi Pico (and Pico W)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/getting-started-raspberry-pi-pico-w\/#more-130865\" aria-label=\"Read more about Getting Started with Raspberry Pi Pico (and Pico W)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":130915,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[324,326],"tags":[],"class_list":["post-130865","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry-pi-pico","category-raspberry-pi-pico-micropython"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Raspberry-Pi-Pico-Getting-Started.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/130865","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=130865"}],"version-history":[{"count":27,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/130865\/revisions"}],"predecessor-version":[{"id":154879,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/130865\/revisions\/154879"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/130915"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=130865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=130865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=130865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}