Try GOLD - Free
Build your own bespoke USB device
Linux Format
|January 2023
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.

YOU NEED
- 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).
CircuitPython
CircuitPython is a great alternative to MicroPython on the Raspberry Pi Pico (and soon to be on the Pico W). It has a similar syntax but code is written to a single file,
This story is from the January 2023 edition of Linux Format.
Subscribe to Magzter GOLD to access thousands of curated premium stories, and 9,500+ magazines and newspapers.
Already a subscriber? Sign In
MORE STORIES FROM Linux Format

Linux Format
Create your first WebSocket service
Mihalis Tsoukalos explains how to use the Go programming language to work with the WebSocket protocol.
9 mins
April 2023

Linux Format
Fantastic Mr Firefox
Nick Peers takes a trip down memory lane to reveal the story behind the rise - and slight fall - of Mozilla's popular web browser.
9 mins
April 2023

Linux Format
Set up your terminal and email like it's 1983
Jump in the hot terminal time machine with Mats Tage Axelsson who emails from the command line using the latest technology.
8 mins
April 2023

Linux Format
Universal layer text effects with GIMP
Posters use them, films and presentations are hard to imagine without them: text effects. Attract attention with Karsten Günther and GIMP.
8 mins
April 2023

Linux Format
Jump to a federated social network
Nick Peers reveals how you can get up and running with this free, decentralised and non-profit alternative to Twitter.
9 mins
April 2023

Linux Format
Free our SOFTWARE!
Taking anything for granted is dangerous, so Jonni Bidwell and Mike Saunders revisit how the free software movement got started to help free us from proprietary tyranny!
4 mins
April 2023

Linux Format
Master RPI.GPIO
Les Pounder goes back to the early days of the Raspberry Pi - and his career with this classic library! -
5 mins
April 2023

Linux Format
Waveshare Zero to Pi3
Transform your Pi Zero into a Pi 3, they promised Les Pounder, but it's more like adding on go-faster stripes.
2 mins
April 2023

Linux Format
The Best OPEN SOURCE Software Ever!
In an attempt to trigger controversy, Michael Reed and Neil Mohr unequivocally state these are the greatest free software apps ever. Probably. We’re just trying to be helpful.
19 mins
April 2023

Linux Format
Linux-Mandrake 7
Simplicity and a wide range of applications make this a great distribution for all Linux users.
2 mins
April 2023
Translate
Change font size