Create txt file for gps output with timestamps

I have a BN-220 GPS module that uses serial TX and RX connections. “sudo cat /dev/ttyTHS1” on its own does not work. It just does nothing and freezes. but for some reason, this minicom command does:
sudo minicom -b 9600 -o -D /dev/ttyTHS1
it spits out this NMEA coordinates:
$GNGSA,A,3,68,67,69,1.78,1.04,1.4517
$GPGSV,3,1,10,03,12,227,19,04,65,281,24,08,09,190,15,09,30,312,14
7D
$GPGSV,3,2,10,16,86,335,13,18,02,078,26,58,049,28,28,19,100,7E
$GPGSV,3,3,10,29,06,032,31,41,089,23
73
$GLGSV,3,1,11,67,40,201,19,68,56,284,25,69,18,331,19,76,02,066,61
$GLGSV,3,2,11,77,41,043,78,54,302,79,12,263,86,14,034,6F
$GLGSV,3,3,11,87,23,087,88,07,137,24
60
$GNGLL,4052.97080,N,07305.21559,W,173104.00,A,A
6B
$GNRMC,173105.00,A,4052.97043,N,07305.21553,W,0.935,050124,A7B
$GNVTG,T,M,0.935,N,1.732,K,A
35
$GNGGA,173105.00,4052.97043,N,07305.21553,W,1,09,1.04,43.3,M,-34.3,M,4B
$GNGSA,A,3,16,04,26,31,09,03,1.78,1.04,1.45
18
$GNGSA,A,3,68,67,69,1.78,1.04,1.4517
$GPGSV,3,1,10,03,12,227,20,04,65,281,24,08,09,190,16,09,30,312,14
74
$GPGSV,3,2,10,16,86,335,13,18,02,078,26,58,049,27,28,19,100,71
$GPGSV,3,3,10,29,06,032,31,41,089,22
72
$GLGSV,3,1,10,67,40,201,19,68,56,284,24,69,18,331,19,76,02,066,61
$GLGSV,3,2,10,77,41,043,78,54,302,79,12,263,86,14,034,6E
$GLGSV,3,3,10,87,23,087,88,07,137,67
$GNGLL,4052.97043,N,07305.21553,W,173105.00,A,A
6F
$GNRMC,173106.00,A,4052.97066,N,07305.21587,W,0.565,050124,A
7F
$GNVTG,T,M,0.565,N,1.046,K,A
38
$GNGGA,173106.00,4052.97066,N,07305.21587,W,1,09,1.04,43.3,M,-34.3,M,46
$GNGSA,A,3,16,04,26,31,09,03,1.78,1.04,1.45
18
$GNGSA,A,3,68,67,69,1.78,1.04,1.45*17
My goal is to save the coordinates with a timestamp of the current time in a text file.
How can this be done?

Hi @aranis.das, there is something I’ve used before to read serial sensors/devices, its pyserial. Someone else already did it, you can check it over here. Just need to install python3 and pyserial with: pip3 install pyserial. And then use the time and/or the datetime python libs to create the timestamp, like here. Just be sure to verify the /dev/ path and the serial port speed and params.

Regards,
Andres
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.c om/
Website: www.ridgerun.com

[quote=“aranis.das, post:1, topic:277973”][/quote]

You need the following libraries:
PySerial
Time
Pandas (for processing received data)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.