PDA

View Full Version : Arduino Shield Question



brian25
10-01-2013, 05:02 AM
hi how to use multiple shields in Arduino?

if i have two..
example, GSM and Ethernet can this work simultaneously in void setup?



void setup(){

Serial.begin(9600);
if (gsm.begin(2400)){
Serial.println("\nstatus=READY");
started=true;
}
Ethernet.begin(mac, ip);
server.begin();

}

KurtEck
10-01-2013, 08:57 AM
Hi Brian,

Others can maybe give you a more concrete answer. But the ability to use multiple shields very much depends on which two specific shields. There are several issues with them, which include:

1) Does the first shield you plug into the Arduino pass through all of the necessary signals and power/ground pins that are needed by the second shield. Many do not. Example some shields rely on signals that come up through the 6 pin ISP connector and many shields do not pass these through.

2) Can both boards be configured, such that they don't both want the same resources, such as IO pins, Timers, Usarts, SPI, ... Example many boards require digital pins 0/1 (for the Usart).

3) Like 2) can any support libraries that are used by the boards be configured to again work with other things. Example if you are using SoftwareSerial it will hog all of the PinChange Interrupts. Or Timers, or too much memory, or... Sometimes some of these you can only find out by trying them.

Good Luck

jwatte
10-01-2013, 11:13 AM
If you have an Arduino Uno or Leonardo, then no, that won't work, as both the shields will want to use the same serial port.
You would have to modify one of the shields to use other pins for the serial port, and use the SoftwareSerial module, or you would have to use an Arduino Mega that has more serial ports (and a proper shield that interfaces with those ports instead.)
If the shields you have do not support any kind of modification/switch to use other pins, then the two shields are not compatible to use together.

brian25
10-01-2013, 11:05 PM
i found site about pin configuration of each shield
http://playground.arduino.cc/Main/ShieldPinUsage

if for example ethernet shield uses pin 10~13 for communication and GSM shield is 2~3(softwareserial).
it means they are compatible to work together with arduino uno?


can this be possible to conflict with other libraries?:sad:


hi thank you for the responsed.:happy:

jwatte
10-02-2013, 12:31 AM
if for example ethernet shield uses pin 10~13 for communication and GSM shield is 2~3(softwareserial).
it means they are compatible to work together with arduino uno?


Yes, they will likely not clash.

However, the software driver (library) for one may disable interrupts for longer than is acceptable for the other. There really is no way to know other than reading the code, or buying and testing it thoroughly.