Drive 7 rgb leds with UNO board

Hello,

I am really newbie to arduino boards and electronics. I'm a programmer who started an electronic project with medical purposes.
I have basic electronic knowledges like resistors, transistors, triacs, voltage divider circuits, fm modulation, etc. But digital signals, IC, clocks, serial, parallel and any other concepts commonly used here are new for me.
I recently bought an arduino board and I really happy with it, but I only have played some times with a few leds and my programming skills.

In this project I need to turn on 7 rgb leds at the same time, but every led has to show a different color. I have readed a lot of entries in this forum, and I think I need to use a multiplexer chip, but I'm not sure if I can drive the 7 rgb leds with diferent colors at the same time, only using the analog output pins that arduino has.

I understand the terms "pull-up/pull-down resistors, forward voltage and forward current for the leds, ohm law and derived calculations (and other basics knowledges), and I know I have to use pwm to create the colors needed (analogWrite method).

I will be so gratefull with you for any suggestion or links to continue in the right way.

I apologize if this is not the right place to post my question,

Best regards.

3*7 is 21 pins minimum. Since the Arduino UNO only has 20 I/O pins MAXIMUM you will either need to use some kind of port expansion or upgrade to a Mega.

Choices for port expansion include chips like the TLC5940 which include current control and handle 4096 levels of brightness on 16 simultaneous channels. Two of those would be more than enough to control 21 LEDs. They connect to the Arduino with SPI so they only use four data pins.

Thank you John for your fast response.

I understand now (I think I knew it) that I need to expand arduino ports. I undestand too (a little) how to do that, but I still have one question: If I expand the arduino port with that chip am I able to turn on every rgb led with different color at the same time?

I still don't understand how to control each led with that chip.

I think I need to read more about serial and parallel features of that kind of ICs, but if you have some recomendations for me I really appreciate it.

Mega, or assemble a '1284 board like this one:
$4.50 mailed to your US location.
2 Serial ports, 32 IO pins total.

(reminds me, I need to get a PL finished for this)

Just for 7 leds may be you don't need any hardware, except resistors.
You could use 3 PWM pins and 7 digital pins (10 total). Depends on what kind leds you have (common anode/cathode), you connects common pin to digital output, and all RGB pins run in parallel to 3 PWM pins via resistors. In code you select 1 led at a time and write appropriate PWM values to create a specific color. Read more: http://arduino.cc/playground/Main/InterfacingWithHardware#Output

That sounds good, I have to say. But since the rgb pins are in parallel, how I select by code one led at a time? My rgb leds are "common anode". You suggest to connect common pin to a digital ouput (via resistor), but how to change it for each of 7 leds?

Thank you in advance!

Let say you choose 9, 10, 11 as PWM pins, and 2, 3, 4, 5, 6, 7, 8, as digital outputs. Setting "HIGH" at pin 2 connected to anode led #1 would switch it "on". Next, you writing analogWrite (9, red_value); analogWrite (10, green_value); analogWrite (11, blue_value);
(I corrected myself, you need 3 resistors on PWM pins.) Than after delay ( 10) , you writing "low" to pin 2 and "high" to pin 3 to light up led #2, and so on.

Ok, I understand now, thank you!

Using your example, what about if I don't turn off the first led (pin 2) and then I try to light up the second one?
I'm asking you this because in some moment I need to light up all the leds and set the specified color for each one.

Again, thanks for you time.

The idea is to cycle thru the 7 LEDs quickly so it looks to the eye as if all are on.

The idea is to cycle thru the 7 LEDs quickly so it looks to the eye as if all are on.

Exactly, this is why delay is so short - 10. You could probably play around with this value, setting it higher - to 100 you 'd notice "blinking" in lighting.

Oh, it is clear for me now, thank you everybody, now I can sleep peacefully, tomorrow I will test all your recomendations .

Best regards.