Tags:
view all tags
---+ The Neo 6M GPS receiver Most GPS receivers use a !UART to communicate with their hosts and the Neo 6M is no exception. The ESP32 has 3 hardware !UARTs with the following default connections: | !UART number | default Rx,Tx GPIO pins | | 0 | 3,1 | | 1 | 9,10 | | 2 | 16,17 | On our system !UART 0 is reserved for REPL, GPIO 9 and 10 are not pulled out to the connector and GPIO 16,17 are used by PSRAM. Fortunately the ESP32 allows to re-map !UARTs to just about any GPIO pin using the GPIO matrix and the !MicroPython driver supports the re-mapping. We can define a !UART as follows: <literal>uart2=machine.UART(2, baudrate=9600, rx=21, tx=22, timeout=10000)</literal> The card on which the Neo 6M GPS receiver is mounted has 4 connection pins (starting from the left): | Pin on Neo 6M | Pin on ESP32 bus | | Vcc | 3.3V | | Rx | Rx: D1 = GPIO 22 | | Tx | Tx: D2 = GPIO 21 | | Gnd | Gnd | Only Pin D2 or GPIO 21 is actually used and as you can tell from the instantiation of !UART2 shown above the Neo 6M receiver communicates on 9600 baud. Here is a photo of the device: <img alt="gps.png" height="391" src="%ATTACHURL%/gps.png" title="gps.png" width="637" /> Once the connection is made and the !UART instantiated all you need is an endless loop to read the !UART line by line. This is what you will see if you print the result: <img alt="gpsdata.png" height="439" src="%ATTACHURL%/gpsdata.png" title="gpsdata.png" width="776" /> These are sentences of the [[http://aprs.gids.nl/nmea/][NMEA protocol. ]]You will need a parser that extracts the relevant information from these messages. It is not too difficult to write such a parser yourself but why do you want to do it if the job has already be done for you? In fact Peter Hinch has a github repository with gps drivers containing all you need: https://github.com/peterhinch/micropython-async/tree/master/gps He uses the NMEA parser from https://github.com/inmcm/micropyGPS but adapted it to his asynchronous driver. -- %USERSIG{UliRaich - 2020-07-01}% ---++ Comments %COMMENT%
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
png
gps.png
r1
manage
169.9 K
2020-07-01 - 09:03
UliRaich
png
gpsdata.png
r1
manage
89.8 K
2020-07-31 - 13:04
UliRaich
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r8
|
r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r2 - 2020-07-31
-
UliRaich
Home
Site map
AFNOG web
Embedded_Systems web
IoT_Course_English web
IoT_Course_French web
Main web
Sandbox web
TWiki web
IoT_Course_English Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
Edit
Attach
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback