Introduction: Pi Pico PIO Demonstration
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
- Pi Pico with the latest MicroPython
- Breadboard
- ULN 2003 driver IC
- 4 LED's
- 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 ...
Attachments
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 .
Attachments
Step 3:
And here it is ! I hope this small tutorial helps people using PIO in future Pi Pico projects !







