GPS Module GY-NEO6MV2 Ublox โมดูล GPS ใช้ระบุตำแหน่งต่างๆบนโลก อ่านค่า ละติจูด ลองจิจูด จากโมดูล GPS ได้
Features:
Based on u-blox NEO-6M GPS module with on-board backup battery and built-in EEPROM.
Comes with external U.FL ceramic antenna for better reception.
It is compatible with various flight controller boards designed to work with a GPS module, APM2.0 and APM2.5 just to name a few.
This module have built-in voltage regulator and it is sometime referred as GY-GPS6MV2.
Operating voltage: 3.3V to 5VDC.
Communication interface: UART TTL, 9600bps.
LED signal indicator.
Pin-out for power and interface
VCC: 3.3 to 5VDC
RX: Data receive in (input to GPS module)
TX: Data transmit out (Out from GPS module)
GND: Ground (Logic and power ground)
Dimension: 36 x 26 mm.
Weight: 22g.
____________________________________________________________________________
Arduino uno r3 -> GPS Module GY-NEO6MV2 Ublox
5V -> Vcc
GND -> GND
ขา4 -> Tx
ขา3 -> Rx
โหลด Library GPS Module GY-NEO6MV2 Ublox
ให้ต่ออุปกรณ์ตามรูปด้านบน แล้วอัพโหลดโค้ดตัวอย่างด้างล่างลง บอร์ด Arduino uno r3
3
* Complete Project Details https://randomnerdtutorials.com
5
* Based on the example TinyGPS++ from arduiniana.org
10
#include < SoftwareSerial.h>
12
static const int RXPin = 4 , TXPin = 3 ;
13
static const uint32_t GPSBaud = 9600 ;
15
// The TinyGPS++ object
18
// The serial connection to the GPS device
19
SoftwareSerial ss (RXPin, TXPin);
27
// This sketch displays information every time a new sentence is correctly encoded.
28
while (ss.available () > 0 ){
29
gps.encode (ss.read ());
30
if (gps.location .isUpdated ()){
31
// Latitude in degrees (double)
32
Serial.print (" Latitude= " );
33
Serial.print (gps.location .lat (), 6 );
34
// Longitude in degrees (double)
35
Serial.print (" Longitude= " );
36
Serial.println (gps.location .lng (), 6 );
38
// Raw latitude in whole degrees
39
Serial.print (" Raw latitude = " );
40
Serial.print (gps.location .rawLat ().negative ? " -" : " +" );
41
Serial.println (gps.location .rawLat ().deg );
42
// ... and billionths (u16/u32)
43
Serial.println (gps.location .rawLat ().billionths );
45
// Raw longitude in whole degrees
46
Serial.print (" Raw longitude = " );
47
Serial.print (gps.location .rawLng ().negative ? " -" : " +" );
48
Serial.println (gps.location .rawLng ().deg );
49
// ... and billionths (u16/u32)
50
Serial.println (gps.location .rawLng ().billionths );
52
// Raw date in DDMMYY format (u32)
53
Serial.print (" Raw date DDMMYY = " );
54
Serial.println (gps.date .value ());
57
Serial.print (" Year = " );
58
Serial.println (gps.date .year ());
60
Serial.print (" Month = " );
61
Serial.println (gps.date .month ());
63
Serial.print (" Day = " );
64
Serial.println (gps.date .day ());
66
// Raw time in HHMMSSCC format (u32)
67
Serial.print (" Raw time in HHMMSSCC = " );
68
Serial.println (gps.time .value ());
71
Serial.print (" Hour = " );
72
Serial.println (gps.time .hour ());
74
Serial.print (" Minute = " );
75
Serial.println (gps.time .minute ());
77
Serial.print (" Second = " );
78
Serial.println (gps.time .second ());
79
// 100ths of a second (0-99) (u8)
80
Serial.print (" Centisecond = " );
81
Serial.println (gps.time .centisecond ());
83
// Raw speed in 100ths of a knot (i32)
84
Serial.print (" Raw speed in 100ths/knot = " );
85
Serial.println (gps.speed .value ());
86
// Speed in knots (double)
87
Serial.print (" Speed in knots/h = " );
88
Serial.println (gps.speed .knots ());
89
// Speed in miles per hour (double)
90
Serial.print (" Speed in miles/h = " );
91
Serial.println (gps.speed .mph ());
92
// Speed in meters per second (double)
93
Serial.print (" Speed in m/s = " );
94
Serial.println (gps.speed .mps ());
95
// Speed in kilometers per hour (double)
96
Serial.print (" Speed in km/h = " );
97
Serial.println (gps.speed .kmph ());
99
// Raw course in 100ths of a degree (i32)
100
Serial.print (" Raw course in degrees = " );
101
Serial.println (gps.course .value ());
102
// Course in degrees (double)
103
Serial.print (" Course in degrees = " );
104
Serial.println (gps.course .deg ());
106
// Raw altitude in centimeters (i32)
107
Serial.print (" Raw altitude in centimeters = " );
108
Serial.println (gps.altitude .value ());
109
// Altitude in meters (double)
110
Serial.print (" Altitude in meters = " );
111
Serial.println (gps.altitude .meters ());
112
// Altitude in miles (double)
113
Serial.print (" Altitude in miles = " );
114
Serial.println (gps.altitude .miles ());
115
// Altitude in kilometers (double)
116
Serial.print (" Altitude in kilometers = " );
117
Serial.println (gps.altitude .kilometers ());
118
// Altitude in feet (double)
119
Serial.print (" Altitude in feet = " );
120
Serial.println (gps.altitude .feet ());
122
// Number of satellites in use (u32)
123
Serial.print (" Number os satellites in use = " );
124
Serial.println (gps.satellites .value ());
126
// Horizontal Dim. of Precision (100ths-i32)
127
Serial.print (" HDOP = " );
128
Serial.println (gps.hdop .value ());
____________________________________________________________________________
ตัวอย่างการใช้งาน NEO-6M Ublox/u-blox GPS Module โคดไลบารีแสดงพิกัด lat , lon ดาวน์โหลดได้ที่นี่
https://github.com/LessonStudio/Arduino_GPS
#include " TinyGPS++.h "
#include " SoftwareSerial.h "
SoftwareSerial serial_connection( 10 , 11 ) ; //RX=pin 10, TX=pin 11
TinyGPSPlus gps; //This is the GPS object that will pretty much do all the grunt work with the NMEA data
void setup( )
{
Serial. begin( 9600 ) ; //This opens up communications to the Serial monitor in the Arduino IDE
serial_connection. begin( 9600 ) ; //This opens up communications to the GPS
Serial. println( " GPS Start " ) ; //Just show to the monitor that the sketch has started
}
void loop( )
{
while ( serial_connection. available( ) ) //While there are characters to come from the GPS
{
gps. encode( serial_connection. read( ) ) ; //This feeds the serial NMEA data into the library one char at a time
}
if ( gps. location. isUpdated( ) ) //This will pretty much be fired all the time anyway but will at least reduce it to only after a package of NMEA data comes in
{
//Get the latest info from the gps object which it derived from the data sent by the GPS unit
Serial. println( " Satellite Count: " ) ;
Serial. println( gps. satellites. value( ) ) ;
Serial. println( " Latitude: " ) ;
Serial. println( gps. location. lat( ) , 6 ) ;
Serial. println( " Longitude: " ) ;
Serial. println( gps. location. lng( ) , 6 ) ;
Serial. println( " Speed MPH: " ) ;
Serial. println( gps. speed. mph( ) ) ;
Serial. println( " Altitude Feet: " ) ;
Serial. println( gps. altitude. feet( ) ) ;
Serial. println( " " ) ;
}
}
VIDEO VIDEO
http://www.instructables.com/id/Arduino-Ublox-GPS/
VIDEO