Go Down

Topic: Tactile button maximum cable lenght? (Read 5089 times) previous topic - next topic

MrGlasspoole

Hi,

what is the maximum cable length to connect a tactile button to the Arduino?
What cable would be the best (awg)?

CrossRoads

You can probably go pretty far, may need to add addtional pullup resistor to ensure  a good high level when the switch is open.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

MrGlasspoole

Or pulldown. But what do you mean by additional?

So 10-20 meters will not be a problem?
Maybe shielded cable?

I also have some water flow sensors here - here also I ask myself how long I can make
the cable.

CrossRoads

This is what I mean by additional - not relying on internal pullup resistor.

Hard to say about the flow sensor without any data.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

MarkT


Or pulldown. But what do you mean by additional?

So 10-20 meters will not be a problem?
Maybe shielded cable?

I also have some water flow sensors here - here also I ask myself how long I can make
the cable.


_Definitely_ shielded cable for that length, and some protection at the Arduino end from transients (1nF -- 10nF or so to ground?).  
Where-ever you run cables for long distances near mains wiring (hard to avoid) you should expect switching transients to be an issue.
[ I won't respond to messages, use the forum please ]

fungus


what is the maximum cable length to connect a tactile button to the Arduino?
What cable would be the best (awg)?


I dunno, but it's a looooooong way.


Do the math:

At 5V DC the AVR chip recognizes anything below 1V as "LOW" so you can afford to lose 4V over the wire.

The internal pullup resistors are about 30K Ohms so a pin will put out 0.15mA when configured as an input with pullup enabled.

Here's a table of wire gauges with resistances in ohms per kilometer (or kilofeet if you're still using old-fashioned units):

https://en.wikipedia.org/wiki/American_wire_gauge#Tables_of_AWG_wire_sizes

You've now got two of the variables in Ohm's law (current and resistance) so the rest is easy.

V = R * 0.00015

Any value of R that gives an answer less than 4V over your required distance is good enough (though you may want to limit it to 1V just to be on the safe side...)

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

CrossRoads

1V is not correct.
V in high minimum with Vcc = 5V is 0.6 * Vcc, or 3V.
V in low maximum with Vcc = 5V is 0.3 8 Vcc, or 1.5V.
So you want that pin sitting above 3V when the switch is  open, or below 1.5V when it is closed.
1.5V to 3V, you may get high or low readings from that.

See Table 29-1 in the '328 datasheet.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.



what is the maximum cable length to connect a tactile button to the Arduino?
What cable would be the best (awg)?


I dunno, but it's a looooooong way.


Do the math:

At 5V DC the AVR chip recognizes anything below 1V as "LOW" so you can afford to lose 4V over the wire.

The internal pullup resistors are about 30K Ohms so a pin will put out 0.15mA when configured as an input with pullup enabled.

Here's a table of wire gauges with resistances in ohms per kilometer (or kilofeet if you're still using old-fashioned units):

https://en.wikipedia.org/wiki/American_wire_gauge#Tables_of_AWG_wire_sizes

You've now got two of the variables in Ohm's law (current and resistance) so the rest is easy.

V = R * 0.00015

Any value of R that gives an answer less than 4V over your required distance is good enough (though you may want to limit it to 1V just to be on the safe side...)




I dont think the resistance is the problem... I would more worry about induced currents and capacitance. Therefore it mainly depends on your environment.

fungus


So 10-20 meters will not be a problem?
Maybe shielded cable?


Should be no problem at all (so long as you don't pass next to any spinning magnets).
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

fungus


I dont think the resistance is the problem... I would more worry about induced currents and capacitance. Therefore it mainly depends on your environment.


I don't think capacitance matters for a push button.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

retrolefty



I dont think the resistance is the problem... I would more worry about induced currents and capacitance. Therefore it mainly depends on your environment.


I don't think capacitance matters for a push button.




I agree. The high voltage switching margins for a AVR input pin (.3vcc/.7vcc) gives the input pin quite a bit of 'noise immunity' and one should be able to run a passive switch contact a pretty long distance. I would consider using an external pull-up resistor of 1K ohms to lower the overall impedance of the switch wiring 'loop'. Anyway, as with any passive switch input you should use some kind of software debouncing function anyway, so any capacitance and inductive effects of a long wire run will not be a factor, you could probably reliably read a passive switch contact with a 1000 ft of twisted pair cable if you really wanted to. The problem with long cable runs is when one is trying to pass higher speed data signals where the cable run capacitance and inductive reactance has an effect of signal rise time, fall time, signal reflections, and external EMI interference.

Lefty

Go Up