Category Archives: Raspberry Pi

First look: Pimoroni’s PicoSystem hackable handheld games console

I’ve had my eye on the PicoSystem, the Raspberry Pi RP2040-based games console platform, for some time. It surfaced back in the Spring and was long marked “coming soon”. But now it’s here, mine showed up yesterday while I was at work, and this morning I’ve been messing about with it.

PSP = PicoSystem by Pimoroni

My interest in this gadget was piqued back when I was thinking about how to port Phantom Slayer to the RP2040. It seemed like an ideal platform for my new-hardware take on a 1982 3D shooter that I’ve loved since first playing it on my Dragon 32. In the end, I had to build the game out of a Raspberry Pi Pico and a monochrome OLED I had in my spares box.

What most appeals about the PicoSystem — I must stop typing ‘PicoStation’ every time… — is that nice 1.5-inch, 240 x 240 IPS LCD that does 16-bit colour, and a proper button layout that’s hard to achieve with a bag of switches and a solderless breadboard. It’s all wrapped in an aluminium casing that packs in a 3.7V, 525mAh rechargeable battery, a USB-C port for charging and program transfer, and a piezo speaker.

Remove the four screws for a peek inside

So just a nicely tooled Pico add-on then? No, it’s more than that. The RP2040 microcontroller is built in, so you don’t even have buy and fit a Pico. However, there are four large screws on the back so it’s dead easy to get inside, and you might very well want to do just that.

Within resides the aforementioned battery, the RP2040 and a generous 16GB of external Flash, all on a neatly labelled circuitboard. But the real reason to crack open the casing is that Pimoroni has left the RP2040’s SWD (Serial Wire Debug) points exposed, so you can, with care, remove the face plate too — undo two more, smaller screws — and solder on a header so you can do real-time debugging during development.

A very neatly laid out circuitboard

Being equipped with an RP2040, the PicoSystem has native UF2 support, so transferring compiled code is just a matter of holding down the X button, the power key and slotting in a computer-connected USB-C cable. “Just” a matter? It’s harder than it sounds. You need two hands: one to hold down the buttons — guitar chord fashion — and the older to fit the cable. Too awkward for me, I think, which is why I shall certainly go down the SWD route.

Alongisde the hardware, there’s a decent C++ SDK which has been designed to do most of the work for you. You write your game around a trio of pre-defined functions. There are the equivalents of Arduino’s start() and loop(), init() and update(), and these are joined by a third structural function, draw(). It’s not hard to guess what each is for, and I’ll be using them to remake Phantom Slayer in colour.

Accessible SWD header! Hurrah!

The update() is called with a fixed 10ms periodicity, but that’s applied as a variable in the source code so it can be changed if you need trigger the function less frequently. It’d be nice if it was a CMakeLists.txt setting.

The draw() function is called as often as the system can call it: up to but not further than 60fs, apparently, or every 16ms. Blitting a full 57,600 pixels (112.5KB at two bytes per pixel) to the ST7789 TFT display takes 12ms, so you’re going to have to consider timing if you’re writing anything but a simple game. Fortunately, there’s a pixel double mode — for an effective resolution of 120 x 120 — if you need to reduce the time your game spends drawing and blitting the picture.

T’other side of the board: the display, controls and battery charge LED

By default the RP2040 is overclocked to 250MHz. The SDK doesn’t appear to take advantage of the MCU’s second core, so there’s an extra resource you can make use of.

You don’t interact with the peripherals directly: the SDK abstracts all of that away for you, which will make it easier to port code when the PicoSystem 2 eventually launches as it inevitably will. The SDK uses the RP2040‘s Programmable IO to squirt the contents of its graphics buffer down to the display.

Right, that’s the platform — now it’s time to start porting my Phantom Slayer C over to the PicoStation SDK. When it’s done I’ll post an update on how it went, and share the code in my GitHub repo.

The PicoSystem costs £58.50 from Pimoroni and other suppliers. The SDK is available on GitHub.

How to build a cellular IoT device with the Raspberry Pi Pico — part two, the code

In part one, I described an IoT demo setup based on the Raspberry Pi Pico and the Waveshare Pico SIM7080G Cat-M1/NB-IoT cellular add-on board, and wrote about some of the design goals. Now it’s time to implement that design with some C++ code: a host application, drivers for the modem, the HT16K3-based display and the MCP9808 temperature sensor, and some third-party libraries to decode incoming commands formatted as JSON and encoded in base64 for easy SMS transmission.

Pico + Waveshare cellular module = compact IoT development board
Continue reading

How to build a cellular IoT device with the Raspberry Pi Pico — part one, the hardware

To turn the Raspberry Pi Pico into an Internet of Things (IoT) device, you need to add wireless connectivity. I thought I’d give it go, to see how straightforward it might be to connect the Pico to cellular networks and have a bare-metal app written in C++ run the show. For a modem, I chose to use Waveshare’s suitably sized Pico SIM7080G Cat-M1/NB-IoT.

Raspberry Pi Pico piggybacking on the Waveshare cellular board
Continue reading

How to pop up a Picoprobe from the Adafruit QT Py RP2040

A little while back I wrote about Adafruit’s QT Py RP2040 and how it makes a nice, compact Picoprobe. That’s a Raspberry Pi RP2040-based device used as a bridge between your computer and a target device for debugging work using Single Wire Debug (SWD). I first used the QT Py RP2040’s side-mounted GPIO pins, but SWD hosting is a great role for the device’s QT Stemma connector.

QT Py Rp2040 with its SWD-ready QT Stemma connector in black and RGB LED marked NEO
Continue reading

Raspberry Pi Pico proxies: the Pimoroni Tiny 2040 and the Adafruit QT Py RP2040

Having spent some time with the Raspberry Pi Pico, I thought it was time to try out some of the other RP2040-based development boards that have become available. When it launched the Pico, the Raspberry Pi Foundation said it would make its RP2040 microcontroller available to third-party board makers. Retailers Pimoroni and Adafruit were among the first to toss their caps into the ring. Their offerings: respectively, the Tiny 2040 and the QT Py RP2040.

RP2040 boards: Pico (L), Tiny 2040 (TR) and QT Py RP2040 (BR)
Continue reading

Stay ahead of git with this sharp script

I work on quite a few git repositories at once, and I don’t always commit changes in one before making changes to another. Or if I do, I don’t always push the changes up straight away. That might not be best practice in software development, but hey, it’s what I do. The issue for me is remembering what state each repo is in. Here’s the script I use to tell me.

Continue reading

Introducing C++ programming on the Raspberry Pi Pico

When I started programming the Raspberry Pi Pico, I used the C language because I’ve worked with it before. The Pico’s SDK also supports C++, but I’ve never used C++. When I started Mac programming in the early 1990s, C was the clear choice. By the time I needed to do object-oriented programming, Apple had bought NeXT and the way to do OOP on macOS was Objective-C not C++. The Pico has given me chance to join the party.

Continue reading

How to use zmv — Z Shell’s super-smart file renamer

I’d like to introduce you — if you’re not already acquainted — to the Z Shell’s incredibly handy function zmv. If you ever need to change at the command line the names of a batch of files consistently, it’s the tool you’ll want to turn to first. It’s not well known, and having been given the nod by a colleague, I thought I’d explore and pass on some notes about taking advantage of it.

Continue reading