GPS tracking with Raspberry Pi 4B + BU-353S4 (Python)

GPS tracking with Raspberry Pi 4 + BU-353S4 + Python

Get GPS information using Raspberry Pi I use Raspberry Pi 4B, but I think that 3 is the same.

What to prepare

--GLOBALSAT BU-353S4 => USB-connected GPS sensor

procedure

Install the required packages

sudo apt-get upgrade
sudo apt-get install gpsd gpsd-clients python-gps cu

Plug BU-353S4 into USB and check the connection with the following command

lsusb
# Prolific Technology, Inc.PL2303 Serial Port is ok
ls /dev/ttyUSB*
# => /dev/ttyUSB0
#Check the port used (will be used later)

After confirming the USB connection, create a gpsd configuration file with the following command (add it below if it already exists)

vi /etc/default/gpsd
# vim /etc/default/gpsd

/etc/default/gpsd


#Add the following two lines (device number to DEVICES)
DEVICES="/dev/ttyUSB0"
GPSD_OPTIONS="-n"
#Set automatic start and restart
sudo systemctl enable gpsd.socket
sudo systemctl start gpsd.socket
sudo reboot

Python sample code

install gps3

pip3 install gps3

gps.py


from gps3 import gps3

gps_socket = gps3.GPSDSocket()
data_stream = gps3.DataStream()
gps_socket.connect()
gps_socket.watch()

for new_data in gps_socket:
  if new_data:
    data_stream.unpack(new_data)
    print('time : ', data_stream.TPV['time'])
    print('lat : ', data_stream.TPV['lat'])
    print('lon : ', data_stream.TPV['lon'])
python3 gps.py
#The output is as follows.
# time :  2020-03-19T13:24:08.000Z
# lat :  35.633116667
# lon :  139.703893333
# alt :  17.1

Summary

It was surprisingly easy, but I had a hard time finding a decent commentary and sample code.

Reference article

https://qiita.com/t2hk/items/572c72fbe99362d92e32

Recommended Posts

GPS tracking with Raspberry Pi 4B + BU-353S4 (Python)
Working with GPS on Raspberry Pi 3 Python
raspberry pi 1 model b, python
Use vl53l0x with Raspberry Pi (python)
Run BNO055 python sample code with I2C (Raspberry Pi 3B)
getrpimodel: Recognize Raspberry Pi model (A, B, B +, B2, B3, etc) with python
Discord bot with python raspberry pi zero with [Notes]
GPGPU with Raspberry Pi
I tried L-Chika with Raspberry Pi 4 (Python edition)
Get CPU information of Raspberry Pi with Python
Connect to MySQL with Python on Raspberry Pi
Measure CPU temperature of Raspberry Pi with Python
Run LEDmatrix interactively with Raspberry Pi 3B + on Slackbot
Try debugging Python on Raspberry Pi with Visual Studio.
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
USB boot with Raspberry Pi 4 Model B (3) LVM edition
Display USB camera video with Python OpenCV with Raspberry Pi
Let's operate GPIO of Raspberry Pi with Python CGI
Raspberry Pi with Elixir, which is cooler than Python
Mutter plants with Raspberry Pi
Raspberry Pi + Python + OpenGL memo
Update Python for Raspberry Pi to 3.7 or later with pyenv
I tried running Movidius NCS with python of Raspberry Pi3
Create an LCD (16x2) game with Raspberry Pi and Python
Connect Raspberry Pi to Alibaba Cloud IoT Platform with Python
Port FreeRTOS to Raspberry Pi 4B
[Raspberry Pi] Stepping motor control with Raspberry Pi
Yamato Transport's parcel tracking with Python
raspberry pi 1 model b, node-red part 17
Serial communication with Raspberry Pi + PySerial
OS setup with Raspberry Pi Imager
VPN server construction with Raspberry Pi
Try moving 3 servos with Raspberry Pi
Using a webcam with Raspberry Pi
[Raspberry Pi] Changed Python default to Python3
Control the motor with a motor driver using python on Raspberry Pi 3!
Programd automatic start at startup with Raspberry Pi 3B + systemd Summary
Get US stock price from Python with Web API with Raspberry Pi
[Note] Using 16x2-digit character LCD (1602A) from Python with Raspberry Pi
Measure SIM signal strength with Raspberry Pi
Pet monitoring with Rekognition and Raspberry pi
Detect "brightness" using python on Raspberry Pi 3!
Detect analog signals with A / D converter using python on Raspberry Pi 3!
USB boot on Raspberry Pi 4 Model B
Raspberry Pi Security Infrared Camera (Python Edition)
Hello World with Raspberry Pi + Minecraft Pi Edition
CSV output of pulse data with Raspberry Pi (confirm analog input with python)
Build a Tensorflow environment with Raspberry Pi [2020]
Adafruit Python BluefruitLE works on Raspberry Pi.
Use python on Raspberry Pi 3 to light the LED with switch control!
Try tweeting arXiv's RSS feed on twitter from Raspberry Pi with python
Get BITCOIN LTP information with Raspberry PI
Try fishing for smelt with Raspberry Pi
Programming normally with Node-RED programming on Raspberry Pi 3
[Python + PHP] Make a temperature / humidity / barometric pressure monitor with Raspberry Pi
I tried to make a traffic light-like with Raspberry Pi 4 (Python edition)
Improved motion sensor made with Raspberry Pi
Try Object detection with Raspberry Pi 4 + Coral
Create a Python multi-user platform with JupyterHub + JupyterLab on Rapsberry Pi 3B +!
Run servomotor on Raspberry Pi 3 using python
Yamato Transport's parcel tracking with Python