USB Switch?? - Connect / Disconnect Signal

Thread Starter

steelxangel

Joined May 13, 2013
2
Hi, I am trying to control the ignition and disconnect a USB device via a button.

My problem is not knowing that transistor or what? I can use it to perform, before hand thank you very much for the help, I'm new to this, Regards
 

Attachments

Last edited:

ErnieM

Joined Apr 24, 2011
8,377
Hi, I am trying to control the ignition and disconnect a USB device via a button.
Could you rephrase that? I don't get what you are trying to accomplish.

It sounds like you want to disconnect a device with a switch instead of unplugging it. Sine USB has just 4 wires inside you just need break those connections (and you could leave the ground wire connected).
 

rsfoto

Joined May 14, 2013
134
Hi,

That is exactly what I want to do also. A friend made a test already just by cutting one of the wires be it the ground or +5V but he got noise in the signal.

I was thinking in using a reed relay like the MD-12Thttp://www.sterenshopusa.com/catalog/prod.asp?f=0&sf=0&c=107&p=2343&desc=12-vdc-coil--1-pole---1-throw-spst--dip-reed-electronic-relay

but after thinking a while maybe due to the magnet inside I get also noise in the data line.

Now I am thinking of eventually using an optocoupler but do not know how to wire it. Also many optocouplers do not allow a through current maybe higher then 200mamp.

Can I drive a Transistor as switch with the optocoupler but here again I have the problem of how to wire it.

This will be used in an remote controlled astronomical observatory.

Any help is appreciated.

regards Raienr
 

kubeek

Joined Sep 20, 2005
5,794
Last year I developed a multi-port usb hub for testing gsm dongles, and the only thing that was needed was to switch the +5V line. I used some P-channel mosfet, but even a simple mechanical switch should work fine.
I am not 100% sure on what the usb specifications says, but I think that a usb device is required to do a reset on power-on and signal it's presence during some timeout. And I don't think the specs object to leaving the data lines connected.

Not sure about the ignition though, perhaps you meant something else?
 

rsfoto

Joined May 14, 2013
134
Last year I developed a multi-port usb hub for testing gsm dongles, and the only thing that was needed was to switch the +5V line. I used some P-channel mosfet, but even a simple mechanical switch should work fine.
I am not 100% sure on what the usb specifications says, but I think that a usb device is required to do a reset on power-on and signal it's presence during some timeout. And I don't think the specs object to leaving the data lines connected.

Not sure about the ignition though, perhaps you meant something else?
Hi,

Well my friend interrupted as you write the +5V cable and he was able to get signal everytime so far without the necessity to interrupt the data lines, but as said, it is a high speed usb camera, and the signal was not clean compared to a not cut cable.

A mechanical solution is not possible as nobody is in the Observatory and the switching is going to be done via a serial controlled relay card.

I have not yet tried the MD-12T reed relay switch and my assumption of introducing noise into the data line is a pure guess.

I would use a USB-A and a USB-B socket and inbetween locate the reed relay switch and the ground and data lines are just passing through.

Now the other idea is to use an Optocoupler switching a capable transistor but my main question here is now from where do I take the current for the base of the transistor ? I guess I can not take ot from the optocouplers signal current but can I take it from the USB +5V line but then I would create a short circuit in the USB power supply ¿ or am I wrong ?

I am a total ignorant in regards to electronics. I have build circuits but with the help of other eg. people and experts like here in this forum.

Any tips are welcome

regards Rainer
 
Last edited:

wayneh

Joined Sep 9, 2010
17,496
...and the signal was not clean compared to a not cut cable.
That's a problem that should be fixable. Having a break in the power line should not, by itself, introduce noise into the digital lines. I think if you are careful with shielding and so on, switching just the power line should be the easy solution.

Personally, I'd probably build a in/out box using an Altoid tin so that I could use normal cables and just add the box in between them. I'd pass-thru all conductors except +5V. On that, I'd use an N-channel MOSFET screwed to the tin for heat sinking. The box should also give you all the shielding needed to avoid noise on the data lines.

Then you just have to figure out how to control the gate of the MOSFET, to operate the switch. If your control voltage is less than 10V, be sure to choose a logic-level MOSFET that will be fully switched on at your available gate voltage.
 

wayneh

Joined Sep 9, 2010
17,496
...I am trying to control the ignition and disconnect a USB device via a button....
You mean a remote button, right? How will you get the "button is pushed" signal to your black box switch?

Oops, just now saw "the switching is going to be done via a serial controlled relay card." Does this mean you could send, say, +12V into the switch box? Perfect for driving the gate of a MOSFET switch.
 

kubeek

Joined Sep 20, 2005
5,794
IIRC the usb specification requires a drop of no more than 0.5V and max 500mA of current, so you should be ok even without screwing the mosfet to something else.
 

wayneh

Joined Sep 9, 2010
17,496
Only 500mA? I thought some devices (like a charging Blackberry or iPhone) could draw more than that.

But yeah, as long as the gate voltage is good, heat shouldn't be an issue with almost any power MOSFET you could find. Just seems like a good idea to screw it down anyway. ;) I'm thinking TO-220 package, with the tab and hole.
 

Thread Starter

steelxangel

Joined May 13, 2013
2
Hello, my problem is with usb device connected to the pc, it "fails" to turn on the pc, and reconnecting the device is solved, I think using two relay TDS-1202L (steren) to momentarily cutting the circuit would solve my problem because "simulate" the reconnection, or at least I hope, Greetings

sorry for the grammar, I'm using a translator ...
 

kubeek

Joined Sep 20, 2005
5,794
You mean the device fails to enumerate and reconnecting the device to the pc solves the problem?
Anyway you should need only one relay or transistor to switch the +5V line.

wayneh: those are amendements to the specification, and AFAIK a PC port can only deliver 500mA, and a charger with special arrangement on the data pins can signal that it can do 1000mA.
 

rsfoto

Joined May 14, 2013
134
That's a problem that should be fixable. Having a break in the power line should not, by itself, introduce noise into the digital lines. I think if you are careful with shielding and so on, switching just the power line should be the easy solution.

Personally, I'd probably build a in/out box using an Altoid tin so that I could use normal cables and just add the box in between them. I'd pass-thru all conductors except +5V. On that, I'd use an N-channel MOSFET screwed to the tin for heat sinking. The box should also give you all the shielding needed to avoid noise on the data lines.

Then you just have to figure out how to control the gate of the MOSFET, to operate the switch. If your control voltage is less than 10V, be sure to choose a logic-level MOSFET that will be fully switched on at your available gate voltage.
Hi Wayneh,

If I understood correctly I can then just use a MOSFET and apply +12V to the gate and my USB power is flowing ¿ right ? In order to disconnect the MOSFET I just use a pulldown resistor to the ground of my switching power circuit. ¿ correct ? Was just watching some videos in YouTube about how to switch MOSFETs :D

Yes I am going to use 12V for the relay card and so I can use only one power source in order to switch the gate of the MOSFET eg. the interrupted 5v line os the USB cable.

Thanks also for the shielding tip. I thing that was the problem he had.

When I have time I will make a test on a breadboard.

Appreciate your answer a lot. Makes the whole enchilada easier I guess :D

regards Rainer
 
Last edited:

rsfoto

Joined May 14, 2013
134
Hi,

Well I was thinking about how to switch the gate and come up with another problem.

I can not use the same ground. One ground comes out of the PC and the other ground comes from the 12V power source which I use for the relay card.

So far as I know I can not join the different 2 grounds into one ¿ due to ground loop issues ?

I have seen that in most switching examples the ground for the consumer and the MOSFET is the same in the circuit

¿ Do I miss something here or do I not fully understand how MOSFET do work ?

Sorry if it sounds stupid ...

Will investigate further ...

Added a few minutes later.

If your control voltage is less than 10V, be sure to choose a logic-level MOSFET that will be fully switched on at your available gate voltage.
Could I use the same +5V from the USB line to switch it using a Logic level MOSFET as you wrote ? Using a high KOhm pull down resistor ? And this line I switch with an optocoupler ?

Thanks and regards Rainer
 
Last edited:

rsfoto

Joined May 14, 2013
134
Hi,

First of all Apologies to Steelxangel for having highjacked his thread Sorry

Also sorry to the others to be a PITA but could this be a correct circuit for switching the power to the USB cameras or be it any USB hardware ?

Thanks again and regards Rainer
 

Attachments

Last edited:

wayneh

Joined Sep 9, 2010
17,496
I can not use the same ground. One ground comes out of the PC and the other ground comes from the 12V power source which I use for the relay card.

So far as I know I can not join the different 2 grounds into one ¿ due to ground loop issues ?
I was going to warn you about this. It may or may not be a problem. When I connect two "grounds", I first check for a voltage difference. Then I use a 200Ω resistor and look for voltage drop across it. Anyway I believe you'll need "ground" to be defined by USB power ground.
Could I use the same +5V from the USB line to switch it using a Logic level MOSFET as you wrote ? Using a high KOhm pull down resistor ?
Sounds fine, yes. I see no need for the optocoupler unless you cannot solve the ground problem.
 

rsfoto

Joined May 14, 2013
134
Hi,

Thanks everybody. Really a great posting and my mind is getting clearer about how to switch remotely the +5V line of the USB cable.

Again, thanks a lot to everybody for this great help.

regards Rainer
 
Last edited:

kubeek

Joined Sep 20, 2005
5,794
I am not sure what you mean. Only usb host is allowed to put voltage on the +5V line, a usb device is allowed to use it as power supply but should not be putting any voltage by itself.
No idea what you mean with short and long lines..
The mosfet in the picture I posted is interrupting the +5V line, with the host on the left side and the device on the right side.
 
Top