SoftwareSerial.h RX and TX pins

Hi, I'm using SoftwareSerial.h with a GSM shield and Uno. In the examples I look at pins 2 and 3 are usually used as the TX and RX pin. Unfortunately I've already used pin 2 for some other purpose. What pins can I use as a replacement for it?

Any you like apart from 0 & 1 which are used for the hardware serial port.

Grumpy_Mike:
Any you like apart from 0 & 1 which are used for the hardware serial port.

Are you familiar with the GSM library athttps://github.com/MarcoMartines/GSM-GPRS-GPS-Shield/blob/GSMSHIELD/doc/List.txt

When I decomment the

#define GSM_TXPIN 2
#define GSM_RXPIN 3

lines in GSM.cpp and replace them with my own numbers the Serial input changes. It goes from constantly outputting ATT: OK RIC: to a state of far less output beginning with DB: NO RESP. Both then generally go to setting the baud rate then say ERROR: SIM900 doesn't answer. Check power and serial pins. The GSM shield doesn't work properly in either case.

Unfortunately I've already used pin 2 for some other purpose.

So change that "other purpose" to another pin and leave pin 2 for the GSM.

You can't change the pin on the GSM shield because it is already hardwired to use pin 2. However, you could reroute the GSM pin to another pin with a wire. Please note this will mean you would need to either unsolder the pin from the GSM shield, which I DO NOT recommend, because it could damage the shield; or bend the pin outward and use a male to female jumper wire to move it to another pin. Only then can you change the GSM_TXPIN in the .cpp file.

HazardsMind:

Unfortunately I've already used pin 2 for some other purpose.

So change that "other purpose" to another pin and leave pin 2 for the GSM.

You can't change the pin on the GSM shield because it is already hardwired to use pin 2. However, you could reroute the GSM pin to another pin with a wire. Please note this will mean you would need to either unsolder the pin from the GSM shield, which I DO NOT recommend, because it could damage the shield; or bend the pin outward and use a male to female jumper wire to move it to another pin. Only then can you change the GSM_TXPIN in the .cpp file.

Would you know what other pins are commonly reserved by GSM shields and their libraries then? I know 7 is typically used for power buttons and 2, 3 for software serial. Since I have to desolder a header to remove the attachment to pin 2 it'd be nice to have an idea of what pins I shouldn't switch to so I can save myself some trouble.

You shouldn't desolder anything.

From what I read when I looked up that library, the older GSM model used D4 and D5, (pin 4 & 5) for the software serial pins but the newer model was changed to use pins 2 & 3, so it is possible nothing is connected to D4 & D5. But it is never a good idea to change a shield pin unless you are absolutely sure it is not being used, and i'm not absolutely sure. So the better way to solve this problem is to move whatever you have on pin 2 right now to another pin.

Really all you need to do is set the pinMode for pins 4 or 5 as either INPUT or OUTPUT and see if that causes the GSM module to act strange. If it does, then you know you can't use those pins.

HazardsMind:
You shouldn't desolder anything.

From what I read when I looked up that library, the older GSM model used D4 and D5, (pin 4 & 5) for the software serial pins but the newer model was changed to use pins 2 & 3, so it is possible nothing is connected to D4 & D5. But it is never a good idea to change a shield pin unless you are absolutely sure it is not being used, and i'm not absolutely sure. So the better way to solve this problem is to move whatever you have on pin 2 right now to another pin.

Really all you need to do is set the pinMode for pins 4 or 5 as either INPUT or OUTPUT and see if that causes the GSM module to act strange. If it does, then you know you can't use those pins.

Pin 2 is currently being used as an input for another attached device and is soldered through a header for a secure connection. Thats why I was a little hesitant to move it unless it was necessary. If it really is best to move it I was just afraid I could end up switching it to another pin that was 'reserved then have to desolder and move it again. So far I know I can't use 2,3, and 7. I'm already using 4 and 6. Possibly 4 and 5 might not be okay to use. So I guess the other digital pins are fair game?

Or the analogue pins, of course.

jarwulf:

Grumpy_Mike:
Any you like apart from 0 & 1 which are used for the hardware serial port.

Are you familiar with the GSM library athttps://github.com/MarcoMartines/GSM-GPRS-GPS-Shield/blob/GSMSHIELD/doc/List.txt

When I decomment the ........................

So what, that does not change my answer. You can use any pin you want. What you can not do is change the pin in software and hope that it will magically change the wiring in the hardware.
So if you change the software you have to change the hardware.

Pin 2 is currently being used as an input for another attached device and is soldered through a header for a secure connection.

Remember pins 2 & 3 are the ones that can directly trigger interrupts, so if your device software needs this then you will have to do some rewriting to use another interrupt mechanism.

Moving GSM software serial from pind 2,3 to 7 (tx),8 (rx).
I have a similar problem. Using an Arduino Micro, I have used wires from the micro to a GSM shield (SM900), were I use "SW" pins 7 and 8 for serial communication. The GSM library appears to choose som other pins for SW serial (it uses the SoftwareSerial library). Apparently the pin usage is specified in GSM3IO.h, although the pin numbers here (3, and 8 ) for 32U4 processor, do not correspond to the 2, 3 pin usage as specified in documentation. (Could it be physical pins vs "non physical?).
Anyway. I would like to move from pins 2 and 3 to 7 and 8. 8 which has interrupt so it can be used for Rx, and 7 which is digital. This frees pin 2 and 3 which I am using for I2C (only these pins are possible with the wire library)..