I have a heater remote that I want to press the buttons of with my Arduino. I am powering both the remote and Arduino from an external 5V source so both grounds are connected.

Currently I have tried using an NPN transistor(TIP122) and it does work but is not very reliable. It probably works 80% of the time but isn't good enough for my purpose. Sometimes nothing happens and sometimes the button is pressed twice for no reason.

These are my connections.enter image description here

I have the emitter connected to ground, collector connected to the button and the base connected to the Arduino with a 1k resistor. Are my connections OK?

I've also tried using a PNP transistor but pulling LOW instead of HIGH and LOW instead of HIGH.

The code is very simple, in the setup I have:

pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
digitalWrite(4, LOW);

Therefore when I restart the Arduino it should press the button, right?

I also have IRLZ44N and IRF540N, would either of these work better?

  • you have to press the button longer than 1/50th of a second – jsotola Jul 12 at 6:18
  • I have tried altering this. I've tried everything from 20-1000ms and they have all given similar results. – Username Jul 12 at 6:29
  • Are you sure, that the button simply pulls a pin to low? That might not be the case. I have solved a similar problem once by using a NPN transistor to bridge the button, instead of pulling it low. That seem to work pretty well, though I haven't tested it thoroughly. – chrisl Jul 12 at 6:39
  • When I tap the ground of the remote on a pin of the button, it "presses it". While I was testing and just doing this with a jumper wire, it seemed to work almost every time. – Username Jul 12 at 6:50
  • why do you use a transistor to pull other 5 V logic pin LOW? – Juraj Jul 12 at 7:42

You could do it as described in the Arduino StarterKit's book using an optocoupler.

  • Links tend to break, so to be useful to future visitors, it’s best to try to answer the question here. – RubberDuck Jul 15 at 0:01

A glance at the TIP22 datasheet shows that this is a Darlington pair transistor, which means that it has very high DC gain (good), but at the cost of a very high Vbe_ON (bad). The datasheet shows that the Vbe_ON is 2.5V, which means that the voltage across the 1K is only 2.5V max, which limits the base current to around 2mA. This is probably not enough for good saturation. In addition, the Vce_SAT for this device is about 2.0V, which may or may not be enough to look like a good GND to the button circuit.

I think a MOSFET like the IRF540N, connected as shown here (substitute button circuit for motor) might be a better choice YMMV

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.