I'm experimenting with an Arduino Mega, using it to test some relay logic. The Arduino is powered from my benchtop power supply via the Vin and GND pins.

I have digital output pins connected to some 2N2222 transistors to drive the relays. Here is a rough schematic:

enter image description here

The relays are four DPDT relays configured as a full adder.

The problem occurs when I try to reset the Arduino by removing the the power. When I disconnect the +5v pin, the Arduino stays on and the relays stay energized. If I short the +5v pin to ground, that successfully resets the Arduino and the relays turn off.

How is the Arduino receiving power when +5v is disconnected? Does it have something to do with the transistors? How can I ensure that the Arduino is only turned on when I want?

EDIT It looks like this was a PEBCAK error; I had the Arduino board resting on top of my breadboard where some detritus was apparently shorting one of the power pins on the bottom! Problem is fixed now.

  • 1
    \$\begingroup\$ Are you sure you want to configure your transistors like that? In the current configuration the emitter voltage is going to be the GPIO_Voltage - 0.7. \$\endgroup\$ Nov 10, 2016 at 18:42
  • \$\begingroup\$ @BrendanSimpson the transistors are definitely providing 5v to power the relays - they turn on and off just fine. (Did I use the wrong symbol? I can never keep them straight.) \$\endgroup\$
    – friedo
    Nov 10, 2016 at 18:52
  • \$\begingroup\$ If they are actually 2N2222's then you used the correct symbol, but Vemitter will never be more than Vb - 0.7, so I would imagine you're actually only getting 4.3V to the relays. \$\endgroup\$ Nov 11, 2016 at 19:18
  • 1
    \$\begingroup\$ @BrendanSimpson you're right - I'm getting about 4.2V out of them. Just enough to trigger the (nominal 5v) relays. \$\endgroup\$
    – friedo
    Nov 13, 2016 at 2:10

1 Answer 1


It looks like the Arduino must still be receiving power from the 5 volts via a non-disconnected GPIO line. Those GPIO pins that are still connected to 5 volts will route the 5 volts to its own local rail inside the chip with maybe a volt drop of about 0.5 volts. This is quite a common occurrence in CMOS chips and works equally well when GPIO pins are inputs and outputs.

Here's what Dave says.

  • \$\begingroup\$ Yeah it looks like something under the Arduino board was shorting pins somewhere - though not the GPIO pins. In any case, problem solved! :) \$\endgroup\$
    – friedo
    Nov 10, 2016 at 18:31

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.