0
\$\begingroup\$

I would like to know if it is possible to convert a USB signal to a RCA phone plug signal in order to close a switch contact. There are pushbutton switches that can remotely close a switch by means of a cable with a standard 3.5 mm plug on the end. These are attached to specialized switch boxes for adaptive devices for people with disabilities. Instead of having a physical pushbutton as the component sending the signal to the switch box, I would like to have the signal originate from a software program and be conveyed through USB or RS-232 and then be converted to the appropriate signal for closing a switch. This is a specialized need and I am not an engineer, so it's kind of hard to explain what I am needing. I do not really know how to look for such a solution. I appreciate any suggestions.

\$\endgroup\$

3 Answers 3

2
\$\begingroup\$

There are devices available such as this one (also available ready-built) that will do what you want. That might be bigger and more cumbersome than what you're looking for, however.

In reply to comment: Not much simpler, for USB, although you may find something smaller, with fewer channels - just search for 'USB Relay'. This looks the most promising route.

An alternative approach, if you do want something simpler, then you may have to step outside of Windows - you don't say anything more specific than 'software' but I'm assuming you mean Windows or anyway a modern OS - but in the days of DOS, you had more direct access to the hardware, so could for instance use one of the RS232 control signals (DTR etc) plus a diode and a small relay. But AFAIK this isn't available under Windows. In fact - ref comments - this is still available under Windows too.

\$\endgroup\$
5
  • \$\begingroup\$ That might work for me, but is there anything simpler than that? \$\endgroup\$
    – user40404
    Apr 17, 2014 at 21:07
  • \$\begingroup\$ The modem control signals (if implemented by the hardware) are still available under windows and other modern operating systems. \$\endgroup\$ Apr 18, 2014 at 21:48
  • \$\begingroup\$ @Chris Stratton Interesting - my understanding is that you can enable and disable them ie select how handshaking is performed, but not actually control their state from code. Could you expand on that? \$\endgroup\$
    – peterG
    Apr 18, 2014 at 22:48
  • \$\begingroup\$ No, you can control them from code. \$\endgroup\$ Apr 18, 2014 at 22:58
  • \$\begingroup\$ @Chris Stratton Yes, I stand corrected. Didn't check that thoroughly enough last night - now I've found the EscapeCommFunction, which does exactly what's reqd. Thanks - useful to know. \$\endgroup\$
    – peterG
    Apr 18, 2014 at 23:12
1
\$\begingroup\$

One way to handle this is to use an FTDI chip, such as the FT232R, which connects via USB to a virtual COM port, and on the other side of the IC presents a full set of RS-232 leads, at TTL levels, including TX/RX, DTR, RTS, CTS and DSR. It is available in a 28-pin SSOP package for $4.50 in single quantities.

You can then use the DTR lead to control a transistor or MOSFET to drive your relay. There are literally dozens of answers here describing how to do that so I won't repeat it here. The DTR lead can be easily manipulated using Windows software (we're doing it right now in one of our test boards to reset a processor using C#.)

\$\endgroup\$
5
  • \$\begingroup\$ Yes, though there's little need to build this with a bare chip for a one-off, since a typical consumer USB serial adapter (ultimately built around such a part) will work. As that will include a line driver on the control signals as well as the data their signal will be inverted and may have a higher level, but that is not really a problem for designing a relay driver. \$\endgroup\$ Apr 18, 2014 at 21:50
  • \$\begingroup\$ @ChrisStratton I mostly included this because PeterG said it couldn't be done under Windows, while I am using this solution every day (and it's cheaper than buying a complete board). I see you also added a comment under his post re controlling modem lines under Windows. \$\endgroup\$
    – tcrosley
    Apr 18, 2014 at 21:57
  • \$\begingroup\$ @tcrosley - whoa - I didn't (intend to) say that it couldn't be done via extra hardware - I'm talking about the built-in serial port here. To the best of my knowledge Windows doesn't allow direct control of DTR etc on that - but Chris (or you) might put me right on that too! \$\endgroup\$
    – peterG
    Apr 18, 2014 at 22:56
  • \$\begingroup\$ @tcrosley . . . yeah, Chris did put me right! \$\endgroup\$
    – peterG
    Apr 18, 2014 at 23:15
  • \$\begingroup\$ @peterG If you have an actual COM port on your PC (most don't anymore, I insisted on one when I got my last computer), then this becomes very simple. \$\endgroup\$
    – tcrosley
    Apr 18, 2014 at 23:47
0
\$\begingroup\$

There are a number of ways to approach the problem. The two I'd suggest you looking into first are phidgets, which should have a solution for you.

Another choice is an arduino with a relay shield.

There are certainly cheaper and more elegant ways to tackle this, but from the tone of your question I'm guessing you need something that is easy to use and has a large community to support questions you have as you progress. You'll find both in the above two options.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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