3 Serial comunications in Arduino Mega 2560


I am trying to set up a project where I communicate a GPS module with a GSM module to send the data over the internet.

When trying each one separately, it works great. I am using the GPS module on ports (RX=10,TX=11,baud=9600) and the SIM900 (GSM) module on ports (RX=12,TX=13,baud=19200) from a Arduino Mega 2560.

However, if I put both together with the same configuration, it stops working.

The last test I did was to get the code where GPS module is working, and only adds SIM900.begin(19200) to it, and then it stopped with a error point problem in wiring.

That’s strange, because this unique line breaks all the set up out.

Does anyone has any clue about what is going on?

Thanks a lot!

? A Mega has hardware serial on pins 14-19. Seems you use softSerial. I think that's limited to 9600 baud. Leo..

Yes, you are right, I am using SoftSerial.

I have used it with the SIM900 alone on 19200 baud rate successfully, so it seems that works on higher rates.

I forgot to say that I am also using the computer as serial, so these are the 3 serials: GPS, GSM and Computer.

thias_milani: Yes, you are right, I am using SoftSerial.

You have free harware serials, just don't use SoftSerial.

I am using SoftSerial.

You have free hardware serials, just don't use SoftwareSerial.


Use Serial to the PC (pins 0 and 1). You're probably doing this already.

Use Serial1 to the GPS (pins 18 and 19).

Use Serial2 to the GSM (pins 20 and 21).

Serial3 is also available on pins 22 and 23.

Be sure to call Serial1.begin(...) or Serial2.begin(...) for the the ports you use.

Does anyone has any clue about what is going on?

If we saw your code, we could tell you. Be sure to use [code] tags around your code [/code].

You should also take a look at NeoGPS. It is smaller and faster than other libraries, and the examples are structured correctly so that you can add your modifications easily. The Troubleshooting section can help you understand the timing issues.

There's a similar sketch in this thread.

Cheers, /dev