I am using Arduino Digital Pins to turn on and off a relay. Now I am using the 5V and GND from the board and supplying this to the relay. This power is turned on/off using a NPN 2n2222. This transistor in turn switches on/off the relay. Now I can make this happen by supplying the power from 3V supply on board. Now I want this to happen using the digital pins. This works, but only on pin13 and not on others. What can be the reason?

  • \$\begingroup\$ Which "Arduino"? \$\endgroup\$ Commented Oct 20, 2013 at 4:40
  • 1
    \$\begingroup\$ All the digital pins are the same in terms of power level and current limits. What does your code look like? And are you using a resistor for the transistor base. \$\endgroup\$
    – Passerby
    Commented Oct 20, 2013 at 5:00
  • \$\begingroup\$ Please be more specific. 'I can make this happen' => I'm completely lost with all the implicit references what you are trying to way from there. \$\endgroup\$
    – jippie
    Commented Oct 20, 2013 at 6:50

1 Answer 1


If I remember correctly, header pin 13 on Arduinos is usually connected to an on-board LED. This may cause it to behave differently under some circumstances.

The best way to understand this is to examine the circuit diagram of your specific Arduino model (or Arduino-compatible model)

enter image description hereenter image description hereenter image description here
Duemilanove Pin 13 LED                        Uno Rev 3 Pin 13 LED                        (marked "L")

LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.

On recent official Arduino products (Uno, Leonardo ...) it looks like the pin 13 LED is isolated by an op-amp buffer so the LED shouldn't affect use of pin 13 for other purposes? I don't know if this is the case for other companies' "compatible" products.

Notice that many (all?) of the pins have multiple alternate functions, if you have enabled those alternate functions you cannot safely use the same pins for controlling LEDs etc.

P.S. For questions like this I think you should post a circuit diagram for your added circuit (and maybe a photo too - but not instead of the circuit diagram). It is also a good idea to cut your code (sketch) down to the smallest and simplest that reliably reproduces the problem and include that code in your question.

  • \$\begingroup\$ Your memory about pin 13 is correct. Scroll down to the note about this here: arduino.cc/en/Reference/digitalWrite \$\endgroup\$
    – Rob
    Commented Oct 20, 2013 at 14:18
  • \$\begingroup\$ Just a note, The Pin 13 on the the Uno, doesn't have that led+resistor. For the most part, the Uno is the board anyone would have, the Duemilanove hasn't been made in years. \$\endgroup\$
    – Passerby
    Commented Oct 20, 2013 at 14:47
  • \$\begingroup\$ I have a leonardo compatible board. AFAIK there was a 20k pull up resistor on board. Anyhow, I tried making a rough design on circuits.io circuits.io/circuits/6200 on digital pin high on 13 it should turn on the relay. \$\endgroup\$
    – whizzzkid
    Commented Oct 20, 2013 at 15:01
  • \$\begingroup\$ @Passerby: It looks to me like Uno Rev3 have that LED (I'll edit A to show what I mean) \$\endgroup\$ Commented Oct 20, 2013 at 15:14
  • \$\begingroup\$ @RedGrittyBrick Yup, I just checked, my Uno has the LED and the resistor too. \$\endgroup\$ Commented Oct 20, 2013 at 16:02

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.