Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Interfaceless USB driven relay

  1. Nov 3, 2009 #1

    I want to make simple USB driven relay but I am wondering if it can be done without having a USB device on the other end. Most solutions I have seen thus far have a microcontroller that drives a relay. I was wondering if I could use a library like libusb to send data directly to the usb port which simply switches a MOSFET or MOSFET relay combo. E.G. I just say, raise power line on USB port 1, that line hooks up to the gate, relay on. Can this be done? Or does USB require a interface with a driver etc. The end goal here is to be able to build this for 5 dollars.

  2. jcsd
  3. Nov 3, 2009 #2


    User Avatar
    Science Advisor

    I've done this with one of the USB to serial conversion ICs (FTDI FT232BM). We used one of the flow control lines (RTS? CTS?) that was offered by the conversion chip, but wasn't being used for anything. Worked pretty well, actually (although it was only driving a very low-current miniature telecom relay).

    There are microcontrollers that have built-in USB support that would probably work really well for this sort of application (you can get drivers that just make them look like serial ports--send a little string to them, and have them turn on; you should be able to wrap a driver around them based on a programmable USB device ID that I think you can put onto the EEPROM). Really cheap, too.

    Alternately, you might be able to do something with the USB host IC's power sourcing capabilities (but I think that in some ICs, this doesn't control the current so much as trigger a warning when certain thresholds are exceeded).

    EDIT: ...And welcome to PhysicsForums!
  4. Nov 3, 2009 #3

    Thanks for the response and the welcome. So are you saying get a USB supported controller for sayyyy a usb mouse, and just hack it to drive the relay? You think this can be done for under 5 dollars? I found a solution that uses a PIC but then I need a PIC programmer...

    EE knowledge and skill - 1
    Programming skill - 9


    are you talking about something like this?

    Do they have something that is a little more human friendly that I don't need machines to solder with.
    Last edited: Nov 3, 2009
  5. Nov 3, 2009 #4
    This thread discusses the same thing:


    There is plenty of microcontrollers that can handle usb, but they require more complicated programming.

    As an alternate, you can get a cheap $3.49 USB to serial converter. All you have to do is devise a simple serial interface that turns on a relay. If you are using windows, you can send commands to the serial through the hyper terminal in the accessories menu, or code a simple app in C or C++ or any language of choice to send data to the serial port.

    Here is the converter:

    And the schematic prototype: this whole thing should cost you less that $5 bucks

  6. Nov 3, 2009 #5
    ahh MATLABdude, you beat me to it. :smile:
  7. Nov 3, 2009 #6

    That seems like a good approach. Curious, what is the limit on how many relays could be controlled using this method? Right now I only want one, but I am just saying. I would like to have everything in one package, e.g. the usb port/relay/power in and out etc. Would it be smarter to go with the micro controller method or the serial port method if this is the end goal?
  8. Nov 3, 2009 #7
    That depends how much current you can draw from the serial port or from the converter, I'm not sure how much though.

    But a USB port can supply up to 500 mA of current.

    If you just need a simple switch, then go for the converter, but if you are into programming consider getting a programmer, and a development board. It will take more work and time to figure it out, but the learning experience will open up a world of new possibilities.

    Here is a suggested PIC development board based on PIC18F4550

    Pic development board

    Pic programmer

    It's a bit pricey but well worth it, if you seriously considering learning it.
  9. Dec 6, 2009 #8
    Last edited by a moderator: Apr 24, 2017
  10. Dec 8, 2009 #9
    Have you considered the parallel port? If it is available with you, its a lot more easier to programm and control.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Interfaceless driven relay Date
Mechanically driven generator & inductive resistance to torque Wednesday at 2:47 PM
Alternative to a relay Dec 28, 2017
Event driven processor Apr 30, 2016
Interrupt-driven circuit Apr 27, 2011
Asymmetrically Driven Transformer Primary Jan 25, 2011