Exact match. Not showing close matches.
PICList
Thread
'[PIC] Connecting a switch with a very long cable'
2005\02\22@164624
by
Martin Tedjawardhana
Hello people,
I need to connect a simple push-on switch with a PIC, but the cable
connecting it can be up to 30 meters. What are the potential problems
here? Interference and such? Cable resistance? Can I get away with
only a simple pull up resistor, or should I put an extra transistor
and use the switch to trigger it ? Or is there another way of doing
it?
Thank you in advance.
Regards,
Martin
2005\02\22@165406
by
Herbert Graf
On Tue, 2005-02-22 at 22:46 +0100, Martin Tedjawardhana wrote:
> Hello people,
>
> I need to connect a simple push-on switch with a PIC, but the cable
> connecting it can be up to 30 meters. What are the potential problems
> here? Interference and such? Cable resistance? Can I get away with
> only a simple pull up resistor, or should I put an extra transistor
> and use the switch to trigger it ? Or is there another way of doing
> it?
A 30meter cable can get quite a bit of voltage induced to it. I'd
suggest probably isolating it with an optoisolator to be safe. TTYL
-----------------------------
Herbert's PIC Stuff:
http://repatch.dyndns.org:8383/pic_stuff/
2005\02\22@170942
by
Jinx
> I need to connect a simple push-on switch with a PIC, but the
> cable connecting it can be up to 30 meters. What are the potential
> problems here? Interference and such?
I'd suggest sending Vcc or high output out through a series resistor,
eg 470 ohms, and the input pin (IP) pulled low with a resistor of
around 10x this, or a value that ensures the signal comfortably falls
outside the transition thresholds of the input. If the environment is
or could be noisy, add a small cap (100n) from IP to Vss, 5V1 zener
(k to IP, a to Vss) to clamp positive excursions and a Schottky diode
(k to IP, a to Vss) to clamp negative excursions
2005\02\22@172244
by
Stephen R Phillips
|
--- Martin Tedjawardhana <spam_OUTbitboxxTakeThisOuT
gmail.com> wrote:
> Hello people,
>
> I need to connect a simple push-on switch with a PIC, but the cable
> connecting it can be up to 30 meters. What are the potential problems
> here? Interference and such? Cable resistance? Can I get away with
> only a simple pull up resistor, or should I put an extra transistor
> and use the switch to trigger it ? Or is there another way of doing
> it?
>
> Thank you in advance.
>
If you are putting this into an industrial environment et al well heck
if you are putting this in any normal environment, (IE not specifically
made for low noise), I suggest ye olde isolated voltage source (with
isolated ground perhaps) and a opto isolator input with current
limiting resistor. A simple derangement. More seriously that cable
will be a conduit for noise injection into your system. A simple pull
up will not remove ground noise etc. Since the opto will be on or off
and have a bit of hysterisis it should be sufficient to remove it being
a trigger for noise. You do need a pull up on it's output or pull down
depending if you use its output as open collector or open emitter. If
you don't need speed, then don't use one that has it (less to glitch).
Once your button makes positive contact you are all set. This is
assuming you aren't trying to multiplex this or anything of course :)
=====
Stephen R. Phillips was here
Please be advised what was said may be absolutely wrong, and hereby this disclaimer follows. I reserve the right to be wrong and admit it in front of the entire world.
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
2005\02\23@034922
by
Martin Tedjawardhana
part 1 910 bytes content-type:text/plain; charset=US-ASCII (decoded 7bit)
Something like this (Attachment)? Is this a better solution than optoisolator?
On Wed, 23 Feb 2005 11:09:32 +1300, Jinx <.....joecolquittKILLspam
@spam@clear.net.nz> wrote:
{Quote hidden}> > I need to connect a simple push-on switch with a PIC, but the
> > cable connecting it can be up to 30 meters. What are the potential
> > problems here? Interference and such?
>
> I'd suggest sending Vcc or high output out through a series resistor,
> eg 470 ohms, and the input pin (IP) pulled low with a resistor of
> around 10x this, or a value that ensures the signal comfortably falls
> outside the transition thresholds of the input. If the environment is
> or could be noisy, add a small cap (100n) from IP to Vss, 5V1 zener
> (k to IP, a to Vss) to clamp positive excursions and a Schottky diode
> (k to IP, a to Vss) to clamp negative excursions
>
> -
2005\02\23@040004
by
Martin Tedjawardhana
|
Thank you... I think optoisolator would be a good idea, but I dont
have a luxury of a separate power supply. Is there a way to reduce or
eliminate the noise? A coil perhaps?
On Tue, 22 Feb 2005 14:22:43 -0800 (PST), Stephen R Phillips
<cyberman_phillips
KILLspamyahoo.com> wrote:
{Quote hidden}>
> --- Martin Tedjawardhana <
.....bitboxxKILLspam
.....gmail.com> wrote:
>
> > Hello people,
> >
> > I need to connect a simple push-on switch with a PIC, but the cable
> > connecting it can be up to 30 meters. What are the potential problems
> > here? Interference and such? Cable resistance? Can I get away with
> > only a simple pull up resistor, or should I put an extra transistor
> > and use the switch to trigger it ? Or is there another way of doing
> > it?
> >
> > Thank you in advance.
> >
> If you are putting this into an industrial environment et al well heck
> if you are putting this in any normal environment, (IE not specifically
> made for low noise), I suggest ye olde isolated voltage source (with
> isolated ground perhaps) and a opto isolator input with current
> limiting resistor. A simple derangement. More seriously that cable
> will be a conduit for noise injection into your system. A simple pull
> up will not remove ground noise etc. Since the opto will be on or off
> and have a bit of hysterisis it should be sufficient to remove it being
> a trigger for noise. You do need a pull up on it's output or pull down
> depending if you use its output as open collector or open emitter. If
> you don't need speed, then don't use one that has it (less to glitch).
> Once your button makes positive contact you are all set. This is
> assuming you aren't trying to multiplex this or anything of course :)
>
>
> =====
> Stephen R. Phillips was here
> Please be advised what was said may be absolutely wrong, and hereby this disclaimer follows. I reserve the right to be wrong and admit it in front of the entire world.
>
>
> __________________________________
> Do you Yahoo!?
> Take Yahoo! Mail with you! Get it on your mobile phone.
>
http://mobile.yahoo.com/maildemo
> -
2005\02\23@131617
by
Andre Abelian
part 1 1064 bytes content-type:text/plain; (decoded 7bit)
Martin,
Diodes are reversed and even not reversed your schematic
Is not going to work. See attachment
Andre Abelian
{Original Message removed}
2005\02\23@143348
by
Jinx
part 1 416 bytes content-type:text/plain; (decoded 7bit)
> Something like this (Attachment)?
More like this. I have similar switches, not 30m wires though,
running past petrol motors and RT radios with no problems.
Plenty of noise around too
> Is this a better solution than optoisolator?
Hard to say. The input to the opto could also be noisy. It's
something you'd have to sort out on site with a scope to be
absolutely sure
part 2 703 bytes content-type:image/gif; (decode)

part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)
2005\02\23@152122
by
Jinx
BTW, is this a toggle switch or push-button and how quickly
does the code have to respond ? You can optimise the closure-
detecting s/w for each
2005\02\23@160628
by
J. Gromlich
The only advantage - but a very BIG advantage - to using the
opto-isolator is that it can be designed so there is no galvanic
connection between the cable and the device being controlled.
In this case, the output of the opto-isolator would drive the PIC
input pin, while the input side of the opto would be driven from
the remote switch in a loop with on ISOLATED power supply.
A good opto will give you 1000s of volts input to output isolation
and have a very low value of capacitive coupling. With good RC
filtering at the opto out/PIC in there is very little chance of noise
triggering anything AND the galvanic isolation can protect the PIC
(or whatever) from even a accidental short to a 240 volt power line.
Roy J. Gromlich
>
> {Original Message removed}
2005\02\23@170628
by
Martin Tedjawardhana
Thank you all for the answers :-)
BTW. It is going to be a push-on button
On Thu, 24 Feb 2005 09:20:28 +1300, Jinx <EraseMEjoecolquittspam_OUT
TakeThisOuTclear.net.nz> wrote:
>
> BTW, is this a toggle switch or push-button and how quickly
> does the code have to respond ? You can optimise the closure-
> detecting s/w for each
>
> -
2005\02\23@182052
by
Jinx
> The only advantage - but a very BIG advantage - to using the
> opto-isolator is that it can be designed so there is no galvanic
> connection between the cable and the device being controlled.
Optical is a good way to go. A long long time ago I installed an
optical loop switch in a dirty and corrosive environment, made
from cheap figure-8 nylon optical fibre (1mm diameter). Light
from an LED went down one fibre and back down the other to
a photo amp. The switch was simply a plastic vane that blocked
or passed the LED's light from one fibre's end to the other. With
a little bit of tinkering it probably could have been made to work
with a single fibre. Length was a touch under 25m (50m overall)
and although intended to be used where metal wire and parts would
have disintegrated, it would have also been virtually immune to
outside interference. And is benign if faulty (ie nothing to short out
and start a fire in this case)
2005\02\23@213020
by
1 1
|
> > I need to connect a simple push-on switch with a PIC, but the
> > cable connecting it can be up to 30 meters. What are the
> > potential problems here? Interference and such?
>
> I'd suggest sending Vcc or high output out through a series resistor,
> eg 470 ohms, and the input pin (IP) pulled low with a resistor of
> around 10x this, or a value that ensures the signal comfortably falls
> outside the transition thresholds of the input. If the environment is
> or could be noisy, add a small cap (100n) from IP to Vss, 5V1 zener
> (k to IP, a to Vss) to clamp positive excursions and a Schottky diode
> (k to IP, a to Vss) to clamp negative excursions
I can't agree. A remote push button must be treated as a separate
device. So here grounding and shielding rules come with all these
circuit common reference wires attached to chassis ground.
That is, if grounding line is to be spread out of a reference point
anyway, then it would be better to add only one signal line, not two.
I'd suggest having a look at the so called "fool-proof input line"
scheme posted by me a couple of years ago.
I also placed the scheme in the left side-bar of
http://thepicster.blogspot.com
under the name "special input." Just add a capacitor between
the PIC input and ground.
Regards,
Mike.
2005\02\23@215822
by
Jinx
> I also placed the scheme in the left side-bar of
>
> http://thepicster.blogspot.com
>
> under the name "special input." Just add a capacitor between
> the PIC input and ground.
The OP did say he had no remote supply. I don't know if his
local supply is 12V or 5V or both
2005\02\24@192746
by
Bob Ammerman
For this 'long loop' design I would ensure that the switch path was low
impedance. This should greatly reduce its susceptibility to noise. Perhaps
one side tied hard to ground, and the other pulled up via a low resistance
resistor. The lower the better, within the current limitations of the wire,
switch, power supply, etc.
Bob Ammerman
{Original Message removed}
2005\02\24@200605
by
Richard.Prosser
Alternatively, and as something of a contradiction, constant current mode
is also good with respect to noise immunity, despite it being a high
impedance configuration. Even better if the swich is organised to provide
the constant current source say 4mA "closed", 20mA "open". Then you can
detect the "disconnected" and "shorted" modes also if that is of concern.
RP
For this 'long loop' design I would ensure that the switch path was low
impedance. This should greatly reduce its susceptibility to noise. Perhaps
one side tied hard to ground, and the other pulled up via a low resistance
resistor. The lower the better, within the current limitations of the wire,
switch, power supply, etc.
Bob Ammerman
{Original Message removed}
2005\02\24@225027
by
Jinx
> impedance configuration. Even better if the swich is organised to
> provide the constant current source say 4mA "closed", 20mA "open"
That would be a good solution, and could be fairly simple as there's
no need to be measuring intermediate values. Would it be possible
to use a PIC's ADC and/or comparator in a current loop ? Microchip
don't appear to have a 4mA-20mA app note for a lone micro
2005\02\25@072333
by
olin_piclist
Richard.Prosser@powerware.com wrote:
> Even better if the swich is organised to
> provide the constant current source say 4mA "closed", 20mA "open".
Um, switches tend to conduct a lot better closed than open.
*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com
2005\02\25@154837
by
Peter L. Peres
On Thu, 24 Feb 2005, Bob Ammerman wrote:
> For this 'long loop' design I would ensure that the switch path was low
> impedance. This should greatly reduce its susceptibility to noise. Perhaps
> one side tied hard to ground, and the other pulled up via a low resistance
> resistor. The lower the better, within the current limitations of the wire,
> switch, power supply, etc.
I think that the only reasonable way to make the line distance-proof is
to match it in impedance and limit the bandwidth on it as much as
possible. Limiting the bandwidth does not necessarily mean low pass
filtering, it could be done with AC at a higher frequency to escape
local noise sources. And adding bidirectional challenge/response
communication with a microprocessor at the far end would be even better.
What happens if that long wire triggers by mistake ?
Peter
2005\02\25@173901
by
1 1
|
Bob Ammerman wrote:
> For this 'long loop' design I would ensure that the switch
> path was low impedance. This should greatly reduce its
> susceptibility to noise. Perhaps one side tied hard to ground,
> and the other pulled up via a low resistance resistor. The
> lower the better, within the current limitations of the wire,
> switch, power supply, etc.
Bob,
Leave the "brute force" approach to the brainless political
clowns :-)
Bob, Schmitt Trigger input low levels
0,2 * Vdd = 0.4v for Vdd= 2v
30m distance results in 100m wire.
So, voltage drop at your super currents on 100m wire must
be much less 0.4v, say 0.1v.
Let your current be as huge as 0.1a.
That is the resistance of the 100m wire must be less than
1ohm. That's the "brute force" cable for 100ma current!
But this is only a fraction of a problem. You have to connect
your ground wire to the reference ground, not to PCB ground.
Your currents must go to the reference ground point not through
the PCB.
And there can exist some voltage drop between the PIC's
ground and the reference level. This makes the cable
even thicker.
Other "brute forcers" add these chaotic voltage drops preventing
(very rarely though, especially with the help of the dead fish)
Schmitt Triggers from switching to 0.
The best way to fight noise is rather to provide noiseless design
than to increase inputs' noise-immunity .
Best Regards,
Mike.
2005\02\26@072218
by
Gerhard Fiedler
Olin Lathrop wrote:
>> Even better if the swich is organised to provide the constant current
>> source say 4mA "closed", 20mA "open".
>
> Um, switches tend to conduct a lot better closed than open.
Um, yes, of course :)
But as I understand this approach, this is really not the point. The switch
wouldn't be connected to the wires...
Voltage Source >--------long wire-------------------+
|
--------------
| Controlled |----+
| Current | Switch
| Source |----+
--------------
Protected |
Voltage <--+-----------long wire-------------------+
Input |
R
|
Gnd
So whether it's easier to have 4 mA closed or 4 mA open depends a lot on
how you make the circuit in the current source. There are probably quite a
number of alternatives.
Gerhard
2005\02\27@140049
by
Richard.Prosser
|
If the supply is say, 12V and this passes to the line & switch then back
via a resistor to earth, you only need a schmitt trigger to detect the
switch openenig & closing. If you want to detect open and short circuits
then either use an analogue input or a simple window comparitor to check
the line is in the correct voltage range.
Using a higher supply voltage reduces the requirement of heavier conductors
mentioned by someone else, as the voltage drop of the cable is less an
issue.
i.e for a 12V supply, "5V" input a suitable sense resistor would be 220ohms
(4.4V at 20mA, 0.88V at 4mA). Then the voltage drop on the cable could be
as high as 6V or so, (allowing for the const current generator) - a cable
loop resistance of up to 300ohms (or 150ohm cable and 150ohm source
protection resistor ?).
If available, I'd probably use an adc input. - with heavy protection on the
incoming line. Probably with an opamp stage to isolate things even more
unless the environment is unusually benign.
Richard P
> impedance configuration. Even better if the swich is organised to
> provide the constant current source say 4mA "closed", 20mA "open"
That would be a good solution, and could be fairly simple as there's
no need to be measuring intermediate values. Would it be possible
to use a PIC's ADC and/or comparator in a current loop ? Microchip
don't appear to have a 4mA-20mA app note for a lone micro
2005\02\27@163346
by
Dwayne Reid
|
At 11:59 AM 2/27/2005, Richard.Prosser
spam_OUTPowerware.com wrote:
>If available, I'd probably use an adc input. - with heavy protection on the
>incoming line. Probably with an opamp stage to isolate things even more
>unless the environment is unusually benign.
Why bother with the op-amp? The requirement is to detect whether a switch
is open or closed - a simple binary choice.
Yes - you can use an a/d input and yes - you would filter and maybe even
clamp the heck out of the signal before feeding it to that input. But
suggesting to use an op-amp where is no need for one simply adds needless
complexity.
Keep in mind that you can make a nice 2 pole RC filter that still meets the
minimum input bias current specs for a few pennies. Add clamping diodes at
the mid-point of the filter for a couple of pennies more.
Add another diode across the resistor between the mid-point of the RC
filter & a/d pin and make the capacitor at the a/d pin large enough and you
eliminate the need for software debounce.
Change the a/d input to any input that has a schmitt trigger input and
eliminate the need for the a/d.
Lots and lots of choices. But no need for an op-amp
dwayne
--
Dwayne Reid <@spam@dwaynerKILLspam
planet.eon.net>
Trinity Electronics Systems Ltd Edmonton, AB, CANADA
(780) 489-3199 voice (780) 487-6397 fax
Celebrating 21 years of Engineering Innovation (1984 - 2005)
.-. .-. .-. .-. .-. .-. .-. .-. .-. .-
`-' `-' `-' `-' `-' `-' `-' `-' `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.
2005\02\27@175154
by
Richard.Prosser
|
If the only requirement is to detect a switch position I'd agree. However,
Jinx's reply had indicated he was considering the "open" and "Short"
circuit detection possibilities as well so I suggested the adc input.
Rather than running a raw adc input directly connected to the remote wire,
I would probably use an opamp to add an additional degree of protection.
RP
At 11:59 AM 2/27/2005, KILLspamRichard.ProsserKILLspam
Powerware.com wrote:
>If available, I'd probably use an adc input. - with heavy protection on
the
>incoming line. Probably with an opamp stage to isolate things even more
>unless the environment is unusually benign.
Why bother with the op-amp? The requirement is to detect whether a switch
is open or closed - a simple binary choice.
Yes - you can use an a/d input and yes - you would filter and maybe even
clamp the heck out of the signal before feeding it to that input. But
suggesting to use an op-amp where is no need for one simply adds needless
complexity.
Keep in mind that you can make a nice 2 pole RC filter that still meets the
minimum input bias current specs for a few pennies. Add clamping diodes at
the mid-point of the filter for a couple of pennies more.
Add another diode across the resistor between the mid-point of the RC
filter & a/d pin and make the capacitor at the a/d pin large enough and you
eliminate the need for software debounce.
Change the a/d input to any input that has a schmitt trigger input and
eliminate the need for the a/d.
Lots and lots of choices. But no need for an op-amp
dwayne
--
Dwayne Reid <RemoveMEdwaynerTakeThisOuT
planet.eon.net>
Trinity Electronics Systems Ltd Edmonton, AB, CANADA
(780) 489-3199 voice (780) 487-6397 fax
Celebrating 21 years of Engineering Innovation (1984 - 2005)
.-. .-. .-. .-. .-. .-. .-. .-. .-. .-
`-' `-' `-' `-' `-' `-' `-' `-' `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.
2005\02\27@183712
by
rosoftwarecontrol
I believe, very long wire has very high cost.
There is a point that wire cost is equal and start
go over the cost of RF/Wireless solution.
More... (looser matching)
- Last day of these posts
- In 2005
, 2006 only
- Today
- New search...