Simple 2 LED project, different brightness


I'm an absolute n00b with an Arduino UNO board. I would like to control 2 LEDs (turn on red, turn on green). Super easy simple stuff.

The setup:

I have a wire from port 7 to the green LED and port 8 to the red one. The other sides of the LEDs are connected with GND. My sketch sets the digital write to HIGH for both pins.

My problem:

One of the 2 LEDs is really bright, the other is on but the brightness is barely noticeable. I can play with the pins, change the wires and LEDs in whatever (digital) configuration I like, there is always one bright LED and one less bright LED. Any idea what I am doing wrong here? If I connect them to pin 1 and 2 (RX and TX) both LEDs have the same brightness (this last one is a bad idea as it blocks the upload thing but it may help explain why it doesn't work on any other pin combination).


PS: I know there should be resistors but I took them out for now to simplify my problem.

Surely the resistors are exactly what would set the brightness of the LED by adjusting the voltage getting to the component?

You don't say if it's always the red or green LED that's really bright, I was under the impression that the two LED colours needed different value resistors to "align" the brightness.

Could be wrong though!

Thanks for the reply. I added a transistor for each (same value) but that just dims both of them, as expected. It's not related with the color, it's related with the pins. Sometimes the red one is the brightest, sometimes the green one. However it's always the LED connected to the same pin that is the brightest. It seems the pins are not sending the same voltage, is that even possible?

This was bad idea to remove resistors, as they not just make adjustment of the brightness, they protect LED and output ports of boards from overload. Dynamic resistance LED's itself very low, if you connect it to battery (9V) for example, by Ohm law current would be high and destroy them. So, what now? I hope arduino doing good, I'm not so sure about LEDs. Try to test led+resistor pair individualy connecting to +5V and GND on boards connector, not to output. If you have spare LEDs the same color, you can compare between them. The week brightness one of them will confirm that it's damaged.

I added a transistor for each (same value)

That's an odd way of referring to a transistor - what exactly do you mean? The same part number? Or did you mean resistor?

Taking the resistors out doesn't simplify your problem, it may be the source of your problem. Without the resistors the current limiting to the LEDs is done by the arduino gates, since they are supplying way above what they are designed for, how much they let through is in the lap of the gods and hence the brightness of the LEDs. Step one make up the LEDs with a resistor (500 ohm or 1 K is a reasonable starting point) , forget the arduino, just feed them with 5V and see if they are comparable brightness. If they are, then you can incorperate the arduino. If then they are different brightness there's a good chance you're stressed the arduino outputs. You could try some pins that haven't had LEDs connected straight to them in this case.

Thank you all for the replies. To AWOL: yes sorry, I meant resistor, not transistor. Mixing things up here. The resistors I used are 220?.

I went back to the single LED with resistor schema, like the one pictured here:

  1. First test: connect the 5V to the the LED, everything working fine with a bright LED.
  2. Second test: set pins 2 to 13 to HIGH and upload the sketch. Using the orange cable (from the schema above) I tested all pins. All pins work but the LED is not bright at all, it's weak. Did I destroy all pins on my Arduino or is my resistor way too strong?

PS: pin 0 (RX) is brighter than all the others, I suppose this is a special pin with a higher voltage?

pin 0 (RX) is brighter than all the others, I suppose this is a special pin with a higher voltage?

You suppose wrong.

Also post the code you are using, possibly you have a pinMode command wrong.

Also, maybe unrelated to your problem, but a fixed size resistor will cause different brightness levels for different color leds, as the forward voltage drop can be quite different between different color leds, thus changing the current formula current = (output voltage - led voltage drop) / resistance.


retrolefty: Also post the code you are using, possibly you have a pinMode command wrong.

Thanks Lefty, you solved the problem! I never considered the problem could be the code as it was only one digitalWrite statement but that's exactly what I was doing wrong. I forgot the

pinMode(pin, OUTPUT);

command (in the beginning for one of the 2 LEDs, in the second part for the single LED). That's why it was acting strangely. Adding the pinMode command and connected the 2 LEDs again (with the resistors this time) solved it, the 2 LEDs have the same intensity now and are as bright as I expect them to be.

Thanks all of you for the help with this uber n00b question!

Groove, pins 0 and 1 really special, as they have resistors 1k attach to them on the board. I think it possible that brightness on pin "0" could be different.