RGB LED + transistors #Was: Interfacing 2 arduinos

I am lighting a dollhouse. The LEDs will be white and on a button push, they will fade to yellow, green, and red (depending on which button). I am using the PWMAllPins example in the playground to let the atmega chip act as a LED driver. I have modified the code a little bit and now I understand, pretty well, what the example code is doing. I can now define an array with 14 values between 0-255 and the LEDs on those pins light accordingly. Long story short, I have the chip acting as a LED driver pretty well. The problem now is that I would like the chips to do a little bit more math and maybe add a LCD or serial output. Adding this into the loop creates a flicker in the "pwm" output.

I now want to use 1 arduino chip as the logic and 1 as a simple led driver that will only accept an intensity control and light LEDs accordingly.

I now need to know what the best way to integrate the chips would be.

Would I2C be the best here? I have absolutely no knowledge of it but I know there are tons of examples out there.

Would PWM outputs into the driver's analog inputs work? This is ideal for me because it would allow me to act like I am using a regular RGB led in the master sketch. (I only need 3 colors which will be replicated 4 times for a total of 12 pins out but 3 values in).

Would serial work? From what I believe, regular serial would be too slow (anything in the main loop that takes time, creates flicker in the LEDs), but I do understand it pretty well so it would be an easier solution to implement than I2C.

I would love to use the PWM method but I'm not sure how the analog inputs would handle this. I'm also wondering if the analog inputs would be accurate enough to take an input this way.

Sorry for all the wordiness!!!

Thanks for the help, -Adam

The first question that comes to mind is: do you really need to PWM all those LEDs individually? It sounds like you're controlling RGB LEDs that are all the same color, so you may only need 3 PWM outputs, with a few external transistors to boost the current.

It also sounds like you're not changing the PWM values all that fast, so any of the serial communication methods (USART, I2C, or SPI) would work. You really only need 1-way communications, so you could do the communication using only 1 wire (plus ground, of course) by sending async serial from the "master" to the "slave". You could even use the SoftwareSerial library on the "master" to keep the hardware USART available for other purposes (like talking to a PC). You'd want to use the hardware USART on the slave side, because SofwareSerial is not kind to time-critical code.

ran

With a transistor, I'll need to use common anode LED's, correct? I can keep adding more LED's as long as I don't break the 8A per transistor, correct?

(Using a TIP102 transistor) http://www.mouser.com/ProductDetail/STMicroelectronics/TIP102/?qs=ljbEvF4DwONmWw0zLDYvVw%3d%3d

Please take a moment to review my basic circuit. http://adamsworld.name/files/led-transistor_example.jpg

Thanks for your time and sorry for the giant image, but my handwriting becomes unreadable at a smaller resolution!

-Adam

I can keep adding more LED's as long as I don't break the 8A per transistor, correct?

Way before you reach that limit you will exceed the power dissipation of the device. Before that you need to use a heatsink. For details see:- http://www.thebox.myzen.co.uk/Tutorial/Power.html and http://www.thebox.myzen.co.uk/Tutorial/Power_Examples.html

Schematic looks OK although it is not very conventionally drawn.