Format of ENU position output over serial

I’m trying to read lines of ENU output over serial using an arduino. I’ve confirmed my hardware works using llh output with nmea sentences previously, but when I switch to ENU output I don’t get any lines printing. I’ve changed the code to print to the computer serial monitor only the data received from the reach output.

Is there any documentation on the ENU output format other than in the RTKLIB doc (Appendix B, pg. 101)?

I was assuming it was a string that I could read and print using

String gpsFix = gpsPort.readString(); - Read the received serial line into a string “gpsFix”
serialMonitor.println(gpsFix); - write the string to the serial monitor.

EDIT: I wrote some matlab code to open the serial port and read whatever is coming through. I can read NMEA sentences when ouput is set to NMEA, however still no data when output is ENU.

Update: Discovered ENU output only streams when you have a fix, ie you need to be outside. Matlab code now gives me a valid ENU line. Will investigate getting it working with Arduino and report back.

Update 2: I’m pretty sure my problem is with arduino - I can now see data coming from the reach, however I can’t figure out which format to specify when reading it, nor which command, ie serial.read, serial.readBytesUntil, etc. When I eventually find out I’ll update this post again…

OH MY GOD I AM SO DUMB… TX and RX connection was reversed on arduino. Using USB cable to PC for matlab meant I skipped that check, and when I checked the NMEA messages I checked in matlab not on arduino.

There goes my entire afternoon :sweat_smile:

Update: I’m sorry, it’s a stream of learning: It’s a little more complicated actually, as readString doesn’t see to work. I’m having the most luck at the moment with Arduino code:

char gpsFix[145];

gpsPort.readBytesUntil(10,gpsFix,145);

This at least gets me the valid ENU data, however there are occasional glitches in the numbers, and I have a garbled character at the end of each line. I’ll play with the baud rate, length of my char array and terminator and see how it goes. Hope some or any of this is useful to anyone in the future!

Hi @Fenrir, how did you parse the incoming ENU data to get the x and y positions? Can we use TinyGPS++ to do that?

I am trying to connect a Reach M+ Rover, that’s getting corrections from a Reach RS base station over Lora Frequency, to get the ENU x and y positions to an Arduino Mega. Right now, I have the Tx and Rx from Reach M+ S1 connected to Arduino. Any help is appreciated.

Hi ashammaa!
It’s been a little while since the project, so I’ll do my best to recall.

Going through my files, it appears I used a library called NeoGPS. The developer also provides useful replacement libraries for serial connections, if you find yourself looking for one.

There is an excerpt at the bottom from my arduino code handling extracting, using the NMEAGPS function from NeoGPS. You would replace logfile.print() with whatever function you are using to deal with the data. I just saved it to an SD card, and parsed the file on a laptop with python.

I hope this helps! I have some more experience I can share if you need it, feel free to ask anything else.

p.s. I may have switched to NMEA output, check if NeoGPS works with ENU, but if it doesn’t, give that a try.

if (fix.valid.location && fix.valid.time) {
      rgb.setColour(ACQUIREDFIX); //LED STATUS yay
      static uint16_t lastLoggingTime  = 0;
      uint16_t startLoggingTime = millis();

      printL( logfile, fix.latitudeL() ); //lat
      logfile.print( ',' );
      printL( logfile, fix.longitudeL() ); //lon
      logfile.print(',');
      logfile.print(fix.altitude_cm()); //altitude above ellipsoid, not Mean Sea Level) in int cm
      logfile.print(',');
      
      logfile.print(fix.dateTime.year); //Time. Time is funky for date/time, see neogps documentation.
      logfile.print(fix.dateTime.month); //nb no delimiter between them. 
      logfile.print(fix.dateTime.date);
      logfile.print(',');
      if (fix.dateTime.hours < 10) 
        logfile.print( '0' );
      logfile.print(fix.dateTime.hours);
      logfile.print( ':' );
      if (fix.dateTime.minutes < 10)
        logfile.print( '0' );
      logfile.print(fix.dateTime.minutes);
      logfile.print( ':' );
      if (fix.dateTime.seconds < 10)
        logfile.print( '0' );
      logfile.print(fix.dateTime.seconds);
      logfile.print( '.' );
      if (fix.dateTime_cs < 10)
         logfile.print( '0' ); // leading zero for .05, for example
      logfile.print(fix.dateTime_cs);
      logfile.print(',');

      logfile.print(fix.satellites); //sat count
      logfile.print(',');
      logfile.print(fix.hdop); //hdop  in "integer thousandths of the DOP"
      logfile.print(',');
      logfile.print(fix.heading());
      logfile.print(',');
      
      logfile.print(uT1);
      logfile.print(',');
      logfile.print(uT2);
      logfile.print(',');
      logfile.print(uT3);
      logfile.print(',');
      logfile.print(uT4);
      logfile.print(',');
      logfile.print(uT5);
      logfile.print(',');
      logfile.print(uT6);
      logfile.print(',');

      logfile.print( lastLoggingTime ); // write how long the previous logging took
      logfile.println();
1 Like