Chat freely about anything...

User avatar
By batstru
#69206 HI all,

I'm trying to make the NEO6MV2 GPS Module to work with the ESP01:
do you know if it's possible to use the serial ports of the ESP to communicate with the GPS?
At the moment I'm setting up the webserver to display some logs, since the RX and TX are used by the NEO6MV2.

Alternatively, is that possible to use the GPS module via the GPIO?

Do you have any documentation that you can share?

Thanks!

Marco
User avatar
By QuickFix
#69210 As I understand from the documentation, the NEO6MV2 uses 3.3V, just like the ESP, so you can safely connect the TX of the GPS module to RX of the ESP8266.
Since (most) GPS modules only send GPS data, you needn't have to connect RX of the GPS to the TX of the ESP, but it's no problem if you have to (haven't read the documentation that well myself).

After that, in the code of the ESP, open the serial-port, let the bytes flow in and parse the data; it should really be a piece of cake. 8-)
User avatar
By batstru
#69249 Hi, I have now connected to the RX of the ESP01 the TX of the GPS module, and the TX of the ESP01 to the RX of the usb2serial converter.

This is the code I'm using:

Code: Select allstatic char line;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.available() > 0) {
    line=Serial.read();
    Serial.println(line);
   } else { Serial.println("Cannot read from the serial line");}
}


The ESP01 is not displaying any data from the serial monitor, and it gives the impression to be hanged.

What I'm doing wrong?

Thanks
User avatar
By QuickFix
#69259 I don't know if declaring the "line" as a static char will work like this. :?
Serial.read() returns a single byte if available.

Totally untested:
Code: Select allvoid loop() {
  if (Serial.available()) {
    size_t len = Serial.available();
    uint8_t sbuf[len];
    Serial.readBytes(sbuf, len);
    Serial.write(sbuf, len);
  }
But you might want to connect the TX of the GPS directly to the RX of your PC first to check if there are really bytes coming through when power is applied. :idea: