Arduino Options

I have been doing a lot of reading on the Arduino site about the various shields and different Arduino microcontrollers themselves, and I have a couple of questions I hope you guys can answer for me.

I seem to be suffering from information overload because I can't seem to find exactly what I want, but I know it's got to be available.

First, the Arduino Pro: The project I'm building for a friend will be permenantly installed. It's for his model train set, and he wants to use it as the "utilities" station for his city lights, street lights, traffic lights, etc.

Eventually, he would like to have other features, such as mechanical moving parts in the landscape, and using inputs to control other actions (like light sensors to turn the house and business lights on when it's "dark outside").

I'm thinking that the I/O pins can be fed to a shield that can be used to distribute power to the LEDs, lights, etc. What kind of shield would be best suited for this? There could be more than 100 lights, and who knows how many mechanically active features by the time we are finished.

For that amount of light, Arduino Mega should be easier to get the job done I think :slight_smile:

But it depends on what matters to you, price? difficulty? Because a 4 usd Atmega168 without any shield/arduino and a bunch of multiplexors is also an option.

Well, here are my thoughts. I think the Pro will allow for sufficient expansion in the future should he want to add more features. I believe it has plenty of programming space to allow for pretty complex sketches. The problem is that it only has 14 I/O pins. Now I just read about the Muxshield that will give 48 digital I/O while only consuming 7 I/O pins from the Pro, so I should be able to get two muxshields, and get 96 I/O from all 14 of the Arduino Pros I/O pins.

That's $60. I don't think he would necessarily mind spending that much, but for that kind of money, I'm sure he wants it to do more than just turn the lights on.

macegr from this forum had a shield that did 64 digital pins. There is a thread about it at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1257672398/0. It seems that it never made it to his store, but a PM to him may be useful.

You should also consider Sanguino (http://www.moderndevice.com/products/sanguino), with 32 GIO pins (US$27 - 35 plus shipping), or, if you want stuff (RTC, eeprom, Ir receiver, buzzer, SD card) on the board, take a look at my own Duino644 kit (Wise time with Arduino: Buy Duino644 kit), for only US$54 (free shipping).

How big is the layout?

To reduce the amount of wiring, you might want to use an approach like putting a shift register, or even a simple micro like an ATTiny2313 if you want to include sensors, on each block of the town.

I think you should just use shift registers. That said, I'm cheap, so that may not be the best choice, but it's certainly inexpensive! You can expand shift registers almost indefinitely still only using 3 Arduino pins, and they can be used with transistors to control higher current things.

Well, for a cheaper solution you can use Charlieplexing technique. I don't know very well what will happen with the current consumption, but any arduino can provide 182 i/o with 14 i/o for leds, so you can just use 1 arduino and nothing more.

Wow. I just did a forum search about charlieplexing. That looks promising, and the math works out as you said. 182 LEDs by using all 14 I/O on the Pro.

The code will likely be a beast, and I'm sure I will get lost in it since some LEDs will be trafic signals and will need to cycle correctly while others will be on all the time, still others will turn on and off depending on the light sensor. Sounds like careful planning is required to make sure I don't have a traffic light on the same circuit as a street light.

Thanks for the suggestion.

Still, I'm also interested in the Shift Register option. Can you guys provide more details?

Keep in mind you can also use the 6 Analog pins as GPI/O as well!

Here's some more info on Shift Registers:

A bit of a read, I know, but it gets you the general idea.

There is a charlieplexing library for Arduino IDE somewhere :slight_smile:

Here's my reply to a PM from WileyCoyote, in case anyone else finds the information useful too:

WileyCoyote,

I do have a few of the Centipede shield prototypes, however the way they're wired mean that only one can be used per Arduino, for a total of 64 extra I/O lines. The redesigned board will be available in about 5 or 6 weeks, and has a jumper to select between two addresses. This will let you use two shields and have 128 extra I/O lines. At the same time, I will be providing breakout boards that will make it easy to interface to all of those signals. Four 20-pin cables lead from each Centipede shield and can plug into either a small breadboard-compatible PCB or a large board with room for solder connectors or standard 0.2" screw terminals.

However, if you can't wait six weeks, you could get some of the MCP23017 chips. They are available in DIP form, and you can still use the Centipede library with them. You can put up to 8 of the chips on the I2C bus, with 16 I/O on each chip. The downside is that this requires a lot of soldering work.

Let me know if you have any questions...

--- Garrett

The code will likely be a beast

The code will be a friendly puppy compared to the nightmare of wiring an array of several score charlieplexed LEDs that covers many square feet.

Before you pick chips and techniques, you need to get a rough idea of what inputs and outputs you want to have in the system. Will there be switches? Light sensors? Motors? Servos? Will the LEDs all be simple on/off, or will some be dimmed? The answers to those questions will have a huge impact on choosing the best solutions.

There's a standard for digital control of locomotive functions that I think may also include control for things like switches and crossing signals. You should find out whether your friend uses that, and wants the features you propose adding to be compatible with it.

Last night, I downloaded the Charlieplexing library and breadboarded a simple 3 LED charlieplex last night.

While it is useful, I definately agree with Ran Talbott. I imagined Charlieplexing more than 100 LEDs, and I lost interest in that option quick, fast, and in a hurry.

I believe the shift register option may be the best option in this case, as I should be able to get close to 2^14 outputs out of 14 I/O pins.

Thanks for posting the link about Shift Registers. I'll read it and see if my thinking is correct.

It's even better than I thought...I can get 2 16-bit shift registers out of only three Arduino pins. So, I should be able to get 8 16-bit shift registers out of 12 pins.

That's a heck of a lot of pins, and they can be used for more than just lighting LEDs, they can be used as general purpose pins, just like the native arduino pins.

Thanks a lot for the help and suggestion, guys! :smiley:

A MAX6954 will charliplex 128 LEDs all by itself.

You can't really use shift registers as general I/O, you'd have to have separate chains of shift registers for inputs and outputs.

I'd really still go with the MCP23017 unless you think 128 pins will not be enough.

Yes, you guys are right. The Shift Registers will not be suitable for General Purpose I/O pins. However, for the project I'm doing, they really only need to be outputs, so I think the Shift Registers will work.

Thanks again!