2
\$\begingroup\$

Possible Duplicate:
I'd like to learn how to make my own USB gadgets
How to build a USB controller having knobs, sliders, and switches

I need to activate a relay via USB, using a program made with any language.

Someone have simple schematics to show me, or some information on how this works?

\$\endgroup\$
5
  • 1
    \$\begingroup\$ phidgets.com \$\endgroup\$
    – kenny
    Mar 27 '12 at 16:09
  • 1
  • \$\begingroup\$ @DanielAccorsi - What's your desired integration level? Are you building a product that will work with someone's software, and therefore you'd want to build a custom PCB, are you working on a production line and want to buy an industrial IO solution and be done with it, or are you just trying to hack something together in your basement? \$\endgroup\$ Mar 28 '12 at 17:35
  • \$\begingroup\$ Hi @KevinVermeer. I want develop my own usb controller to activate some relays. But i think be necessary buy a USB to printer parallel adapter, or to serial, like people saying below. \$\endgroup\$ Mar 28 '12 at 18:20
  • \$\begingroup\$ @DanielAccorsi - Ah, then it is in fact a duplicate of the above posts. You don't need to get an adapter, that's more of a quick and dirty hack. The linked posts will have more information on what you want to do. \$\endgroup\$ Mar 28 '12 at 19:43
6
\$\begingroup\$

The easiest way is to buy a premade USB to parallel interface unit. These are available and may not be especially expensive, but there is a cheaper way.


A USB to RS232 serial port interface gives you several controllable control lines that can drive relays. For example, see the diagram below. Vcc is provided by an external power supply suited to the relay voltage. Ground is commined with the interface unit and the power supply. DTR and RTS are RS232 signals from the interface unit.

enter image description here

From here

Many ebay USB to RS232 serial adapters

Example:

enter image description here


For more than a few relays, a USB to printer parallel port adapter gives you 8 actual data lines plus a number of printer port control lines that are under computer control. In most cases you will need a buffer IC to allow the logic level signals to drive relays. A ULN2803 IC, a USB to parallel printer port unit and a power supply suited to the relay operating voltage is all that will be needed.

Replace resistors and LEDs in this diagram with relays.
Zener optional. If not used connect V+ to pin 10.
V+ shown as 9V but choose to suit relays.

http://www.epanorama.net/circuits/uln2803circuit.gif

Excellent and extensive parallel port interfacing page

Many ebay USB o printer parallel port adapters

Example:

enter image description here


Parallel port to relay kitset with circuit

enter image description here


ADDED:

The text below is summarised from material from the reference above re parallel port adapters used for printing.
Note that using data output methods that treat the port as a printer should work correctly.
Control of low level bit adressed functions may not be possible but you should still be able to manage at least 8 lines of relay control with ease and probably a few more with a little effort. he article says:

  • Notes on USB parallel port adapters.

    The USB-Parallel Port Adapter enables users to connect parallel port interfaced devices like printers to a desktop or laptop PC via the PC's USB port.

    The parallel port through this kind of adapter looks pretty same as normal parallel port for high level programs on Windows system. The low level implementation of them is completely different, and the low level I/O control operations described in this document do not work with USB parallel port adapters.

    USB parallel ports are generally targeted for driving normal printers, and not designed for anything else ... and it will not work for the direct output pin controlling described in this document.

\$\endgroup\$
6
  • \$\begingroup\$ Great!! Thanks Russell. All information I was searching... I will try... \$\endgroup\$ Mar 27 '12 at 17:35
  • \$\begingroup\$ We aware that many USB to parallel port devices are really USB to printer devices and do not provide easy low level access to the pins. \$\endgroup\$
    – Craig
    Mar 27 '12 at 19:56
  • \$\begingroup\$ Be aware of what Craig says! A quote from the very page referred to by Russell: "you can forget using the USB (to) parallel ports for your own harware controlling." \$\endgroup\$ Mar 27 '12 at 21:11
  • \$\begingroup\$ @Craig - ? I explicitly mentioned "real" USB to parallel interfaces and printer interfaces, with more emphasis on the latter. If you can send a data word to a printer it should give you control of 8 relays from any application that can operate a printer, so I'm not sure what point you are making. It may be that you cannot toggle some of the control lines at low level but surely data lines must be accessible by right. If not, it would be useful to know what the problem encountered is. Can you be more specific please. \$\endgroup\$
    – Russell McMahon
    Mar 27 '12 at 21:13
  • \$\begingroup\$ See addition to answer. Should be OK for basic 8 bit output. \$\endgroup\$
    – Russell McMahon
    Mar 27 '12 at 21:24
0
\$\begingroup\$

I bought one of these things a while ago. They're useful if you want to use those relays to switch mains power to a device. I use them to power on my audio amp and desk lamp from the PC. Software is available for Linux (from http://sispmctl.sourceforge.net/ ) and I presume Windows is standard.

\$\endgroup\$
1
  • \$\begingroup\$ @juppie, its almost, but i need create one like these EG-PMS hardware. \$\endgroup\$ Mar 28 '12 at 18:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.