How to controll brightness of LED array..??

I have an array of LEDs connected to arduino… How do I control the brightness of the whole array with a PWM output…??

Please help me with the connection and how to do it…??

Here is the LEDs connected to the arduino…

Choose a led dim value between 1 and 255.

analogWrite(LedPin, LedDimVal);

Tobbera: Choose a led dim value between 1 and 255.

analogWrite(LedPin, LedDimVal);

What if all of them are not connected to the PWM pins..??

There are only 6 PWM pins on a Uno. The best way to control brightness on you array is to connect then to a shift register. Then use SPI to load the shift register and a PWM pin to the shift register enable to control brightness.

Array of LEDs means many LEDs connected in parallel? If this is the case, you can connect PWM output to transistor (mosfet) base (gate) and switch on/off (= PWM control) the LEDs through the transistor (mosfet).

Yes, PWM to a transistor between LED cathodes & Gnd would be easiest way to control brightness of all LEDs. You'll have to move one of the anodes to 12 or 13 and free up a PWM pin. Code is simple for it:

analogWrite (PWMpin, (analogRead (A0)>>2) ); // read 10-bit ADC result, shift off lower 2 bits & write 8 bit result to PWM pin With NPN or N-channel MOSFET, 0 will be full off, 127 will be midway, 255 will be full on.

Pavouk106: Array of LEDs means many LEDs connected in parallel? If this is the case, you can connect PWM output to transistor (mosfet) base (gate) and switch on/off (= PWM control) the LEDs through the transistor (mosfet).

No all the LEDs are not in parallel.. Each of them will be given a different pattern to switch ON and OFF..

Their cathodes are in parallel tho - so you will PWM the cathode connection to GND to control their brightness.

You have 10 LEDs in that drawing. At 20mA per LED, you are pushing 200mA. 200mA is the general safe limit for current using just the pins you are using. Not only will one of the solutions someone suggests (transistors, constant current LED driver chip, shift registers) help with your lack of enough PWM pins, it will also help with your potentially dangerous current draw.

Which one is the correct connection ..??

OR

SoftPWM library...?

I think both could work, depending on the Vf of the LEDs. You will have some voltage drop across the transistors, it that was as high as 0.7V then: 3.3V - 0.7V - 0.7V = 1.9V. Most Red LEDs are in 2.2V Range? Might not turn on with just 1.9V. Check the specs on the parts you will use.

I'm not familiar with SoftPWM.

This looks like a good choice for NPN, with Vce at just 0.3V http://www.digikey.com/product-detail/en/2N3904BU/2N3904FS-ND/1413

Lots of Red, Greeen, Yellow LEDs with different brightnesses with Vf up to 2.2V. (not Blue tho) 3.3 - 0.3 - 0.3 = 2.7V to play with:

http://www.digikey.com/product-search/en?FV=fff40008%2Cfff801b9%2C1140050&k=led&mnonly=0&newproducts=0&ColumnSort=1000011&page=1&stock=1&pbfree=0&rohs=0&quantity=&ptm=0&fid=0&pageSize=25

I am actually going to use the circuit on a propeller clock/display..So the bad part is that the circuit has to be as small as possible and components as less as possible.. I am using al SMD components..

I am trying to controll the brightness of all of them with a PWN pin..

1 LED for each row is getting too small, so I planned of using 3 LEDs in parallel for each row(for each pin).. :(

Please suggest something..

Search digikey - all kinds of parts are available, different sizes of SMD LEDs, resistors, transistors. Brightness also is size dependent - I think 1206s are brighter than 0805s for the same cost. You know what to look for now - low Vce in saturation transistors, Low Vf LEDs (color dependent), resistors as needed: (3.3V - Vf - Vce - Vce)/.02 = resistor value. Are you making a PCB, or hand mounting them onto propeller blades? Or use PCBs as the blades? Can do multicurved shapes in eagle that iteadstudio can make. Couple of 6-pin JST connectors, 1.5mm pitch are pretty small. I think thru hole ends up being smaller due to not have legs splayed out. 12 pin, 1mm even http://www.digikey.com/product-detail/en/BM12B-SRSS-TB(LF)(SN)/455-1798-1-ND/926869 Or just go with 0.05" ribbon cable right to the board. Or discrete wires.

This is the schematic that I have designed.. But I am worried that the atmega will not be able to take the load of so many LEDs.. If I use 1 LED for each pin the area of the display is getting too short, hence I thought of connecting 3 LEDs in parallel for each pin..

So where's all the transistors? You get 300mA to spread across the ports as noted in Section 29 of the datasheet. You can spread that over 10 LEDs or 30 LEDs.

Watch the current PER PORT, you have to spread them out more. See Section 29 of the data sheet for details.