Comment interfacer Arduino avec le module GPS NEO 6M?

How to use GPS Module with Arduino

NEO 6M GPS Module Parts

Code

#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
/*
This sample sketch demonstrates the normal use of a TinyGPSPlus (TinyGPSPlus) object.
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/
static const int RXPin = 3, TXPin = 2;
static const uint32_t GPSBaud = 9600;

// L’objet TinyGPSPlus
TinyGPSPlus gps;

// La connexion série au périphérique GPS
SoftwareSerial ss(RXPin, TXPin);

void setup()
{
Serial.begin(115200);
ss.begin(GPSBaud);

Serial.println(F(« DeviceExample.ino »));
Serial.println(F(« A simple demonstration of TinyGPSPlus with an attached GPS module »));
Serial.print(F(« Testing TinyGPSPlus library v. « )); Serial.println(TinyGPSPlus::libraryVersion());
Serial.println(F(« by Mikal Hart »));
Serial.println();
}

void loop()
{
// Ce sketch affiche des informations chaque fois qu’une nouvelle phrase est correctement encodée.
while (ss.available() > 0)
if (gps.encode(ss.read()))
displayInfo();

if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println(F(« No GPS detected: check wiring. »));
while(true);
}
}

void displayInfo()
{
Serial.println(F(« google map link below: « ));
if (gps.location.isValid())
{

Serial.print(« http://www.google.com/maps/place/« );
Serial.print(gps.location.lat(), 6);
Serial.print(F(« , »));
Serial.println(gps.location.lng(), 6);

}
else
{
Serial.print(F(« INVALID »));
}

Serial.print(F(« Date/Time: »));
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(F(« https://raspberryme.com/ »));
Serial.print(gps.date.day());
Serial.print(F(« https://raspberryme.com/ »));
Serial.print(gps.date.year());
}
else
{
Serial.print(F(« INVALID »));
}

Serial.print(F( » « ));
if (gps.time.isValid())
{
if (gps.time.hour() < 10) Serial.print(F("0"));
Serial.print(gps.time.hour());
Serial.print(F(« : »));
if (gps.time.minute() < 10) Serial.print(F("0"));
Serial.print(gps.time.minute());
Serial.print(F(« : »));
if (gps.time.second() < 10) Serial.print(F("0"));
Serial.print(gps.time.second());
Serial.print(F(« . »));
if (gps.time.centisecond() < 10) Serial.print(F("0"));
Serial.print(gps.time.centisecond());
}
else
{
Serial.print(F(« INVALID »));
}

Serial.println();
}

Retrouvez l’histoire de Raspberry Pi dans cette vidéo :

Youtube video

  • 2 modules GPS, GY-NEO6MV2 NEO-6M module de contrôle de vol GPS
  • ICQUANZX GY-NEO6MV2 NEO-6M Module de commande de vol GPS 3 V-5 V avec antenne en céramique super puissante compatible avec Arduino EEPROM APM 2.5