Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Adafruit Feather 32u4 FONA + Adafruit Ultimate GPS FeatherWi
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit Feather 32u4 FONA + Adafruit Ultimate GPS FeatherWi

by JoanCS on Sat May 16, 2020 7:19 am

Good morning. I assembled the two plates following the instructions.
With test programs, the GSP responds.
I'm interested in being able to read GPS using this code and I can't get the data back. That I am doing wrong.
Thanks.

( Adafruit Feather 32u4 FONA + Adafruit Ultimate GPS FeatherWing MTK3339 )

#include <TinyGPS.h>
#include <SoftwareSerial.h>

unsigned long fix_age;

// variables GPS
SoftwareSerial GPS(1,0); // 1 TX i 0 RX
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;
int year;
byte month, day, hour, minute, second, hundredths;
// fi

void setup()
{
GPS.begin(9600);
Serial.begin(9600);
}

void loop()
{
long lat, lon;
//unsigned long fix_age, time, date, speed, course;
//unsigned long chars;
//unsigned short sentences, failed_checksum;

// retrieves +/- lat/long in 100000ths of a degree
gps.get_position(&lat, &lon, &fix_age);

getGPS();
Serial.print("Latitud : ");
Serial.print(LAT/1000000,7);
Serial.print(" i Longitud : ");
Serial.println(LON/1000000,7);

Serial.print("Data : "); Serial.print(day, DEC); Serial.print("/");
Serial.print(month, DEC); Serial.print("/"); Serial.println(year);
Serial.print("Hora : "); Serial.print(hour, DEC); Serial.print(":");
Serial.print(minute, DEC); Serial.print(":"); Serial.println(second, DEC);
Serial.print("Altitud (metres): "); Serial.println(gps.f_altitude());
Serial.print("Rumb (graus) : "); Serial.println(gps.f_course());
Serial.print("Velocitat(kmph) : "); Serial.println(gps.f_speed_kmph());
Serial.print("Satelits : "); Serial.println(gps.satellites());
Serial.println();
//gps.stats(&chars, &sentences, &failed_checksum); // ?
delay(2000);
}

void getGPS()
{
bool newdata = false;
unsigned long start = millis();
// Every 1 seconds we print an update
while (millis() - start < 1000)
{
if (feedgps ()){
newdata = true;
}
}
if (newdata)
{
gpsdump(gps);
}
}

bool feedgps()
{
while (GPS.available())
{
if (gps.encode(GPS.read()))
return true;
}
return 0;
}

void gpsdump(TinyGPS &gps)
{
//byte month, day, hour, minute, second, hundredths;
gps.get_position(&lat, &lon);
gps.crack_datetime(&year,&month,&day,&hour,&minute,&second,&hundredths);
LAT = lat;
LON = lon;
{
feedgps(); // If we don't feed the gps during this long routine, we may drop characters and get checksum errors
}
}

JoanCS
 
Posts: 29
Joined: Thu May 07, 2020 12:43 pm

Re: Adafruit Feather 32u4 FONA + Adafruit Ultimate GPS Feath

by JoanCS on Sat May 16, 2020 7:37 am

Attached is a montage of the montage.
Attachments
20200516_132125_2_opt.jpg
20200516_132125_2_opt.jpg (34.19 KiB) Viewed 124 times

JoanCS
 
Posts: 29
Joined: Thu May 07, 2020 12:43 pm

Re: Adafruit Feather 32u4 FONA + Adafruit Ultimate GPS Feath

by JoanCS on Tue May 19, 2020 3:08 pm

Good afternoon.
I will finally use this code which works properly.
The problem lies in the reading it gives me of the long, which has 5 digits !!!

GSM reading:
Date: 19/5/2020
Fix: 1 quality: 1
Location: 41514.2148N, 214.3532E
Speed (knots): 0.99
Speed (Km/h): 1.83
Angle: 162.11
Altitude: 560.60
Satellites: 5

The documentation example says this:
- 044235.000 representa la hora GMT (04:42:35)
- “A” es la indicación de que el dato de posición está fijado y es correcto. “V” sería no válido
- 4322.0289 representa la longitud (43º 22.0289´)
- N representa el Norte
- 00824.5210 representa la latitud (8º 24.5210´)
- W representa el Oeste
- 0.39 representa la velocidad en nudos
- 65.46 representa la orientación en grados
- 020615 representa la fecha (2 de Junio del 2015)

If I pay attention to the technical document (which I have to do) and the operations to be done:
41514.2148N --> 41º5114,2148’ --> 44.????? NOOOO quadra (google 41.8542 !!!!)
214.3532E --> 2º14,3532’ --> 2.23922 aquest es ok i correcte (google 2.2389 ok)

41514.2148N ??????


Code: Select all | TOGGLE FULL SIZE

#include <Adafruit_GPS.h>

// what's the name of the hardware serial port?
#define GPSSerial Serial1

// Connect to the GPS on the hardware port
Adafruit_GPS GPS(&GPSSerial);

// Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
// Set to 'true' if you want to debug and listen to the raw GPS sentences
#define GPSECHO false

char Dada[120];
int b=0;

void setup()
{
  //while (!Serial);  // uncomment to have the sketch wait until Serial is ready
  Serial.begin(9600);
  Serial.println("Adafruit GPS library basic test!");
  GPS.begin(9600);
  // uncomment this line to turn on RMC (recommended minimum) and GGA (fix data) including altitude
  GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  // uncomment this line to turn on only the "minimum recommended" data
  // GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
  // For parsing data, we don't suggest using anything but either RMC only or RMC+GGA since
  // the parser doesn't care about other sentences at this time
  // Set the update rate
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); // 1 Hz update rate
  // For the parsing code to work nicely and have time to sort thru the data, and
  // print it out we don't suggest using anything higher than 1 Hz
}
uint32_t timer = millis();

void loop() // run over and over again
{

  char c = GPS.read();
  // if you want to debug, this is a good time to do it!
  if ((c) && (GPSECHO))
    Serial.write(c);

  // if a sentence is received, we can check the checksum, parse it...
  if (GPS.newNMEAreceived()) {
    // a tricky thing here is if we print the NMEA sentence, or data
    // we end up not listening and catching other sentences!
    // so be very wary if using OUTPUT_ALLDATA and trytng to print out data
    //Serial.println(GPS.lastNMEA());   // this also sets the newNMEAreceived() flag to false

    if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag to false
      return;  // we can fail to parse a sentence in which case we should just wait for another
  }

  // approximately every 2 seconds or so, print out the current stats
  if (millis() - timer > 2000) {
    timer = millis(); // reset the timer

    Serial.print("\nTime: ");
    if (GPS.hour < 10) { Serial.print('0'); }
    Serial.print(GPS.hour, DEC); Serial.print(':');
    if (GPS.minute < 10) { Serial.print('0'); }
    Serial.print(GPS.minute, DEC); Serial.print(':');
    if (GPS.seconds < 10) { Serial.print('0'); }
    Serial.print(GPS.seconds, DEC); Serial.print('.');
    if (GPS.milliseconds < 10) {
      Serial.print("00");
    } else if (GPS.milliseconds > 9 && GPS.milliseconds < 100) {
      Serial.print("0");
    }
    Serial.println(GPS.milliseconds);
    Serial.print("Date: ");
    Serial.print(GPS.day, DEC); Serial.print('/');
    Serial.print(GPS.month, DEC); Serial.print("/20");
    Serial.println(GPS.year, DEC);
    Serial.print("Fix: "); Serial.print((int)GPS.fix);
    Serial.print(" quality: "); Serial.println((int)GPS.fixquality);
    if (GPS.fix) {
      Serial.print("Location: ");
      Serial.print(GPS.latitude, 4); Serial.print(GPS.lat);
      Serial.print(", ");
      Serial.print(GPS.longitude, 4); Serial.println(GPS.lon);
      Serial.print("Speed (knots): "); Serial.println(GPS.speed);
      Serial.print("Speed  (Km/h): "); Serial.println((GPS.speed)*1.852);   //1knots=1.852Km/h o 1knot=0,514444... m/s
      Serial.print("Angle: "); Serial.println(GPS.angle);
      Serial.print("Altitude: "); Serial.println(GPS.altitude);
      Serial.print("Satellites: "); Serial.println((int)GPS.satellites);
    }
  }
}

JoanCS
 
Posts: 29
Joined: Thu May 07, 2020 12:43 pm

Please be positive and constructive with your questions and comments.