The following tools to read GPS using Arduino UNO. GPS (Global Positioning System) is a system for determining the earth's surface position with the help of satellite signal synchronization and for determining location, speed, direction and time.
Hardware Requirement
- GPS Module with NEO6MV2
- Arduino UNO
- LCD 2x16 Module
- Power supply +5 Volt, +3 Volt
Block Diagram
Schematic
Arduino - LCD Wiring
Arduino - GPS NEO6MV2 Module Wiring
Source Code/Sketch
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
static const int RXPin = 8, TXPin = 9;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
void setup(){
Serial.begin(9600);
ss.begin(GPSBaud);
lcd.begin(16, 2);
lcd.print("Interfacing GPS");
lcd.setCursor(0, 1);
lcd.print(" dg Arduino");
delay(2000);
lcd.clear();
lcd.print("Baca Lokasi GPS");
delay(2000);
}
void loop(){
while (ss.available() > 0)
if (gps.encode(ss.read())) displayInfo();
if (millis() > 5000 && gps.charsProcessed() < 10){
lcd.clear();
lcd.print("No GPS detected:");
lcd.setCursor(0,1);
lcd.print("check wiring.");
while(true);
}
}
void displayInfo(){
if (gps.location.isValid()){
lcd.setCursor(0, 0);
lcd.print(gps.location.lat(), 6);
lcd.print(" LS ");
lcd.setCursor(0, 1);
lcd.print(gps.location.lng(), 6);
lcd.print(" BT ");
}
else{
lcd.clear();
lcd.print("INVALID");
}
delay(500);
}
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
static const int RXPin = 8, TXPin = 9;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
void setup(){
Serial.begin(9600);
ss.begin(GPSBaud);
lcd.begin(16, 2);
lcd.print("Interfacing GPS");
lcd.setCursor(0, 1);
lcd.print(" dg Arduino");
delay(2000);
lcd.clear();
lcd.print("Baca Lokasi GPS");
delay(2000);
}
void loop(){
while (ss.available() > 0)
if (gps.encode(ss.read())) displayInfo();
if (millis() > 5000 && gps.charsProcessed() < 10){
lcd.clear();
lcd.print("No GPS detected:");
lcd.setCursor(0,1);
lcd.print("check wiring.");
while(true);
}
}
void displayInfo(){
if (gps.location.isValid()){
lcd.setCursor(0, 0);
lcd.print(gps.location.lat(), 6);
lcd.print(" LS ");
lcd.setCursor(0, 1);
lcd.print(gps.location.lng(), 6);
lcd.print(" BT ");
}
else{
lcd.clear();
lcd.print("INVALID");
}
delay(500);
}
How it Works
1. Connect the Arduino with Peripherals needed
2. Plug in the Power Source on the device
3. Compile and upload the script program above to your arduino
2. Plug in the Power Source on the device
3. Compile and upload the script program above to your arduino
4. On the LCD will display the position of the GPS module based on south latitude and east
longitude
* LS = Lintang Selatan (Bahasa Indonesia)--> South Latitude
* BT = Bujur Timur (Bahasa Indonesia) --> East Longitude
Video for Project II - 22. Interfacing GPS Module with Arduino
Download the required file.
No comments:
Post a Comment