-->
Page 1 of 2

2 serial connections: 1 to GPS and other to Serial Monitor?

PostPosted: Sun Jun 14, 2015 3:02 am
by Duane J
I have an MTK3339 (G.top010) GPS [1] that I'm trying to connect to the esp8266. It uses a serial bus to communicate its coordinates.

I'd like to be able to listen to the serial data from the GPS, and send it back to my laptop via Serial Monitor--in other words, I have two simultaneous serial connections going on in the main loop. From what I've seen, this is fairly simple [2] with the SoftwareSerial library on a regular Arduino mcu:

Code: Select all#include <SoftwareSerial.h>
 
SoftwareSerial GPS(3, 1); // RX, TX
 
void setup() 
{
  Serial.begin(115200);
  while (!Serial) { }
  GPS.begin(9600);
}
 
void loop()
{
  if (GPS.available())
  {
    Serial.write(GPS.read());
  }
}


AFAICT, there is no analogous SoftwareSerial library available for the esp8266? Lacking that, I tried a hardware serial with "Serial.swap()" in the main loop, hoping I could read on one pair of pins (13, 15) and read/write on another (3, 1). So far, no dice (it freezes up after several loops).

Are there any libraries that could help me accomplish this dual serial comms task? Any other approaches I could consider?

Thanks,
Duane

[1] http://www.aliexpress.com/item/Gms-hpr- ... 92334.html
[2] http://www.jarzebski.pl/arduino/kompone ... eo6-m.html

Re: 2 serial connections: 1 to GPS and other to Serial Monit

PostPosted: Tue Jun 16, 2015 12:49 am
by ricg
It sounds like you want to send gps data back to a pc via an esp8266 ?
if you plan to use an arduino it will need to read the gps data and send it to a esp ( connected to your wifi ). It would then be recv'd by a program listening on a specified port on the PC.
Is that what you have in mind?

Re: 2 serial connections: 1 to GPS and other to Serial Monit

PostPosted: Tue Jun 16, 2015 1:03 am
by FlyingHacker
I have not tried it, but DuckDuckGo turned up this, which looks promising:

https://github.com/plieningerweb/esp8266-software-uart

Re: 2 serial connections: 1 to GPS and other to Serial Monit

PostPosted: Tue Jun 16, 2015 3:24 am
by HermannSW
It is really easy if the connection to Serial Monitor is oneway only (use "Serial1"), see:
http://www.esp8266.com/viewtopic.php?f=8&t=3460

Hermann.