Emlid Reach to Arduino Uno?

I have just been using Reach-view for most of the configuration, but now I am ready to start using my GPS coordinates. I had another code(attached) from an Arduino sample using the tinyGPS library that I am retrieve and parse the NMEA strings. I figured it would be just as easy as hooking the TX(white?) pin from the Emlid to the rx pin i had set on the Arduino using software serial.

Reach & Arduino are being powered by USB from my computer.

Reach position output settings
UART
57600
NMEA

Reach Firmware: 1.2

I have the TX pin from reach(white?) connect to pin 4 on my arduino.


Could there be something with the logic voltage? Doesn’t Arduino run at 5v logic and reach is at 3.3v? I don’t know if that make a difference or not.

CODE:

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
/*
   This sample code demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object.
   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
   
LC20031 pinout(Top View *pins down*  L to R 5 to 1 
  GND-5
  GND-4
  TX-3
  RX-2
  3.3V-1


Emlid Reach 
Power Reach Via the USB cable 
White-GPS RX
Blue GPS TX
 
*/
// The TinyGPS++ object
TinyGPSPlus gps;
int i=0;
// The serial connection to the GPS device 
SoftwareSerial ss(3, 4);// GPSTX to 4, GPSRX  to 3  // this part go switched around and may be the issue k

void setup()
{
  Serial.begin(9600);
  ss.begin(57600);//GPS Baud Rate

  Serial.println(F("GPS SatsLatLong"));
  Serial.println(F("Outputs Latitude and longitude"));
  Serial.println(F("Jake Falck"));
  Serial.println();
  

}

void loop()
{
  while (Serial.available() < 1) {} // Wait until a character is received
char val = Serial.read();
Serial.flush();
if (val == 'g'){
   Serial.println(F("Sats Latitude   Longitude"));
  Serial.println(F("     (deg)      (deg)    "));
  Serial.println(F("-------------------------"));
  printInt(gps.satellites.value(), gps.satellites.isValid(), 5);
  printFloat(gps.location.lat(), gps.location.isValid(), 11, 6);
  printFloat(gps.location.lng(), gps.location.isValid(), 12, 6);
  Serial.println();
  Serial.println();
  i++;

}
  if (millis() > 5000 && gps.charsProcessed() < 10)
    Serial.println(F("Error: GPS data received(check wiring)"));
}

// This custom version of delay() ensures that the gps object
// is being "fed".
static void smartDelay(unsigned long ms)
{
  unsigned long start = millis();
  do 
  {
    while (ss.available())
      gps.encode(ss.read());
  } while (millis() - start < ms);
}

static void printFloat(float val, bool valid, int len, int prec)
{
  if (!valid)
  {
    while (len-- > 1)
      Serial.print('*');
    Serial.print(' ');
  }
  else
  {
    Serial.print(val, prec);
    int vi = abs((int)val);
    int flen = prec + (val < 0.0 ? 2 : 1); // . and -
    flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
    for (int i=flen; i<len; ++i)
      Serial.print(' ');
  }
  smartDelay(0);
}

static void printInt(unsigned long val, bool valid, int len)
{
  char sz[32] = "*****************";
  if (valid)
    sprintf(sz, "%ld", val);
  sz[len] = 0;
  for (int i=strlen(sz); i<len; ++i)
    sz[i] = ' ';
  if (len > 0) 
    sz[len-1] = ' ';
  Serial.print(sz);
  smartDelay(0);
}

static void printDateTime(TinyGPSDate &d, TinyGPSTime &t)
{
  if (!d.isValid())
  {
    Serial.print(F("********** "));
  }
  else
  {
    char sz[32];
    sprintf(sz, "%02d/%02d/%02d ", d.month(), d.day(), d.year());
    Serial.print(sz);
  }
  
  if (!t.isValid())
  {
    Serial.print(F("******** "));
  }
  else
  {
    char sz[32];
    sprintf(sz, "%02d:%02d:%02d ", t.hour(), t.minute(), t.second());
    Serial.print(sz);
  }

  printInt(d.age(), d.isValid(), 5);
  smartDelay(0);
}

static void printStr(const char *str, int len)
{
  int slen = strlen(str);
  for (int i=0; i<len; ++i)
    Serial.print(i<slen ? str[i] : ' ');
  smartDelay(0);
}
2 Likes

Do not forget to connect GND on Reach to GND on Arduino.

1 Like

I didn’t realize I have to do that. What is the reason for that? I figured since its getting powered by the usb cable I just had to plug in the tx and rx pins.

Tried that, didn’t do anything different.

First up, make sure you don’t dual supply power. If reach is powered via USB, DO NOT put 5V on the GPIO 5V. Ground is ok, and from what I’ve read necessary for serial comms to work.

Second up, TX on reach goes to RX on Uno, and likewise for RX reach to TX Uno, although I just saw you’ve already done that. Pinouts are here, you are correct that white is RX. I’m pretty sure it doesn’t matter about the logic voltage, my Mega works fine with it, and reach is 5V tolerant.

Looking at my UNO and your code, I see you are using software serial. This is because you are connected to PC via USB I guess. Software serial is a pain, but should work. (Have a look at NeoSoftwareSerial and similarly NeoGPS).

On a different note, have you checked your baudrates? I see in your code reach is at 57600, USB Serial is at 9600 and software serial, ss is at 57600. That should be fine I guess.

You haven’t really said what your error is yet. If you are getting the “Error: GPS data received(check wiring)”, does reach have satellites, and is outputting NMEA over Serial out?

Give us some more information on what the problem is and we can we what else we can suggest. Good Luck!

I did the same connections as he showed in the picture and run the same program he mentioned but my emlid reach rtk is not reading any GPS co-ordinates. Already checked the baud rates and reach satellites as well. Please let me know if you have any suggestions. Thanks guys!

Did you try to connect both rx and tx? I think other than hs ss needs both if you do not adapt the library.

i got the co-ordinates some how by using other program but i wanted to connect this emlid reach to raspberry pi CM 3, as I’m not a good programmer in python could you please help me out. Thanks for your response mate! Cheers!

I think you can just copy this:

https://www.electronicwings.com/raspberry-pi/gps-module-interfacing-with-raspberry-pi

HI,
Maybe it is too late but I think I found your problem. In the loop function you use “Serial” instead of “ss”. Try :

while (ss.available() < 1) {} // Wait until a character is received
char val = ss.read();

In your case “Serial” is used for the serial port and “ss” for the GPS. I use a very similar code strarting from the DeviceExample code from tinyGPS++ and it worked.

Pierre

Just to leave a 2022 trace do not waste your time on this example set the output position 1 of your reach m2 rover to NMEA format at 57600 bps the reach M2 S1 UART cable the white RX to pin 4 the bleue TX to pin 3 (yes it’s reverse to arduino)

static const int RXPin = 3, TXPin = 4;
static const uint32_t GPSBaud = 57600;

// The TinyGPSPlus object
TinyGPSPlus gps;

// The serial connection to the GPS device RX of Reach m2 goes to TX and vis versa
SoftwareSerial ss(RXPin, TXPin);

just take this example https://github.com/mikalhart/TinyGPSPlus/blob/master/examples/DeviceExample/DeviceExample.ino

7:20:55.541 → Sats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum
17:20:55.541 → (deg) (deg) Age Age (m) — from GPS ---- ---- to London ---- RX RX Fail
17:20:55.586 → ----------------------------------------------------------------------------------------------------------------------------------------
17:20:55.586 → **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 0 0 0
17:20:56.606 → **** ***** 45.532707 -73.927566 259 12/21/2022 22:20:56 260 ****** 17.66 2.41 NNE 5243 54.63 NE 229 1 3
17:20:57.578 → **** ***** 45.532711 -73.927558 266 12/21/2022 22:20:57 267 ****** 18.53 2.30 NNE 5243 54.63 NE 470 2 4
17:20:58.604 → **** ***** 45.532718 -73.927558 272 12/21/2022 22:20:58 274 ****** 17.37 2.56 NNE 5243 54.63 NE 706 3 5
17:20:59.621 → **** ***** 45.532722 -73.927558 284 12/21/2022 22:20:59 286 ****** 17.37 2.02 NNE 5243 54.63 NE 948 4 7
17:21:00.598 → **** ***** 45.532726 -73.927551 291 12/21/2022 22:21:00 292 ****** 17.37 2.20 NNE 5243 54.63 NE 1183 5 11
17:21:01.623 → **** ***** 45.532733 -73.927551 296 12/21/2022 22:21:01 297 ****** 17.37 1.80 NNE 5243 54.63 NE 1422 6 12