I soldered a cable to the button of a remote control and I want to simulate that button press by setting the pin to input mode and back to output (LOW) again.

For this to work I connected the ground of the battery (black wire) to the GND of the arduino.

Is this 100% safe if I hook the arduino up to the power grid or to my pc?

I also disconnected the ground pins and had my arduino connected to my pc and suddenly it worked too. I got a BSoD shortly after.

  • What is the voltage of the power grid?
    – VE7JRO
    Commented Feb 7, 2018 at 22:42
  • I think the battery has like 17,5 volts.
    – Tvde1
    Commented Feb 7, 2018 at 22:52
  • 1
    had my arduino connected to my pc and suddenly it worked too ... what worked?
    – jsotola
    Commented Feb 8, 2018 at 5:55
  • 1
    what kind of a remote control? ... you have provided almost zero information in your post.
    – jsotola
    Commented Feb 8, 2018 at 6:02
  • The remote has a battery and buttons and an antenna. My goal is to be able to simulate a button click with an arduino. I also was able to simulate the button press without the two grounds connected.
    – Tvde1
    Commented Feb 8, 2018 at 6:24

2 Answers 2


All grounds should be connected to provide a common reference point.

  • 2
    Unless you use galvanic isolation.
    – Majenko
    Commented Feb 8, 2018 at 10:39

Unless you use galvanic isolation (see below) then yes, you must connect the grounds together. That is vital (see here).

The main concern though is the voltage you are switching. The Arduino cannot connect any of its IO pins directly to any voltage over 5V. Doing so will most likely damage your Arduino.

Instead, you need to use the Arduino to switch a device that will switch the button for you. The simplest is a BJT or MOSFET:


simulate this circuit – Schematic created using CircuitLab

But there are a couple of other caveats you should consider. The most important one is to do with how far away the remote device is, and how it is powered. Connecting the grounds of two devices that are very distant can get quite messy, since "ground" at different points may be at completely different potentials, and the voltage drop across the "ground" wire (wires don't have zero resistance) coupled with the existing ground connection through the power supplies creates a ground loop and introduces massive amounts of interference. For this kind of arrangement, it is good to introduce ...

Galvanic Isolation

This electrically separates the two circuits completely. There is absolutely no electrical connection between your Arduino and the device you are switching.

The most common way of achieving this in low powered digital circuits is to use an opto-isolator (also called an opto-coupler). This is basically an LED and photo-transistor together in a single package. Turn the LED on and the phototransistor turns on. The basic arrangement is exactly the same as the circuit above, but the wire going in from the Arduino is connected to an LED:


simulate this circuit

Now you really don't care what ground potential is at the other end, nor how it is powered. As long as the opto-isolator can cope with the voltage it has to switch all will be good. Nothing in the remote circuit can do any damage at all to the Arduino since there is no way for current to flow back from that circuit to the Arduino.

  • But I should not be scared that connecting the grounds and powering the arduino by pc or by dc will in any way damage the battery or do something to the power cirquit in my house?
    – Tvde1
    Commented Feb 8, 2018 at 11:02
  • Just connecting grounds? No. That can't hurt anything. Connecting 17V to the Arduino's GPIO pin will kill the Arduino, but nothing else.
    – Majenko
    Commented Feb 8, 2018 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.