does anyone foresee a problem with using a looooooong wire, specifically, same diameter as hookup wire, but 20m long, dual core with a switch at the end, connected the standard switch way 5v >> arduino pin >> 10k resistor >> gnd?
if a problem is foreseen, how would i go around fixing it!
kelvinmead:
does anyone foresee a problem with using a looooooong wire, specifically, same diameter as hookup wire, but 20m long, dual core with a switch at the end, connected the standard switch way 5v >> arduino pin >> 10k resistor >> gnd?
if a problem is foreseen, how would i go around fixing it!
Not really a problem with just a manual switch. Switch bounce may be a little longer then normal but that can be handled in software as always. Wouldn't harm to also wire a .1ufd cap from the input pin to ground.
You don't say what will bring the pin high.
Preferable would be a 4.7K pullup to 5V located at the arduino input, with the switch connecting the pin to Gnd when closed.
kelvinmead:
does anyone foresee a problem with using a looooooong wire, specifically, same diameter as hookup wire, but 20m long, dual core with a switch at the end, connected the standard switch way 5v >> arduino pin >> 10k resistor >> gnd?
20m is nothing for a switch.
Transmission of data at MHz frequencies? Yes. A switch...? No problem at all.
Move R1 between S2 and +5, with D2 connected between R1 and S2. Then if something happens at you switch or to the wire, you are not shorting +5 to Gnd, you are only connecting the pin to Gnd.
The how long depends on the wire+switch+connectors resistance.
You need D2 to go below 1.5V (0.3 x Vcc from section 29 of the datasheet).
Using Ohms Law: Vout = 5V x Rwire/(R1 + Rwire)
Solving for Rwire = 1830 ohm for Vout to be 1.4V
(with R1 = 4.7K, which also limits the current out to the switch to ~1mA - vs unlimited as you have it drawn)
kelvinmead:
out of interest, what would be too long... i suppose the resistance of the wire before the interference?
but 100's of metres, 1000's of metres?
Here's a table of Ohms per kilometer based on wire gauge:
The Arduino recognizes "HIGH" at about 2.5V so you can lose 2.5V in the wire to the switch (and back again to the Arduino). Assume a current of a couple of milliamps, the rest is Ohms law.