SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By PointBlank017
#116327
Is there any way to adjust the input pin sensitivity on an Arduino Uno? My Arduino will literally detect inputs from my mere proximity to the board when the input being used has a wire lead coming from it.

Edit: Since I'm already asking for help, I've encountered another problem and I'm in need of some advice.

My goal is to take feedback from 3 different on/off switches independently and light LEDs according to a pattern determined by what switches are pressed. I was drawing power from the 5V pin, connecting three switches to power in parallel, running a lead after each switch to the Digital Input Pins, then a diode, then joining all three leads together again with a resistor before connecting to ground. My sketch (which I believe is okay) does not run with this circuit. No matter what switch is closed, the Arduino runs the loop inside main() endlessly.


Thank you for the help!
You do not have the required permissions to view the files attached to this post.
By MichaelN
#116336
PointBlank017 wrote:Is there any way to adjust the input pin sensitivity on an Arduino Uno? My Arduino will literally detect inputs from my mere proximity to the board when the input being used has a wire lead coming from it.
The inputs of microcontrollers have a very high impedance which explains why you are seeing this. I suggest you enable the pullup resistors on the affected lines, which ensures the logic state will be high unless you actively pull them low.
PointBlank017 wrote:Edit: Since I'm already asking for help, I've encountered another problem and I'm in need of some advice.

My goal is to take feedback from 3 different on/off switches independently...
That isn't a good way of doing things, as whenever you press one switch, the other 2 inputs will no longer be pulled down by the resistor (they will essentially be floating). Why not just do the following? I personally prefer switches pulling to ground (rather than 5V), although either would work. If you really want you can omit the resistors and use the internal pullups.
Image
By PointBlank017
#116351
Thank you for your reply. I eventually solved my problem by arranging the circuit in a similar way to option 2, however, I kept the doides because it seems that all inputs would receive signals if only one switch was closed. Option 1 eliminates this problem altogether. I will rebuild the circuit this way. Your help is appreciated.
By waltr
#116355
No, both circuits have total independent switches to the inputs. The only difference between the two options is the logic level of switch closed or open.

Diodes are not needed.
By PointBlank017
#116364
I tested the circuit exactly as it looks in Option 2 and indeed everything works. I now understand why the diodes are not necessary, but I don't quite understand what you mean by:
MichaelN wrote:the other 2 inputs will no longer be pulled down by the resistor (they will essentially be floating).
I've already witnessed that each switch does need its own resistor, but I can't wrap my mind around the idea that just one isn't adequate. Can anyone help explain how that works out?

Again, thank you all for the input. I'm new to electronics and your advice since I've started this project has been very helpful.
By triath5147
#116367
He's referring to your diagram I believe. With the set up you have, the diodes are after the connection that takes the signal to the Arduino input pin. Therefore it is blocking the flow of current from the pin to ground, and it is as if the pin is now floating in space, instead of being pulled to ground by the resistor. A teacher of mine used to compare electrical components to plumbing. The diode acting like a check valve, only allowing flow in one direction. Just like a water Check Valve, the Diode needs a certain amount of current to open, Just like there needs to be enough water pressure to overcome the spring pressure of a mechanical check valve. So to sum it up. The Arduino, on it's own without you telling it to pull or push current, does not have adequate water pressure to open the diode valve and therefore is left hanging out in space( floating). If you take the diode out, current is PULLED to ground ( following path of least resistance). Hope that helps and I didn't confuse the situation more.
By PointBlank017
#116482
@triath5147, It's interesting because the circuit seems to work even with the diodes. But here it is without them. Also shown is the early stage of what it will control.

Image