I'm stuck at this seemingly simple thing. I have a NMEA GPS module. It doesn't matter how it operates, it just transmit serial data stream at a baud rate of 38400.

I have an arduino Mega which has several hardware serial modules. If i directly connect GPS Tx to Arduinos Tx pin (and program arduino to not to use default serial module, Serial0) then i can observe raw GPS sentences transmitted by the GPS module using the arduino serial monitor.

What I really want is to read the GPS module to arduino Serial1 port and forward the receiving data through the default serial port Serial0 without doing anything. So that i should be able to monitor the data from the serial monitor as exactly in the previous case.

I tried something like follows, but it's not working (it gives a stream of digits, i tried doing all the possible changes but nothing worked)

void setup(){
  Serial.begin(38400); // the default serial module, serial0
  Serial1.begin(38400); // GPS is connected to this

void loop(){
  if(Serial1.available()){ // if GPS data available
    Serial.print(Serial1.read()); // write it to serial0

Hope someone here will be able to give me some solution.

  • \$\begingroup\$ Shouldn't you be connecting GPS Tx to Arduino Rx (not Tx)? \$\endgroup\$ Oct 16, 2013 at 20:27
  • \$\begingroup\$ @RedGrittyBrick nope, in the first case it should be Tx bacause arduino is not receiving anything, GPS Tx behave like arduino Tx. \$\endgroup\$
    – Anubis
    Oct 17, 2013 at 6:34

1 Answer 1


Serial::print() converts the bytes to an ASCII representation. Use Serial::write() instead.

  • \$\begingroup\$ As Ignacio stated, Serial.print() converts the input to ASCII while Serial.write() "passes through" the binary data. Here is the link to the Arduino reference: arduino.cc/en/Serial/Write \$\endgroup\$
    – KK6FSL
    Jan 2, 2014 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.