Shop OBEX P1 Docs P2 Docs Learn Events
How to drive a small relay directly from USB port? — Parallax Forums

How to drive a small relay directly from USB port?

john_sjohn_s Posts: 369
edited 2013-11-14 09:02 in General Discussion
I came across a need to drive a small 5V/30mA relay to indicate when my computer's powered.
I figure that I can energize it directly from USB port when my PC is ON.

So how about driving a small relay directly from USB +5V / 500mA supply - any cons against it?
USB relay.PNG
471 x 313 - 4K

Comments

  • localrogerlocalroger Posts: 3,451
    edited 2013-11-13 20:17
    Yes that should work.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-11-13 20:19
    Hi john;

    I can't think of anything wrong with doing this.

    Duane J
  • tonyp12tonyp12 Posts: 1,951
    edited 2013-11-13 20:41
    A non-enumerated usb port will supply 100mA.
    But the inrush could be a problem, that is why circuit that use usb-power have soft start.

    Quote:
    The USB 2.0 Spec allows a maximum capacity of 10uF and therefore a maximum Inrush of 50uC.
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2013-11-13 22:38
    tonyp12 wrote: »
    A non-enumerated usb port will supply 100mA.
    But the inrush could be a problem, that is why circuit that use usb-power have soft start.

    Quote:
    The USB 2.0 Spec allows a maximum capacity of 10uF and therefore a maximum Inrush of 50uC.

    I dont know how to say this. Thank you ! . Some one whom knows what they are talking about .
    I have a Real pet peve with products that don't follow the USB-IF guidelines . , Esp those y cables .
    http://www.usb.org/developers/compliance/
    USB is not a power port . its a power'ed serial bus ....... Its not wise to treat a PC's USB port as a power connection with our considering
    how much damage you can do to a computer with a USB hack..

    If you take USB as a Smart power port Yes in a way you can * request * power units .
    as Tony said above . the un requested max for a made to spec USB HOST is 100 mA ....
    The Relay Might be OK IF you can make shure the pull in current is not too high .

    May I ask why a Opto Isolator is not a option ?
    the dinky LEDs in them can go high on 5 mA ..

    and are not inductive surge devices ...?


    http://www.usb.org/developers/powerdelivery/PD_1.0_Introduction.pdf here is some night reading .
    are all you tinkers ready to deal with what is above !?
    * thankfully the dumb state is 5V ........
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-11-13 23:18
    Inrush current should not be an issue with an inductive load, since the current builds slowly, as opposed to a capacitive load, which looks -- briefly -- like a dead short. I might add a series diode on the +5V side, though, to protect the PC from effects of the recirculating current when the relay is turned off.

    -Phil
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2013-11-13 23:48
    ELI the ICE man at his finest . Good point Phil .

    to play EE and do things safe .
    I would at the very least slap it on a scope to watch for any kinda spikes prior to a full PC use .
  • john_sjohn_s Posts: 369
    edited 2013-11-14 07:02
    USB relay_s.PNG
    Thanks folks! Final circuit - Schottky diode added :)
    471 x 313 - 4K
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2013-11-14 08:16
    That diode looks like a good way to rectify any issues :)
  • john_sjohn_s Posts: 369
    edited 2013-11-14 09:02

    May I ask why a Opto Isolator is not a option ?
    the dinky LEDs in them can go high on 5 mA ..

    ........

    Yeah, it has to be low power (30mA when energized) relay as I need dry contacts to perform other tasks :)
Sign In or Register to comment.