Using resistors to scale the brightness of 12 LEDs

Dear Arduino community,

I have a problem with the following project:

I wanted to control the brightness of 12 LEDs by using different resistors. Unfortunaley they all have the same brightness and across the highest resistor (22kOhm) and the lowest (360Ohm) there is the same Voltage (3.3 V). I powered the arduino using the USB cable port to my laptop which should, as far as I know, supply the pins with 5V and not 3.3 V. Furthermore I need to have a 5V supply.

Please help me because I dont seem to understand why the brightness of the LEDs is the same evendough they are connected to resistors with diffent Ohms.

I tried to use PWM before but I need to record honeybees that move towards the leds. Unfortunately honeybees can see the LED flickering and so does my video camera, which make the recordings useless because I will use a programm to track the bees.

There is a lot of information missing, I cannot give a accurate answer. Post an annotated schematic showing exactly how you connected everything. Show all connections and power sources. What you are saying does not compute but the brightness change may be so small you cannot see it. What color are the LEDs, sounds like maybe a white or blue one.

  • Your LED connections look suspicious.

  • See this example.

No, not suspicious, just wrong.

@denno385 those resistors are supposed to be in series with the LEDs. You have them connected in parallel, I'm pretty sure. So the voltage will always be 3.3V. If this was a real circuit you would be damaging the LEDs and Arduino pins.

  • So much for simulators.
    :scream:
2 Likes

well I actually tried it on a PCB already and yes a LED was damaged :frowning: I will come back to you guys soon. Thank you in advance

  • The pin the LED was connected to should always be considered problematic or the controller may act up in the future too.

I might even order a new arduino Uno

I took some liberties with your Wokwi image, stripping all but one circuit.

Pin 3 should be toast by now. This circuit makes no sense whatsoever.

Please wire up what you think you're doing in Wokwi, and run it by us before you toast any more hardware.

2 Likes
  • If you plan on this as a hobby and can afford it, it’s wise to have several boards to aid in project development.

  • Highly suggest you to consider buying 10 or so Arduino Pro Minis ($5.00 each) they use the same controller as the UNO.
    You will need one (1) FTDI USB serial board, about $10.00

2 Likes

Good suggestions, thank you!

IMG_2905

Arduino Pro Mini

1 Like

I used 9,1kOhm and 620 Ohm resistors (marked in blue) because I dont have a 9.7kOhm resistor. I think they are connected wrongly anyway. I did not use a positive terminal because I found when you power the Uno via a USB cable, there is no need to connect the 5V pin.

I hope this circuit is a bit better!

cheers

No

  • LEDs are backwards.

  • Resistors should be in series with the LED.

  • For example.

IMG_2907

3 Likes

LED intensity is proportional to current. Voltage drop across the LED is more or less constant, within reason. Hence, you simply need a progression of suitable increasing resistors to arrive at decreasing intensity. Use the circuit @LarryD has shown you. Do not use less than, say, 220 ohms, and you'll find that probably 22 kOhm becomes difficult to discern, though ambient lighting will affect that.
Show us your code, and tell us more about how you want to control the LEDs, please, so we can help you with that as well.
I hope you're using LEDs of all the same batch, because there's such a variety of output/mA that mixing batches of any one colour will frustrate you as well.

1 Like

It is much clearer, thanks! Much easier to understand and to see that it is clearly wrong.

In this circuit, as you have drawn it, there is no risk of damaging the LEDs or the Arduino, but the LEDs will never light. That's because, as mentioned by others, the LEDs are connected backwards and will not conduct any current. The "D" in LED stands for Diode, a component which will only pass current in one direction. To pass current and light up, the anode must be at a higher voltage than the cathode.

If you reverse the LEDs, they and the Arduino will be damaged, because the LEDs are in parallel with the resistors, when they should be in series.

With the resistors in parallel with the LEDs, they can't limit the current flowing through the LEDs, so a large uncontrolled current will flow, until that current stops because the LEDs or the Arduino pins are burned out.

2 Likes

For what reason exactly, what brightness range do you need, and how small do the increments need to be?

You could use or make a linear led dimmer with either a buck mode LED driver (e.g. PicoBuck), or with a simple opamp + mosfet servo. Both you could control with a PWM signal that you run through an RC filter to smoothen it out. This way you can set the LED current (and this, brightness) at high resolution and across a fairly large range with only a single GPIO.

The opamp servo solution I've used on one or two projects; it works especially well for LEDs up to about 200mA and it's surprisingly stable and linear.

Hi, @denno385

Can you please clarify.
You want each LED to have its own unique brightness and you select each LED.
OR
You want to control the brightness of each individual LED. That is any LED can have any brightness that you control?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

Hello everyone!

Thank you for all the replies and interest. I remade the circuit by connecting the LEDs in series and not in parallel. I hope now it works. The brightness of the LEDs (thus the resistor values) have been specified by some calculations using a luxmeter and a power regression model. So what do you guys think about the circuit?

1 Like

I think they're in parallel, not in series.