出自flip the world 檢視Application - u-blox NEO-6M, GPS module的原始碼 頁面討論 閱讀檢視原始碼檢視歷史 ←Application - u-blox NEO-6M, GPS module 您沒有權限執行編輯此頁面,由於以下原因: 您請求的操作只有這個群組的使用者能使用:使用者 您可以檢視並複製此頁面的原始碼。 Reading a '''u-blox NEO-6M''' GPS module on a Raspberry Pi with gpsd, and capturing NMEA sentences with gpspipe. [[File:Rpi gps.png|thumb|200px|RPi2 with GPS module(u-blox NEO-6M)]] [[File:Rpi gpio.png|thumb|200px|RPi2 GPIO]] == HW connection == <pre> PRi2 -- u-blox NEO-6M VCC -- VCC(3v3 / 5V) TX(GPIO8) -- Rx Rx(GPIO10) -- Tx Gnd -- Gnd or CP2102 -- u-blox NEO-6M VCC -- VCC(3v3 / 5V) TX -- Rx Rx -- Tx Gnd -- Gnd </pre> == Software == *Install raspbian *Install tools **scons-2.3.4 **gpsd-3.14 **sudo apt-get install scons libncurses5-dev python-dev pps-tools python-gobject python-gtks-dev **sudo apt-get install gpsd gpsd-clients python-gps *TTY issue **RPi dominate /dev/ttyAMA0 as default serial console **Vi /etc/inittab <pre> #Spawn a getty on Raspberry Pi serial line T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100 to: #Spawn a getty on Raspberry Pi serial line #T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100 </pre> **Vi /boot/cmdline.txt ***Remove “console=ttyAMA0,115200 kgdboc=ttyAMA0,115200” ***And, it would be looks like, ****dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait *Notes ** If your gpsd controled by systemctl ** edit /etc/default/gpsd and modify the DEVICES as you want <pre> # Default settings for gpsd. # Please do not edit this file directly - use `dpkg-reconfigure gpsd' to # change the options. START_DAEMON="true" GPSD_OPTIONS="" DEVICES="/dev/ttyAMA0" USBAUTO="true" GPSD_SOCKET="/var/run/gpsd.sock" </pre> **It only starts working after gpsd attempts 4800, 9600, 19200 then finally 38400 **Solved by ***stty speed 115200 </dev/ttyAMA0 *Run **sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock == Result == [[File:Gps 01.png|thumb|xgps]] [[File:Gps 02.png|thumb|cgps]] <pre> First, you need to run gpsd with ur GPS module connected by TTY serial, gpsd /dev/ttyAMA0 connected by USB, gpsd /dev/ttyUSB0 </pre> == Grab geo info by gpspipe == <pre> #!/bin/bash gpsdata=$( gpspipe -w -n 10 | grep -m 1 lon ) lat=$( echo "$gpsdata" | jsawk 'return this.lat' ) lon=$( echo "$gpsdata" | jsawk 'return this.lon' ) echo "You are here: $lat, $lon - https://maps.google.com/maps?q=$lat,+$lon" </pre> == Reference == * [https://www.microduino.cc/wiki/index.php?title=Microduino-NEO-6M Microduino-NEO-6M] * [https://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/using-uart-instead-of-usb Using UART instead of USB] * [http://www.catb.org/gpsd/installation.html GPSD Installation Instructions] * [http://raspberry.piaustralia.com.au/pages/using-the-raspberry-pi-model-b-with-itead-studio-rpi-gps-add-on Using the Raspberry Pi Model B with ITead Studio RPi GPS Add-on] * [http://thomasloughlin.com/gpspipe-gps-client/ Using GPSPIPE as a Client or Logger for GPSD] [[Category:Projects]] 返回到「Application - u-blox NEO-6M, GPS module」。