Arduino (IoT): Simple Tutorial GPS LS20031

Arduino Honduras Santiapps Marcio Valenzuela

Tutorial GPS LS20031

En este tutorial recibiremos datos de un modulo GPS.

Requisitos:

  1. Computadora (mac)
  2. Arduino MEGA o UNO (el código cambia porque los Rx/Tx cambian)
  3. Modulo GPS LS20031
  4. Breadboard
  5. Arduino IDE (https://www.arduino.cc/en/Main/Software)
Arduino IoT: Simple Tutorial GPS Titan3 Santiapps Marcio Valenzuela
Arduino IoT: Simple Tutorial GPS LS20031

La conexión:

  • GPS Pin 5 (left-most when viewed from above) : No connection (or ground)
  • GPS Pin 4 : to Arduino ground (GND) pin
  • GPS Pin 3 : to Arduino pin 0
  • GPS Pin 2 : No connection
  • GPS Pin 1 (right-most when viewed from above) : to Arduino 3.3V pin

El código:

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

void loop() {

 if (Serial1.available()) {
 int inByte = Serial1.read();
 Serial.write(inByte);
 }
}

 

En el monitor serial saldrá algo así:

$GPGGA,105317.709,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*4C
$GPGLL,8960.0000,N,00000.0000,E,105317.709,V,N*49
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,105317.709,V,8960.0000,N,00000.0000,E,0.00,0.00,010610,,,N*78
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32

Estas son NMEA sentences o datos NMEA (http://en.wikipedia.org/wiki/NMEA_0183) los cuales deben ser parsed a datos de ubicación, velocidad etc.  Esto lo logramos usando la TinyGPS library (http://arduiniana.org/libraries/tinygps/).

Para ello usamos las siguientes conexiones:

  • GPS Pin 5 (left-most when viewed from above) : No connection (or ground)
  • GPS Pin 4 : to Arduino ground (GND) pin
  • GPS Pin 3 : to Arduino pin 2
  • GPS Pin 2 : No connection
  • GPS Pin 1 (right-most when viewed from above) : to Arduino 3.3V pin

Ahora abramos el sketchtest_with_gps_device de la TinyGPS library desde File > Examples > TinyGPS > Examples > test_with_ps_device :


nss.begin(9600);

Ahora vemos:

Testing TinyGPS library v. 9
by Mikal Hart
Sizeof(gpsobject) = 103
Acquired Data
-------------
Lat/Long(10^-5 deg): -4223579, 17344651 Fix age: 14ms.
Lat/Long(float): -42.23579, 173.44651 Fix age: 22ms.
Date(ddmmyy): 0 Time(hhmmsscc): 11210560 Fix age: 35ms.
Date: 0/0/2000  Time: 11:21:5.60  Fix age: 40ms.
Alt(cm): 13870 Course(10^-2 deg): 999999999 
 Speed(10^-2 knots): 999999999
Alt(float): 138.70 Course(float): 10000000.00
Speed(knots): 10000000.00 (mph): 11507795.00 (mps): 5144444.00
 (kmph): 18520000.00
Stats: characters: 156236 sentences: 10 failed checksum: 35
-------------

Pronto veremos otro modulo, el Titan 3 de GTOP.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s