u center

-Google Translate-
Hello everyone :slight_smile:
I'm used m8n.
I upload the code to arduino and open the u center ( baudrate to 115200 )
and Nothing works, no fix.
I would love to get help
many thanks :slight_smile:

#include <NeoSWSerial.h>
#include <NMEAGPS.h>

#define GPSBaud 9600
#define ConsoleBaud 115200

// The serial connection to the GPS device
//AltSoftSerial gpsPort; // pins 8 & 9 would be better!
#define RXPin 8
#define TXPin 7
NeoSWSerial gpsPort(RXPin, TXPin);

NMEAGPS gps;
uint8_t updates = 0; // used to count elapsed seconds

NeoGPS::Location_t des( 44.88285, -68.67253 ); // Orono, ME

void setup()
{
  Serial.begin(ConsoleBaud);
  gpsPort.begin(GPSBaud);

}

void loop()
{
  // Process characters from the GPS

  while (gps.available( gpsPort )) {
    gps_fix fix = gps.read();

    // Every 5 seconds, do an update.
    if (++updates >= 5) {
      updates = 0;
      Serial.println();

      // If we have a location, give instructions
      if (fix.valid.location) {

        // Establish our current status
        double distanceToDestination = fix.location.DistanceKm( des );
        double courseToDestination   = fix.location.BearingToDegrees( des );
        const __FlashStringHelper *directionToDestination =
                                        compassDir(courseToDestination);
        int courseChangeNeeded = (int)(360 + courseToDestination - fix.heading()) % 360;

        // debug
        Serial.print( F("DEBUG: Course2Dest: ") );
        Serial.print(courseToDestination);
        Serial.print( F("  CurCourse: ") );
        if (fix.valid.heading)
          Serial.print( fix.heading() );
        Serial.print( F("  Dir2Dest: ") );
        Serial.print(directionToDestination);
        Serial.print( F("  RelCourse: ") );
        Serial.print(courseChangeNeeded);
        Serial.print( F("Lat: ") );
        Serial.print( fix.latitude(), 6 );
        Serial.print( F("  Lon: ") );
        Serial.println( fix.longitude(), 6 );

        Serial.print( F("  CurSpd: ") );
        if (fix.valid.speed)
          Serial.print( fix.speed_kph() );
        Serial.println('\n');

        // ???  THIS ISN'T A THING
        //Serial.print( F("current Angle: ") );
        //Serial.println(atan2(gps.location.lat(), gps.location.lng())*180/M_PI);

        // Within 20 meters of destination?  We're here!
        if (distanceToDestination <= 20.0)
        {
          Serial.println( F("CONGRATULATIONS: You've arrived!") );
          exit(1);
        }

        Serial.print( F("DISTANCE: ") );
        Serial.print(distanceToDestination);
        Serial.println( F(" meters to go.") );
        Serial.print( F("INSTRUCTION: ") );

        // Standing still? Just indicate which direction to go.
        if (fix.speed_kph() < 5.0)
        {
          Serial.print( F("Head ") );
          Serial.print(directionToDestination);
          Serial.println( '.' );

        } else // suggest a course change
        if ((courseChangeNeeded >= 345) || (courseChangeNeeded < 15))
          Serial.println( F("Keep on straight ahead!") );
        else if ((courseChangeNeeded >= 315) && (courseChangeNeeded < 345))
          Serial.println( F("Veer slightly to the left.") );
        else if ((courseChangeNeeded >= 15) && (courseChangeNeeded < 45))
          Serial.println( F("Veer slightly to the right.") );
        else if ((courseChangeNeeded >= 255) && (courseChangeNeeded < 315))
          Serial.println( F("Turn to the left.") );
        else if ((courseChangeNeeded >= 45) && (courseChangeNeeded < 105))
          Serial.println( F("Turn to the right.") );
        else
          Serial.println( F("Turn completely around.") );
      } else {
        Serial.println( F("Waiting for GPS fix...") );
      }
    }
  }
}

//------------------------------------------------------------
//  This snippet is from NMEAaverage.  It keeps all the
//    compass direction strings in FLASH memory, saving RAM.

const char nCD  [] PROGMEM = "N";
const char nneCD[] PROGMEM = "NNE";
const char neCD [] PROGMEM = "NE";
const char eneCD[] PROGMEM = "ENE";
const char eCD  [] PROGMEM = "E";
const char eseCD[] PROGMEM = "ESE";
const char seCD [] PROGMEM = "SE";
const char sseCD[] PROGMEM = "SSE";
const char sCD  [] PROGMEM = "S";
const char sswCD[] PROGMEM = "SSW";
const char swCD [] PROGMEM = "SW";
const char wswCD[] PROGMEM = "WSW";
const char wCD  [] PROGMEM = "W";
const char wnwCD[] PROGMEM = "WNW";
const char nwCD [] PROGMEM = "NW";
const char nnwCD[] PROGMEM = "NNW";

const char * const dirStrings[] PROGMEM =
  { nCD, nneCD, neCD, eneCD, eCD, eseCD, seCD, sseCD,
    sCD, sswCD, swCD, wswCD, wCD, wnwCD, nwCD, nnwCD };

const __FlashStringHelper *compassDir( uint16_t bearing ) // degrees CW from N
{
  const int16_t directions    = sizeof(dirStrings)/sizeof(dirStrings[0]);
  const int16_t degreesPerDir = 360 / directions;
        int8_t  dir           = (bearing + degreesPerDir/2) / degreesPerDir;

  while (dir < 0)
    dir += directions;
  while (dir >= directions)
    dir -= directions;

  return (const __FlashStringHelper *) pgm_read_ptr( &dirStrings[ dir ] );

} // compassDir

If you mean the u-center application from Ublox, then this has nothing at all to do with Arduino.

U-center is meant to be directly connected to a GPS.

Hello srnet
Thank you for your answer
Yes,i mean the u-center application from Ublox.
The reason I need u-center is to change the rate to 5hz, gps and glonass.
I saw on YouTube it can be connected directly through Arduino.
Or I just need to connect the m8n via adapter to u-center ??

ilan7:
Hello srnet
Thank you for your answer
Yes,i mean the u-center application from Ublox.
The reason I need u-center is to change the rate to 5hz, gps and glonass.
I saw on YouTube it can be connected directly through Arduino.
Or I just need to connect the m8n via adapter to u-center ??

U-center applications works on serial port so you can do it in both ways. You can use TTL to Serial converter and then plug your GPS directly in your laptop and get data on ucenter.

Or you can also use Serial Port of Arduino UNO i.e. Pin#0 and Pin#1 and then can get serial data on u-center.

Now I understood why I didn't get any data
According to the code, I connected the pins 7,8.
I opened new sketch, pins 0,1 And it works
Thank you

Good to know that it worked for you.
Btw If it's given in the code to use 7 and 8 then it must be working on software serial and it's better to use the software serial.

If you connect it with the hardware serial i.e. 0 and 1 then you have to remove the pins when you upload code in Arduino. So to avoid this I always recommend to use software serial.

jackthom41 Thank you for the response
I change my Code too SoftwareSerial (7,8), altsoftserial (8,9) , NeoSWSerial(7,8).
The only way to get data ( See fix and Satellites, and change the settings )
from u-center to arduino is hardware serial, only pin (0,1),
( Direct communication with the computer ) Like connecting directly the m8n With adapter to the computer.
I read it online ( I don't know if that's true, For now only the hardware serial Works for me (0,1) )
Thanks anyway :slight_smile: