Better to stand-by to the GND or to the PIN

Hi Everyone,
I have a circuit, and it works (but if you see some issue please write to me), see attached.

The question is:
since I have a tilt component and I can put it up or down in my final version, in this situation is better to have a normal operation with the tilt open (and let the V5 connected to the PIN) or closed (and have the V5 connected to the GND through a R)?

Or said in a different way: one of the two options have a problem long term regarding heating and working?


Depends, for noisy conditions, I prefer a N.C. switch going to GND.

Pull-up 1k or 2.2k

Thanks. Do you think that a R10K is too much? I'm considering to change the circuit to a pulldown, better?

10k would probably be okay.



The easy/safe way to connect a switch to the Arduino is to connect the switch between pin and ground. And use the internal pull up on the pin, so you don't need any external resistor at all. The pin is normally HIGH, and becomes LOW when the switch is closed.

const byte switchPin = 2;

void setup() {
  pinMode(switchPin, INPUT_PULLUP); // enable internal pull up

void loop() {
  if (digitalRead(switchPin) == LOW) // if pressed/closed
    // do things

150k is waay to high for LEDs. You probablly won't be able to see them lit up with that value. Maybe you meant 150 ohm. Leo..

Thank you larryd for the schema, very useful.

Wawa, I've tried without R using the pin HIGH but the board start overheating, and I don't know way...

I've tried without R using the pin HIGH

Not sure whether you are talking about switch or LED. You must use a series resistor to drive an LED, 150 ohms or more, or you will overload the chip and the LED and can damage both.