2

I have a small device with a simple push button. I'd like my Arduino to be able to make the device register button pushes. It seems like the best way to do this is to use a transistor to close the circuit for the button when my Arduino sends it a pulse from one of its pins. I've mapped out what I think the circuit should look like on a breadboard. I didn't include the device in this diagram, but it's powered by a CR2032 watch battery, which seems to give 220 mAh at 3Vs.

Basically, the two sides of the button would be connected to the transistor's collector/emitter leads. Then the digital pin on my Arduino would be connected via a resistor to the base lead on the transistor. When the pin sends some current to the base lead, the transistor will make current flow through it and the device will register a button press.

Example circuit

I made this by adapting the circuit here, which looks like this: Base circuit

Basically I got rid of the motor/load and flyback diode, and hooked the two ends of the device's button up to the collector/emitter leads of the transistor.

I'm concerned that I've screwed up this circuit somehow, and will fry either the device or the Arduino or something else when I try and run it, otherwise I'd just test it right away.

Could anyone give me feedback if I'm on the right track here? I couldn't find other answers which dealt with quite this setup, where you are pressing a button on another device, though this question seemed related.

0

Yes, you have screwed the circuit up slightly.

You want to lose the red wire between the collector and +5V otherwise when you turn the output pin HIGH the transistor will explode.

Also you need to make sure that the ground of the Arduino (emitter of the transistor) is connected to the - of the target circuit and that the button you are "pressing" is an active-low system with internal pullup. If it's not then you will have to come up with another way.

An opto-isolator is a better choice than a transistor when you don't know the internal circuitry of the target device:

enter image description here

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.