CIRCUITPY THON
Build your own bespoke USB device
Les Pounder uses his snake charming skills again to prove how easy it is to make USB devices with Python and the cheapest of Pis.
Credit: https://circuitpython.org
OUR EXPERT
Les Pounder is associate editor at Tom’s Hardware and a freelance maker for hire. He blogs about his adventures and projects at http://bigl.es.
YOU NEED
Raspberry Pi Pico
A rotary encoder
5x M2M wires
Half breadboard
Code: https:// github.com/ lesp/LXF-Circuit Python_ Scroller/ archive / refs/heads / main.zip
Building a USB-powered interface device is hard, right? Not really. Creating USB devices with microcontrollers has been possible for years. We remember using an Arduino Micro to emulate keystrokes for an arcade cabinet build.
Over the years, it has become much easier to emulate many different USB devices, and with the Raspberry Pi Pico and a little CircuitPython code, we can fool our OS into thinking a Pico is both a mouse and a keyboard.
In this project, we will create a device that will scroll long pages using a rotary encoder. The same encoder will also be programmed to act as a push button, taking a screenshot when pressed. This project is a useful introduction to creating alternative user inputs – for example, for use by people with accessibility issues.
Too easy
This build is simple so we can focus on using the rotary encoder, rather than building a complex circuit. Typical rotary encoders have five pins. The three pins are for the encoder, the centre one being GND, while the other two register increments or decrements as we turn. The other two pins are for the push button at the base of the encoder. Pushing down on the encoder will push a button. For wiring instructions, see the high-res diagram available via the download (see URL on left).