I realize this is not strictly an Arduino question, but I figured this group could still help...
I want to connect multiple devices to a Pi or an Arduino: a GPS device, an Adafruit GSM FONA, a temperature sensor, and an OBDII serial device. The GPS uses Serial, the FONA uses Serial, and the OBD interface uses Serial.
I'm trying to figure out how I can connect all these devices. I'm thinking I'll need to connect the FONA to the Pi, the GPS to an Arduino, and then connect the Arduino to the Pi over US.
Question: do the USB ports on the Pi share the same "line?" as the TX/RX GPIO pins? Or can I safely use the FONA on the TX/RX pins, and then connect the Arduino to the USB port?
If not, should I use I2C instead?
Any guidance here is appreciated!
Thanks!
Question: do the USB ports on the Pi share the same "line?" as the TX/RX GPIO pins?
No.
Or can I safely use the FONA on the TX/RX pins, and then connect the Arduino to the USB port?
Yes.
should I use I2C instead
No. The Pi can only be used as an I2C master.
Thank you!
And just to confirm, really stupid question, there's no way to use the FONA and the GPS Hat on the same Pi at the same time, right? What do people do in these situations? Add another microcontroller?
A Hat is just a blank canvas, it is not incompatible with anything. The processor in the Pi has two serial ports sadly these come out at the same pins as the first serial port or on GPIO 32 & 33 which are not accessible.
What do people do in these situations? Add another microcontroller?
No just add another UART, you can get an I2C USRT with buffer that should do the job.
There are lots but this is one:-
On An arduino you can use a Mega with four serial ports or a Leonardo or Micro with a USB serial and a hardware one. Or you can use a bit banging software emulation. Linux, being not real time, stops you using this technique on the Pi.
osmosis311:
I realize this is not strictly an Arduino question,
Arduino: a GPS device, an Adafruit GSM FONA, a temperature sensor, and an OBDII serial device. The GPS uses Serial, the FONA uses Serial, and the OBD interface uses Serial.
Well, that's three serial devices and, since this is an Arduino Forum, it might help to know that the Arduino Mega has four serial ports.
Thanks Nick! Very good point, and I think I should leave the Pi out of my setup and switch to a Mega.
Are the Serial ports on the Mega simultaneous? Or, similar to SoftwareSerial, can I only read/write to one at a time?
If I use a Mega, I should be able to connect the FONA and a GPS module without any problem?
Thanks!
Are the Serial ports on the Mega simultaneous?
They are hardware so yes.
I'd choose sensors with I2C interface instead of serial, then you can't run out of ports with many connected devices. I'm using a single ribbon cable for my I2C bus, running from the processor board to all external devices, and clip sockets onto it wherever a device has to be connected. This cable can also be used to power the devices, signal interrupts etc.
Only caveat: the devices should use the same voltage on their I2C bus as the controller, mixing 5V and 3.3V devices can become tricky. With an Arduino Pro (Mini) you have the choice of 5V and 3.3V controller operation.
Maybe I'm going about this the wrong way. Maybe I can just use a single chip for each serial device, and have the chips communicate with each other over I2C?
What's the "smallest" Atmel chip that [uses Arduino and] has a dedicated hardware UART?
With I2C, can I make a request and get a response from a device?
Thanks!
osmosis311:
If I use a Mega, I should be able to connect the FONA and a GPS module without any problem?
There should be no problem at all. This is what Arduino is about. If you use shields that are Uno-size, and most are, you will have to get smarty-farty and run cable to the relevant serial ports. I imagine you would do this from the jumper points. As for your reply #8, I don't think you are going the wrong way at all, and there is nothing you have mentioned about your project that warrants such an overly-complicated approach and using I2C is particularly dumb.
osmosis311:
Maybe I'm going about this the wrong way. Maybe I can just use a single chip for each serial device, and have the chips communicate with each other over I2C?
That's possible, using e.g. an Pro Mini at 4$. It should also be possible to connect multiple serial devices to any Arduino, using the SoftwareSerial library.
osmosis311:
With I2C, can I make a request and get a response from a device?
Every I2C device has a unique address (7 bit), usable to address it in point-to-point communication. Every device can act as a slave, that sends data or receives commands or data on request from a bus master. An Arduino uses the Wire libraries onRequest and onReceive interrupt handlers for that purpose.
A device can act as a master, if so equipped, sending commands, data or requests to an specific slave. An Arduino uses requestFrom and begin/endTransmission for that purpose. A master also can broadcast data/commands to all other devices on the bus, to e.g. notify all others about specific events; I plan to use that feature instead of individual interrupt lines for every device.
Multiple I2C devices can try to become a bus master at any time, the protocol resolves possible collisions. Mastership lasts as long as a transmission takes, i.e. until the master or slave sends a NACK or STOP signal. Then the bus is free again, the next device can become the master and do its own transmissions.
All these features together qualify I2C for the best and cheapest way for connecting many devices, over an single 2 wire bus - all other Arduino pins remain free for other purposes. I thought that you should know this, the rest is up to you 
Does SoftwareSerial work as reliably as a true UART?
Can I use it for my GPS module?
GPS are pretty slow output a lot of times 4800-N-1 format, software serial is perfect for that.
Cool, thanks Robert! (I sent you an email re: this subject as well).