Can a USB Relay Be Controlled Without a Microcontroller?

  • Thread starter Thread starter barderer
  • Start date Start date
  • Tags Tags
    Relay Usb
Click For Summary

Discussion Overview

The discussion revolves around the feasibility of controlling a USB relay without a microcontroller. Participants explore various methods of interfacing with USB to drive a relay, including the use of libraries and serial communication, while considering cost constraints and technical challenges.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant questions whether a USB relay can be controlled without a microcontroller, suggesting the use of a library like libusb to send data directly to the USB port to switch a relay.
  • Another participant shares their experience using a USB to serial converter to control a relay, indicating that it worked well for low-current applications.
  • There is a suggestion that microcontrollers with built-in USB support could simplify the process, although they may require more complex programming.
  • A participant proposes using a cheap USB to serial converter as a viable alternative, mentioning the possibility of creating a simple serial interface to control the relay.
  • Questions arise regarding the number of relays that can be controlled using these methods, with a note that USB ports can supply up to 500 mA of current.
  • Some participants express interest in learning about microcontrollers and programming, weighing the benefits of different approaches.
  • One participant suggests considering the parallel port as an easier alternative for programming and control.

Areas of Agreement / Disagreement

Participants express a range of views on the best approach to control a USB relay, with no clear consensus on whether to use a microcontroller or a serial interface. The discussion remains unresolved regarding the optimal method and the feasibility of achieving the goal within the specified budget.

Contextual Notes

Participants note limitations regarding the current draw from the USB or serial port and the complexity of programming required for microcontrollers. There are also references to specific hardware options and their associated costs, which may influence the decision-making process.

Who May Find This Useful

This discussion may be useful for hobbyists, electronics enthusiasts, and individuals interested in DIY projects involving USB control and relay systems.

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:
 
what,

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.
 

Similar threads

Replies
12
Views
3K
Replies
37
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
2
Views
2K
Replies
4
Views
3K