0

I have a SIM900 GPRS/GSM Shield (details here) and I am looking to stack a GPS shield (such as this one here).

My question is: I believe that they both require software serial, also it says to use software serial on D7 and D8 for both. Is this possible on an Uno?

I am a bit confused at if software serial has to have these two specific pins, or if these are just what is chosen on schematics?

What would be the most effective way to stack these two shields so they don't interfere with each other?

EDIT: Using a gps shield such as this gives the option of

If you need to move the software serial port pins, they can be custom-routed to any other pin by cutting the solder jumpers between pins GPS-RX and D8 and/or GPS-TX and D9.

This isn't entirely clear to me, but am I right in thinking it means I can have multiple software serials on my Uno, just using different pins?

0

SoftwareSerial can use any pins. That's the whole point of it. However, some shields are wired to use specific pins. If two shields try and use the same pins then you can't use them together. Not stacked, anyway. You will have to use flying leads, or physically alter the shield (cutting tracks, soldering in "bodge" wires) to use them together.

That said, though, you can only use ONE SoftwareSerial port reliably at a time. That means, regardless of what pins they use, you can't use two shields together that require pins other than 0 and 1 (hardware serial).

To use them both you will need a board with multiple hardware UART ports and modify the shields (as mentioned above) to use the correct pins for those UART ports.

  • Ah, so even if I have for example: SIM900 on D7 and D8, Wifi on D5 and D6, GPS on D3 and D4. and set up each of these with their own SoftwareSerial serial1(7, 8); SoftwareSerial serial2(5, 6); SoftwareSerial serial3(3, 4); It still wouldn't work? – Calco Aug 3 '16 at 10:36
  • Not reliably. SoftwareSerial is a blocking system. It uses interrupts to start reception of a character through a port, but while that character is being received nothing else can happen. So you can only receive through one port at a time. If anything arrives on one of the other ports while something is being received on one port it is lost forever. – Majenko Aug 3 '16 at 10:45
  • If I did the same kind of pin redirection, just on a Mega to the hardware serials, then used serial1, serial2 and serial3. Would this be the best way to reliably communicate with each shield? – Calco Aug 3 '16 at 10:51
  • Yes. That would be ideal. – Majenko Aug 3 '16 at 10:51
  • Just to confirm, in this case I could redirect all the shields hardware serial pins (D0 and D1 of each shield) to each hardware serial of the Mega. Meaning I don't even need software serial? – Calco Aug 3 '16 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.