Electronic – Ohm’s law and the voltage drop across a resistor

current-limitingdigital-logicohms-lawresistorsvoltage-drop

I'm trying to wrap my head around Ohm's law and there are plenty of similar questions already asked in this forum. But I just still don't understand it. It's about calculating resistor values.

Let's say that I have an IC which has an input pin I want to control high. I am doing this by connecting 3.3v to the input pin and I want to limit the current flowing to the pin to 2mA.

So by the use of Ohm's law I have calculated that 3.3 / 0.002 = 1650. So I would need a 1.65 KOhm resistor right?

So what happens to the voltage now? Shouldn't the voltage going to the pin be lower too because of the resistor? How can it still be 3.3v?

How about this? The supply voltage is still 3.3v but I need to lower the voltage to half for the IC, with a current of 1mA. So my calculation is (3.3 / 2) / 0.001 = 1650. The resistor value is exactly the same as before. 1.65 KOhm!

Can someone explain what I'm doing wrong? I feel really dumb right now.

Best Answer

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. A typical pull-up resistor application.

  • Generally you can assume that most CMOS style inputs are such high impedance that they draw such a small current that you can ignore it. (At high frequencies you have to take the input capacitance into account.)
  • With SW1 open (Figure 1a) no current flows through the resistor. The GPIO pin is pulled high as you required.
  • With SW1 closed (Figure 1b) then current flows and the full supply voltage is dropped across R2 so \$ I = \frac V R = \frac {3.3}{10k} = 0.33 \ \text {mA} \$.

How about this? The supply voltage is still 3.3v but I need to lower the voltage to half for the IC ...

In that case you use a potential divider.

schematic

simulate this circuit

Figure 2. A potential divider used to bias the non-inverting input to half-supply.

Here again the op-amp's input resistance will be very high. A pair of relatively low resistors is used to divide the supply voltage in two (or any other ratio you choose). The op-amp's input draws (or sources) such a small current that the divider voltage is not affected.


So I could just connect the 3.3v to the IC without a resistor, right? The resistor is there because otherwise the switch would create a short-circuit between V+ and GND when closed.

It depends what you are trying to do. If the input pin is always high then you can connect it to 3.3 V (note capital V).

schematic

simulate this circuit

Figure 3. Various configurations. Some are bad.

  • 3a can be used if you never have to switch the input.
  • 3b is bad because the input is floating. It will be susceptible to stray voltages and static and may switch randomly.
  • 3c is correct. The input is pulled to a defined level by the resistor or by SW1. The resistor limits the current to a small value.
  • 3d will also work without a resistor because it switches between two defined logic levels. Note that during the switch transition the GPIO input is not connected to anything (so it's temporarily like 3b) but the small input capacitance will probably suffice to hold the voltage steady until the other contact is made.