220R is way too low, that is 20mA per switch. I would use 4k7 as a standard pull-up/down value.
A really useful rule to learn is Ohms law : V = IR.
I would forget about wiring the switch that way, do it properly.
http://www.thebox.myzen.co.uk/Tutorial/Inputs.html
Grumpy_Mike:
I would forget about wiring the switch that way, do it properly.
http://www.thebox.myzen.co.uk/Tutorial/Inputs.html
I appreciate all the input. Looking over that article it doesn't really conclude with a definitive answer as to which, the pull-up or pull-down are a better solution. Reading it kind of makes me think that pull-up is a more viable option because of the comments at the end of the article? So, I will proceed with testing this, I really appreciate the help guys!!
One major advantage of using the pull-up is that you can use the internal pull-up resistors of the Arduino (add pinMode (port, INPUT_PULLUP); to use them). That saves you on external components, and makes the overall wiring just a bit simpler.
wvmarle:
One major advantage of using the pull-up is that you can use the internal pull-up resistors of the Arduino (addpinMode (port, INPUT_PULLUP);to use them). That saves you on external components, and makes the overall wiring just a bit simpler.
Sounds like pull-up and pull-down are digital input connections right?? This probably wont work because I am using only analog inputs through the 16 MUX chips.
Well, yes, of course. Switches by nature go ON and OFF and that is a digital signal. Connecting that to an anlog port will basically get you readings of 0 and 1023 (or whatever the maximum value is for your analog port).
I may have missed something but I assumed these switches are connected to the Arduino which has those internal pull-ups. For connections to your MUX chip, you may need that external resistor anyway.
ndstudio:
Looking over that article it doesn't really conclude with a definitive answer as to which, the pull-up or pull-down are a better solution.
Maybe I was not forceful enough. An external pull down resistor is NOT the preferred answer. I attempted to say why but I think you have missed it.
Sounds like pull-up and pull-down are digital input connections right??
No you often use them with analogue connections as well.
Gotcha, going with the external resistor 3.3k pull-up seems to be working pretty good. I'm not seeing any drop in voltage on the first 3 that I have tried so far.
As for completing this project with a total of 256 analog inputs with about 80% of them 10k pots and 20% of them being pull-up switches. I should be good on what the Arduino Mega can deliver as far as current draw and etc.
For the switches here, I would suggest both a pullup and pulldown are needed,
When the switch is open, the pullup will ensure a high signal.
When the switch is closed,the pulldown will ensure a low signal.
You don't want a floating input to feed thru the analog switch to the Arduino input. You don't want 5V connecting directly to an input for providing a level, it's too easy to make a wiring mistake and short 5V to Gnd,
Changing the Arduino pin to
pinMode (pinX, INPUT_PULLUP);
and reading it with
if (digitalRead(pinX) == LOW){
// switch is closed
}
and then toggling the mux input between open and closed to Gnd should be sufficient.
