Go Down

Topic: Better to stand-by to the GND or to the PIN (Read 214 times) previous topic - next topic

wakareva

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?
Thanks,
Tomaso
.Giallo.

larryd

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

larryd

#2
Dec 29, 2019, 06:48 pm Last Edit: Dec 29, 2019, 06:49 pm by larryd
Depends, for noisy conditions, I prefer a N.C. switch going to GND.

Pull-up 1k or 2.2k







No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

wakareva

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

larryd

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

larryd

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

Wawa

#6
Dec 29, 2019, 11:15 pm Last Edit: Dec 29, 2019, 11:15 pm by Wawa
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.
Code: [Select]
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..


wakareva

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...
.Giallo.

MarkT

Quote
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.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up