හැදින්වීම
NEO-6M GPS Receiver Module
-
- ගෝලීය ස්ථානගත කිරීමේ පද්ධතිය (GPS) මඟින් පෘථිවියේ ඇති වස්තුවක එහි පිහිටීම නිවැරදිව තීරණය කිරීම සඳහා පෘථිවියේ අභ්යවකාශ හා භූගත මධ්යස්ථාන වල චන්ද්රිකා මඟින් යවන සංඥා භාවිතා කරයි.
- NEO-6M GPS ග්රාහක මොඩියුලය මයික්රෝකොන්ට්රොලර් එකක් හෝ පරිගණක පද්ධතියක් සමඟ සන්නිවේදනය කිරීම සඳහා UART සන්නිවේදන ක්රමවේදය භාවිතා කරයි.
- එයට චන්ද්රිකා වලින් අක්ෂාංශ, දේශාංශ, උන්නතාංශය, UTC වේලාව යනාදිය වැනි තොරතුරු NMEA ආකාරයෙන් ලැබේ. අපට භාවිතා කිරීමට අවශ්ය තොරතුරු උපුටා ගැනීම සඳහා මෙම දත්ත භාවිතා කළ යුතුය.
Interfacing Diagram
Interfacing NEO – 6M GPS Receiver Module With Arduino UNO
Example
අපි ආර්ඩුයිනෝ හි සිරියල් මොනිටරයේ ජීපීඑස් ග්රාහක මොඩියුලය මඟින් ලබා ගත් දත්ත (අක්ෂාංශ, දේශාංශ, උන්නතාංශය සහ වේලාව) ප්රදර්ශනය කිරීමට වැඩසටහනක් නිර්මාණය කරමු.
GitHub වෙතින් ජීපීඑස් ග්රාහක මොඩියුලය ට අදාල library එක ඩවුන්ලෝඩ් කර භාවිතා කරන්නෙමු.
Download this library from here.
Note :ඔබ බොහෝ දත්ත ***** ආකෘතියෙන් දකිනවා නම්, ආර්ඩුයිනෝ වෙත සම්බන්ධ කර ඇති GPS මොඩුයුලය විවෘත අවකාශයක ගන්න (උදාහරණයක් ලෙස බැල්කනියේ). GPS චන්ද්රිකා වෙත සම්බන්ධ වීමට යම් කාලයක් අවශ්ය විය හැකිය. තත්පර 20-30 අතර කාලයක් එය ලබා දෙන්න එවිට එමඟින් ඔබට නිවැරදි දත්ත ලබා ගැනීම ආරම්භ කළ හැකිය. ඔබ විවෘත අවකාශයක සිටී නම් සාමාන්යයෙන් චන්ද්රිකා වෙත සම්බන්ධ වීමට තත්පර 5 කට වඩා ගත නොවේ, නමුත් ඉඳහිට එයට වැඩි කාලයක් ගත විය හැකිය (උදාහරණයක් ලෙස චන්ද්රිකා 3 ක් හෝ වැඩි ගණනක් ජීපීඑස් ග්රාහකයාට නොපෙනේ නම් ටිකක් වැඩි වෙලාවක් ගත විය හැකිය).
Sketch For Displaying GPS Parameters On Serial Monitor
#include <TinyGPS++.h> #include <SoftwareSerial.h> /* Create object named bt of the class SoftwareSerial */ SoftwareSerial GPS_SoftSerial(4, 3);/* (Rx, Tx) */ /* Create an object named gps of the class TinyGPSPlus */ TinyGPSPlus gps; volatile float minutes, seconds; volatile int degree, secs, mins; void setup() { Serial.begin(9600); /* Define baud rate for serial communication */ GPS_SoftSerial.begin(9600); /* Define baud rate for software serial communication */ } void loop() { smartDelay(1000); /* Generate precise delay of 1ms */ unsigned long start; double lat_val, lng_val, alt_m_val; uint8_t hr_val, min_val, sec_val; bool loc_valid, alt_valid, time_valid; lat_val = gps.location.lat(); /* Get latitude data */ loc_valid = gps.location.isValid(); /* Check if valid location data is available */ lng_val = gps.location.lng(); /* Get longtitude data */ alt_m_val = gps.altitude.meters(); /* Get altitude data in meters */ alt_valid = gps.altitude.isValid(); /* Check if valid altitude data is available */ hr_val = gps.time.hour(); /* Get hour */ min_val = gps.time.minute(); /* Get minutes */ sec_val = gps.time.second(); /* Get seconds */ time_valid = gps.time.isValid(); /* Check if valid time data is available */ if (!loc_valid) { Serial.print("Latitude : "); Serial.println("*****"); Serial.print("Longitude : "); Serial.println("*****"); } else { DegMinSec(lat_val); Serial.print("Latitude in Decimal Degrees : "); Serial.println(lat_val, 6); Serial.print("Latitude in Degrees Minutes Seconds : "); Serial.print(degree); Serial.print("\t"); Serial.print(mins); Serial.print("\t"); Serial.println(secs); DegMinSec(lng_val); /* Convert the decimal degree value into degrees minutes seconds form */ Serial.print("Longitude in Decimal Degrees : "); Serial.println(lng_val, 6); Serial.print("Longitude in Degrees Minutes Seconds : "); Serial.print(degree); Serial.print("\t"); Serial.print(mins); Serial.print("\t"); Serial.println(secs); } if (!alt_valid) { Serial.print("Altitude : "); Serial.println("*****"); } else { Serial.print("Altitude : "); Serial.println(alt_m_val, 6); } if (!time_valid) { Serial.print("Time : "); Serial.println("*****"); } else { char time_string[32]; sprintf(time_string, "Time : %02d/%02d/%02d \n", hr_val, min_val, sec_val); Serial.print(time_string); } } static void smartDelay(unsigned long ms) { unsigned long start = millis(); do { while (GPS_SoftSerial.available()) /* Encode data read from GPS while data is available on serial port */ gps.encode(GPS_SoftSerial.read()); /* Encode basically is used to parse the string received by the GPS and to store it in a buffer so that information can be extracted from it */ } while (millis() - start < ms); } void DegMinSec( double tot_val) /* Convert data in decimal degrees into degrees minutes seconds form */ { degree = (int)tot_val; minutes = tot_val - degree; seconds = 60 * minutes; minutes = (int)seconds; mins = (int)minutes; seconds = seconds - minutes; seconds = 60 * seconds; secs = (int)seconds; }