Seems like I can't restart USB modem in Linux, so I setup an arduino gig to emulate usb modem plug/unplug.

I have Arduino Uno R3 and several N-channel mosfet https://www.sparkfun.com/products/10213, and used the setup in http://bildr.org/2012/03/rfp30n06le-arduino/ for switching the ground wire of the usb modem on/off.

This works, for a while, then the usb hub started to have problem. I think I have to really emulate USB plug/unplug, that is, cutting off both the power wire and the data wire of the usb modem.

The problem is, while the USB power has +5V and ground, the data has D+ ~+2.5V and D- ~-2.5V, they doesn't have a common ground, to be used with the setup using N-channel mosfet.

What should I do? if I buy another arduino uno just for the data wire, I still have problem, the data ground is not the same with the arduino ground (I think N-Mosfet requires a common ground), I don't know if this will cause problem.

Do I need a DC voltage step-up component? or is there other solution.

I'm thinking how usb plug works, is first connect the power wire, wait some micro seconds then connect the data wire, with unplug the opposite.

  • 4
    \$\begingroup\$ Have you thought about using good old relays? \$\endgroup\$
    – arne
    Apr 9, 2014 at 12:58
  • 1
    \$\begingroup\$ You should never open just the ground wire of a USB connection; this causes all kinds of problems, as you discovered. You should use a P-channel FET in the V_USB wire instead. \$\endgroup\$
    – Dave Tweed
    Apr 9, 2014 at 13:24
  • \$\begingroup\$ @arne is there a component you would recommend? I thought relay was to be used to switch off AC power :P \$\endgroup\$
    – fireh
    Apr 9, 2014 at 13:25
  • \$\begingroup\$ A relay is nothing more than an electromagnetically activated switch. A switch can be used for any kind of circuit (AC or DC) so long as it's rated for the voltage and current of the system. Keep in mind I would still recommend @Turbo J's answer. Use a PMOS on the USB power rail. \$\endgroup\$
    – horta
    Apr 9, 2014 at 14:52

1 Answer 1


switching the ground wire of the usb modem on/off.

Bad choice. Use a P-channel MOSFET (like IRLML6401) to switch the +5 Volt wire instead.

Cutting GND could make the data lines float near the 5 Volts power level, because there is usually some ESD protection on them. There may also be some return current on them. Both would cause malfunctions in USB hubs.

how usb plug works, is first connect the power wire, wait some micro seconds

The reason behind this is to reduce the chance of ESD damage in the data lines - the power lines are much less likely damaged by ESD. You don't need to separate the data lines (and GND) at all if you just cut the power on the 5 volt line.

  • \$\begingroup\$ For P-ch MOSFET is there other component I'd need? For example for N-ch MOSFET, I have to add pull-down resistor to the gate. I've searched local online arduino shops but they don't have P-ch MOSFET, they do have relays but not the solid state one. \$\endgroup\$
    – fireh
    Apr 9, 2014 at 23:57

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.