USB Switch?? - Connect / Disconnect Signal

Discussion in 'The Projects Forum' started by steelxangel, May 13, 2013.

  1. steelxangel

    Thread Starter New Member

    May 13, 2013
    2
    0
    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
     
    Last edited: May 14, 2013
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    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).
     
  3. rsfoto

    Member

    May 14, 2013
    134
    1
    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
     
  4. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    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?
     
  5. rsfoto

    Member

    May 14, 2013
    134
    1
    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: May 14, 2013
  6. wayneh

    Expert

    Sep 9, 2010
    12,100
    3,034
    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.
     
  7. wayneh

    Expert

    Sep 9, 2010
    12,100
    3,034
    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.
     
  8. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    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.
     
  9. wayneh

    Expert

    Sep 9, 2010
    12,100
    3,034
    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.
     
  10. steelxangel

    Thread Starter New Member

    May 13, 2013
    2
    0
    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 ...
     
  11. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    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.
     
  12. rsfoto

    Member

    May 14, 2013
    134
    1
    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: May 14, 2013
  13. rsfoto

    Member

    May 14, 2013
    134
    1
    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.

    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: May 14, 2013
  14. rsfoto

    Member

    May 14, 2013
    134
    1
    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
     
    Last edited: May 14, 2013
  15. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    You need a P-channel logic-level mosfet to switch it, like IRLML6402 for example.
     
    rsfoto likes this.
  16. rsfoto

    Member

    May 14, 2013
    134
    1
    Hi,

    Thanks a lot. I do not find the IRLML6402 in Mexico. Could an APM3095P also be used ?

    http://www.agspecinfo.com/pdfs/A/APM3095P.PDF

    Thanks :)
     
  17. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Yes that one will work too.
     
    rsfoto likes this.
  18. wayneh

    Expert

    Sep 9, 2010
    12,100
    3,034
    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.
    Sounds fine, yes. I see no need for the optocoupler unless you cannot solve the ground problem.
     
    rsfoto likes this.
  19. rsfoto

    Member

    May 14, 2013
    134
    1
    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: May 15, 2013
  20. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    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.
     
Loading...