How can I use Raspberry Pi 3 as a USB gadget. Is there any way?

How can I enable the USB gadget mode on Raspberry Pi?

  • 1
    What do you mean by USB gadget? Do you wan't it to act as a slave device like USB flash drive?
    – Mark
    Commented Aug 24, 2017 at 8:59
  • It might be possible, but I don't know of any exact way to do it. What is it you want to achieve? What kind of device do you want the Pi to behave like? The Raspberry Pi Zero is probably easier to get to work as a gadget since it has the right kind of connection, but the real question is what you want it to do, and what you want to send back and forth between the gadget and the host.
    – Bex
    Commented Aug 24, 2017 at 11:52
  • 1
    @Mark "gadget" is linux slang for whatever device has the b-type USB connection.
    – Bex
    Commented Aug 24, 2017 at 11:54
  • Here i found this wonderful tutorial isticktoit.net/?p=1383 You just need to follow it for the type of gadget you need which you did not specify.
    – user64112
    Commented Aug 25, 2017 at 11:44
  • 4
    Possible duplicate of Is there a way to make a RP3-B act as a USB gadget/periferal? Commented Nov 5, 2017 at 2:06

1 Answer 1


You cannot use the Raspberry Pi 3 as a USB gadget. At the time of writing this is only possible on the Raspberry Pi 0, 0W, A, A+, and 4. The Pi B, B+, 2, 3, 3A+, and 3B+ lack the required pin for OTG.

If you have a Pi Zero, this gist has some examples that work with minimal configuration like g_serial, g_ether, or g_multi. For example, a minimal way to enable the serial gadget is to add dtoverlay=dwc2 to /boot/config.txt and g_serial to /etc/modules

lukas2005's original answer linked to iSticktoit.net's examples of using the more modern ConfigFS approach. The keyboard HID example is a good one to start with. And when you have only one functional micro-USB port, it becomes particularly valuable to configure multiple gadgets at a time, something that is not as readily available with the old g_* kernel modules.

  • 1
    About lukas2005's answer: it may have gotten downvoted because the provided link is about the RPi zero (and variants) while the OP asks about RPi 3 (I didn't downvote, and the link is very useful indeed).
    – calocedrus
    Commented Jan 24, 2018 at 1:55
  • Can you tell how to do USB 3.0 gadget on RPi 4?
    – Kozuch
    Commented Sep 6, 2019 at 1:12
  • @Kozuch are you having trouble with setting up a gadget on the Pi 4 in the first place? Here is one of the simplest tutorials. Or you mean you're not getting USB 3.0 transfer speeds (which would warrant opening a new question)?
    – jdonald
    Commented Sep 6, 2019 at 15:31
  • I have not tried anything yet, just asking whether it is possible to do USB 3.0 OTG. It surely is not via the USB-C connector on Pi 4 since according to schematics it only connects to USB 2.0 lanes. So can you tell about USB 3.0 - is it possible via the Type-A connectors? Probably not?
    – Kozuch
    Commented Sep 6, 2019 at 16:15
  • 1
    I asked a new question here: raspberrypi.stackexchange.com/questions/102294/…
    – Kozuch
    Commented Sep 6, 2019 at 16:24

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.