Is there a shield that just gives you more ports?

Hi. I want to make a project which would require more analog ports than any arduino i know of has. I know there are modules that give you the ability to operate more servos, but I want to use both servos and potentiometers, at the same time, separately. That made me wonder:is there a module/shield i can buy that when connected to the arduino just increases the number of ports. I mean that you get ports that you use as normal analog ports, but it doesn't require a spaghetti code that makes servos do a wave.

You can use an analog multiplexer to connect 16 analog inputs to each analog input pin. On an UNO that gets you 96 pot inputs. On a Nano you get 128 (it has A6 and A7 inputs). On a MEGA you get 256 (16 analog inputs).

You can further expand by using another layer of multiplexer: Each analog input pin can connect through one multiplexer to 16 other multiplexers. That's 256 pots per pin. That's 1536 for the UNO, 2048 for the NANO, and 4096 for the MEGA.

Extra analogue pins has nothing to do with extra servos. Spaghetti code is your responsibility it is not the consequence of having a servo expansion chip.

The tutorial I saw used said "spaghetti code" to make some servos spin as a group. I had a bit of hope that there is a shield, that when you import a library allows you to use more pins, which literally work the same way as the ones normally available on the board

Does it work with outputs? And is there a good text tutorial on those?

Total rubbish. There are a lot of poor tutorials about, written by people who get something working and then thing they are experts.

Any analogue multiplexer can work as an input or an output.

A good library or function can make the code easy to drive.

But it can only drive one output at a time.

For digital inputs and outputs you would probably be best served by a "Port Expander". Typically I2C/Wire/TWI devices. You can set individual pins as inputs or outputs.

For specialized outputs, like for driving LEDs or servos, there are specialized chips for that. Port Expanders won't help for adding analog inputs for pots or output pins for the Servo library which is limited by the number of available timers (12 per timer). Use a 16-channel PWM Shield for each 16 servos.

So is there a shield that would allow me to use more ports? I mean literally all I would have to do is import a library, then use it with as little code as possible?

No. There is no trivial way to make pinMode(), digitalRead(), digitalWrite(), analogRead(), analogWrite(), SoftwareSerial(), tone(), Stepper, Servo, etc, etc, etc... to use pins you add as if they were built in to the processor. There is no one shield that will expand your selection of processor I/O pins. Sorry.

Different uses of pins (analogRead() for pots, Servo library for servos) require different way to add more pins.

How many ports do you need and how many you have? Maybe easier to just get a different board all together

I have both an UNO and a leonardo. I decided that the easiest way for them to use more ports is to get a due clone (only 2x the price of an analog extender) so i can use it either on its own, or make it transfer data with the uno/leonardo.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.