Configure a Raspberry Pi as a USB Device

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • il-magic-scanner

    Writeup of the build of a prototype phone scanner

  • Going to toot my own horn a little bit here. I used this capability on this work project: https://github.com/nhsx/il-magic-scanner (long story short: use a pi camera to read ID info off a phone screen, then pretend to be a keyboard and "type" it into an attached computer). There's a spun-off standalone daemon at https://github.com/nhsx/il-keebd which handles the "pretend to be a keyboard" bit. It listens on a local socket for text, converts it to scancodes, and squirts them up to the usb host.

    The keymap isn't complete by any means, but it's got enough there to be interesting.

  • il-keebd

    USB-OTG keyboard daemon for raspberry pi

  • Going to toot my own horn a little bit here. I used this capability on this work project: https://github.com/nhsx/il-magic-scanner (long story short: use a pi camera to read ID info off a phone screen, then pretend to be a keyboard and "type" it into an attached computer). There's a spun-off standalone daemon at https://github.com/nhsx/il-keebd which handles the "pretend to be a keyboard" bit. It listens on a local socket for text, converts it to scancodes, and squirts them up to the usb host.

    The keymap isn't complete by any means, but it's got enough there to be interesting.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • voicetunes

    Offline voice-controlled music player for Raspberry Pi

  • Here’s the solution I built for that, with a combination of on-device voice control, and a Bluetooth remote: https://github.com/lukifer/voicetunes

    Something I’d still like to add is a USB OTG emulation of iOS/Android/iPod/etc, so that the currently playing track shows on the dash, steering wheel controls can be used, etc, but my last experimentation a couple years ago didn’t go anywhere. (All the open source stuff for emulating CarPlay and Android Auto seem to be for the other direction: the dash, not the device.)

  • composite-joystick

    Use a Raspberry Pi in gadget mode to combine several josyticks into one

  • I've done this, it's super useful. The use case for me was that I wanted to simultaneously use two joysticks with the same game, mixing their inputs together instead of just using one or the other for each axis. The behavior only ended up being possible by writing a "joystick mux" program that would accept input from multiple joysticks and then retransmit it as a gadget-mode device.

    Side note, USB HID descriptors are a disaster and someone should do something about it. Even commercial devices by reputable manufacturers have broken descriptors. A tool with modern ergo and integration would probably get a surprising amount of traction.

    https://github.com/saulrh/composite-joystick

  • ipod-gadget

    iPod usb gadget for audio playback. Client app: https://github.com/oandrew/ipod

  • Check this out: https://github.com/oandrew/ipod-gadget

    It's a USB gadget kernel module that pretends to be an iPod to stream music to car/etc.

  • arduino-esp32

    Arduino core for the ESP32

  • I would also take a look at esp32 and possibly raspberry pi pico W as well.

    For the esp32 there is this official example of what I think is faking a usb drive: https://github.com/espressif/arduino-esp32/blob/master/libra...

    Not all ESP32s support USB OTG and I don’t have the correct one here atm to test with. Not sure how much more work would be needed to serve files from sd card.

    You could then use a web server on the esp32 to transfer your files

  • teslausb

    A smart USB drive for Tesla Dashcam - extended storage, auto archive, web viewer

  • I use this for my Teslas Dashcam (it was built for it), but it also has a feature to rsync music files from a network share every time it connects to the network. Sounds like it would cover what you want, and it supports RPI Zero Ws natively.

    https://github.com/marcone/teslausb

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts