Maker Pro
Maker Pro

connecting 8ft of cable to digital logic (OUCH)

I need to send a 4khz square wave via 12 feet of untwisted pair 22 AWG
cable (two wires).

To do this, I am using a PIC. The output of the PIC goes to an
optoisolator (the LED part) with a series resistor. The optoisolator
"output" is a NPN transistor. The collector is connected via the 12
feet of wire to the UP input of a 74HC193 counter. The input is pulled
up to +5V (on the counter side) via a 1k resistor. The GROUND of the
counter is connected to the emitter of the transistor via 12 feet of
wire. The optoisolator will sink (or is it source?) about 5ma of
current through the pullup. Power supplies for the PIC and 74HC193 are
totally seperate. The only connection between the two is the 12 feet of
wire.

My question is, I imagine that 12 feet of wire connected to the input
of HC logic is going to have problems. I suppose it acts like a huge
antenna and all kinds of high frequency junk will get on it and cause
random switching of the input. How can I prevent this? I was thinking
maybe a low pass RC filter on the counter side, or perhaps chokes on
the input and the GND line. Anyone have any experience with this kind
of thing?

Thanks!

Asa
 
I need to send a 4khz square wave via 12 feet of untwisted pair 22 AWG
cable (two wires).

To do this, I am using a PIC. The output of the PIC goes to an
optoisolator (the LED part) with a series resistor. The optoisolator
"output" is a NPN transistor. The collector is connected via the 12
feet of wire to the UP input of a 74HC193 counter. The input is pulled
up to +5V (on the counter side) via a 1k resistor. The GROUND of the
counter is connected to the emitter of the transistor via 12 feet of
wire. The optoisolator will sink (or is it source?) about 5ma of
current through the pullup. Power supplies for the PIC and 74HC193 are
totally seperate. The only connection between the two is the 12 feet of
wire.

My question is, I imagine that 12 feet of wire connected to the input
of HC logic is going to have problems. I suppose it acts like a huge
antenna and all kinds of high frequency junk will get on it and cause
random switching of the input. How can I prevent this? I was thinking
maybe a low pass RC filter on the counter side, or perhaps chokes on
the input and the GND line. Anyone have any experience with this kind
of thing?

Thanks!

Asa

You should put the opto at the 74hc193 end of the wire, the series
resistor at the pic end, that way you have a good chance of success.
 
M

Meindert Sprang

I need to send a 4khz square wave via 12 feet of untwisted pair 22 AWG
cable (two wires).

To do this, I am using a PIC. The output of the PIC goes to an
optoisolator (the LED part) with a series resistor. The optoisolator
"output" is a NPN transistor. The collector is connected via the 12
feet of wire to the UP input of a 74HC193 counter. The input is pulled
up to +5V (on the counter side) via a 1k resistor. The GROUND of the
counter is connected to the emitter of the transistor via 12 feet of
wire. The optoisolator will sink (or is it source?) about 5ma of
current through the pullup. Power supplies for the PIC and 74HC193 are
totally seperate. The only connection between the two is the 12 feet of
wire.

My question is, I imagine that 12 feet of wire connected to the input
of HC logic is going to have problems. I suppose it acts like a huge
antenna and all kinds of high frequency junk will get on it and cause
random switching of the input. How can I prevent this? I was thinking
maybe a low pass RC filter on the counter side, or perhaps chokes on
the input and the GND line. Anyone have any experience with this kind
of thing?

Move the optocoupler to the receiving end and you have a system that
resembles the current loops from the 70's used to connect terminals across
several 100 feet of wire to mainframes, running at 9600 or 19200 baud. It's
called "current loop" and is very insensitive to noise.

Meindert
 
Something else I am curious about is: lets say I connect the GND wire
as you say, so basically the PIC's GND has a 12 foot long piece of wire
attached to it. Could this somehow couple noise to the PIC's GND and
cause problems? I can see that your method prevents the COUNTER GND
from seeing noise, since the opto is on its side.
 
M

Mike Young

I need to send a 4khz square wave via 12 feet of untwisted pair 22 AWG
cable (two wires).

That doesn't seem to be much worse than any other audio signal on speaker
wire. Speaking from the depths of my ignorance, what application would be so
sensitive to something so seemingly small and uncomplicated?
 
I need to send a 4khz square wave via 12 feet of untwisted pair 22 AWG
cable (two wires).

To do this, I am using a PIC. The output of the PIC goes to an
optoisolator (the LED part) with a series resistor. The optoisolator
"output" is a NPN transistor. The collector is connected via the 12
feet of wire to the UP input of a 74HC193 counter. The input is pulled
up to +5V (on the counter side) via a 1k resistor. The GROUND of the
counter is connected to the emitter of the transistor via 12 feet of
wire. The optoisolator will sink (or is it source?) about 5ma of
current through the pullup. Power supplies for the PIC and 74HC193 are
totally seperate. The only connection between the two is the 12 feet of
wire.

My question is, I imagine that 12 feet of wire connected to the input
of HC logic is going to have problems. I suppose it acts like a huge
antenna and all kinds of high frequency junk will get on it and cause
random switching of the input. How can I prevent this? I was thinking
maybe a low pass RC filter on the counter side, or perhaps chokes on
the input and the GND line. Anyone have any experience with this kind
of thing?

Is optical isolation absolutely necessary? If not, use RS232 for this
as it is designed to transmit digital signals up to 100m distance at up
to 115kHz. The common MAX232 will do the job nicely. You could also use
RS485 which is designed for cable runs of 1km or more. The MAX481 is
even easier to use as you won't need external caps.

If you must do optical isolation, look around the net for opto-isolated
RS232 schematics/products.

RS232 and RS485 solves the noise problem differently. RS232 simply
transmits at a high voltage (+/-12V) to drown out noise. RS485 uses a
low voltage differential scheme in which the noise on + signal and -
signal cancel each other out. RS485 should be used with twisted pair
wires for best result.
 
P

Pooh Bear

You should put the opto at the 74hc193 end of the wire, the series
resistor at the pic end, that way you have a good chance of success.

Agreed.

Doing it the OP's way results in a high-Z condition when the opto is 'off'
and the 'wire' may be subject to any manner of interfering signals that it
can't reject.

Graham
 
P

Pooh Bear

Something else I am curious about is: lets say I connect the GND wire
as you say, so basically the PIC's GND has a 12 foot long piece of wire
attached to it. Could this somehow couple noise to the PIC's GND and
cause problems?

Very unlikely.
I can see that your method prevents the COUNTER GND
from seeing noise, since the opto is on its side.

It's about keeping the impedance low on the cable actually.

Graham
 
T

Tony Williams

To do this, I am using a PIC. The output of the PIC goes to an
optoisolator (the LED part) with a series resistor. The
optoisolator "output" is a NPN transistor. The collector is
connected via the 12 feet of wire to the UP input of a 74HC193
counter. The input is pulled up to +5V (on the counter side) via
a 1k resistor. The GROUND of the counter is connected to the
emitter of the transistor via 12 feet of wire. The optoisolator
will sink (or is it source?) about 5ma of current through the
pullup. Power supplies for the PIC and 74HC193 are totally
seperate. The only connection between the two is the 12 feet of
wire.

Perhaps drive push-pull, like this.

5v +--[R]-+-[R]--+0v Remote V+
| | | +---+ |
+--[C]-+-[C]--+ | _|_ |/
| | \_/ -|Opto1
+--------------+ | |\
Line | + |
PIC->--[R2]-------------------+ +-->4KHz sq wave.
| + |
| _|_ |/
| \_/ -|Opto2
| | |\
+---+ |
Remote 0v

This keeps the line low-impedance all the time,
with only a +/- V-Led transitions on it.. bearing
in mind that 12 ft of untwisted cabling is a
transmitting aerial as well.

The two [C]'s deliver the Led current and the
[R]'s need only be low enough to keep the centre tap
at near Vcc/2 if the sq wave is not 1:1.
Led current is 2.5V/R2.
 
R

Rich Grise

I need to send a 4khz square wave via 12 feet of untwisted pair 22 AWG
cable (two wires).

To do this, I am using a PIC. The output of the PIC goes to an
optoisolator (the LED part) with a series resistor. The optoisolator
"output" is a NPN transistor. The collector is connected via the 12
feet of wire to the UP input of a 74HC193 counter. The input is pulled
up to +5V (on the counter side) via a 1k resistor. The GROUND of the
counter is connected to the emitter of the transistor via 12 feet of
wire. The optoisolator will sink (or is it source?) about 5ma of
current through the pullup. Power supplies for the PIC and 74HC193 are
totally seperate. The only connection between the two is the 12 feet of
wire.

My question is, I imagine that 12 feet of wire connected to the input
of HC logic is going to have problems. I suppose it acts like a huge
antenna and all kinds of high frequency junk will get on it and cause
random switching of the input. How can I prevent this? I was thinking
maybe a low pass RC filter on the counter side, or perhaps chokes on
the input and the GND line. Anyone have any experience with this kind
of thing?

Put the optoisolator at the destination end.

Good Luck!
Rich
 
R

Rich Grise

I need to send a 4khz square wave via 12 feet of untwisted pair 22 AWG
cable (two wires).

To do this, I am using a PIC. The output of the PIC goes to an
optoisolator (the LED part) with a series resistor. The optoisolator
"output" is a NPN transistor. The collector is connected via the 12
feet of wire to the UP input of a 74HC193 counter. The input is pulled
up to +5V (on the counter side) via a 1k resistor. The GROUND of the
counter is connected to the emitter of the transistor via 12 feet of
wire. The optoisolator will sink (or is it source?) about 5ma of
current through the pullup. Power supplies for the PIC and 74HC193 are
totally seperate. The only connection between the two is the 12 feet of
wire.

My question is, I imagine that 12 feet of wire connected to the input
of HC logic is going to have problems. I suppose it acts like a huge
antenna and all kinds of high frequency junk will get on it and cause
random switching of the input. How can I prevent this? I was thinking
maybe a low pass RC filter on the counter side, or perhaps chokes on
the input and the GND line. Anyone have any experience with this kind
of thing?

And if you can't twist them, at least twirl the plug a couple of times.

Good Luck!
Rich
 
R

Rich Grise

Something else I am curious about is: lets say I connect the GND wire
as you say, so basically the PIC's GND has a 12 foot long piece of wire
attached to it. Could this somehow couple noise to the PIC's GND and
cause problems?

No, that's what the optical isolation is for.
I can see that your method prevents the COUNTER GND
from seeing noise, since the opto is on its side.

Lessee if I remember - that's the one providing the signal, right? Since
it's an output, it shouldn't hurt, as long as you've followed all of the
standard grounding practices.

Have Fun!
Rich
 
Top