0

I am working on a project where I connect a GPS module and GPRS SIM900 shield. The location will be sent when it recives a certain character.

Now my question is, can the Arduino receive from GPRS and GPS module data at the same time? The GPS is not given coordinates, however it works properly without receiving a message from the GPRS.

I am using softwareserial for both. Should/can I use hardware serial and softwareserial?

  • 1
    You cannot receive from two softwareserial devices at the same time. – Majenko Dec 25 '17 at 15:41
1

I am using SoftwareSerial for both.

As others have said, you cannot listen to 2 SoftwareSerial ports at the same time.

Should/can I use HardwareSerial and SoftwareSerial?

... can the Arduino receive from GPRS and GPS module data at the same time?

Yes, but...

This answer provides full details on choosing "good" combinations of hardware and software serial ports. To summarize:

  • Use the HardwareSerial port (i.e., Serial) for one of the devices. You can still use it for debug prints, as long as the device has some kind of command "format". For example, if commands start with "AT", just make sure that none of your debug prints start with "AT". It is the absolute best choice. You would have to disconnect RX pin 0 from the device in order to upload new sketches over USB.

  • Use AltSoftSerial for the other device. It is the most efficient software serial port, and it can be used at the same time as Serial. It only works on two specific pins.

  • NeoSWSerial is the next best choice, at limited baud rates. It can be used with the above choices, but transmitting on NeoSWSerial prevents them from receiving.

  • SoftwareSerial is the worst choice. Receiving or transmitting on SoftwareSerial prevents all of the above from receiving anything. It disables interrupts for long periods of time.

0

Probably you don't need to use both GPS and GPRS in same time. Just check for a certain character from GPRS in the loop and when it comes check the GPS data.

Why not connect GPS module to hardware serial?

0

you can connect gps to hardware serial port rx and gsm to software serial. in similar way, I solve the problem

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.