Using Pi-Hats together with a Pico

I own quite a number of Pi-Hats and wondered if I could reuse them with a Pico/Pico-W. So I created two adapter PCBs: “pico-zero-base” and “pico-pi-base”:
pico-zero-base
pico-pi-base

This is not something like a “poor man’s pi”: some hats are just better suited for the Pico because the Pico doesn’t take have a minute to boot and does not need a clean shutdown. And you don’t want to by an expensive Pi just to use the Scroll pHat to display some scrolling text ;-)

There were a number of challenges in the project:

  • pin-mapping: both boards now support I2C, SPI, UART and I2S
  • form-factor: the PCBs have Pi-Zero and Pi format, this they fit into available cases
  • layout: I wanted to keep the area underneath the WLAN-chip and antenna without traces
  • software

Porting the Linux-drivers of various hats to the pico was easier than expected, since most of my Hats had python-based drivers using I2C or SPI. So I only had to change some lines of codes, mainly the low-level I2C/SPI-functions. And since I am a CircuitPython user I could rely on 400+ libs for all kind of components, this also makes live easier (but MicroPython shouldn’t be much more complicated, it only takes longer searching for and installing software).

Currently I ported/tested the following Hats successfully:

  • Scroll pHat HD
  • Touch pHat
  • 4-Letter pHat
  • LED-Shim
  • Button-Shim
  • Pirate-Audio Speaker-Hat
  • Pirate-Audio Shim
  • Adafruit Speaker Bonnet
  • Display-Otron-Hat
  • InkyImpression 5.7"

You can find all relevant information here: GitHub - bablokb/pcb-pico-pi-base: An Interface PCB to use Pi-Hats with a Pi-Pico(w) (including ready to order production files). PCB-production is very cheap these days, a batch of 5 of the pico-zero-base costs about 6 Euros (including tracked shipping and EU-taxes). The pico-pi-base is a bit more expensive (16€/5units), mainly due to the higher weight. The only thing you have to solder are the Picos and the pin-headers.

4 Likes

I like your thinking, and bonus for actually building an actual board. =)

You have been busy. What a great project.

I’d be happy to pay a commercial price for these boards as a kit/partly built. I hope someone will put them into production and make them available.

It is all open-hardware, so in theory anyone could build and sell them. But things get more complicated if you sell: you would also have to provide support.

Besides this, it is also a price issue. If I order a batch of pico-zero-base in China, five pieces will cost less than alone the shipping I pay when I order something from Pimoroni. But it is probably as you said: some people would be willing to pay a commercial price.

@bablokb I just found this project and am likely going to get some pico-pi-base boards produced…

I did notice that the rst switch was not included in the assembly BOM. Shouldn’t be any problem finding the switch and installing it myself, but was wondering if there was a reason it was not part of the assembly. Not available from LCSC?

Thank you for a great design and project!

For info…
If you are looking for a “ready made” PICO pretending to be a “regular Pi” solution there is a board called Pi-Square made by SB-Components. The PCB has an embedded PICO RP2040 chip with added ESP module for WiFi and a small monochrome OLED display. It costs £20.

1 Like

Yes, I didn’t find a suitable switch from LCSC. Buttons and switches are labelled in a way that their search does not turn up everything. I think I now found some, so I could revise the board. But I do have enough of them, so this is not a priority on my list.

Finding the switch yourself might be difficult, since it must fit exactly into the holes on the pcb. And to be honest, soldering them was a real challenge, they are very very small.

The pi-zero-base is simpler. Pimoroni has these THT switches.

Thanks for the link. Not a bad product and well documented. But since it does not support the Pico-W, you have to adapt all your network programming and route your stuff through the co-processor. I actually use a similar ESP-01S together with a normal Pico and that works very well unless you need https. So this should not hold you off.

The SB-board has one problem: it won’t support I2S (wrong routing of pins), so various audio-hats won’t work. But they don’t claim that, so this is ok. And audio from the Pico is not high-quality anyhow.

Further info…
Just had a notification of new stuff on Aliexpress including an interesting version of a Pi-Zero (non-wifi) development board using an RP2040 “engine” which includes a Micro-SD slot, mini-HDMI socket and two USB-C sockets. There’s no camera but there is lithium battery support.
It’s actually made by Waveshare and Aliexpress costs £8.55 inc and Waveshare $9.99 exc.

I would check that it can access all the memory. A previous WS RP2040 board with extra memory,16MB, did not have a ‘special’ uf2 and could only use the same amount as a Pico, 2MB.

@bablokb Hoping to get a bit of guidance as to getting started, now that I have one of the pico boards assembled, and ready to go.

A few things have me confused; I’m not real familiar with with circuitpython, but have used uPython on the ESP32, and so not totally in the dark, but definitely a little unsure.

I was going to start by testing the LED shim, and run a few examples. As I start to walk thru things, I’m confused in a couple places:

  1. I’ve installed the latest circuitpython…the uf2 file. as I understand it, the additional files from your github are also needed. I assume those are in addition to an install of circuit python? If so, does that group of folders/files simply get saved on the pico? (I’m using Thonny as my IDE).

  2. Using the led shim as an example, if I look at the example, it references the adafruit driver/library. I’m somewhat confused by just which library files I need, and a source. The adafruit library (found on github), or the pimoroni files for the led shim (also found on github).

I obviously do need to spend some time with the pico and circuit python to understand that better, especially compared to ESP32 and micropython. Any guidance you can provide regarding my two questions is appreciated.

CircuitPython is not so much different to MicroPython (it is a fork and they share a lot of code). So once you are into coding Python, you will hardly notice a difference. Where they do differ is the methods/functions to access the hardware.

As a starter, you should head on to learn.adafruit.com - they have a lot of learning guides there. The CircuitPython guide should get you going. Regarding libraries: CP has a tool called “circup” (available via pip). This tool will analyze your code and fetch and install all necessary libraries. There is probably also a learning guide for that. BTW: Pimoroni libs won’t work, they are not for CP.

One nice thing about CP is that it exposes a drive, so you can copy, edit, delete files directly on the device without any specialized editor. But Thonny is fine (I never used it but many use it for CP). So you can copy my examples directly to the drive of the device. For the led shim, e.g. copy the contents of examples/led_shim to the drive, the code.py is then in the root of the drive. Libraries go into a lib-folder on the drive. The lib-folder of my repository contains a number of libs that I ported from normal Python to CP. You could just copy the whole folder or only selected drivers (the led-shim does not use any of these, because it uses some standard Adafruit CP libs).

Having said this: You don’t need CircuitPython for my boards. They work perfect with MicroPython.The only benefit you have from CP is that I already ported a lot of drivers for the Pi-hats to CP and not to MP.

Another note: my examples are based on my version of CP. This version is basically identical, but adds the pin-mapping Pi->Pico in the board-module. E.g. you reference board.GPIO17 in your code (because the Pi-hat uses GPIO17), but internally, this is routed to board.GP5 (on the zero-board). So my version of CP is not strictly necessary if you do the mapping yourself (my repo has the mapping tables).

Thank your for that insight and guidance, that definitely helps, and should get me going. Truly appreciated!