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.
@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.
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
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.
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.
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.
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.
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?
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?