bradb667 wrote:Christian-
The problem with the Arduino by itself is that it's limited to supplying about 200mA on all the pins at any one time. Assume that's 10 LEDs each drawing 20mA.
There are two typical solutions: One is to use charlieplexing (something like
http://uzimonkey.blogspot.com/2009/01/c ... duino.html). I'm not sure if there are any pre-made shields you can buy that do this, but I imagine there are.
Charlieplexing doesn't get you around the current limitation. All Charlieplexing does is allow you to control a larger number of LEDs with the same number of I/O lines.
For instance, suppose you have 8 I/O lines. How many LEDs can you independently with that?
A naive answer would be 8 - one independently-controlled LED per I/O line.
A somewhat more sophisticated answer might be to arrange the LEDs into a 4x4 matrix, scan through the matrix to make all the LEDs appear constantly illuminated, and take advantage of the one-way nature of diodes to prevent any LEDs from turning on when you don't want them to...
But Charlieplexing goes a step further. With it you can take those 8 I/O lines and create a 7x8 matrix of independent LEDs. For any two I/O pins (x,y), there are two LEDs, LED(x,y) and LED(y,x) with opposite orientation
To turn a LED on, you put its anode pin high and its cathode pin low. To turn a LED off when its anode pin is high, you set its cathode pin as an input so the I/O pin won't pass current.
It's a neat trick but it's got all kinds of problems. Because the matrix is wired so densely, it can be challenging to build a Charlieplex matrix. Because the cathode pin of each LED connects to the anode pin of 7 other LEDs, a wiring fault or programming error can make the display light up in weird ways that are hard to diagnose. You can't easily mix and match LED types in a Charlieplex, either: If LED(A,B) takes 3V, and LED(A,C) and LED(C,B) can run on 1.5V, then lighting LED(A,B) (and not LED(A,C)) will also light those other two.
You can't share resistors over whole columns of the matrix like you can with a normal rectangular LED matrix, and with the process of scanning through the matrix it can be hard to get adequate brightness out of it. Mostly it's just not worth it.
The other typical solution is to use a LED driver such as the TLC5940 (
https://www.sparkfun.com/products/10615 for a shield version). This is a much higher-end solution than charlieplexing as it gives you a large number of pins that can do PWM (pulse width modulation, used for effects like strobe lights).
PWM wouldn't really be used for strobes. Strobes are just an on/off thing based on (coarse) timing. PWM is used to blink LEDs on and off... but normally it does this very fast, to provide a dimming effect.
This is probably the best way to go. The LED driver incorporates a constant current sink driver (which stabilizes the performance of the LEDs much better than a resistor, and allows you to use a high DC supply voltage (unregulated, even) to power the LEDs in series...
So a good way to approach this, if you are wiring up a whole lot of lights in a ship model and want them to be independently controllable, would be a setup like this:
1: Power the whole project on some high voltage, maybe 18V. Unregulated should be fine... Also set up a voltage regulator to supply a second, lower voltage (3.3V or 5V) to power the logic circuits, like the microcontroller and the LED driver boards. (The Arduino has an onboard voltage regulator that can accept that 18V supply and provide a robust 5V source...)
2: To anywhere you're going to have lights, run wires for the high and low voltage sources, and ground.
3: Install multiple LED controller circuits (to keep wiring of LEDs relatively simple and "local" to the controller driving them) and connect all of these to the Arduino's serial bus.
4: Mount the Arduino in the base if you like, so it doesn't take space in the model and can be local to pushbutton controls mounted in the base, if any...
With a setup like this, you'd be running five wires from the base into the model - high voltage, low (regulated) voltage, ground, serial clock, and serial data. For the multiple LED drivers, you could use something like
this - which is basically the same as the PWM shield but smaller.
One thing that kind of bugs me about this particular controller, however, is the way multiple controllers are linked. Basically, you have to daisy-chain them. So if you had a controller in each nacelle, you'd need to run serial data up one nacelle, then back down again to daisy chain to the next controller... Normally with these kinds of serial connections, there's a "slave select" pin you can use to select which device you're talking to. It's another wire to each device either way, but with "slave select" you're at least not having to linearize something that's not really linear...