I want to use my Raspberry Pi as a remote power management device to turn my home server on and off. I would also like to monitor whether the server is on or off by using the power LED pins on the server's motherboard which I have measured provides about 5V when the server is on.

Since the Raspberry Pi GPIO pins work with 3.3V I am using a simple resistor voltage divider to bring the 5V down to 3.3V as suggested here: https://elinux.org/RPi_GPIO_Interface_Circuits#Voltage_divider. The article suggests using a 33k and a 18k resistor. (I have calculated the ratio between the resistors should be 17:33, but the article uses a 33k and a 18k resistor since I think 17k resistors are difficult to come by)

My question is how I can be sure that the resistor values used in the article will not allow more that 0.5mA (as suggested here https://raspberrypi.stackexchange.com/questions/3209/what-are-the-min-max-voltage-current-values-the-gpio-pins-can-handle) to flow into the GPIO pin of the Pi since the voltage division relies only on the ratio between the resistors and not the actual sizes of the resistors.


simulate this circuit – Schematic created using CircuitLab

I was thinking of applying Kirchhoff's current law at Node 1 in the schematic above which would yield: $$ i = \frac{3.3V}{18kΩ} - \frac{3.3V}{33kΩ} = 83.33μA $$ which is well within the current limit of the GPIO pins, but I am unsure whether it is applicable in this case.


It is wrong.


simulate this circuit – Schematic created using CircuitLab

As I understand the GPIO is in the Input mode (or analog mode). (Output mode when connected to the circuit which actively drive the pin can damage the pin - so be careful). In this mode pin has a very high impedance - lets say much more than 10MOhm (R1). R1 & R2 are in parallel and its resistance is 32891.458hms. The current sourced from the 5V is 5V / (18k + 32891.458) is 98.24uA. The voltage drop across the R1 & R2 is 98.1uA * 32891.458Ohms = 3.231V So the current which flows through the Raspberry PI pin (R1) is 3.231V / 10MOhm = 0.32uA

In the low power uC this current is much lower as the PINs input impedance is much higher than 10MOhm

  • \$\begingroup\$ Indeed, the current is so low it can be ignored. But why would RPi pin get damaged if it was accidentally an output? (Hint: it would not get damaged - the network looks like a 10k pullup to 3.3V for all purposes). \$\endgroup\$ – Justme Oct 19 '19 at 0:47
  • \$\begingroup\$ @Justme Output pin has a very low impedance. If it is driven low it effectively shorts it to the ground. In this case current will not damage it - but it good to remember what may happen if one pin is low and another high. It is safer to configure output pins if they are connected to something which actively drives the line as OC ones \$\endgroup\$ – P__J__ Oct 19 '19 at 1:23
  • \$\begingroup\$ I know how an IO pin works. If you now agree it does not get damaged after all, why not edit the false statement away from the answer? \$\endgroup\$ – Justme Oct 19 '19 at 1:29
  • \$\begingroup\$ So what is the point of connecting voltage divider to the output port? \$\endgroup\$ – P__J__ Oct 19 '19 at 10:07
  • \$\begingroup\$ You claimed it will be damaged if it were an output. There is no point of it being output of course as it is supposed to be an input. It would not be an output unless there is some coding or prototyping error, and even if it were an output due to some accident, it would not get damaged. \$\endgroup\$ – Justme Oct 19 '19 at 10:25

You have some errors in the calculations. And actual values of resistors does matter, not only their ratios. If you keep the ratio but divide the values by 10 it would allow 10 times more current and if there is a mistake in wiring more than 0.5mA would flow.

Let's simplify a bit. Imagine 5V supply and 10k resistor shorted to ground. I=U/R so max available current is 0.5mA. So as a safety feature you could add a 10k resistor from RPi pin to whatever circuitry, but it is not necessary.

Now, since you have 18k resistor, available current will be of course less, even less than 0.3mA, no matter what.

The input can be assumed to draw no current so total resistance is 51k. It means less than 0.1mA flows from 5V to ground. Voltage at RPi input would be 3.2V so good enough.

  • \$\begingroup\$ he is not asking about the voltage - but current through RPi pin. \$\endgroup\$ – P__J__ Oct 19 '19 at 0:30
  • \$\begingroup\$ It is a 3.3V CMOS input which is not 5V tolerant so when voltage is kept at 3.3V or below there will practically be no current flowing in. If the voltage is taken above 3.3V then the current must be limited to 0.5mA to prevent damage. I explained that 0.5mA would never flow into RPi even if it is unpowered when there is at least 10k from 5V to RPi input. What else do you need? \$\endgroup\$ – Justme Oct 19 '19 at 0:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.