Você está na página 1de 4

25/04/2017 Controlling relays via USB ­ Electrical Engineering Stack Exchange

   
sign up log in tour help 

_
Electrical Engineering Stack Exchange Here's how it works:
is a question and answer site for
electronics and electrical engineering
professionals, students, and
enthusiasts. Join them; it only takes a
minute: 
Anybody can ask Anybody can The best answers are voted
a question answer up and rise to the top
Sign up

Controlling relays via USB [duplicate]

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?

usb   relay

edited Apr 13 at 12:32 asked Mar 27 '12 at 15:50
Community ♦ Daniel Accorsi
1 113 1 1 3

marked as duplicate by stevenvh, Toby Jaffey , Kevin Vermeer Mar 28 '12 at 19:42
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1   phidgets.com – kenny Mar 27 '12 at 16:09

1   electronics.stackexchange.com/questions/267/… electronics.stackexchange.com/questions/1942/… –
 Toby Jaffey Mar 27 '12 at 16:09

    Thanks Joby, very helpful for me. –  Daniel Accorsi  Mar 27 '12 at 17:28

    @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?  – Kevin Vermeer Mar 28 '12 at 17:35

    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. –  Daniel Accorsi
Mar 28 '12 at 18:20

2 Answers

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.

https://electronics.stackexchange.com/questions/28799/controlling­relays­via­usb 1/4
25/04/2017 Controlling relays via USB ­ Electrical Engineering Stack Exchange

From here

Many ebay USB to RS232 serial adapters

Example:

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.

Excellent and extensive parallel port interfacing page

Many ebay USB o printer parallel port adapters

Example:

https://electronics.stackexchange.com/questions/28799/controlling­relays­via­usb 2/4
25/04/2017 Controlling relays via USB ­ Electrical Engineering Stack Exchange

Parallel port to relay kitset with circuit

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.

edited Mar 27 '12 at 21:23 answered Mar 27 '12 at 16:29
Russell McMahon
105k 7 126 249

    Great!! Thanks Russell. All information I was searching... I will try... –  Daniel Accorsi  Mar 27 '12 at 17:35

    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. – Craig Mar 27 '12 at 19:56

https://electronics.stackexchange.com/questions/28799/controlling­relays­via­usb 3/4
25/04/2017 Controlling relays via USB ­ Electrical Engineering Stack Exchange
    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."  – Wouter van Ooijen Mar 27 '12 at 21:11 

    @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. – Russell McMahon Mar 27 '12 at 21:13 

    See addition to answer. Should be OK for basic 8 bit output. – Russell McMahon Mar 27 '12 at 21:24

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.

edited Mar 27 '12 at 16:44 answered Mar 27 '12 at 16:42
stevenvh jippie
124k 13 392 598 25.8k 9 68 130

    @juppie, its almost, but i need create one like these EG­PMS hardware. –  Daniel Accorsi  Mar 28 '12 at


18:24

https://electronics.stackexchange.com/questions/28799/controlling­relays­via­usb 4/4

Você também pode gostar