Skip to content

Tech news and reviews, on air and online

Uncategorized

I built Pico-Pal, a Pocket Pet that goes on holiday

PicoPal by Matt Porter
PicoPal by Matt Porter

I started with a Raspberry Pi Pico and one of those little red Nokia 5110 screens. A few iterations later, I had a pocket pet that could go to the seaside, send me a postcard and come home saying SPLOO. Somewhere along the way, I also had to work out what to do when somebody else’s pet got stuck at my house.

This is Pico-Pal, a little hardware and software project I’ve been working on. It’s a virtual pet with a colour screen, Wi-Fi and one Cherry MX key. You can feed it, play with it and teach it to speak. You can also send it to a disco. Whether it comes back ready for bed is its problem. Whether it comes back at all turned out to be mine.

From a Nokia screen to a colour pocket pet

My original shopping list included three buttons, a battery and sensors for light, tilt and head pats. I could already imagine playing peek-a-boo with it. Then I looked at what I actually needed to get a pet on the screen and cut the first build down to one key, a piezo buzzer and USB power.

Before I picked up the soldering iron, I built the game in a software emulator. That decision paid off. The same game now runs in the emulator, on the handheld, in an Android app and in a browser, and pets can travel between them.

The Raspberry Pi Pico W worked, but I moved to the postage-stamp-sized ESP32-C3 Super Mini and a 1.54-inch, 240 × 240 ST7789 colour display. Colour gave the pet a face with expressions and gave its world things like weather. I still have a soft spot for the Nokia display, so there’s a line in the firmware that switches the driver back to it.

The PicoPal by The Gadget Man
The PicoPal by The Gadget Man

The first handheld

The first board is a piece of stripboard about 30 × 51 mm, with the display above the ESP32. I breadboarded the circuit first so I could check the wiring before committing it to solder. The screen plugs into an eight-pin header, and the piezo has a 220 Ω resistor in series.

Part What it does
ESP32-C3 Super Mini The brains, with Wi-Fi and USB-C
1.54-inch ST7789 TFT, 240 × 240 (TZT module) The screen, plugged into an 8-pin socket
8-pin female header Lets the screen unplug from the board
Cherry MX switch and keycap The one and only control
Piezo buzzer Chirps, tunes and Pipspeak
220 Ω resistor In series with the piezo
Stripboard and insulated wire Holds it all together
Signal C3 pin
Screen clock (SCL) GPIO 4
Screen data (SDA) GPIO 3
Screen reset (RES) GPIO 2
Screen data/command (DC) GPIO 1
Screen chip select (CS) GPIO 0
Screen backlight (BLK) GPIO 10, high = on
Key, to ground GPIO 9
Piezo, via 220 Ω GPIO 5

The board is 12 strips by 20 rows. I cut eight tracks along row 7 and checked the cuts with a meter before soldering in the C3. Holding the Cherry MX key as I plug the device in puts it in upload mode, because the switch shares GPIO 9 with the C3’s BOOT button. An early layout included a 100 µF capacitor to smooth the power during Wi-Fi activity. The USB-powered prototype worked without it, so I left the pads free.

Stripboard layout: component side on the left, copper side with track cuts on the right
Stripboard layout: component side on the left, copper side with track cuts on the right

The two-part case is 3D-printed and measures about 38 × 87 × 24 mm. I designed it in Python with manifold3d, which let me adjust the measurements in one place. The key clips into a 14 mm square opening in a 1.5 mm plate. The buzzer sits behind a grille, USB-C comes out of the side, and four tabs on the back plate hold the stripboard in place. A quick print of just the front face let me check the screen and key openings against the actual parts before printing the whole case.

What can you do with one key?

Tap to move through the menu and hold to choose. Hold the key on an empty nest and an egg appears. Once it hatches, you can feed your pet, play Catch, or try Echo, where it chirps out a rhythm and you have to copy it. Each pet gets its own name, colour and personality, and tracks food, energy, friends and play. Leave it hungry or lonely and its affection starts to slide.

The chirps are part of its language, Pipspeak. It starts as a Hatchling, moves through Pidgin and eventually becomes Fluent, complete with a crest. It picks up words from you and from its travels. A seaside trip might bring back SPLOO for wave and GULLA for seagull. You may also get a postcard saying “A GULL ATE MY CHIP”, which seems a fair summary of a British seaside holiday.

Pets can visit friends, decide they get on well enough to move in together and, with a bit of luck, find an egg. They can holiday at the seaside, in the mountains or in the city. Some evenings there’s an invitation to a disco, where they learn BOOGA and come home tired and happy. You can call them home early from a holiday.

Where Pico-Pals go when they leave home

I built the Resort as a single PHP file with an SQLite database on my own hosting. It works like a postbox. Each Pico-Pal checks in, drops off messages and collects anything waiting for it. Two devices can be in different countries and switch on at different times. Messages are signed with a key unique to each device, and the Resort holds incoming mail until the recipient confirms it arrived. You can also open the Resort in a browser to see who’s away and when the next party is.

Moving a pet took more thought. The home device offers it, the destination confirms there’s room and that it has received the pet data, and then the home device commits the move. Only then does the pet appear at the other end. If a connection drops, either side can check the transfer state before carrying on. The Resort uses the same handover for holidays.

The handheld has its own Wi-Fi setup network for entering your home Wi-Fi details and adding friends by code. Pet data is stored in flash, so unplugging the handheld doesn’t wipe its progress. The Android and browser versions check in with the same Resort, so friends can join in without having to solder anything.  

The pet that wouldn’t come home

I had two handhelds, two pets called KILU and BOBMIM, and a visitor called MIMFE. MIMFE went to see KILU and didn’t come back. One issue was guest Wi-Fi isolation, which was getting in the way of reaching the boards locally. Separately, KILU’s board could barely hear the router at around −90 dBm. The serial scan command made that visible, and I got the prototype working again by increasing transmit power and adding a short wire to its aerial.

While the Resort was unreachable, KILU kept putting the same offer to send MIMFE home back in the queue. Eventually there were enough copies to fill the available memory and send it into a reboot loop. I changed the queue to keep one copy of each repeated message. BOBMIM later ran short of memory while receiving one pet and sending another, so I made the queued messages more compact, sent pet data straight from storage and added free-memory logging over serial.

The colour screen had already taught me a similar lesson. One full frame needs around 115 KB, which is a fair chunk of the C3’s roughly 400 KB of RAM before Wi-Fi and a secure connection get involved. Drawing the display in two halves brought the buffer down to around 57 KB. The firmware is a single Arduino C++ sketch with no extra libraries. I use Espressif’s 3.x boards package, select ESP32C3 Dev Module, enable USB CDC On Boot and choose Huge APP to fit the roughly 1.4 MB compiled sketch.

Version two gets its own circuit board

The next version is a 34 × 85 mm two-layer PCB that I’ve designed in KiCad for fabrication and assembly by JLCPCB. It uses an ESP32-C3-MINI-1 module, with the aerial at the edge of the board and copper kept clear around it. There’s a 600 mAh LiPo with USB-C charging, a hot-swap Cherry MX socket and a surface-mount buzzer switched by a transistor. The firmware will be able to read the battery voltage and tell when USB is plugged in.

Part Version 1 Version 2
Brains ESP32-C3 Super Mini board ESP32-C3-MINI-1 module, soldered to the board
Aerial Tiny chip aerial (plus my wire) The module’s proper aerial, at the board edge with no copper near it
Power USB only 600 mAh LiPo (503040) with USB-C charging
Key Cherry MX switch, wired Cherry MX in a hot-swap socket, so switches change without soldering
Sound Piezo disc MLT-8530 surface-mount buzzer, louder at 3.3 V
Screen Plugged into a socket Soldered straight onto the board
Extras   Power switch, reset button, red charging light, battery level sensing
Case 38 × 87 × 24 mm 39 × 90 × 17.7 mm
The routed version 2 board: front on the left, back (mirrored) on the right. The white area at the bottom right of the front is the aerial's copper-free zone.
The routed version 2 board: front on the left, back (mirrored) on the right. The white area at the bottom right of the front is the aerial’s copper-free zone.

I used scripts to keep the board, case and parts list working from the same measurements, then used Freerouting to lay the tracks. The KiCad design-rule check is clean. I’ve also been through the JLCPCB placement preview, where it’s worth checking the rotation of every part. The Kailh socket was out of stock, so that and the screen are on my list to solder by hand.

Signal GPIO
Screen SCL, SDA, RES 4, 3, 2
Screen DC, CS, backlight 6, 7, 10
Key (pulled up) 9
Buzzer 5
Battery voltage (halved) 0
USB connected 1
USB data 18, 19
Serial RX, TX 20, 21

The new case is 39 × 90 × 17.7 mm, about 6 mm thinner than the original, with rounded edges and a recess that makes the key easy to find with your thumb. There’s a proper power switch at the top and a pinhole in the back for reset.

A render of the refined version 2 case
A render of the refined version 2 case

What’s next for Pico-Pal?

The game, the Resort and the first two handhelds are working. The next job is to order and build the new boards, fit the battery and screen, print the new case and update the firmware for the new pin layout and battery display. Then I’ll get friends and family trying the handheld and the Android app.

I still rather like the idea of giving it a pat on the head. That can wait until I’ve got the battery working.

You can see the project at picopal.uk. There’s nothing to buy just yet.

Having fun with friends at the Disco. Every night at 7pm
Having fun with friends at the Disco. Every night at 7pm

Discover more from The Gadget Man | AI & Tech News and Reviews | Matt Porter

Subscribe to get the latest posts sent to your email.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.