I've made simple shortcut buttons to be used with Google Meet (componets on breadboard and the code in python):

  • one button connected to some GPIO pin that makes a keystroke (ctrl + e) for toggling the camera;
  • a second button connected to another GPIO pin that toggles the mic (ctrl + d); and
  • a led that tracks if camera is being used. If yes, led on. Otherwise, led off.

The problem

It works fine. Now I want to go further and make it a USB Device. I have been researching/studying about USB standard and how are USB devices implemented. Found about some microcontrollers that are ready for USB, like the ATmega32U2. But I don't want to get into microcontrollers/C programming at the moment. I was thinking about using my RPi 4B to act as a microcontroller.

The idea

With my prototype connected to GPIO pins as descibed above I would connect a USB cable to other GPIO pins (but only the data wires) and taking care to use resistor and any electronic components needed to prevent burning anything. Then write the software (probably python) to make the RPi "talk USB" through the cable to another computer or even RPi itself.

Is this idea possible to be done (RPi act as a microcontroller for USB device) or should I drop it and jump to microcontrollers?

Thank you!

2 Answers 2


This is a bad idea because the current requirements for a Pi4 (recommended) are 4 amps of current. Most laptops have a current limitation of around 500mA, which is 1/8th of what you need. USB Chargers that plug into a wall sockets have a current limit of upto 2 amps, and are still insufficient.

If you want to go with raspberry pi's, take a look at the pi zero, a much smaller version with lesser current requirements. A custom microcontroller is always going to be better and more efficient, but you need to know hardware development before you start designing your own.

  • Thank you for your answer. I understand that powering the RPi with USB power won't work. I will power the RPi with adequate power source. Let's focus on the USB data wires. Is it a bad idea to connect them to the RPi GPIO and make the computer recognize there is a "USB device" connected?
    – Prompt01
    Commented Dec 11, 2020 at 21:01
  • What do you mean connect GPIOs as USB Wires? The USB wires are 5V, D+, D- and Gnd. You can get 5v and Gnd from the Pi, but there is no way for you to get D+ and D-, these are differential data lines, they do not follow the usual 3.3V/Gnd voltage levels of the Raspberry Pi GPIOs. If you want to write your own kernel level drivers for bit-banging the data out, its theoretically possible, but that would be a very difficult task, and performance would be extremely poor.
    – Adi
    Commented Dec 12, 2020 at 0:42
  • Additionally and more importantly, D+ and D- need a 90 Ohm trace impedance between them to work, getting this via jumpers is not impossible.
    – Adi
    Commented Dec 12, 2020 at 0:42
  • "there is no way for you to get D+ and D-, these are differential data lines, they do not follow the usual 3.3V/Gnd voltage levels of the Raspberry Pi GPIOs." That was the kind of answer I was looking for. Thank you once more! Now I'm convinced it does not worth the trouble.
    – Prompt01
    Commented Dec 12, 2020 at 1:55

For embedded project, it is recommended to use Arduino Pro Micro! Someone has made a Zoom control box with it, so it should fit your purpose! If you have to use Raspberry Pi, you should use Pi Zero!

  • That's awesome! Exactly what I am trying to do but with less buttons. Thank you! Still, for prototyping purposes (using USB of course), is it still a bad idea to use the 4B or can it be done?
    – Prompt01
    Commented Dec 11, 2020 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.