Hi Arduino friends,
So my project is to use an arduino to control a GPS module (I’m using the Adafruit MTK3339 GPS shield and logger) and an Xbee transmitter to transmit GPS data wirelessly. I’ve attached a picture of my setup for visuals (wire coloring is wrong, but I didn’t have time to sort them out at the time)
The problem is that the Arduino unos are only capable of one active serial port at a time, so if I try to plug in the GPS module and the Xbee using the SoftwareSerial library to enable extra serial ports, neither of them will work properly. I could just get an Arduino mega and just solve the problem there, but that’s too easy and I think there is some really viable workarounds.
Some solutions I thought of were to code some sort of delay, where the Xbee and GPS module will take turns using the serial port, though I’m not exactly sure yet on how to code this (maybe using the listen() object in the SoftwareSerial library?). Another solution was to use the miniSD slot on my GPS shield, have it write to a text file in the miniSD, then have the Xbee read that text file and transmit the data that way, only problem is i’m not sure if that would still require the serial port. Third is to use another serial library called AltSoftSerial, but that can only be used on pins 8, 9, and the manufacturer of the GPS shield set pins 8,7 as the RX, TX connections into the hardware itself.
Sorry for the wall of text. How can I go about programming the arduino to have the GPS module and the Xbee take turns, or would that not be possible since the GPS module works asynchronously? If I use the miniSD in this manner, would I still have to deconflict the usage of the serial port between the GPS module and the xbee? I was hoping I could just get the arduino to work via direct connect and stream the raw NMEA data rather than parsing it (parse it at the receiving station instead). Thanks in advance!