Go Down

Topic: Pin 13 LED always on (Read 5826 times) previous topic - next topic

blablatros

Mar 16, 2012, 12:23 am Last Edit: Mar 16, 2012, 12:36 am by blablatros Reason: 1
Hello everybody,

I just received my UNO yesterday. I tried the blink example and it works without any problems. I then tried the fade example - the LED on pin 9 fades as it should, but the on-board LED (pin 13) is always on. It is the same with other examples as well (AnalogReadSerial, even BareMinimum).

Is this normal behavior? Shouldn't the on-board LED be turned off?

I am able to switch it off by adding the DigitalWrite(13, LOW) in the example sketch.

Nick Gammon

Mine seems to do that too. I can't offhand see where in the initialization code it is turned off. It is turned on during the bootloading process.

Looks like the pin isn't set to output, so they have left the weak pull-up on it seems. I am measuring 0.7V on pin 13, and even then, plugging in the meter draws enough current to extinguish the LED.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

zoomkat

If the pin 13 LED is somewhat dim when lit then it is probably in a timing circuit. When using an ethernet shield, the LED is dim as it is being used as the timing pin for the shield.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

woody_unreal

Could always throw in the code for setup of
Code: [Select]
pinMode(13, OUTPUT);
and then use
Code: [Select]
digitalWrite(13,LOW); from loop if you didn't want to see it on :)
But im not sure if thats what you were looking for :)

Nick Gammon

Just this is all that's required:

Code: [Select]
digitalWrite(13,LOW);

It's already input. What you are seeing is the internal pull-ups putting a weak current on the pin.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

blablatros

Thanks for replies.

@Nick - I too am measuring around 0.7V on pin 13.

@Woody - That is exactly what I did, and it does work. I just assumed that the LED would be turned off unless explicitly set to HIGH.

@Nick - putting
Code: [Select]
digitalWrite(13, LOW) in the loop without
Code: [Select]
pinMode(13, OUTPUT) in the setup does not change anything - the LED stays lit.

However, putting just
Code: [Select]
pinMode(13, OUTPUT) in the setup, and nothing else in the loop works - LED is turned off.

So, it seems that it is normal for pin 13 LED to be dimly lit. I just did not perceive it as dim - it is almost as bright as ON, TX or RX LEDs. I do not see any difference when lighting it with 5V (pin 13 set as OUTPUT and set to HIGH) or 0.7V (pin 13 in its default INPUT state).


Nick Gammon


I am able to switch it off by adding the DigitalWrite(13, LOW) in the example sketch.



@Nick - putting
Code: [Select]
digitalWrite(13, LOW) in the loop without
Code: [Select]
pinMode(13, OUTPUT) in the setup does not change anything - the LED stays lit.


Your earlier post suggested that doing the digitalWrite(13, LOW) was all that was needed.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

blablatros

Sorry, I realize now that I haven't specified in my first post that I also put
Code: [Select]
pinMode(13, OUTPUT) in the setup.

---

I measured the voltage at pin 13 again, and now I am getting around 1.4V instead of previously measured 0.7V. Plugging the meter does not extinguish the LED as it did earlier, it just make it dimmer. Now I am puzzled...

BradBouton

I know this is an old topic but just encase anyone else is experiencing similar problems(This just happened on my uno last night).  I found that the UNO and other boards have an internal pull-up resistor that is disconnected by default.  If you take your finger, place it on the solder joints(on bottom of board obviously) and try to bridge the joint of pin13 and ground(may have to rub your finger around), you should begin to see some reaction from the LED if it doesn't just turn off completely.  This is where things get strange....  After observing this problem I decided to place some solder to try and permanently bridge the pin to ground.  The LED then became totally unresponsive.  I then un soldered the junction and believe it or not, after removing the solder I just put on, the board now seems to be working totally fine(which is very strange to me because I assumed it had to do with the pull up resistor being engaged, but it appears the solder could have just fallen out?????!!?!?!?!?!  Not sure)  Anyways that is how I was able to fix the problem.   Or at least it that is how it appears to be.  I haven't droped an meter on it yet but I will shortly and report my findings.

Nick Gammon

On newer Unos the LED is driven by an op-amp (LM358) which may turn on if the output is left floating.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

BradBouton

Do you know what would cause that?  I generally only use pin13 as the clk line on my SD card.  Hope I didn't short something out.  Does this mean that the op-amp is compromised and is the clock going to be out of sync when I do SPI?

retrolefty


Hello everybody,

I just received my UNO yesterday. I tried the blink example and it works without any problems. I then tried the fade example - the LED on pin 9 fades as it should, but the on-board LED (pin 13) is always on. It is the same with other examples as well (AnalogReadSerial, even BareMinimum).

Fade uses a analogWrite() statement that requires it to be used onlywith a digital pins that have PWM output capabilities, pin 13 does not have PWM capabilities. A UNO has PWM only on pins 3, 5, 6, 9, 10, and 11.

Is this normal behavior? Shouldn't the on-board LED be turned off?

I am able to switch it off by adding the DigitalWrite(13, LOW) in the example sketch.

Due to the changes made on Rev3 Uno and mega boards the on board pin13 LED is not longer directly driven by the AVR output pin but rather 'buffered' via a spare op-amp stage. This results in a floating input pin condition for the op-amp which can result in the led being on when it shouldn't be, but it's a rather random thing as the offset input value of the op-amp plays a role. The only way to be absolutly sure that the pin 13 led remains off is to do both a pinMode(13,OUTPUT) and a digitalWrite(13,LOW), best placed in your setup function.

Lefty

retrolefty

#12
Aug 01, 2013, 01:09 am Last Edit: Aug 01, 2013, 01:11 am by retrolefty Reason: 1

Do you know what would cause that?  I generally only use pin13 as the clk line on my SD card.  Hope I didn't short something out.  Does this mean that the op-amp is compromised and is the clock going to be out of sync when I do SPI?


I would not worry about it, the 'problem' is with the op-amp input. It will not effect anything else you do or wire to pin 13. If you wired a say 10k ohm resistor from pin 13 to ground the problem would go away, or set the pin to output mode and output LOW in your setup function

Lefty

BradBouton

So  now I'm way confused.  I made a simple external circuit with a resistor and led, to test.  With a blank sketch uploaded, pin13 and gnd output around 0.8V and if I were to switch the wire from pin 13 to another pin I get around 0.6 V.  Is that standard?  I was expecting to see 0 voltage across the circuit.  Of course when I set the output to HIGH I get right around 5V. 

Nick Gammon

With a blank sketch the pin is floating. How about if you write LOW to it?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up