Go Down

Topic: GPS module with MKR GSM 1400 (Read 998 times) previous topic - next topic

khalidalrifai

Is it possible to use GPS module with Arduino MKR GSM 1400?

I want to use Adafruit Ultimate GPS Breakout with Arduino MKR GSM 1400.

I want to obtain the coordinates and then send them through SMS.

shtrier

im also quit curious on this topic!


k4hvd

Hmm,
Here is some code ive been testing with.


Code: [Select]

/*
 * GPS TEST
 * MKRGSM1400
 * SERCOM TEST (MAKE NEW SERIAL PORT)
 *
 */
#include <Arduino.h>
/*

//NEW SERIAL
// | 11         | SDA              |  PA08  |                 |   NMI  | *16 |     | X00 |     |  *0/00  |   2/00  | TCC0/0 | TCC1/2 | I2S/SD1  |          |
// | 12         | SCL              |  PA09  |                 |   09   | *17 |     | X01 |     |  *0/01  |   2/01  | TCC0/1 | TCC1/3 | I2S/MCK0 |          |
Uart Serial3 (&sercom0, 11, 12, SERCOM_RX_PAD_0, UART_TX_PAD_2);
void SERCOM0_Handler() { Serial3.IrqHandler(); }
//IN SETUP
//pinPeripheral(11, PIO_SERCOM);
//pinPeripheral(12, PIO_SERCOM);
*/

#define SerialGPS Serial1  // RX&TX PINS
//#define SerialGPS Serial3 // SCL&SDA PINS


void setup() {
//pinPeripheral(11, PIO_SERCOM);
//pinPeripheral(12, PIO_SERCOM);
  Serial.begin(9600); //USB
  SerialGPS.begin(9600); //TEST GPS.

  while(!Serial) { ; } //WAIT FOR SERIAL USB.
  Serial.print("\nTEST SOMETHING\n\n");
 
}

#define CHECK_INTERVAL 5  //seconds.
unsigned long previousTest;
bool mGPS_got_line = false, mGPS_paused = false;
uint8_t mGPS_idx=0;
char mGPS_TempLine[120];

void loop() {

if (millis() - previousTest >= CHECK_INTERVAL*1000UL)
{
  previousTest = millis();
  Serial.print("\n\nGET NEW LINE\n\n");
  if (mGPS_paused) mGPS_paused = false;
}
char mGPS = 0;
if ((SerialGPS.available() > 0) && !mGPS_got_line && !mGPS_paused)
{
  mGPS = SerialGPS.read();
  //Serial.write(mGPS);   //DEBUG
  if (mGPS == '\n')
  {
    mGPS_TempLine[mGPS_idx] = 0; mGPS_idx = 0; mGPS_got_line = true;
  }
  else
  {
     mGPS_TempLine[mGPS_idx++] = mGPS;
     if (mGPS_idx >= 120) mGPS_idx = 119;
  }
}
if (mGPS_got_line)
{
  if (strstr(mGPS_TempLine, "$GPRMC"))
  {
    Serial.print("-->");Serial.println(mGPS_TempLine);
    //DO SOMETHING WITH THE LINE.
   
    //done parsed.
    mGPS_paused = true; mGPS_got_line = false; //Reset to get a new after paused has been reset.
  }
  else
  {
    mGPS_got_line = false; //wrong line not GPRMC. get another.
  }
}

} //END LOOP

MESWEB

Any news with this configuration?

k4hvd

#5
Mar 25, 2019, 10:51 am Last Edit: Mar 25, 2019, 11:04 am by k4hvd
Yes it works fine.
(doesnt do much but, it reads gpsmodule, skip until it finds a string with GPRMC and display it in serialmonitor. wait x seconds and repeat.)

Just ignore the Sercom part in the code. its commented out already.

Hook up you GPS-module with the RX/TX pins and you should recieve GPRMC Lines.

MESWEB

Yes it works fine.
(doesnt do much but, it reads gpsmodule, skip until it finds a string with GPRMC and display it in serialmonitor. wait x seconds and repeat.)

Just ignore the Sercom part in the code. its commented out already.

Hook up you GPS-module with the RX/TX pins and you should recieve GPRMC Lines.
Can you read GPS data using by mobile GSM and SMS txt messages?

k4hvd

Can you read GPS data using by mobile GSM and SMS txt messages?
I suggest you check out the examples in MKRGSM library.
Those functions are included there.

Go Up