[PYTHON] Use GPS with Edison

A test to read GPS connected to Edison UART using python.

Premise

Module to install

hardware

Try out

The connection with UART is made by mraa, and the acquired value is processed by pynmea2.

import mraa
import serial
import pynmea2

#UART port specification
uart = mraa.Uart(0)

#Creation of Serial object. Baud rate is 9600bps
ser = serial.Serial(uart.getDevicePath(), 9600)

while 1:
	#Parse line by line
    msg = pynmea2.parse(ser.readline())
    
    #Sentence processes GGA stuff
    if msg.sentence_type == 'GGA':  # Global Positioning System Fix Data
        print {
            'gps.number_of_satellites': msg.num_sats,
            'gps.latitude': msg.latitude,
            'gps.longitude': msg.longitude,
            'gps.altitude': msg.altitude,
        }

You can get something like this.

{
    'gps.altitude': -12.8,
    'gps.longitude': 139.77447469,
    'gps.number_of_satellites': '11',
    'gps.latitude': 35.700290937
}

Impressions

As long as the circuit is connected, python + mraa + pynmea2 can handle it very easily. There are several sentences defined in NMEA, so it seems that you need to understand NMEA to use it correctly.

reference

Recommended Posts

Use GPS with Edison
Use mecab-ipadic-neologd with igo-python
Use RTX 3090 with PyTorch
Use ansible with cygwin
[Python] Use JSON with Python
Use Mock with pytest
Face recognition with Edison
Use indicator with pd.merge
Use Gentelella with django
Use mecab with Python3
Use tensorboard with Chainer
Use DynamoDB with Python
Use pip with MSYS2
Use Python 3.8 with Anaconda
Use pyright with Spacemacs
Use python with docker
Use TypeScript with django-compressor
Use LESS with Django
Use MySQL with Django
Use Enums with SQLAlchemy
Use tensorboard with NNabla
Use nim with Jupyter
Use Trello API with python
Use shared memory with shared libraries
Use "$ in" operator with mongo-go-driver
Use custom tags with PyYAML
Use directional graphs with networkx
Use Twitter API with Python
Use pip with Jupyter Notebook
Use DATE_FORMAT with SQLAlchemy filter
Use TUN / TAP with Python
Use sqlite3 with NAO (Pepper)
Use sqlite load_extensions with Pyramid
Use Windows 10 fonts with WSL
Use chainer with Jetson TK1
Use SSL with Celery + Redis
Use Cython with Jupyter Notebook
Use Maxout + CNN with Pylearn2
Use WDC-433SU2M2 with Manjaro Linux
Use subsonic API with python3
Use Sonicwall NetExtener with Systemd
Use prefetch_related conveniently with Django
Use AWS interpreter with Pycharm
Use Bokeh with IPython Notebook
Use Python-like range with Rust
Use MLflow with Databricks ④ --Call model -
Use pyright with CentOS7, emacs lsp-mode
Use Azure SQL Database with SQLAlchemy
Use PointGrey camera with Python (PyCapture2)
Use vl53l0x with Raspberry Pi (python)
Use PX-S1UD / PX-Q1UD with Jetson nano
How to use virtualenv with PowerShell
[Python] Use Basic/Digest authentication with Flask
Use NAIF SPICE TOOLKIT with Python
Use rospy with virtualenv in Python3
Use markdown with jupyter notebook (with shortcut)
Use Python in pyenv with NeoVim
Use Tensorflow 2.1.0 with Anaconda on Windows 10!
How to use FTP with Python
Use curl / jq library with Go
I can't use Japanese with pyperclip