1
\$\begingroup\$

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.

\$\endgroup\$
10
  • \$\begingroup\$ What IC are you using? Most ICs are designed so that, if you don't apply a voltage outside the power rails, the input current will be limited by the IC itself, and no external resistor will be needed. \$\endgroup\$
    – The Photon
    Apr 26, 2020 at 13:44
  • \$\begingroup\$ The datasheet says "Logic control input pin current MIN -30, MAX +30 mA. \$\endgroup\$
    – Czab
    Apr 26, 2020 at 14:57
  • \$\begingroup\$ Please share a link to the datasheet. Elsewhere it probably tells you that if you don't abuse the chip, the actual current will be at most a few microamps (for a CMOS digital input) or maybe a milliamp (for TTL). \$\endgroup\$
    – The Photon
    Apr 26, 2020 at 14:58
  • \$\begingroup\$ ti.com/lit/ds/symlink/tmux1574.pdf?ts=1587827401925 \$\endgroup\$
    – Czab
    Apr 26, 2020 at 15:02
  • \$\begingroup\$ Okay, a switch chip is more complicated. Now, if you're asking about the S or D I/O's, the current in will depend on what's connected to the other side of the switch (D or S pins). If you're asking about the EN or SEL inputs, look for the line about "input high leakage current" or "input low leakage current". \$\endgroup\$
    – The Photon
    Apr 26, 2020 at 15:09

6 Answers 6

1
\$\begingroup\$

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.
\$\endgroup\$
9
  • \$\begingroup\$ Ok. 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. \$\endgroup\$
    – Czab
    Apr 26, 2020 at 11:11
  • \$\begingroup\$ Thanks for the answer! It was really helpful. \$\endgroup\$
    – Czab
    Apr 26, 2020 at 11:17
  • \$\begingroup\$ See Figure 3, etc. Don't forget to accept an answer after a day or two. \$\endgroup\$
    – Transistor
    Apr 26, 2020 at 11:23
  • \$\begingroup\$ Figure 3c is what I want, except I want the input to normally be low and the switch to make it high. So the resistor needs to be between GND and the GPIO. \$\endgroup\$
    – Czab
    Apr 26, 2020 at 11:29
  • \$\begingroup\$ Correct. I think you've got it. I've added 3d for interest. What are you making? \$\endgroup\$
    – Transistor
    Apr 26, 2020 at 11:32
0
\$\begingroup\$

That is the limit, when there is 3.3V over the resistor. If there is no current flowing, there will be 0v over the resistor, 3.3V on both sides.

\$\endgroup\$
0
\$\begingroup\$

It looks like you have Ohm's law under control, but you don't know how the input pin of an IC works.

You only get a voltage drop across a resistor if there is a current flowing through it. The drop is proportional to the current.

schematic

simulate this circuit – Schematic created using CircuitLab

How much current flows through R1 if your digital signal is 3.3 volt? Roughly zero amperes. The input has a very high impedance, high enough that we can round it down for this purpose. 0 amperes * 1650 ohm = 0 volt drop.

Only if the IC is damaged to short-circuit the input to ground, or if the pin is configured as an output, will you ever get the full current through R1. In this case, your calculations are correct, and the resistor will limit the short-circuit current to a harmless 2 mA.

Since this is an unusual case, you rarely see this type of protection. Often you put the current limit at the power supply, or you have some special needs - hot-plugging, test hardware, extra robust, etc.

\$\endgroup\$
5
  • \$\begingroup\$ I see. It's starting to make more sense now. Except I don't quite understand how there can be voltage if there's zero amperes? \$\endgroup\$
    – Czab
    Apr 26, 2020 at 11:01
  • \$\begingroup\$ @Czab You have same voltage at both the ends of the resistor, so the potential difference is zero. That is why you can have zero ampere. The flow of current requires potential difference across a resistor. \$\endgroup\$
    – sarthak
    Apr 26, 2020 at 11:05
  • \$\begingroup\$ I just assumed the input pin would draw more current. But thanks for the answer! It helped. \$\endgroup\$
    – Czab
    Apr 26, 2020 at 11:16
  • 1
    \$\begingroup\$ The input will draw current. The value of that current (or range of values) will be stated in the datasheet for that specific IC ... so read it. A typical value for a digital input might be 1 uA, or less than 10 uA. Which is why @pipe says, roughly 0 amperes. \$\endgroup\$ Apr 26, 2020 at 11:34
  • \$\begingroup\$ The datasheet says "Logic control input pin current MIN -30, MAX +30 mA". \$\endgroup\$
    – Czab
    Apr 26, 2020 at 14:56
0
\$\begingroup\$

It seems that in first case you want to limit current to the input but want to supply the full voltage source to the input.

For that i suggest you to connect source, pin and resistor all in parallel. It will make a current divider. Will limit the current flow to the pin because some current from the voltage source will go to resistor and then you will be able to send the remaining current to the pin.

For second case where u want to limit voltage and the current for the input you will have to use the voltage divider. By using the voltage divider you can give input to the pin from the outputs of any resistor of the voltage divider circuit and you will be able to limit the current also by using proper resistors in the voltage divider circuit.

\$\endgroup\$
0
\$\begingroup\$

In comments you revealed that your question is related to the SEL and EN input pins of a TMUX1574 switch IC.

Like digital input pins typically are, these pins are designed to not draw significant current so long as the input voltage is between the power supply rails:

enter image description here

In some digital ICs, higher currents might be drawn if the input pin is driven above Vdd or below ground, by more than a couple hundred millivolts. In this chip, voltages above Vdd (up to 5.5 V) are acceptable, but voltages below ground should probably still be avoided, according to the recommended operating conditions table

enter image description here

Very likely you don't require any current limiting resistors in your application.

\$\endgroup\$
0
\$\begingroup\$

The IC input itself will have a resistance and capacitance (complex input impedance), so you need to use a resistor divider calculation to get the current.

The resistive component of the input impedance of typical IC inputs is relatively high, so current will only flow during a tiny transient interval (after a switch closure) to charge up the tiny input capacitance to the new voltage level (on both sides of your series resistor).

\$\endgroup\$

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.