Can a USB Relay Be Controlled Without a Microcontroller?

  • Thread starter Thread starter barderer
  • Start date Start date
  • Tags Tags
    Relay Usb
AI Thread Summary
A USB relay can potentially be controlled without a microcontroller by using a USB to serial converter, which allows for simple serial communication to activate a relay. While some users have successfully driven relays using flow control lines from USB to serial ICs, others suggest that using a microcontroller with built-in USB support may provide more flexibility and functionality. The discussion highlights that USB ports can supply up to 500 mA, which is sufficient for low-current relays. For those interested in learning programming, investing in a microcontroller development board is recommended, although it requires more effort compared to simpler solutions. Ultimately, the choice between using a microcontroller or a serial converter depends on the user's goals and willingness to learn.
barderer
Messages
4
Reaction score
0
Hello,

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.

Nick
 
Engineering news on Phys.org
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!
 
MATLABdude,

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?
http://www.futureelectronics.com/en/Technologies/Product.aspx?ProductID=CY7C63813SXCCYPRESS3700911

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

https://www.physicsforums.com/showthread.php?t=351234

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:
http://cgi.ebay.com/USB-to-Serial-Cable-RS232-DB9-Magellan-Garmin-PC-new_W0QQitemZ230377060753QQcmdZViewItemQQptZLH_DefaultDomain_0?hash=item35a38af991

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

relais.gif
 
ahh MATLABdude, you beat me to it. :smile:
 
waht,

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?
 
barderer said:
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.

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.


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?

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
http://www.sparkfun.com/commerce/product_info.php?products_id=8561

Pic programmer
http://www.futurlec.com/PIC_Programmer.shtml

It's a bit pricey but well worth it, if you seriously considering learning it.
 
what,

How should I choose which tech to learn? I see starter kits for things like this

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2615&dDocName=en535536

that seem to be more powerful for the same price. I am serious about learning, but I want to start with something that will be very versatile . soo many options!
 
Last edited by a moderator:
Have you considered the parallel port? If it is available with you, its a lot more easier to programm and control.
 
Back
Top