Raspberry Pi + GPS modul over UART

Using GPS-module for use with Raspberry Pi, you will likely have to connect it to the raspberry pi 4 th
contacts: power, land, TX, RX. Of course I think power – 3.3V or 5V and ground (GND) of Raspberry Pi or external (ground of raspberry, GPS-module and external sources does not forget merge). Contact module TX RX Connect to the foam to raspberry and RX contact to the foam TX.

Next, we need software that can parse data adequately GPS. We use this example program gpsd:
sudo apt-get update
sudo apt-get install gpsd gpsd-clients python-gps

Since we work with GPS-module to UART, we need to make some presets:

sudo nano /boot/cmdline.txt

Remove option console=ttyAMA0,115200, to get:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

В ОС Raspbian UART інтерфейс представлений пристроєм /dev/ttyAMA0. If we use RaIn OS Raspbian UART interface device submittedspbian, there UART-on and hanging terminal. To release the UART interface for GPS receiver perform the following procedures:

sudo nano /etc/inittab

comment out there (#) or remove T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Once the module is connected set speed UART 9600kbit/s (depending on your module)

stty -F /dev/ttyAMA0 9600

We perform:

sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock

To display information from the GPS module do so:

cgps -s

We see something:


Enough is a good idea to read this information using Python script (working second code):

In the future, we’ll talk about how the data obtained from GPS module to send to the server python-script via GET or POST requests. Here)

information sources:


Оставить ответ

Обязательные поля помечены*

Этот сайт использует Akismet для борьбы со спамом. Узнайте как обрабатываются ваши данные комментариев.