# Calculate resistor value for GPIO pin on Raspberry Pi for input mode

I want to place a 4-way DIP switch to enable setting the "operation mode" for my Pi project. The GPIO pins will be in "IN" mode with "PullDown" flag enabled.

How do I calculate the value for R??

I wonder if 1K resistor is going to be too much? I read that it is recommended to use at least 1K resistor to protect the GPIO pin from overload.

From what I know the voltage drop is calculated as V=IR, which means if we have 50mA current as produced by 5V rail ( not sure what is the impedance of RPi GPIO in input mode), and 1000 Ohm then the voltage on GPIO PIN is going to be about 4.9 V.

Am I missing something?

• R=0 . With GPIO pull-down enabled. Or you may connect PWR_FLAG to GND and use GPIO pull-ups. PWR_FLAG may not be connected in any way to 5V!! Sep 18, 2021 at 18:37
• So what are you trying to do? If the DIP switch is open, the IO pin will float, which is invalid unless input has pull-down enabled. When DIP switch is closed, it connects IO pin via resistor to something -what voltage is at top of the resistor? The IO pin only tolerates 3.3V, connecting it to 5V, even via a resistor, would not be good design either. Sep 18, 2021 at 18:41
• @Justme I am planning to pull-down on the input GPIOs ( updated the post as well ). Sep 18, 2021 at 18:42
• @MarkoBuršič Rignt, I just read that for the input only 3.3V is acceptable, anything higher will damage the circuit. So basically I don't need any resistor whatsoever as soon as I connect the input for DIP to 3.3V on RPi itself? Sep 18, 2021 at 18:43
• No, the GPIO will be HiZ at startup, so no current will flow. After you will configure it as INPUT and PULL-DOWN, then it will sink 3.3V/Rpulldown. After that you have a valid state that you can read. Sep 18, 2021 at 18:48