Hardware Serial for Skylab SKM 53 GPS Module

Hey guys,

Recently I am playing with this module and I realised all the codes available are using software serial.

Is it possible for me to program and using the hardware serial which is the tx and rx of the arduino ?

Any advice ?

Thanks and appreciate.

Is it possible for me to program and using the hardware serial

It is possible. Whether you can do it, or not, is a different question. One that only you can answer.

which is the tx and rx of the arduino ?

The ones that say TX and RX next to them.

Is it possible for me to program and using the hardware serial which is the tx and rx of the arduino ?

Yes. Connect the device to the Tx and Rx pins on the Arduino and away you go. This will not work, however, if you need Serial output to the Serial monitor or input from it and you will need to disconnect the device from the Tx/Rx pins in order to upload a program.

Unless, of course, you use a Mega which has 4 hardware serial ports. Which board are you using ?

Here is working code attached .with assocaited library . kust unzip Software serial & pasted in Library folder.

Main is code that can USE gps. Use the pins 8,9

I have considered arduino UNo board here. if you using arduino mega you can use any hardware Serial available

main_c.zip (1.78 KB)

SoftwareSerial.zip (8.75 KB)

UKHeliBob:
Yes. Connect the device to the Tx and Rx pins on the Arduino and away you go. This will not work, however, if you need Serial output to the Serial monitor or input from it and you will need to disconnect the device from the Tx/Rx pins in order to upload a program.

Unless, of course, you use a Mega which has 4 hardware serial ports. Which board are you using ?

Hi,

I am using Arduino UNO board.

AMPS-N:
Here is working code attached .with assocaited library . kust unzip Software serial & pasted in Library folder.

Main is code that can USE gps. Use the pins 8,9

I have considered arduino UNo board here. if you using arduino mega you can use any hardware Serial available

Hi,

I dont plan to use software serial but only use hardware serial which is D0 and D1 of arduino UNO board.

UKHeliBob:
Yes. Connect the device to the Tx and Rx pins on the Arduino and away you go. This will not work, however, if you need Serial output to the Serial monitor or input from it and you will need to disconnect the device from the Tx/Rx pins in order to upload a program.

Unless, of course, you use a Mega which has 4 hardware serial ports. Which board are you using ?

So I just connect the GPS module Tx to Arduino Rx and GPS Rx to Arduino Tx ? Do I use Serial.begin ?

Do I use Serial.begin ?

If you want serial communications to start, you do.

So I just connect the GPS module Tx to Arduino Rx and GPS Rx to Arduino Tx ? Do I use Serial.begin ?

Yes to both, but what are you going to do with the GPS data and why the determination not to use SoftwareSerial ?

If you using Hardware serial.here is code. But keep in mind if you using below code.You can use the values other parts you need to change code. The code given first uses software serial; you can use latitude & longitude any part of code.

 #include <string.h>
 #include <ctype.h>
 int ledPin = 13;                  // LED test pin
 int rxPin = 0;                    // RX PIN 
 int txPin = 1;                    // TX TX
 int byteGPS=-1;
 char linea[300] = "";
 char comandoGPR[7] = "$GPRMC";
 int cont=0;
 int bien=0;
 int conta=0;
 int indices[13];
 void setup() {
   pinMode(ledPin, OUTPUT);       // Initialize LED pin
   pinMode(rxPin, INPUT);
   pinMode(txPin, OUTPUT);
   Serial.begin(4800);
   for (int i=0;i<300;i++){       // Initialize a buffer for received data
     linea[i]=' ';
   }   
 }
 void loop() {
   digitalWrite(ledPin, HIGH);
   byteGPS=Serial.read();         // Read a byte of the serial port
   if (byteGPS == -1) {           // See if the port is empty yet
     delay(100); 
   } else {
     // note: there is a potential buffer overflow here!
     linea[conta]=byteGPS;        // If there is serial port data, it is put in the buffer
     conta++;                      
     Serial.print(byteGPS, BYTE); 
     if (byteGPS==13){            // If the received byte is = to 13, end of transmission
       // note: the actual end of transmission is <CR><LF> (i.e. 0x13 0x10)
       digitalWrite(ledPin, LOW); 
       cont=0;
       bien=0;
       // The following for loop starts at 1, because this code is clowny and the first byte is the <LF> (0x10) from the previous transmission.
       for (int i=1;i<7;i++){     // Verifies if the received command starts with $GPR
         if (linea[i]==comandoGPR[i-1]){
           bien++;
         }
       }
       if(bien==6){               // If yes, continue and process the data
         for (int i=0;i<300;i++){
           if (linea[i]==','){    // check for the position of the  "," separator
             // note: again, there is a potential buffer overflow here!
             indices[cont]=i;
             cont++;
           }
           if (linea[i]=='*'){    // ... and the "*"
             indices[12]=i;
             cont++;
           }
         }
         Serial.println("");      // ... and write to the serial port
         Serial.println("");
         Serial.println("---------------");
         for (int i=0;i<12;i++){
           switch(i){
             case 0 :Serial.print("Time in UTC (HhMmSs): ");break;
             case 1 :Serial.print("Status (A=OK,V=KO): ");break;
             case 2 :Serial.print("Latitude: ");break;
             case 3 :Serial.print("Direction (N/S): ");break;
             case 4 :Serial.print("Longitude: ");break;
             case 5 :Serial.print("Direction (E/W): ");break;
             case 6 :Serial.print("Velocity in knots: ");break;
             case 7 :Serial.print("Heading in degrees: ");break;
             case 8 :Serial.print("Date UTC (DdMmAa): ");break;
             case 9 :Serial.print("Magnetic degrees: ");break;
             case 10 :Serial.print("(E/W): ");break;
             case 11 :Serial.print("Mode: ");break;
             case 12 :Serial.print("Checksum: ");break;
           }
           for (int j=indices[i];j<(indices[i+1]-1);j++){
             Serial.print(linea[j+1]); 
           }
           Serial.println("");
         }
         Serial.println("---------------");
       }
       conta=0;                    // Reset the buffer
       for (int i=0;i<300;i++){    //  
         linea[i]=' ';             
       }                 
     }
   }
 }

O/p

Valid position (status is A):



$GPGGA,154653,4428.2011,N,00440.5161,W,0,00,-00044.7,M,051.6,M,*6C
$GPGSA,A,1,*1E
$GPGSV,3,1,10,02,50,290,003,10,25,24,045,35,27,56,145,00,78
$GPRMC,154653,V,4428.2011,N,00440.5161,W,000.5,342.8,050407,N
7F

Time in UTC (HhMmSs): 154653
Status (A=OK,V=KO): V
Latitude: 4428.2011
Direction (N/S): N
Longitude: 00440.5161
Direction (E/W): W
Speed in knots: 000.5
Direction in degrees: 342.8
Date in UTC (DdMmAa): 050407
Magnetic variation:
Variation (E/W):
Mode: A

UKHeliBob:
Yes to both, but what are you going to do with the GPS data and why the determination not to use SoftwareSerial ?

Hi,

Actually I am building up a system where the system will constantly update the GPS location and then when some event triggered, the GSM shield will be activated and the corresponding GPS location at the time event triggered will be sent to mobile phones.

My Skylab SKM 53 is using software serial, my GPRS Shield V2.0 is using software serial as well. Based on my reading, software serial can be used multiple times but only one will be communicating each time right ? So I am seeing the possibility of using HW Serial for GPS.

What are your advices ?

What are your advices ?

Get a Mega and do it using 2 of the hardware serial ports.

UKHeliBob:
Get a Mega and do it using 2 of the hardware serial ports.

Is it possible for using software serial only to do my required system ?

UKHeliBob:
Get a Mega and do it using 2 of the hardware serial ports.

By the way, how is it possible for me to send SMS to multiple mobile phone numbers ?

Is it possible for using software serial only to do my required system ?

Maybe, but as you have said, SoftwareSerial can only receive from one source at a time so you will have to juggle with listen() to receive what you want when you want. You could presumably listen to the GPS until the trigger event happens, switch to listening to the GSM, send your message and when communication with the GSM is complete return to listening to the GPS. You might, however, miss a trigger event from the GPS in the meantime.

Vincent19:
By the way, how is it possible for me to send SMS to multiple mobile phone numbers ?

At its simplest send it to one then the next then the next, maybe holding the numbers in an array.

There may well be a way to send to multiple numbers using one command but it is not an area that I am familiar with.

UKHeliBob:
Maybe, but as you have said, SoftwareSerial can only receive from one source at a time so you will have to juggle with listen() to receive what you want when you want. You could presumably listen to the GPS until the trigger event happens, switch to listening to the GSM, send your message and when communication with the GSM is complete return to listening to the GPS. You might, however, miss a trigger event from the GPS in the meantime.

I think this is good enough for now if I am using software serial. I will make an interval of like few seconds before the next trigger SMS can be sent to avoid overload/extra unnecessary SMS sent.

By the way, is it possible to send SMS to multiple phone numbers ?

Have you tested my code

AMPS-N:
Have you tested my code

No, I got it working ady over the hardware serial.

UKHeliBob:
At its simplest send it to one then the next then the next, maybe holding the numbers in an array.

There may well be a way to send to multiple numbers using one command but it is not an area that I am familiar with.

Hi,

I am trying out with these code but it seems to be not working accordingly. I sent 'INSTRUCTABLES' to the GPRS Shield but nothing happened :frowning:

Any advice ?

Thanks !