Picoth two-factor authentication device
By Rosemary Hattersley. Posted
With a self-described “young and curious mind”, maker Angainor is a veteran of Raspberry Pi projects ranging from routers and home automation to retro gaming and time-lapse photography. There are “so many projects out there, you just want to buy 50 Raspberry Pi [boards] and build them all,” he enthuses. Rattling off his list of previous builds, he declares, “I’m bound to have forgotten some of them.” When Raspberry Pi announced Pico, its new microcontroller, he knew the time had come to create Picoth, a tiny security device he’d use all the time.
Advertisement
Head to head: Raspberry Pi + Raspberry Pi Zero + Raspberry Pi Pico.
Simple security
Picoth is a “small USB keypad with RGB buttons and a nice colour TFT screen. Just plug it in and you get a powerful authentication assistant that will type in your 2FA (two-factor authentication) codes for you. You can store up to ten codes per page, with any number of pages you need,” making it ideal for online banking, GitHub, Twitter, and messaging platforms. Rather than having to unlock the phone, open the authenticator app, scroll to find the code, then type it in within a few seconds, Angainor says Picoth is set up with one touch to display the code with its label and one touch to auto-type it. Furthermore, the screen displays the remaining time, since 2FA codes change every 30 seconds.

“This first goal of the project was to have something I feel the need for every single day: a small and trustable device that can keep my various 2FA authentications safe and always at hand,” says Angainor of why he created Picoth. Raspberry Pi Pico “handles the hardware – a 4×4 matrix keypad and its 16 RGB LEDs, the 240×135 TFT colour screen, and a clock module – as well as all the software: code generation, USB_HID emulation, and animations”.
With experience using Python on other microcontrollers, Angainor jumped at the chance to do the same with a Raspberry Pi one. “I just love Python’s expressiveness and compactness, and it’s so seamless to prototype with.” He likes Pico because it boots in a couple of seconds, is very affordable, and hardware vendors had extensions and packs available as soon as Pico went on sale. He chose Pimoroni’s “intelligent” multifunction Keypad Base, having tried to create a similar device using the firm’s Keybow.
Tricky code words
For Picoth, he says the “fun thing was parsing the official documents to check the flexible GPIO features, and what pins could be routed to I2C and SPI ports.” Having connected Pico to the display and keypad, he set about coding using MicroPython and Pimoroni libraries. He compiled everything himself as the Pimoroni firmware lacked the SHA-256 and SHA-1 he needed, editing the display library code since the pins were hard-coded. He got his device to work but hit a snag (see magpi.cc/harshdecision) relating to the USB input devices. It meant the device couldn’t type the code itself. “While usable, this was a serious drawback” and prompted a move to CircuitPython which is slower but has built-in USB-HID support.

The change meant “significant changes and added constraints” to his plans. Getting the keypad and display to work together was perhaps the biggest hurdle in the project but, as ever, the Raspberry Pi community came up trumps: “an awesome library by Sandy Macdonald, targeting a keybow2040, that was a perfect fit for the keypad,” says Angainor. He also notes that Raspberry Pi and Python’s ecosystems were what made the project possible at all, turning things into a matter of deciding how to assemble the parts. “There were some hacks needed because some items were not to be used that way, but that’s part of the fun.”
Rosie has worked for consumer tech titles such as PC Advisor, Computeractive, CNET and Macworld and written For Dummies books on using iPads, Androids and tablets
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles
Raspberry Pi vs Raspberry Pi Zero 2 vs Raspberry Pi Pico in Raspberry Pi Official Magazine 159
Without an operating system, any computer – including your Raspberry Pi – is just a dumb lump of sand. Put Raspberry Pi OS on it however, and you’ve got yourself a working system that can handle games, web browsers, emails, programming and everything else we bang on about here all day every day. The latest […]
Read more →
Win one of ten M.2 HAT+ Compact
The ability to connect NVME SSD drives to Raspberry Pi 5 is very cool, although it does slightly limit the cases you can use. With the M.2 HAT+ Compact, you can even fit an SSD-powered Raspberry Pi into the official case – and we have ten to give away below. Win one of ten M.2 […]
Read more →
Raspberry Pi 500+ in Raspberry Pi Official Magazine issue 158
We’re quite taken with Raspberry Pi 500+. But when you don’t need all that processing power, and just want a board that will make a plastic skeleton jump around in a terrifying manner, you’ll find Raspberry Pi Pico more than up to the job. There’s more terror in the magazine (which is only right as […]
Read more →
Sign up to the newsletter
Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.