GPS Verbinden U-BLOX Raspberry Pi: Unterschied zwischen den Versionen
Die Seite wurde neu angelegt: „Plug the USB GPS into the pi, you should be able to see it detected in sudo lsusb Mine came up as: Bus 001 Device 004: ID 1546:01a6 U-Blox AG Using: dmesg | gr…“ |
Keine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
Plug the USB GPS into the pi, you should be able to see it detected in | Plug the USB GPS into the pi, you should be able to see it detected in | ||
sudo lsusb | sudo lsusb | ||
Mine came up as: Bus 001 Device 004: ID 1546:01a6 U-Blox AG | Mine came up as: Bus 001 Device 004: ID 1546:01a6 U-Blox AG | ||
Using: | Using: | ||
dmesg | grep -i usb | dmesg | grep -i usb | ||
I worked out that my USB GPS was paired to ttyACM0 | I worked out that my USB GPS was paired to ttyACM0 | ||
At this point you can test your GPS device is functional and sending data by: | At this point you can test your GPS device is functional and sending data by: | ||
sudo cat /dev/ttyACM0 | sudo cat /dev/ttyACM0 | ||
The next thing we need to do is pipe the GPS feed into GPSD (the gps demon) for it to interpret the data and hopefully give us something useful to use later. | The next thing we need to do is pipe the GPS feed into GPSD (the gps demon) for it to interpret the data and hopefully give us something useful to use later. | ||
sudo gpsd /dev/ttyACM0 -n -F /var/run/gpsd.sock | sudo gpsd /dev/ttyACM0 -n -F /var/run/gpsd.sock | ||
this command connects the output of ttyACM0 to the gpsd socket | this command connects the output of ttyACM0 to the gpsd socket | ||
NB: I had to ensure that the -n flag was present in this command, as trying without the flag resulted in a time out. | NB: I had to ensure that the -n flag was present in this command, as trying without the flag resulted in a time out. | ||
You should now be able to test the GPS using | You should now be able to test the GPS using | ||
cgps -s | cgps -s | ||
Which will bring up a small window showing the GPS data. | Which will bring up a small window showing the GPS data. | ||
Things to note; If you have any problems and cgps always displays ‘NO FIX’ under status and then aborts after a few seconds, you may need to restart the gpsd service you may have to kill and reboot the gps demon by typing | Things to note; If you have any problems and cgps always displays ‘NO FIX’ under status and then aborts after a few seconds, you may need to restart the gpsd service you may have to kill and reboot the gps demon by typing | ||
sudo killall gpsd | sudo killall gpsd | ||
and then | and then | ||
sudo gpsd /dev/ttyACM0 -n -F /var/run/gpsd.sock | sudo gpsd /dev/ttyACM0 -n -F /var/run/gpsd.sock | ||
which will restart the gpsd service and pick up the new settings. | which will restart the gpsd service and pick up the new settings. | ||
Now you should be able to use the GPS data for whatever your project needs; in my case I want to build a GPS fence so that if my beehive is detected leaving a known area (such as a field) then it will alert me and provide me with a GPS co-ordinate feed. | Now you should be able to use the GPS data for whatever your project needs; in my case I want to build a GPS fence so that if my beehive is detected leaving a known area (such as a field) then it will alert me and provide me with a GPS co-ordinate feed. | ||
I used the Lady Ada guide on how to setup GPS devices to help me; the link is: | I used the Lady Ada guide on how to setup GPS devices to help me; the link is: | ||
http://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/setting-everything-up | http://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/setting-everything-up | ||
Version vom 25. Januar 2014, 14:08 Uhr
Plug the USB GPS into the pi, you should be able to see it detected in
sudo lsusb
Mine came up as: Bus 001 Device 004: ID 1546:01a6 U-Blox AG Using:
dmesg | grep -i usb
I worked out that my USB GPS was paired to ttyACM0 At this point you can test your GPS device is functional and sending data by:
sudo cat /dev/ttyACM0
The next thing we need to do is pipe the GPS feed into GPSD (the gps demon) for it to interpret the data and hopefully give us something useful to use later.
sudo gpsd /dev/ttyACM0 -n -F /var/run/gpsd.sock
this command connects the output of ttyACM0 to the gpsd socket NB: I had to ensure that the -n flag was present in this command, as trying without the flag resulted in a time out. You should now be able to test the GPS using
cgps -s
Which will bring up a small window showing the GPS data. Things to note; If you have any problems and cgps always displays ‘NO FIX’ under status and then aborts after a few seconds, you may need to restart the gpsd service you may have to kill and reboot the gps demon by typing
sudo killall gpsd
and then
sudo gpsd /dev/ttyACM0 -n -F /var/run/gpsd.sock
which will restart the gpsd service and pick up the new settings. Now you should be able to use the GPS data for whatever your project needs; in my case I want to build a GPS fence so that if my beehive is detected leaving a known area (such as a field) then it will alert me and provide me with a GPS co-ordinate feed. I used the Lady Ada guide on how to setup GPS devices to help me; the link is:
http://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/setting-everything-up