Simulating cable disconnect on USB Host Shield 2.0

A MOSFET controlling VBUS

A MOSFET controlling VBUS

Today I want to show a simple USB Host Shield 2.0 modification which allows controlling power to USB peripheral. I learned this technique from Camille’s comment to one of digital camera USB control articles. In short, the idea was to cut VBUS connection between USB host and peripheral, simulating disconnect state. P-channel MOSFET, inserted into VBUS, worked as a switch. I designed this capability into USB Host Shield 2.0 but never needed the functionality therefore this useful feature was left undocumented. Recently I started working with very interesting Nikon P&S camera which can be turned on and off with VBUS power so I finally made this modification. It is very simple.

Take a look at the title picture (click on it to make it larger). The modification uses existing VBUS power select pads of the shield. Out of the box, the one labeled 5V is shorted with solder bridge. First step is to remove this bridge with a solder wick so both pads are clean.

It can be seen that a MOSFET in SOT-23 package fits nicely on those pads (I’m using FDN306P). Drain and source pins are soldered to VBUS and 5V, respectively, and gate, which hangs in the air, is routed to an unused digital pin via an 1M resistor. When digital pin is low the MOSFET conducts. When digital pin goes high the MOSFET switches off disconnecting VBUS from the peripheral.

If you are going to drive high-power peripherals, like digital cameras or phones, it is a good idea to add some capacitance to 5V. I’m using 220uF low-ESR organic polymer tantalum cap in 1210 package which fits nicely on 0.1″ spaced 5V and GND pins of the shield; an ordinary leaded 100-200uF aluminum capacitor will work as well.


16 comments to Simulating cable disconnect on USB Host Shield 2.0

  • Vik


    I am considering the use of USB Modem with the USB Host shield and I want to cut the power off to the Modem while my Micro controller sleeps. If I am not wrong, this functionality does the same. Can u please provide an elaborate picture and details of the circuits used. I want to implement and check it for my project.


    • Title picture is as elaborate as it gets. All you need is one MOSFET connected as shown with gate tied to a digital pin for control.

  • Vik

    Well I am a newbie in soldering electronic stuff thats why I wanted to very clear so that I dont mess up my board.

    Once we remove the solder from the 5V bus, we will have same two bars as shown for 3.3V. Do we need to connect source to one of them and then connect the drain to the VBUS line on the board or on the VBUS connection which is also available on an other place in the board.

    One more thing. Is the green wire coming from the digital pin and get connected to the gate ?

    I have run your descriptor code and tried to make the processor sleep. The code goes in such a way that it prints the descriptors and goes to sleep for a while. Then it wakes up and again prints the descriptors. I took out the USB host shield board while the processor was in sleep and then mounted it back. But once I mounted it back, after waking up, the processor could not print the descriptors and showed the message of error. *
    Request error. Error code: FF


    Do you have an idea why is this error appearing ?

  • Vik

    I just checked with the reset button on the USB host shield. If i click it after mounting the USB host shield, the code again starts to give the correct values.

  • Vik

    Now I checked by only removing the USB device while the processor was in sleep and it again returns the following error

    Request error. Error code: 0D

    Once I start the reset, it fixes the problem.

  • Vik

    I have been trying to understand the connections. What I have got out from the picture is that drain is soldered to one of the 3.3V pad and source is connected to one of the 5V pad. Is it correct ? I am getting confused when you mention that drain is connected to VBUS. Is drain connected to VBUS or 3V pad. Is this setting letting 3.3V operate the platform or not ?

    • Look at the Eagle files. Left sides of solder jumpers are tied together and routed to VBUS. Right sides are routed to 5V/3.3V.

  • Vik

    In order to save power, we may want to switch on the Mosfet by applying positive voltage on the gate and switch it off by using low voltage. In that configuration would I require a N type mosfet ? And what would be the connections for drain and source ?

    • N-type MOSFET can only be used to break a ground line (unless you want to generate negative voltage for the gate).

  • rod

    Is it possible to purchase this board with this modification made already?

  • markusk

    hi oleg,
    don’t tease! 😉 which is the Nikon P&S camera that can be turned on and off with VBUS power?


    • S3300 has this feature. S3100 is very similar, should have this too. It is really easy to find out – turn the camera off, plug it into live USB port, the camera should turn on.

  • Natile

    I have an issue on my camera (D90): I use your USB Host Shield rev.2.0.1 and when the camera is connected to the shield, I can no longer access to the PalyBack or to the liveView of the camera. If I click on the buttons on the camera the back screen remains black… I have tried to disconnect the VUSB PWR. If I do that, the back screen work again, but the shield is no longer able to communicate with the camera. I hope that there is a trick to disconnect this VUSB PWR and let the shield communicate whith the camera. there is several unused welding pads on the VUSB PWR track but I haven’t find any documentation on it. I there something to do with them to solve this issue?
    Thanks in advance for your help !

    • As far as I know, Nikon DSLRs shut off the LiveView screen during PTP session; you won’t be able to use it. I’m using Canon cam when I need to see LV, for focus stacking and other things.

  • Natile

    Thanks for your reply,
    obviously, the menu button or the info button on the camera light on the screen even during a ptp connexion…
    Have you any feed back on other SLR/SLT brand like Sony or Pentax ?