No Next Item No Next Conference Can't Favor Can't Forget Item List Conference Home Entrance    Help
View Responses


Grex Hardware Item 157: Serial port to relay outputs?
Entered by scott on Sun Nov 8 00:12:17 UTC 1998:

I'm looking for a way to switch various things on and off by sending 
commands from an RS-232 serial port.  I'd like to get about 8 outputs, 
such as relays (or signals that could be used to drive relays), and a 
fairly simple command language.

(X-10 would work here, but the command language in rather difficult to 
use since it needs a string of 16 zeroes (character null) for each 
command, and those are hard to send in most programming languages. Plus, 
it would be expensive).

18 responses total.



#1 of 18 by n8nxf on Mon Nov 9 10:54:57 1998:

That's easy to do with a parallel port but a lot more difficult with a 
serial port.  Check in the Jameco catalog.  There is also a design in the
latest Electronics design but that circuit uses a PIC device.


#2 of 18 by scott on Mon Nov 9 12:05:10 1998:

Well, learing to use PICs or perhaps the BASIC Stamp isn't that far down on
my list of eventual "want-to" projects (the long term list, of course).


#3 of 18 by rcurl on Mon Nov 9 17:09:37 1998:

Serial-Parallel converters are available, for what that's worth. 


#4 of 18 by scott on Tue Nov 10 00:46:37 1998:

I'm not sure that would work.  The parallel port method involves 
toggling the lines somehow, not sending streams of data.  I don't think 
the converter would be able to replicate that.

Although... one of my units does have a parallel port.  Wonder if I can 
poke memory to toggle lines on it.  Tandy BASIC on a Model 100, anyone?


#5 of 18 by n8nxf on Tue Nov 10 12:23:17 1998:

I did a contract job that used a parallel port on a PC to control 8
devices. I don't know how it would work with your Tandy but it is suppose
to conform to the Centronics standard, right?


#6 of 18 by scott on Tue Nov 10 21:28:53 1998:

Well, sort of... it was 1983, you know, and it was a Tandy (Radio Shack) 
product.  I did try to print on my HP DeskJet, and the line feeds were 
wrong.

I'm more concerned about the programming hooks than the hardware, 
though.


#7 of 18 by n8nxf on Wed Nov 11 11:58:00 1998:

You won't be sending line feeds to your controller, will you?  I think
the manual gives the port addresses and all you need to do is OUT the
desired binary word to the desired port.  It would be pretty simple to
write a little program and probe the port for a corresponding voltage.
I may even have a controller you could borrow if you want to flash
115 vac bulbs. (It also switched a second parallel port between two
outputs and disabled mouse and keyboard inputs.)


#8 of 18 by rtg on Thu Nov 12 01:57:51 1998:

I know someone who's quite the expert on the mod 100 from Tandy.  He
runs a web site called www.m100.com.  You might check there for
pointers...

As for relay control from a serial port, check the ads in either Circuit
Cellar Ink, or Midnight Engineering.  There's lots of vendors who sell
DA and control gear that would do the trick...


#9 of 18 by scott on Thu Nov 12 15:18:13 1998:

Yup, I've been to m100.com, Club 100, and "Tri-Mike Network East".  :)


#10 of 18 by rtg on Fri Nov 13 04:39:59 1998:

m100.com, and TMNE are one and the same guy. The business is in New
Hampshire, but the servers are here in Ann Arbor.


#11 of 18 by arthurp on Sun Jan 17 07:30:51 1999:

This is similar to a project I'm working on.  Does anyone know without
looking it up how much current is needed to drive a tiny 5v relay, and
how that compares to what 1 bit of a parallel port can deliver.  Am I
going to hav to do something yucky, or can I drive such a relay from the
port directly.  


#12 of 18 by scott on Sun Jan 17 13:39:27 1999:

You can drive an optoisolator directly, since it really only is an LED on the
input side.  I've driven full-size 120VAC solid state relays from the status
lines on serial ports before.  From a quict glance into my RS catalog, the
lowest power 5V relays need 20ma, which might be just beyond what a parallel
port can push.  However, if you had a power source (a PC is loaded with power)
it would be fairly easy to munge up a single transistor circuit (with maybe
2 resistors) to drive a relay.


#13 of 18 by gull on Sun Jan 17 22:47:24 1999:

Be sure to put a diode across the relay coil to supress the 'inductive
kick', or your port may not last long.

(To clarify:  The diode can be just about any rectifier diode, and goes in
so that normal current flow reverse-biases it.  When the relay releases, the
sudden collapse of the magnetic field in the coil produces a high-voltage
spike with the opposite polarity.  The diode shorts out this spike.)


#14 of 18 by scott on Mon Jan 18 00:35:18 1999:

Ohh, good idea.  but maybe with a driver output that isn't as big a problem
as with a mechanical switch?  Depends on how abrupt the power is cut off...


#15 of 18 by n8nxf on Mon Jan 18 11:26:09 1999:

Any time you remove the power to a coil the magnetic field around it
collapses.  In so doing, it generates a voltage across the coil with
opposite polarity of that originally applied.  Just the other day we
had a scope connected across the coil of a little 5 v IC sized relay
without a diode and were seeing spikes of 100 v and more when power
was removed.  Spikes of that magnitude would easily blow the logic
in most any IC.  I'd also recommend against driving the relay from the
IC.  Use a little darlington transistor to do the work.  Even if you're
just driving the LED in an opto-isolator. 


#16 of 18 by gull on Sat Jan 23 23:29:52 1999:

It's really *only* important with a driver output, since a 100V spike can
blow a transistor, but is unlikely to faze a mechanical switch.  A diode is
cheap insurance.


#17 of 18 by arthurp on Mon Apr 5 05:39:56 1999:

I was hoping to make a circuit that would have just data wires runing to it
without having to use a power source.  Maybe I have to use a power source
after all and control switching with opto-couplers from the computer?


#18 of 18 by n8nxf on Mon Apr 5 10:13:54 1999:

Don't bother with the opto-isolators.  You only need those if you're
going between the PC and line voltage or if you want to connect your
PC to a patient.  Take power from the buss or the PC's power supply.
I'm sure you can find logic-level relays if you look around.

Response not possible - You must register and login before posting.

No Next Item No Next Conference Can't Favor Can't Forget Item List Conference Home Entrance    Help

- Backtalk version 1.3.30 - Copyright 1996-2006, Jan Wolter and Steve Weiss