Right now I own a Mega 2560 and I guess there is no way it can handle all above.
So, what to do?
I heard about shields, but i don't know which one would be the best for me, and if one of those would be even enough.
Please enlighten me.
Um, honestly your probably going to want a few more arduino Megas. You could maybe handle that many inputs with a whole bunch of demultiplexers such as the 4051 or something similar but the lag on reading that many inputs with one Mega would be pretty impressive. If I am doing the math right and the rotary switches have one analog output each you are looking at around 350 inputs and 50 outputs. If I may ask what in the world are you making that would require that many I/O pins? Anyway, the way I would go about it would be to have a dedicated mega for each part, one for the leds, one for the toggle switches, one for the push buttons... so on, and the have on master Mega to handle the main commands, sending out data to each of the slave controllers. I think a bit more information on the project you are thinking of doing would be very helpful because depending on the requirements it might be possible to get away with multiplexing some of the inputs or outputs to cut down on the pin requirements.
ookid:
If I may ask what in the world are you making that would require that many I/O pins?
Sure, panels for a flight simulator.
ookid:
If I am doing the math right and the rotary switches have one analog output each you are looking at around 350 inputs and 50 outputs.
Fortunately some user here taught me how to read them using just 1 input.
ookid:
Anyway, the way I would go about it would be to have a dedicated mega for each part, one for the leds, one for the toggle switches, one for the push buttons... so on, and the have on master Mega to handle the main commands, sending out data to each of the slave controllers. I think a bit more information on the project you are thinking of doing would be very helpful because depending on the requirements it might be possible to get away with multiplexing some of the inputs or outputs to cut down on the pin requirements.
But how to connect those extra arduinos? There is only 2 serial ports.
By connecting them to another PCs I would have to read them through the ethernet or something?
What would be your idea?
A lot depends on the physical location of all the devices. If you have several clusters of switches/LEDs/displays etc. deparated from each other, then use a separate Arduino to control each cluster and have them communicate with each other.
To drive several 7-segment displays or a lot of LEDs from a single Arduino, multiplex them. You can do this yourself using e.g. ULN2803s as column drivers, or you can use display driver ICs such as these http://www.maximintegrated.com/products/display/controllers.cfm.
For reading a lot of push buttons or toggle switches, put diodes in series with them and connect them in a matrix. For example, an 8 x 8 matrix needs 16 I/O pins (of which 8 can typically be shared with other devices too) and handles 64 push buttons or switches.
dc42:
then use a separate Arduino to control each cluster and have them communicate with each other.
About this, would be great if I can solve this just by adding more cards, but as I stated in the previous post, there are only 2 serial ports in most motherboards you can find out there and I was planning to use one of them for a different device.
How can I get 2 or more Arduino boards working as a single unit?
You can have the PC talk to one of the Arduinos over serial or (preferably) USB, and have that talk to the others over SPI or I2C.
For things like setting the frequencies of nav/comm sets, use rotary encoders (just like real nav/comm sets) rather than rotary switches. You can multiplex rotary encoders in the same way as push buttons.
Would you even need the PC to talk to the Arduinos? I was just figuring that the Arduino would show up to the flight simulator as a keyboard or other such HID device, correct? Along the lines of multiple Arduinos talking to each other what I meant to say was that each master/ slave Arduino would have its own predefined address and when the master sent commands down the line it would append the intended addressee and then each slave would compair that address with theirs and see if it matched. If it did they would execute something, otherwise, they would ignore it. This protocol is implemented by I2C and SPI but could also be implemented on the serial ports if so desired.
There is no 1 shield that can do all you want.
Get some protoboard and add some chips & connectors to break out the signals to your various panel locations.
LEDs can be driven from MAX7219 (SPI)
Seven segment displays can be driven by 4 MAX7219 (SPI)
You're never going to change more than 2 inputs at a time, yes? Only have 2 hands?
Push buttons - are these momentary switches> Or push on, push off kind of parts?
All the digital things can be read in via parallel load shift registers, clock them all together and shift in via SPI, act on the bits that changed.
Pots - Mega has 16 Analog ports? Scan them all.
The Rotary Encoders - I would use chips like LFLS7184 to create an interrupt when the rotary encoder was turned. React to the interrupt & direction line as needed.
With some decent coding, I think you could make the Mega pretty responsive to all you listed.
I assume you're referring to USB ports. An Arduino is a very slow device, so you can connect them via USB hubs with no problem. USB allows up to 127 devices to be connected to a USB hub. USB hubs typically don't have that many physical inputs, but you should have no trouble finding a couple of cheap USB hubs that support a dozen or so ports and daisy chaining them to give as many ports as you need.
I assume you're referring to USB ports. An Arduino is a very slow device, so you can connect them via USB hubs with no problem. USB allows up to 127 devices to be connected to a USB hub. USB hubs typically don't have that many physical inputs, but you should have no trouble finding a couple of cheap USB hubs that support a dozen or so ports and daisy chaining them to give as many ports as you need.
But Is it possible to access to both of them at the same time if they are using the same port?
Rookie 2 said most "motherboards" only had 2 ports, not the mega's.
So 1 is committed to something else, and 1 free for Arduino's.
2 seems kind of small tho, anything recent has at least 4, with 2 needed for keyboard/mouse.
Even my old(ish, 4 years with Win Vista) Sony Vaio laptop has 4 ports.
Each USB slave gets its own COM port, yes? So you'd need multiple COM ports open.
Being a hardware designer, I'd tack on a protoboard and start adding chips 8) and keep it to just 1 interface to the PC.
Oops - I misunderstood. I'd stay with the one Mega attached to the PC and talk to satelllite arduinos over Serial. You could have those satellites talk to multiples too if necessary.
CrossRoads:
2 seems kind of small tho, anything recent has at least 4, with 2 needed for keyboard/mouse.
Even my old(ish, 4 years with Win Vista) Sony Vaio laptop has 4 ports.
You are right, according specifications the motherboard I'm using has 4 x USB 3.0 and 12x 2.0
Currently I have couple joysticks, and the arduino board, all in different ports, I wasn't event counting keyboard and mouse which are connected through the USB too.
However, I can see 2 COM ports only, COM1, and COM3.
Do they appear as I am connecting more devices?
Or maybe if I connect 2 arduino they use the same COM and I'm able to read/write from/to both just from there?
I'm really confused. :~
Each Arduino you connect to your computer's USB will be considered a separate virtual COM device talking on a separate COM port. (USB - Wikipedia)
You can have a network of up to 127 devices on a single USB network. I'm assuming that you have at least 2 USB controller chips in your machine (possibly 3 if the USB 2.0 ports are driven by two separate ones). This gives you plenty of devices you can connect up to your computer. If you don't have enough USB ports, buy a USB 2.0 hub. You can then connect more USB devices off of that.
For each Arduino you plug in, you will get a new COM port show up in your device manager list.
An alternative would be as others have suggested, to connect the Arduino boards to each other via their serial ports, reducing the number of connectors you need to go to your computer. However, depending on your experience, this may be a little more difficult as you will have to manage your own internal (daisy or ring) network (though you may find something prefabbed by someone else online). This also would complicate programming each board as only one will be physically connected to the PC. It is possible to use the main board as an “in-system programmer” (ISP), but I've only just seen that this can be done and programming a network of Arduinos from one Arduino, although theoretically possible, is beyond my knowledge at the moment.
Oh, FYI. If you have the COM port open and you somehow disconnect the Arduino and try to reconnect it again, I think it may jump to another COM port since it's normal COM port is unavailable. This happen to me when I still have the serial monitor up and unplug and then replug in my Arduino (or accidentally short something on it and then unshort it).