[HH] cheapest/simplest way to control a relay from a PC

Tom Metro tmetro+hhacking at gmail.com
Fri Nov 9 14:38:25 EST 2012


Nuno Sucena Almeida wrote:
> Those relays as you say are 5V min TTL compatible...

3.8 V max required to energize the coil.


> ...since you are talking about a desktop it
> shouldn't be the case;

Right.

According to:
http://www.epanorama.net/circuits/parallel_output.html#circuithow

"In real world the voltages can be something different from ideal when
the circuit is loaded. The output current capacity of the parallel port
is limited to only few milliamperes. ... Load (up to 2.6 mA @ 2.4 v) ...
The parallel port data pins are TTL outputs, that can both sink and
source current. In ordinary parallel port implementations the data
outputs are 74LS374 IC totem-pole TTL outputs which can source 2.6 mA
and sink 24 mA."

and elsewhere on the page:

"The IBM specifications says...the following: The data output pins (pins
2-9) sink 24 mA, source 15 mA, and their high-level output is min. 2.4
V. The low state for both is max."

Undoubtedly the current differences are a reflection of the switch to
lower power logic.

It does look like voltage could be a problem, unless you use an external
supply and sink through the port, or lightly load the outputs.

I'm wondering if all 8 of the data outputs were ganged together through
diodes, would that stiffen up the source voltage to come close to 4.2 V
with a 10 mA load?


> the first of those relays has typ. coil resistance of 200Ω , which
> would imply 10mA. It seems a bit high for a parallel port...

Good point. I just saw TTL compatible and didn't look closely at the
other numbers. Of course TTL really refers to the old-school, high-power
bipolar TTL logic. Not LS or CMOS parts.


> Honestly I feel that the opto-coupler solution would be simpler and less
> prone to mechanical failure and noise.

Mechanical failure is a down-the-road problem. (This isn't intended to
be a long term fix.)

Are you referring to audible noise or EMF? Audible noise is irrelevant.
The relay as a built-in flyback diode for EMF suppression.

The optocoupler approach requires more thought. It would help to know
what circuit the transmitter is using. Are they sourcing or sinking? Do
I use a bipolar photo-Darlington? A MOSFET? Do I size it to handle the
same 100 mA the transmitter can drive, or the much lower current I'm
actually using for my homemade emitter?

A relay isn't elegant, but it short circuits these questions, making
them irrelevant.

Thanks for the feedback.

 -Tom



More information about the Hardwarehacking mailing list