I am in the process of designing a pcb for my project that requires me to read the state of multiple push buttons and switches.
I know that to avoid any reading errors i need to incorporate pull up resistors.
So i am wondering if it is best practice to incorporate these resistors in the circuit board or can i use the "input_PULLUP" command in my code to achieve the same result.
If including the resistors in the circuit board is preferred is there any benefit to using pull up resistors over pull down resistors.
My thinking is to use pull down resistors so when the switch or botton is in the off position then the line is pulled down to ground so no current can flow. Im thinking of it as a safety mechanisms as if something is going wrong then Instinct is to turn it off which will only stop the current if pull down resistors are used if my thinking is correct?
Any help or advice will be muchly appreciated thanks.
External pullup resistors are better where a stronger pullup is necessary. Like long wires (antenna) between a switch and processor or electrically noisy environments. A switch on a PC board inches from the processor will probably be fine with internal pullups.
Switches wired to ground (active low) with internal pullups only need 2 wires to them. Ground and signal. Switches with pulldowns need 3 wires and a physical resistor. One of the 3 wires is always hot and will cause a problem if it contacts ground.