I have several switches as inputs for a project, but I am setting the inputs to use internal pull-up resistors so the switches ground the pin. Do I still need resistors (10K) in series with the switch or can I leave it as is? I don't think I need the resistors because I'm no longer sinking current into the pin.
IO Resistors
(4 posts) (3 voices)-
Posted 5 years ago #
-
Is there a chance that the switch might get shorted onto something?
If you are certain there is no chance of misconnection, then there is little point protecting the pin.Posted 5 years ago # -
the short answer is no, you shouldn't need additional resistors, though it may be safer to use them.
you can also test to make sure your assumptions are correct.
if you have the internal pullup's enabled, then a) the pin should be at 3.3v when nothing's connected. verify this with a multimeter if you have to, and b) connecting the pin to ground will not cause a direct short from vcc to gnd since there is a resistor in series. if you have an ammeter, you can use one to verify this, though you may wish to add a second, external resistor in series for your first measurement to make sure it behaves as expected. (i.e. the current measured should be (3.3v / (Rint + Rext)))
Posted 5 years ago # -
I should add ...
If the question relates to your engine project, which I assume has a battery of much higher than 3.3V voltage, then I would leave series resistors in to protect the processor a little. A dead-short from, say, a 12V battery to a pin will quickly 'release the blue smoke' (fry it). Likely pins to get shorted are ones which are attached to wires, e.g. switches.
The STM32F103xB documentation (Table 7) says the maximum injected current is 5mA, so it'd take a few K to protect a pin.
Posted 5 years ago #
Reply
You must log in to post.