Pages: [1]   Go Down
Author Topic: Tactile button maximum cable lenght?  (Read 3066 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 544
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can probably go pretty far, may need to add addtional pullup resistor to ensure  a good high level when the switch is open.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 544
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Hard to say about the flow sensor without any data.


* long_cable_switch.jpg (31.08 KB, 960x720 - viewed 47 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Shannon Member
****
Karma: 214
Posts: 12406
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 149
Posts: 5626
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...)

Logged

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 544
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Riga, Latvia
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 149
Posts: 5626
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

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

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 149
Posts: 5626
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1]   Go Up
Jump to: