Hi, how many shields can be put on top of the MEGA? What can I do if some of the pins are needed by multiple shields? How do I determine when to use shield and when to use breakout board?
There are pictures going around of about twenty shields in a stack, but you are probably kidding yourself if you need more than four or five, and probably should not be using an Arduino.
It depends on what you are doing, but you could run out of power before you run out of pins. Some shields require their own power supply.
Some shields have configurable pins to avoid clashes, use of software serial etc. You can also clip pins and make your own jumpers but, if you don't plan things properly, you can also find out that what you did was unnecessary.
Using a spreadsheet to keep track of things can be a good idea.
Only you can determine when to use shield and when to use breakout board, and you might as well throw the idea of home-made shields into the mix while you are doing it.
Will I damage the boards if there are pins that they both use? I am a bit hesitate to fool around with reconfiguration of shields. Some shields require the user to change the hardware by adding resistor, cutting connection, etc.
I want to allow my MEGA to connect to the internet via wifi. Which wifi module do you recommend?
Clearly, if two boards use the same pin, you will come to grief, even if you don't actually damage anything, and you just have to come to terms with that. I don't think it happens often though, and some pins just pass through a board without being connected thereon. For instance, pin D4 bis conventionally used for selecting an SD card, and you are not likely to find a motor shield or display shield that is dumb enough to use it, but the pin will probably be on it.
I have never heard of a shield that requires a resistor to be added, and I wouldn't think its manufacturer would stay in business too long. I am also unaware of any need to cut a connection, although I have clipped pins. I know of shields where where a connection has to be bridged in order to use an SD card.
My worry is that one mistake damages several boards...
You worry too much.
In the Arduino world, doing things that don't work is quite easy, but doing things that actually destroy things is not so easy.
Hi,
Re pins:
My current project involves a number of sensors. the code to use them allows me to change the data line they are sending to (I had several whose example codes wanted pin 8).
Also to complcate things anything that needs to use a hardware interupt (for example to detect when a button is pressed or a IR beam is broken) has to be connected to one of 6 digital pins on the Mega (only 2 IR pins on a Arduino UNO) which means I have to reconfigure my keypad.
A third thing to consider is if you need pwm which pins have pwm avaliable (some arduino processor boards have them marked).
If two shields use the same pin it will be confusing for them if it's a output pin (unless it's intentional ie: you want to trigger something on two shields at the same time)
If they are on the same input pin. it might confuse your script although it would be a handy way to maxamise the limited number of interupt lines (although you will have to determine which shield triggered it).
To keep track of what is using which of the 53 digital i/o and 15 analog pins on the Arduino Mega likeNick_pyner suggested a spreadsheet or even a simple table on a sheet of paper list the pins then write beside them what is connected to it (object/shield/device etc) and if its input or output.
In my design I'm using a protoshield mega which will have stackable headers for the pins that the uno also uses and the rest non stackable pins as the shield will be my breakout board for the cable looms to screen, keypad, sensors etc. On top of this will be a datalogging shield.
Oh and another thing to watch out for - I/O pins can only deliver up to about 40ma each, the arduino powered solely off usb can draw only about 500ma max (Gueuino mega specs) so you may need to provide external 5vdc.
One way you could kill a chip or board is if you put a 5v logic level output signal into a 3.3v logic level input without some sort of logic level converter. there are some 3.3v shields and modules (and a few arduino's such as the lillypad)
I don't think that the Arduino was ever designed with a multitude of shields stacked on it in mind. In my opinion it's the weak point of the system if; but one would probably not buy an Arduino if one needed that functionality.
If multiple shields really needed to be supported, the Arduino would have had some form of bus system specified (using e.g. SPI or I2C due to the 'limitations' of the AVR micro) and all shields would connect to the Arduino using that bus system only.
newto_arduino:
How do I determine when to use shield and when to use breakout board?
Availability of what you need is one thing to consider. Pin conflicts are another one; breakout boards win here as you can wire them as you need while shields often need to be modified. Shields offer convenience (no wiring required).
