ตัวอย่างการอ่านค่า GPS ผ่าน Raspberry Pi UART port

 

https://www.instructables.com/id/Raspberry-Pi-the-Neo-6M-GPS/

ติดตั้ง gpsd program parsing the raw GPS data

Open a terminal session and type sudo apt-get install gpsd gpsd-clients and press Enter.

After that installs, let's start the serial port:

Type stty -F /dev/ttyAMA0 9600 and press Enter.

Now start GPSD:

Type sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock and press Enter.

Now display by typing cgps -s and press Enter.

 

https://www.amazon.co.uk/MakerHawk-Microcontroller-Compatible-Navigation...

  • [ How to Use this Module ]: https://drive.google.com/open?id=15cIa03wqNB7sItn6I2s5xZ8PGOZ1Q0JF; Video - https://www.youtube.com/watch?v=bgOZLgaLa0g. ★Library: http://arduiniana.org/libraries/tinygpsplus/. ★The easiest way to use the GPS module is to use TinyGPSPlus library: https://github.com/mikalhart/TinyGPSPlus/releases; GPSBaud needs to be set to 9600 instead of 4800; PPS pin is not needed unless using the GPS to drive a hardware high precision clock.
  • [ High Sensitivity ]: The GPS module uses the original 7th generation chip and the software is compatible with NEO-6M. The GT-U7 module features high sensitivity, low power consumption, and miniaturization. Its extremely high tracking sensitivity greatly expands its coverage.
  • [ Advantage ]: In the area that the ordinary GPS receiver can not locate , such as narrow urban sky, dense Jungle environment, Our module can achieve high-precision positioning.
  • [ Effect ]: With a USB interface, you can directly use the phone data cable on the computer point of view positioning effect. With IPEX antenna interface, the default distribution of active antenna, can be quickly positioned.
  • [ Application Areas ]: Vehicle-mounted, handheld devices such as PDAs, Vehicle-monitoring, Mobile phones, camcorders and other mobile positioning systems, Sharing bike, Sharing mobile power

 

 

 

 

https://learn.adafruit.com/adafruit-ultimate-gps-hat-for-raspberry-pi/us...

Use 'gpsd'

You can always just read that raw data, but its much nicer if you can have some Linux software prettify it. We'll try out gpsd which is a GPS-handling Daemon (background-helper)

Installing a GPS Daemon (gpsd)

The first step is installing some software on your Raspberry Pi that understands the serial data that your GPS module is providing via /dev/ttyAMA0.
Thankfully other people have already done all the hard work for you of properly parsing the raw GPS data, and we can use (amongst other options) a nice little package named 'gpsd', which essentially acts as a layer between your applications and the actual GPS hardware, gracefully handling parsing errors, and providing a common, well-defined interfaces to any GPS module.

To install gpsd, make sure your Pi has an Internet connection and run the following commands from the console:

Download: file

Copy Code

 

  1. sudo apt-get update
  2. sudo apt-get install gpsd gpsd-clients python-gps

And install the software as it prompts you to do.

 

https://www.abelectronics.co.uk/kb/article/1035/raspberry-pi-3--4-and-ze...

 

pi@raspberrypi:~ $ stty -F /dev/ttyS0 9600
pi@raspberrypi:~ $ cat /dev/ttyS0
$GPGSV,4,3,13,25,10,122,,26,73,285,39,27,15,254,21,29,39,067,18*76
$GPGSV,4,4,13,31,39,207,23*47
$GPGLL,5115.11544,N,00034.65187,W,163349.00,A,A*7E
$GPRMC,163350.00,A,5115.11532,N,00034.65191,W,0.155,,230320,,,A*68
$GPVTG,,T,,M,0.155,N,0.287,K,A*2F
$GPGGA,163350.00,5115.11532,N,00034.65191,W,1,08,1.15,34.7,M,46.1,M,,*7B
$GPGSA,A,3,26,27,31,04,05,16,29,21,,,,,1.88,1.15,1.49*07
$GPGSV,4,1,13,04,09,296,16,05,13,039,24,09,07,327,18,16,42,297,25*79
$GPGSV,4,2,13,18,59,095,33,20,05,147,,21,63,143,21,23,07,301,*76
$GPGSV,4,3,13,25,10,122,,26,73,285,39,27,15,254,21,29,39,067,18*76
$GPGSV,4,4,13,31,39,207,23*47
$GPGLL,5115.11532,N,00034.65191,W,163350.00,A,A*70
$GPRMC,163351.00,A,5115.11526,N,00034.65188,W,0.204,,230320,,,A*63
$GPVTG,,T,,M,0.204,N,0.377,K,A*26
$GPGGA,163351.00,5115.11526,N,00034.65188,W,1,08,1.15,34.8,M,46.1,M,,*78
$GPGSA,A,3,26,27,31,04,05,16,29,21,,,,,1.88,1.15,1.49*07
$GPGSV,4,1,13,04,09,296,15,05,13,039,24,09,07,327,18,16,42,297,24*7B
$GPGSV,4,2,13,18,59,095,33,20,05,147,,21,63,143,21,23,07,301,*76
$GPGSV,4,3,13,25,10,122,,26,73,285,39,27,15,254,20,29,39,067,18*77
$GPGSV,4,4,13,31,39,207,22*46
$GPGLL,5115.11526,N,00034.65188,W,163351.00,A,A*7C
$GPRMC,163352.00,A,5115.11511,N,00034.65161,W,0.388,,230320,,,A*66
$GPVTG,,T,,M,0.388,N,0.718,K,A*2E
$GPGGA,163352.00,5115.11511,N,00034.65161,W,1,08,1.15,34.8,M,46.1,M,,*78
$GPGSA,A,3,26,27,31,04,05,16,29,21,,,,,1.88,1.15,1.49*07
$GPGSV,4,1,13,04,09,296,13,05,13,039,24,09,07,327,18,16,42,297,25*7C
$GPGSV,4,2,13,18,59,095,33,20,05,147,,21,63,143,21,23,07,301,*76
$GPGSV,4,3,13,25,10,122,,26,73,285,39,27,15,254,20,29,39,067,16*79
$GPGSV,4,4,13,31,39,207,22*46
$GPGLL,5115.11511,N,00034.65161,W,163352.00,A,A*7C
$GPRMC,163353.00,A,5115.11492,N,00034.65175,W,0.371,,230320,,,A*6E
$GPVTG,,T,,M,0.371,N,0.687,K,A*2F
$GPGGA,163353.00,5115.11492,N,00034.65175,W,1,08,1.15,34.3,M,46.1,M,,*7D
$GPGSA,A,3,26,27,31,04,05,16,29,21,,,,,1.88,1.15,1.49*07
$GPGSV,4,1,13,04,09,296,13,05,13,039,22,09,07,327,17,16,42,297,25*75
$GPGSV,4,2,13,18,59,095,33,20,05,147,,21,63,143,20,23,07,301,*77
$GPGSV,4,3,13,25,10,122,,26,73,285,39,27,15,254,21,29,39,067,14*7A

ประเภทเนื้อหาของ article
Raspberry Pi Zero
Rating
Average: 3 (1 vote)