GPIO but Pure Insanity

I know this is completely and utterly ridiculous, but I would love to find a way to have several hundred digital IO pins on an arduino mega. A shield would probably be the best way to go, but I do not know of one large enough. How would I go about this? My budget is up to sixty five dollars. If this is impossible do not be afraid to say so, but I would appreciate suggestions. Thanks!

First question would be what those IOs have to do.

Inputs (how many, analog or digital), outputs (how many, high / low, or PWM).

What will be connected to those pins?

All digital, high low. Can digital pins be either in or out? No pwm or analog needed, but it would be great if said shield was stackable so that such things could theoretically be added. The pins would be used to connect to rotary encoders(incremental)

It's completely possible to have a hundreds IO. Main question is - how fast they are changing and how are are you going to process them?

I would like them to change as fast as possible. Commands will be sent to the board via a raspberry pi doing the brain work.

still not clear. Is a 1 sec reaction time is fast enough? Or you need a 10mS?

In general it's hazardous to have large amounts of wires over a certain distance. You may be better off with port extenders, accessible with 2-4 common bus lines and concentrating 16 inputs or outputs each.

Rotary encoders for human selection or motor position determination? A controller can handle only a limited number of rotary encoders, so that a couple of dedicated slave controllers may be what you want.

ConnerAnderson: The pins would be used to connect to rotary encoders(incremental)

There are various ways of adding extra I/O pins but my guess is that you will run out of CPU cycles to process the encoder data long before you use up all the pins on a Mega, never mind extra pins.

...R

Ideally I would like 10ms. It would have to be fairly fast. Multiple boards are fine as long as the pi can communicate with the pins. Basically, I need to get 100 pins worth of info to the pi fast enough that a human would see very little delay.

The pins would be used to connect to rotary encoders(incremental)

100 rotary encoders would be pretty much impossible on an Arduino-like board, AFAIK. Each encoder usually uses two pins and generates quite a significant pulse rate, what with the usual "lots" of steps per revolution.

Any way to use more than one?

More than one of what?

How fast are those encoders putting out their pulses?

Simple encoder or quadrature (with direction)?

Clock speed is your main issue. Communication with the Pi is another: how often do you need the pulse totals to be communicated? What communication channel do you plan to use?

Hi, What is the application that needs several hundred I/O? How many input and how many output?

Thanks.. Tom.. :) PS. MCP23017, I2C 16 I/O

read X/Y PROBLEM

you have not given any actual clues to what you are doing.

Application drives the solutions

if you have 'hundreds' whatever that really means of digital I/O, I/O means inputs and outputs to us. there is a difference.

Do you have a robotics chair that has a hundred encoders and are trying to make a human interface for game play ?

Do you have a field of solar panels that you want each to move ?

Once you can define the real issue, in clear terms, it becomes much easier to help. and answers are not met with .... naw, that cannot work, because I did not tell you about "Z" ......

you should know exactly how many encoders and what type of encoders. saying encoder is like saying a light. I have an LED on my bench. there is another light over my head, one over the plants and one on the pole in the street.

a simple encoder will have one phase output, but 2 phase or 3 phase is common when you get into some things. a Gray scale encoder will tell you where you are, not just that you moved. it has more output pins. And then there might be a switch ?

do you have any sort of schematic ?

it may be that one MEGA could read all your inputs and end them to the Pi it could be that one MEGA could control all your outputs or maybe one mega could do half I and half O....

in very general and very broad terms, the RPi can talk to multiple Arduinos depending on the Arduino board, the total memory might come up short, so a second board might be needed, or a board with more memory.

Please take a few minutes and describe what you want to do. it might be that there are other ways to get you there faster and easier.

I am kinda new at robotics. I am trying to build a robot with legs, but I am having trouble figuring out what to do. servos are not fast or strong enough to be usable really, nor do they have a great range of motion. I thought maybe I could rig up a rotary encoder to a fast and strong dc motor, but to do so with a legged robot would mean an insane number of GPIO pins. Is there some obvious answer that I am just not getting?

I kind of liked the idea of muscle wire but quickly found out that it is just not a practical solution.

A servo is nothing more than a DC motor with position feedback and smart controls to get it to the desired position all into a convenient package. Servos come in many sizes and shapes - including really big and strong ones - but in those industrial ranges the controls and motor are often sold separately. Typical range of motion is 180°, but you can get 720° servos as well. That should be enough for your robot.

A basic rotary encoder has one output. A quadrature encoder has two. Grey scale encoders have many - there are dedicated chips for those to read all the outputs and give you the number over e.g. an I2C or SPI bus. You need either one of those, or limit switches on each joint to find a home position, from where you can start counting.

It sounds like you have nothing done yet, and that you're thinking way too far ahead and most likely in the totally wrong direction. Start small: start with one arm, or one finger. By the time you get that one to work fully you're probably a year further, and it's time to add another arm, then legs, etc.

A more sensible approach would be to use a handful of Pro Minis, each controlling one limb, or the face, or the body, and one or two for each hand. Then the main brain, the RPi, can send high level commands to the limbs which operate otherwise independently.

Trying to do all this in a single board is madness and won't work. Too much code. Too much processing. Too many wires. Too long wires. Just a few issues you will run into.

ConnerAnderson:
I am kinda new at robotics. I am trying to build a robot with legs, but I am having trouble figuring out what to do. servos are not fast or strong enough to be usable really, nor do they have a great range of motion. I thought maybe I could rig up a rotary encoder to a fast and strong dc motor, but to do so with a legged robot would mean an insane number of GPIO pins. Is there some obvious answer that I am just not getting?

I kind of liked the idea of muscle wire but quickly found out that it is just not a practical solution.

a human has a hip and a knee and an ankle joint for each leg. that is 6 motors for bi-pedal movement
a dog would have 12. I might be missing a tilt or twist, but the numbers are not very high.
if you sketch out the device you want to make, you can show where each motor would go.
by putting the idea into a sketch, things start to become clear and your understanding increases.
watch a few videos of others who have done a similar thing to get a peek behind the curtain.

Ok... I can start with something smaller. Would you guys recommend any specific servos that might be useful? arm, finger, or robot, I still need a faster servo. The ones I am using only go 30 rpm.

Cheap would be good too, as long as quality is not to compromised.

What size is the the thing you want to build - that will have a huge bearing on the components required.

You also need to work out where the masses (such as batteries and motors or servos) will be located relative to the limbs that need to be controlled.

A diagram of the proposed machine would be a great help. See this Simple Image Upload Guide

...R

I'd rather use separate controller (like Arduino pro mini) for each joint and connect them together to Pi by I2C bus. So Pi will send a high level commands to each controller.