Raspberry Pi has a Micro USB port for power supply. My question is if this port is only for power purposes or can it be used for data as well? I would like to be able to attach my Raspberry Pi as a USB peripheral to another computer. Is this possible over a power port? If not, can this be done in another way?

  • I know this question is long closed, but one thing you could do if you really wanted to would be to program an Arduino with two serial ports to simply pass messages through. A little hackish, but you should be able to get something working that way. Commented Sep 20, 2013 at 14:00
  • The new IO board shipped with Compute Module Development Kit seems to have USB slave connector... how can one get it working?
    – Kozuch
    Commented Oct 1, 2014 at 9:39
  • The port on the Pi is only for power purposes, but via a adaptor it is possible to connect to the Pi via a serial connection to have basic access to the Pi
    – Wilf
    Commented Oct 15, 2015 at 21:22

11 Answers 11


I've had a look at the schematic; the data pins for the micro USB connection are not connected to anything. Therefore, there is no way to mount the RPi as an external device.

It could be possible to mount the RPi's hard drive or login over the network by using SSH.

The GPIO pins include a set of UART data lines, which could be used to form a serial connection to the RPi from your PC.

Bit-banging USB

Bit-banging USB has been done (AVR V-USB), however, you would need to design your own expansion board that added another USB port. It is conceivable this port could power the RPi. Having done this, you would need to write some sort of driver. Good Luck.

If you are prepared to go to all this trouble, it might be worth looking at an FTDI Chip instead. You would connect this to the UART pins of the RPi. From a software perspective, you would communicate with the computer as if it was a serial device.

  • Except maybe reimplementing USB with GPIO?
    – user13
    Commented Jun 14, 2012 at 8:21
  • 2
    There's no hope there. You can't bit-bang USB. Commented Jun 14, 2012 at 8:22
  • That diagram was what I was looking for. Nice answer.
    – Jivings
    Commented Jun 14, 2012 at 8:22
  • 1
    @Alex, Bit-banging USB has been done. A 40MHz PIC can do low-speed USB. Maybe a 700MHz ARM could do normal speed?
    – finnw
    Commented Jun 14, 2012 at 9:33
  • 3
    dicks.home.xs4all.nl/avr/usbtiny - another banged USB for 12Mhz AVR. Note that it's only possible because in microcontrollers you have full control over the clock and interrupts. You'd need to run RTLinux at the very least to get that kind of control. Also you should use SPI not GPIO to do this. Commented Jun 19, 2012 at 21:03

As the data pins of the micro USB port are not connected to the SoC's USB PHY you cannot use this port for data (in either host or slave mode).

It should be possible however to use the USB Type A port on the Model A in slave mode.

Some further details;

The Model B uses a SMSC LAN9512 USB 2.0 Hub and 10/100 Ethernet Controller IC to provide multiple physical USB host ports from the single USB OTG port available on the Broadcom SoC. (See schematic here: http://www.raspberrypi.org/wp-content/uploads/2012/04/Raspberry-Pi-Schematics-R1.0.pdf)

The presence of this hub IC prevents the USB ports from being used in slave mode. However, as the Model A does not have this IC present and instead just has a single USB port connected directly to the SoC's OTG port it should be possible to configure it to act in slave mode through software.

As the Model A has a female host USB port, a HOST to HOST conversion cable will be needed.

Please see this Raspberry Pi Forum thread for more details: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=15696


Rasberry PI A/A+/B/B+ models have OTG mode disabled by variety of reasons:

  • USB port occupied with USB hub (ethernet),
  • missing OTG 5th pin (grounded), or
  • data pins are not connected (power port).

You’d need Raspberry PI Zero for OTG or so called Gadget Mode. Data USB port can be used for OTG and “power”. As of time of this writing Serial and Ethernet were tested, but others should work with proper amount of efforts (keyboard, disk, camera, etc.) Composite devices should work as well. See more info at

The work is expected to be merged into rpy-4.4 version of kernel for OTG functionality to be available OOTB for simpler hacking.

Majority of heavylifting was conducted in Github raspberrypi/linux Issue #1212.

  • 1
    Hello and welcome. Thank you for your input. You might want to contribute here too: raspberrypi.stackexchange.com/questions/38576/…
    – Ghanima
    Commented Jan 5, 2016 at 23:08
  • @Ghanima: done ;) raspberrypi.stackexchange.com/a/40626/39346
    – myroslav
    Commented Jan 5, 2016 at 23:21
  • 1
    This answer is confused, especially since the links don't provide any supporting evidence for the claim that the power jack can be used for data. Most of them are simply about implementing OTG gadget mode in the kernel, which is now standard and can be done but not via the power jack. There is only one jack that can be used for both power and data, not two.
    – goldilocks
    Commented Oct 30, 2016 at 20:24
  • 1
    I'd corrected the answer. The fact is that data port can be used to power Raspberry PI Zero and as OTG port
    – myroslav
    Commented Nov 24, 2016 at 20:17
  • 1
    This is not entirely true: RPi A has no Ethernet and can be used as a USB slave. Commented May 19, 2017 at 12:22

The Model A will be able to use the standard gadget interface since the USB on the PI is OTG then you can just force it into device mode.

But this means you lose ethernet and any other USB


Unfortunately power supply ports do not generally work this way so you will not be able to use the micro USB port for anything other than power.

I can't currently think of a way you can use the Pi as a peripheral device, however there are several other ways you can access the Pi including SSH, FTP or samba share.

If you elaborate on what you are trying to achieve then we can advise the best method of doing it.

  • Just a hypotetical example, I would like to use Raspberry Pi as a sound card. I would of course write drivers for both ends, but I need to connect it to the PC somehow.
    – user13
    Commented Jun 14, 2012 at 8:24
  • 1
    An elegant solution for that would be to pipe audio through SSH. Of course you could also try using the GPIO!
    – Jivings
    Commented Jun 14, 2012 at 8:28

Time to provide an updated answer.

On the B, B+, 2B, 3B and 3B+ USB device mode is not possible because the USB controller on the SoC is connected to a USB Hub with Ethernet chip, not directly to a port.

On the A, A+ and 3A+ device mode is possible but the port must be forced into device mode (IIRC this is done through a device tree overlay), since there is no OTG ID pin. You will also need a USB A to A cable to make the connection.

On the zero, zero W and the 4B device mode is possible out of the box.

Device mode is also possible on the compute modules, not sure offhand if it has to be manually enabled.


A lot of work has been done since the time the question was asked. Using some Rasberry Pi models as a USB peripheral device (e.g. mass storage, serial, ethernet, keyboard, mouse) is now possible. See this gist and this guide.


Yes you can if you use some USB Peripheral Controller with SPI Interface like MAX3420E and write driver for it if it is not yet supported in Linux and handle specific USB class you want to implement.


Yes, you can use a Model A as a USB slave device:


Although it's quite limited to just usage as a mass storage device ( SD card) - no GPIO access, display or even ARM CPU usage.


Can the Pi Emulate an HID device with via USB?

This can be done with ANY kind of Pi

The least-expensive solution is to use the Pi Zero.

The text of this link is way too long to post here, but the Zero can be any kind of HID. Keyboard, mouse, flash drive, camera, whatever you can think of.

Turning your Raspberry PI Zero into a USB Gadget

enter image description here

Making it a keyboard or mouse is easy.


You could do a simple network connection from your PC to the Raspberry Pi and use Pulse Audio to transfer sound over the network. Pulse Audio is a Sound Server which offers network transparency. So you can play sound files on your PC and hear them with speakers connected to your Raspberry Pi.

Your Answer

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