rmentjens | Posted: 9 Jan 2021, 06:49 PM |
---|---|
Member Posts: 4 Joined: 9-January 21 |
Good evening. I am trying to use the nmea.py script to generate $GPRMC sentences. So far I am partially succesful. However there seems to be a problem with the script. I run the script on a RPI zero W. I connected a USB UART to the USB port and connected that to a console on my computer. showing the NMEA sentences. The thing is. The time runs too fast. after every 6 seconds, one minute seems to have passed. every second ten new GPRMC sentences are sent. Is there a way to make the time run slower, and also is there a way to only send the GPRMC string every minute. in stead of ten times a second? Kind regards, Raymond. Last edit by rmentjens at 9 Jan 2021, 06:50 PM ------------- |
[top] | |
mit | Posted: 10 Jan 2021, 05:20 PM |
yeah whatever Admin Posts: 566 Joined: 4-May 16 |
Something has gone wrong if it is outputting ten times a second. Are there any error messages? What version of python are you running? ------------- |
[top] | |
rmentjens | Posted: 11 Jan 2021, 05:59 PM |
Member Posts: 4 Joined: 9-January 21 |
Evening again. The Python version is 2.7.16 I added a screenshot Putty screen on the right is the received $GPRMC string. The left and bottom screens are from the RPI WH You can see in the orange circles that there is a time diffirence between the RPI's time and the time that the second computer receives (don't look at the hour diffirence. my timezone is CET) The right screen gets a new $GPRMC line approximately ten times a second. adding one second to the GPRMC string. ------------- |
[top] | |
mit | Posted: 11 Jan 2021, 06:16 PM |
yeah whatever Admin Posts: 566 Joined: 4-May 16 |
Strongly recommend using python3, python2 is obsolete. A quick google suggests the behaviour of datetime.utcnow() may be different in python2 vs python3. ------------- |
[top] | |
rmentjens | Posted: 14 Jan 2021, 04:18 PM |
Member Posts: 4 Joined: 9-January 21 |
Evening. Using python3 did the trick! It works like a charm now. This script makes it easy to sync any $GPRMC synched clock. I use it to sync a nixie clock to NTP for cheap. I use a wireless serial bridge with two 2.4G Wireless Serial Transparent Transceiver Module (OPEN-SMART). As I said works like a charm. Possibly useable to sync the precision clock via a wireless link. Thank you for the script and the assistance to get it to work. Kind regards, Raymond. ------------- |
[top] | |
mit | Posted: 15 Jan 2021, 05:27 PM |
yeah whatever Admin Posts: 566 Joined: 4-May 16 |
Excellent. At some point I'll update the script to do the checksums properly and periodically resync with the system clock. I did make a start on a wireless NTP module for the precision clock. Using an ESP8266 and an NTP client, even made a cute PCB for it: Never got round to finishing it, but I hope to do so when I get a chance. I really wanted it to reliably synchronize to within a millisecond, which might be an impossible goal with NTP over wifi. I got pretty close though. I was just at the point of potentially starting over, using PTP instead of NTP, and possibly fitting a TCXO to the PCB, when I got distracted with another project. ------------- |
[top] | |
rmentjens | Posted: 3 Apr 2021, 09:44 AM |
Member Posts: 4 Joined: 9-January 21 |
Good Morning. I saw you made some changes to the nmea.py script, making it generate the correct checksum. I had to change one line in the script to make it work. Line 20: with serial.Serial('/dev/ttyUSB', 9600) as ser: to with serial.Serial('/dev/ttyUSB0', 9600) as ser: After this script worked like a charm. ------------- |
[top] | |
mit | Posted: 3 Apr 2021, 06:09 PM |
yeah whatever Admin Posts: 566 Joined: 4-May 16 |
The name of the serial device will depend on what hardware you're using. With enough effort it's possible to auto-detect the device name, but for this little script I didn't bother. ------------- |
[top] | |
Sign in to post a reply.