Introduction: Pi Pico PIO Demonstration

About: I’m a retired Avionics repair technician ( depot level ) . I was also responsible for the quality control for the soldering shop . Sports to keep my old hardware in shape and Linux and embedded systems to keep…

The Pi Pico has an interesting feature : PIO or programmable IO . This is a little standalone processor that handles input/output while the main processor continues other tasks . It is programmed in a kind of assembler so it is a little exotic at first glance ... I struggled and searched in order to understand how it works so I bought this book , after a little study I got things working :-)

This is a very simple demo : we make a 4bit-counter , feed the result to the state machine and the PIO takes care of the rest .

Supplies

  1. Pi Pico with the latest MicroPython
  2. Breadboard
  3. ULN 2003 driver IC
  4. 4 LED's
  5. 4 resistors , 120 or 220 Ohms ( red LED : 220 Ohms , blue LED: 120 Ohms)

Step 1: Preparing the Circuit

Make sure your Pico has the latest MicroPython under the hood . Then build the circuit as seen in the schematic diagram . The ULN 2003 may be a little overkill because the Pico can drive LED's directly but when the counter reaches hex "F" the Pico may get a little hot so better safe than sorry ...


Step 2: Downloading the Script

After downloading the script you can load it into the Pico ( in Thonny file/save as/ Pi Pico/main.py) or run it (F5).

I tried to explain what is happening in the comments inside the script . In fact , we "build" a state machine and feed it with the status of the counter .

Step 3:

And here it is ! I hope this small tutorial helps people using PIO in future Pi Pico projects !