Arduino Uno LED on Pin 13 is Always ON

Al Salamo Alaykom,

I have a problem on my Arduino Uno, the LED on Pin 13 is Always on,

I tried to upload this code:

int ledPin = 13;
int value;
void setup(){
  Serial.begin(9600);
  pinMode(ledPin,OUTPUT);
  digitalWrite(ledPin,LOW);
}

void loop(){
  digitalWrite(ledPin,LOW);
  value = digitalRead(ledPin);
  Serial.print("1# LED 13 is: ");
  Serial.println(value);
  delay(1000);  
  digitalWrite(ledPin,HIGH);
  value = digitalRead(ledPin);
  Serial.print("2# LED 13 is: ");
  Serial.println(value);
  delay(1000);   
}

this code suppose to OFF the LED but it didn't. On the other hand, the serial prints to me that LED is always "LOW" although it didn't turn off and just constantly ON.... even when I plug in the USB it turn ON and not blinking.... so please do you have any solution ASAP ?!..... Thanks in advance =)

Please edit your post, select the code, and put it between [code][/code] tags.

You can do that by hitting the # button above the posting area.

On my Uno the LED blinks using your code.

I tried to upload this code:

Did you succeed?

Maybe U5 (op-amp) failed? http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf Upper left in that schematic. That is the same op-amp IC that controls the +5v/usb power bus FET T1.

Mr. Nick Gammon Thanks for your reply.. I edited my post.... your LED work correctly as I want but mine is always ON.. and gives a serial port = 0.

Mr.SurferTim Thanks for your reply.... how could I know that?! and how to fix it?!

How to find if it failed should be simple. If the D13 pin is LOW (measure with a voltmeter), then the LED should be OFF. If it is ON, then the only device between the D13 pin and the LED is U5. It is a two op-amp package, one a simple voltage follower op-amp circuit for the LED, and the other a comparator for T1.

How to replace it depends on your skill and equipment available. The LM358 is the 8 pin soic located between the crystal can and the power barrel jack.

I made a code to make the LED low, When I use a voltmeter on pin 13 (connecting between pin 13 and Arduino's ground pin) it gives me a 172 mV, and when I made another code which make the LED High it gives me 148 mV,

But in "both cases" the LED is constantly ON.... so the "op-amp" is the reason behind that as you guessed before?!

Plug in an external LED and resistor in series (say around 470 ohms) and see if the external LED blinks. Connect between pin 13 and Gnd.

Pin 13 -->  (+) LED (-)  -->  470R resistor --> Gnd

Did you previously connect something to pin 13? An LED? Did you use a resistor like I showed above?

I made a code to make the LED low, When I use a voltmeter on pin 13 (connecting between pin 13 and Arduino's ground pin) it gives me a 172 mV, and when I made another code which make the LED High it gives me 148 mV,

The voltage is higher when D13 is LOW? Something is wrong there somewhere, but may not be the op-amp.

Mr. Nick, I connected the Arduino as you mentioned before and the external LED is OFF (while I gave the pin 13 a HIGH), and it gives 148 mV on the voltmeter, and vise versa except it gives 172 mV... and in both cases the Internal LED (LED 13) in constantly on..

Did you previously connect something to pin 13? An LED or something else?

Yes I made some experiments before and I used pin 13 several time and it was working correctly, but suddenly LED 13 becomes ON permanently and pin 13 stops working.

before that I was making a circuit to control 12V solenoid valve by 5V Arduino's volt and I use this circuit:

http://i.stack.imgur.com/W2qbH.png

after this crash I used another pin and it works correctly, but pin 13 stops working and LED is always ON.

Did you use that exact circuit, including the diode?

yes I did

And its solved,., i may not know the reason for the issue,. but there is a simple solution by me,. check this video,.

http://www.youtube.com/watch?v=franFBXgG-A&feature=share

I find it quite annoying and usually just turn it off with a digitalWrite at the top of each sketch.

Glue! Why didn’t I think of that. Oh yea, I don’t own a Uno type board. :wink:

Hello!

This is my first post, i´m new arround here and arround Arduino also.

I recently bought a UNO and i´m testing it using the exemples in arduino homepage.

I´m now testing the following sketch:

int ledPin = 9;      // LED connected to digital pin 9
int analogPin = 3;   // potentiometer connected to analog pin 3
int val = 0;         // variable to store the read value

void setup()
{
  pinMode(ledPin, OUTPUT);   // sets the pin as output
}

void loop()
{
  val = analogRead(analogPin);   // read the input pin
  analogWrite(ledPin, val / 4);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255

Nothing happened after the sketch uploading and the orange led (pin 13) is always on.

i´ve removed all the wiring and the led keeps on.

Next i´ve connected an external led with a resistor to pin 13 but the external led did not even flash.

As long as i keep the external led, the orange one does not light.

I´m worried about the “health” of the UNO, could you please give me a help?

What do you think it´s happening?

Thanks in advance!

The problem on the first page of discussion, is apparently one of failure of the op-amp driving the indicator LED.

The matter raised by @narenravi does not actually represent a "problem", but is a reflection of the deliberate design of the Arduino UNO as I have tempted to clarify in this later thread. I have also pointed out why the "glue" idea is risible.

In respect of @JV_78's query, his observations actually indicate that the Arduino is working absolutely correctly. Of course his LED was not responding to his sketch for the quite simple reason that he specified pin 9 in the sketch whilst the LED is indicating the state of pin 13.