i have a project that requires multiple buttons......i have each button using its own 10k resistor.....the fist circuit was perfect....10k on the money!! when i put in the 2nd button circuit the resistance drops to 5k and so on.....i cant for the life me figure out what im doing wrong!! any help would be appreciated!! i have a screenshot of the wiring.....the switches are approx. 25' away from the arduino.
larryd:
i was under the impression that the internal PULL_UP wasnt enough to use over long-ish distenses.......my switches are about 20-25' away from the arduino....im using cat5e with each pair shielded and a shield over the all for pairs. if thats not enough shielding then im at a loss as to how to proceed
chriswheelz:
i was under the impression that the internal PULL_UP wasn't enough to use over long-ish distances.......my switches are about 20-25' away from the Arduino....I'm using cat5e with each pair shielded and a shield over the all for pairs. if that's not enough shielding then I'm at a loss as to how to proceed
And that is generally correct, you probably do want "stiffer" pullups for very long cables because of the potential for interference pickup and leakage currents.
So for starters, the switches should connect to ground. This is a matter of sensible safety, in the case - however improbable - of a fault, the most likely fault is a short to ground. If the switch wire shorts to ground, then it merely exhibits as if the switch was closed. While that may be bad, it is in the vast majority of circumstances better than having the supply voltage shorted to ground so if you can avoid having the supply voltage itself being taken out along your cable, that is absolutely preferable.
Your additional pullup (you might as well use INPUT_PULLUP as a default) will be adjacent to the Arduino, connected separately from each input to Vcc and somewhere in the range 1 to 10k. 1k will draw 5 mA when the button is pressed, so a reasonable amount, but if you have no problems with 10k, use that.
In addition, a 0.1 µF ceramic capacitor between each input pin and ground will suppress interference picked up by the cable and provide a degree of debouncing however you should be using software debouncing for the buttons. I advise a debouncing algorithm that checks for a sustained change in the input statue on every pass of the loop over a period of some ten milliseconds, timed by seeing millis() advance by that number. All eight buttons can be debounced simultaneously when you read them into a single byte (which you can do here using port-wide read operations).
Paul__B:
wow thats a lot of info 8-)!!! thank you!! so im installing a wheelchair lift in my van for my mother.....i have upgraded the motors and im trying to automate the operation so she can use it on her own, to try and regain some independence.....
im using a mega to control everything so pins and space for the code isn't an issue....im still fairly new to the arduino scene but i have learned a ton from doing smaller projects.....i have had so many setbacks in this project and im trying not to get frustrated!! would you be willing to collaborate more on this? i can send you what ever you need!!