Two Serial Devices - Best options?

I want to start experimenting with either a Garmin Etrex Handheld GPS OR a magnetometer.

Both devices have Serial Input and Output and at the moment I am only really interested in reading Data from one of them.

Initially I want to simply take the Serial stream from one of the devices and Serial Write (or Print, I am not sure of the correct term here yet) to my P.C. via the USB connection. Once I get this working I can work on Parsing the data into usable units.

My question is how to receive and/or send to two serial devices "serially" (recieve from the GPS, process, then send to P.C. for debugging)

Is Software Serial a good way to go?
Should I buy a external multiplexer device? (I have seen somewhere a chipset that will allow selection of source and destination devices)

I would prefer to learn to write all of the code, rather than using libraries if at all possible, a rod for my own back I know, but I like to know how things work.

This is not for a specific project, it is to assist in learning data stream processing, which will eventually be included into a number of prospective projects.

At this stage I am not looking for coding, or schematics, I would just like some thoughts on the best way to handle this.

Thanks

If you have a Uno, you'd wire its hardware serial D0 and D1 to the other device's serial.

You can connect the TX of some serial device to RX (D0) alone. Leave the Arduino TX disconnected. Now the Arduino will receive data from the device, and transmit to the computer via the USB. Just don't send anything from the computer to the Arduino. You have to disconnect it while uploading programs.

If you need two way communication with the device(s), get a Mega. It has multiple hardware serial ports.

Magnetometers usually communicate via I2C or SPI serial interfaces, which are completely independent of the TX/RX serial ports on an Arduino, and require different software libraries.

jremington:
Magnetometers usually communicate via I2C or SPI serial interfaces, which are completely independent of the TX/RX serial ports on an Arduino, and require different software libraries.

Thanks for that reminder, but it doesn't solve the Garmin GPS testing issue, I still want to be able to read data from the GPS and forward to the P.C. to debug my parsing attempts.

Kiwi_Bloke:
I still want to be able to read data from the GPS and forward to the P.C. to debug my parsing attempts.

We just told you how. So what is the problem?

aarg:
You can connect the TX of some serial device to RX (D0) alone. Leave the Arduino TX disconnected. Now the Arduino will receive data from the device, and transmit to the computer via the USB. Just don't send anything from the computer to the Arduino. You have to disconnect it while uploading programs.

If you need two way communication with the device(s), get a Mega. It has multiple hardware serial ports.

Thanks, this looks promising for the first stage of testing.
For this experimentation phase getting a Mega is not an option, and in at least one of the final projects I think I can use I2C to communicate with some of the components so won't need a Mega.

ieee488:
We just told you how. So what is the problem?

Except you told him wrong. He needs the hardware port to send stuff to the PC.

ieee488:
We just told you how. So what is the problem?

This answer was to the response suggesting I use i2C for the magnetometer, it didn't address the Serial comms with the GPS.

Interestingly no one has commented on Software serial, or external Multiplexing?

On the Uno, software serial is the way to go (as long as the baudrates are not too extreme).

You can not connect the TX of the device to the RX of the Uno as that would imply two outputs (the second one is the output of the USB connection to the microcontroller) connected together (there is a work around with diodes).
For the same reason I doubt the multiplexer will work.

I had an Etrex long ago (was stolen :frowning: ). You will have to check the levels. Usual serial communication is -12V/+12V and the Arduino will not like that; the signal levels are also inverted (5V -> -12V, 0V -> +12V).

PS Never knew that the Etrex had a serial port; mine was USB only as far as I remember.

@Kiwi_Bloke, make life simple for yourself - at least to start with.

If you are using an Uno keep the Hardware Serial port free for communication with your PC and for uploading programs. Create a SoftwareSerial port on (say) pins 4 and 5 for communicating with your Garmin.

If you have a Mega it will have 3 spare Hardware Serial ports and will be even easier to use.

If you have a Leonardo or Micro it will have 1 spare Hardware Serial port.

The second example in Serial Input Basics will provide the foundations for receiving and displaying the data.

If you need to get data from both devices at the same time the simplest option is to use a Mega.

...R

Robin2:
@Kiwi_Bloke, make life simple for yourself - at least to start with.

If you are using an Uno keep the Hardware Serial port free for communication with your PC and for uploading programs. Create a SoftwareSerial port on (say) pins 4 and 5 for communicating with your Garmin.

If you have a Mega it will have 3 spare Hardware Serial ports and will be even easier to use.

If you have a Leonardo or Micro it will have 1 spare Hardware Serial port.

The second example in Serial Input Basics will provide the foundations for receiving and displaying the data.

If you need to get data from both devices at the same time the simplest option is to use a Mega.

...R

Thanks for this assistance, it is most useful, I won't need to get from both units so no problems there.
I just need to work my way through all of your information to get it to work

sterretje:
You can not connect the TX of the device to the RX of the Uno as that would imply two outputs (the second one is the output of the USB connection to the microcontroller) connected together (there is a work around with diodes).

On the Uno at least, there is a 1K resistor between the 16U2 output and the RX pin. So a device of sufficiently low impedance connected to the RX pin should override the 16U2. Also if you send nothing from the computer, the 16U2 output is in a fixed state.