Raspberry Pi Pico Tutorial: Getting started with MicroPython & CircuitPython

3 min read 7 months ago
Published on Apr 22, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Raspberry Pi Pico Tutorial: Getting Started with MicroPython & CircuitPython

Step 1: Soldering the Header Pins

  1. Gather all the necessary materials: Raspberry Pi Pico, header pins, soldering iron, holder, sponge, solder, flux, solderless breadboard (optional), and safety equipment.
  2. Cut the header pins to the appropriate length (20 pins on each side of the Pico).
  3. Heat up the soldering iron.
  4. Place the header pin on the Pico's pad and solder by heating the pin and pad while feeding solder from the other side until a good connection is made.
  5. Repeat the process for all 40 pins.
  6. Clean up the board with a solder flux remover if desired.

Step 2: Setting Up the IDE

  1. Install an Integrated Development Environment (IDE) for programming the Pico.
  2. Download Thonny IDE from thonny.org for Windows, Mac OS, or Linux.
  3. Open Thonny and ensure MicroPython firmware is on your Pico.
  4. There are two methods to add MicroPython firmware:
    • Method 1: Use Thonny to flash the firmware by pressing the boot select button on the Pico while connecting it to your computer via USB.
    • Method 2: Download MicroPython firmware from the Raspberry Pi website, save it on your computer, and paste it onto the Pico's mass storage device.
  5. Select the interpreter as Python in Thonny and write a simple program to test the setup (e.g., printing "Hello World").

Step 3: Programming with MicroPython

  1. Access the pins and hardware on the Pico using the machine and time libraries.
  2. Control the onboard LED connected to pin 25 by setting it to high or low output within a loop.
  3. Utilize the sleep function from the utime library to create delays in the program execution.

Step 4: Installing CircuitPython

  1. Download the CircuitPython UF2 file from the official website.
  2. Flash CircuitPython onto the Pico by following a similar process as with MicroPython (using the boot select button and copying the UF2 file to the Pico's mass storage device).
  3. Write a simple CircuitPython program to blink the onboard LED by importing the board, setting the LED pin as an output, and controlling its state with time delays.

By following these steps, you can get started with MicroPython and CircuitPython on your Raspberry Pi Pico. Experiment with different programs and projects to explore the capabilities of this versatile microcontroller. Remember to subscribe to the NerdCave channel for more tutorials and projects related to the Raspberry Pi Pico.