Receiving GPS data

Hello,

I'm trying to receive GPS data, I tried two things:

  • Using my Teensy 3.2 and check the Serial Monitor to see if I received anything. The Serial Monitor doesn't show any data at all. The baudrate of the GPS module is 4800 baud. I tried several codes and watched lots of tutorials about serial communication, but none helped me. Now my question is: How can I see the data that the GPS module sends to the RX pin on the serial monitor?

Here the link of the Teensy : Click here
Here the link to the datasheet of the GPS module (MR 350) I use: [Click here](https://www.globalsat.com.tw/ftp/download/MR-350 S4 Specification V1.2.pdf)

#include <SoftwareSerial.h>

//RX1 pin0, TX1 pin1
//RX2 pin9, TX2 pin10
//RX3 pin7, TX3 pin8

SoftwareSerial gps1(0, 1); // seriële communicatie van de eerste gps
char datatest;

void setup() {
  // functie maken voor de initialisatie van de gps'en
  Serial.begin(4800);
    gps1.begin(4800);

  }

void loop() {
  
  if (gps1.available()){
    datatest = gps1.read();
    Serial.print("Data gps1:");
    Serial.println(datatest);
  }
}
  1. I tried using an FTDI (FT232RL) connected directly to my GPS module (MR 350), and use Hterm to see any incoming data.
    Link to the datasheet of the FTDI: Click here
    Now I can see the data that the FTDI receives from the GPS module, however the data doesn't look like NMEA data at all. I checked the connections and found out that the RX pin of the FTDI fluctuates between -0.7 and 2.6 V. I think this is the reason why I don't get correct data. Now the question is: How can I receive correct NMEA data?

I want to thank everyone in advance!

That Teensy has three hardware serial ports so you don't need software serial.

If you do want to use it though, use different pins - you are using the ones that the primary serial port uses to talk to your PC.

The data sheet you linked for the GPS device is nearly useless. Since the GPS runs on 5V, what are the voltage levels on the GPS TX pin?

The Teensy is a 3.3V processor and may be damaged if you connect an input pin to 5V.

gps1.begin(4800);

try 9600

GPS RX to microcontroller TX, GPS TX to microcontroller RX

No need to make another SoftwareSerial, use the one of the available ones. Make sure your TX / RX are connected correctly. TX from GPS goes to RX on Teensy, TX from Teensy goes to RX on GPS.

If you have USB-UART (USB to Serial) module, you can plug GPS directly to its TX/RX pins and read GPS data on PC using Serial Monitor or Termite serial port utility.

Hope this helps,

chall3ng3r:
No need to make another SoftwareSerial, use the one of the available ones. Make sure your TX / RX are connected correctly. TX from GPS goes to RX on Teensy, TX from Teensy goes to RX on GPS.

If you have USB-UART (USB to Serial) module, you can plug GPS directly to its TX/RX pins and read GPS data on PC using Serial Monitor or Termite serial port utility.

Hope this helps,

Thanks for your feedback, what I originally did wrong was that I forgot to convert the RS232 level to TTL level. Right now I can see the data correctly. If I don't use SoftwareSerial, how should I write my code instead?

Glad to know you're getting data from GPS now.

To use default HW serial port of board you can simply use the Serial.begin(9600) with GPS's baud rate. For boards with multiple HW serial ports, you can use them like Serial1.begin(9600), Serial2.begin(9600) etc.

See more examples on following link:

Hope it helps.

Yes, I'm using Serial2 and Serial3 and they work great!

1 Like

There is a detailed example of reading and parsing GPS data in my tutorial
Arduino Serial I/O for the Real World
For level conversion between 5V/ 3V3 see the circuits in my tutorial on Serial connections between Arduinos Arduino to Arduino/PC

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.