How to tell what current-limiting resistor to use

I'm having my Arduino Leonardo substitute a few buttons in a device. In the buttons, one pin connects to ground with the other going to a microcontroller. I figured I could connect an NPN transistor in parallel, with the emitter to ground, the collector to the microcontroller, and the base to a resistor and my Arduino. How do I choose this resistor? Every guide I found involves getting the current load, and I don't know how to do that. I'm thinking I can just put in a 10k resistor and be fine, but I want to make sure. Thanks for any help

It depends on the circuit you are controlling. In most cases, where the connection is into a microcontroller pin itself, the pin will be pulled up by a resistor in the device. All you do then is connect the transistor directly across the button pins, no need for a resistor in the collector/emitter circuit.

You'll need 470 ohm resistor on the base though.

4lifenerdfighter (author)  steveastrouk4 years ago
Yes, I was wondering about the base. Thank you for the 470 number.