[sci.electronics] Computer Controlled Switch?

jantypas@ucrmath.UUCP (John Antypas) (07/19/88)

I've never really jumped into electronics before so I'm not sure this will
work, but the problem is driving me crazy.  I have a USR Courier 2400 modem
which has the habit of hanging REGULARLY.  True, it MIGHT need servicing, 
but according to USR it just might be brownout conditions.  In any case,
when the modem hangs, the only way to fix it appears to be cycling the 
power on the modem.  Since the hanging never occurs when I'm around to fix
things, I'd like a way for the computer to cycle the power for me.

I have a spare parallel port on the machine, so, would it be possable to 
run a line from the parallel ports strobe line and ground to let us say a 
relay (normally closed) which could then switch power off/on?

True, this design might be dead wrong, but like I said, I'm new to this, and
the courier has dictated I learn.

Thanks.

John Antypas -- Soft21 --21st Century Software:

UUCP: {buita, crash, garp, killer, pyramid}!soft21!jantypas
      {reed, sdeggo, ucsd!ucrmath, uport}!soft21!jantypas
Internet: jantypas%soft21.uucp@{garp.MIT.EDU, ucsd.EDU}
Domains:  jantypas@soft21.CTS.COM { Doesn't work everywhere }

jbn@glacier.STANFORD.EDU (John B. Nagle) (07/20/88)

      I'd get the modem fixed.  "Brownout conditions" sounds like
utter bullshit to me.  

      One useful thing to know is that pin 20 of an RS-232 port, Data
Terminal Ready, can be turned on and off by the computer.  If you have
a subroutine library for the PC's serial ports, there's probably a way
specified to turn it on and off.  By convention, "ON" is -12v, and 
"OFF" is +12.  DTR just tells the modem that the computer is up and talking,
so it's a reasonable way anyway to turn the modem on and off.  I assume
that it's your own program running the modem, since you want to control
the modem's power when you're running unattended, so presumably you aren't
doing anything else with DTR.

      So, if you built a suitable cable, one that passed all the pins
from the serial port to the modem but also brought out wires from 
pins 20 and 7 (7 is ground), you'd have a signal you could turn on and
off.   The next step is to get that signal to do this.

      You can probably take 5 or 10 mA of power off the DTR line.  
So look for a 12v relay that requires very little current to drive
it, and has enough current capacity at the contacts to switch the power
to your modem.  Put a diode in series with the relay, and connect the
result to the wires from pin 20 and 7.  This should switch when you 
change the state of DTR from software.  If you reverse the diode, you
will reverse the state for which the relay is on.

      Better to switch the low voltage from the wall transformer than
the 120v power line.  If you do switch the power line, take appropriate
precautions, including fusing, and make sure you have a relay with enough
muscle for the job.  Something like Magnecraft part W101MIP-2 (Newark
stock number 23F5578, price $4.96 each) should do it.  That relay can
switch up to 200v at 0.5A, and is rated for 1500v breakdown voltage
between the contacts and coil, so it should provide sufficient isolation.
You can probably get something at Radio Shack, but I wouldn't trust it.

      This is an awful hack, you know.

					John Nagle

phd@speech1.cs.cmu.edu (Paul Dietz) (07/20/88)

In article <17571@glacier.STANFORD.EDU> jbn@glacier.UUCP (John B. Nagle) writes:
>By convention, "ON" is -12v, and "OFF" is +12.
>
>      You can probably take 5 or 10 mA of power off the DTR line.  
>So look for a 12v relay that requires very little current to drive
>it, and has enough current capacity at the contacts to switch the power
>to your modem.  Put a diode in series with the relay, and connect the
>result to the wires from pin 20 and 7.  This should switch when you 
>change the state of DTR from software.  If you reverse the diode, you
>will reverse the state for which the relay is on.

Several comments:
1) I didn't realize that there were any 12V relays that worked reliably
off of 5mA.

2) While +/-12 V is what's supposed to be on the line, it's frequently
not what you get, besides which, not all machines let you muck with
this. (i.e. it's hard wired on some, and plain non-existant on others.)

3) In addition to the series diode, you also want a free wheeling diode
in parallel with the relay coil, pointing the other direction. (Though
one could probably debate wether this was absolutely necessary given the
other diode...)

4) There's an easier, much cheaper solid state solution. Go to your
local Radio Shack and get an opto-isolator with triac output, and
a standard 600V triac (overkill, but dirt cheap...). The opto-isolator
can easily be driven by these sorts of currents (it just looks like
an LED from that end) and then you can easily use the triac output
to control the big triac. Then you can control reasonably big
120 VAC loads so long as they're not too inductive (no motors, etc.).
Total cost should be under $10, and that includes the pretty box.
If I remember correctly, the little card that the opto-coupler comes
on gives the schematic (these two parts, and two resistors) which
should make life trivially easy. Another advantage is that it's
easy to try out before you commit to building the thing. Just take an
LED and a resistor (say 2k for sake of argument) and connect it to
these pins and see if you can get the software to work...

Hope this helps...

Paul H. Dietz                                        ____          ____
Dept. of Electrical and Computer Engineering        / oo \        <_<\\\
Carnegie Mellon University                        /|  \/  |\        \\ \\
--------------------------------------------     | | (  ) | |       | ||\\
"If God had meant for penguins to fly,             -->--<--        / / |\\\  /
he would have given them wings."            _________^__^_________/ / / \\\\-