Speedsaver has quit [Remote host closed the connection]
Speedsaver has joined #Speedsaver
peterm6881 has joined #Speedsaver
<peterm6881> hey Xogium
<peterm6881> i dont know what the deal is with that pps pin. I cant work out if that needs to be connected directly to a UART interface
<peterm6881> all I can find is stupid videos of guys showing the pulse on oscilloscopes or meters
<peterm6881> this guy uses chrony to set the system time from his usb dongle, same type I have
<peterm6881> could that work?
<Xogium> maybe ? I dunno
<peterm6881> do we have chrony in our build?
<peterm6881> since we dont have Python to run gpstime.py
<Xogium> nop we don't since we never relied on gps time
<peterm6881> could you check that video if there are any problems with his method?
<peterm6881> he explains it all pretty well
<Xogium> kind of sucks that he didn't put up as text tutorial
<peterm6881> i found a guy who connected pps to GPIO18 on a Raspberry Pi, which sure enough is a PCM connection to use the 1Hz pulses to sync something else
<peterm6881> i think we're barking up the wrong tree that pps has anything to do with setting the system time from gps
<Xogium> well in everything I've ever read they talked about pps
<peterm6881> its just a sync pulse that can be used to synchronise multiple devices, because it always arrives at exactly the same time
<peterm6881> thats a sweeping statement Xogium ;)
<Speedsaver> Title: GPSD Time Service HOWTO (at gpsd.gitlab.io)
<peterm6881> this is where I started today
<peterm6881> but nowhere does it talk about connecting physical pins
<peterm6881> but perhaps this is the page you remember reading
<peterm6881> Connect a PPS-capable GPS receiver to one of your serial or USB ports. A random cheap consumer-grade GPS receiver won’t do; you may have to do some hunting to find a usable one.
<peterm6881> Check that it actually emits PPS by pointing GPSD’s gpsmon utility at the port. If it has a good (3D-mode) fix, lines marked "PPS" should scroll by in the packet-logging window. A new device out of the box may take up to 30 minutes for the first 3D fix. If gpsmon shows a 3D fix, but does not show PPS lines, try running ppscheck.
<peterm6881> steps 3 and 4 are so bloody vague
<Xogium> Connect a PPS-capable GPS receiver to one of your serial or USB ports.
<Xogium> right at same time
<peterm6881> exactly, it doesnt mention pins
<peterm6881> its a black hole
<Xogium> 1PPS-capable GPS receivers use an RS-232 control line to ship the 1PPS edge of second to the host system
<peterm6881> if I sent you one of the python scripts, can you work out how to do what its doing?
<Xogium> sounds like a pin to me, control line
<peterm6881> so we'd have to blow away a whole UART connection
<peterm6881> try:
<peterm6881> except:
<peterm6881> print 'ERROR: No GPS Present, time not set!!'
<peterm6881> sys.exit()
<peterm6881> gpsd = gps(mode=WATCH_ENABLE)
<peterm6881> while True:
<peterm6881> #wait until the next GPSD time tick
<peterm6881> gpsd.next()
<peterm6881> if gpsd.utc != None and gpsd.utc != '':
<peterm6881> #gpsd.utc is formatted like"2015-04-01T17:32:04.000Z"
<peterm6881> #convert it to a form the date -u command will accept: "20140401 17:32:04"
<peterm6881> #use python slice notation [start:end] (where end desired end char + 1)
<peterm6881> # gpsd.utc[0:4] is "2015"
<peterm6881> # gpsd.utc[5:7] is "04"
<peterm6881> # gpsd.utc[8:10] is "01"
<peterm6881> gpsutc = gpsd.utc[0:4] + gpsd.utc[5:7] + gpsd.utc[8:10] + ' ' + gpsd.utc[11:19]
<peterm6881> os.system('sudo date -u --set="%s"' % gpsutc)
<peterm6881> sys.exit()
<Xogium> it needs to hook up the pin of pps to a detect pin
<peterm6881> i think i hit pay dirt
<Speedsaver> Title: Script to set system date from GPS - INDI Forum (at www.indilib.org)
<peterm6881> can you check this for me
<Xogium> If you are using an RS232 cable, examine it suspiciously, ideally with an RS232 breakout box. Cheap DB9 to DB9 cables such as those issued with UPSs often carry TXD/RXD/SG only, omitting handshake lines such as DCD, RI, and DSR that are used to carry 1PPS. Suspect this especially if the cable jacket looks too skinny to hold more than three leads !
<peterm6881> i think that 1pps pin could mess with our heads
<Xogium> so yes we don't have the stuff required to carry the 1pps signal
<peterm6881> does that script make sense to you? No Python required
<Xogium> hence why gpsmon says n/a
<peterm6881> gps_set_date:
<peterm6881> if [ ! -e "/dev/gps0" ]
<peterm6881> then
<peterm6881> exit
<peterm6881> #!/bin/bash
<peterm6881> else
<peterm6881> GPSDATE=""
<peterm6881> until [ "$GPSDATE" != "" ]; do
<peterm6881> GPSDATE=`gpspipe -n 10 -w | grep TPV | grep -e '"mode":[23]' | grep '"time":' | sed -r 's/.*"time":"([^"]*)".*/\1/' | tail -1`
<peterm6881> done
<peterm6881> date --utc -s "$GPSDATE"
<peterm6881> fi
<peterm6881> never heard of /dev/gps0
<Xogium> As far as using the script to set the system time; as per the INDI configuration panel, KStars can get the date/time and position info from gpsd but from what I found out, only the position is passed correctly. The time is taken from the system time which is not correct if it's not set via a real time clock and don't have access to the Internet for ntpd.
<Xogium> so this is totally pointless
<peterm6881> oh for fuck sake
<peterm6881> ok im done thinking about this
<Xogium> but I did tell you what is wrong and why 1pps isn,t detected, at least
<Xogium> the pin isn't connected to anything
<peterm6881> it wasnt clear about how to connect it, to be fair, it still is a bit mysterious
<peterm6881> we already have micropython right?
<peterm6881> in our build
<Xogium> yes
<peterm6881> surely gpstime.py can be used
<Xogium> maybe but it wouldn't be accurate and could drift hugely
<peterm6881> maybe, but its worth a try surely
<peterm6881> and better than nothing
<peterm6881> are you able to check if it runs in our build?
<Xogium> I'll have to port it but I don't see why not
<peterm6881> ok wait
<peterm6881> mayeb you can check it on the fly
<peterm6881> check if you can access the pi therought the server
peterm6881 has quit [Quit: Leaving]
peterm6881 has joined #Speedsaver
<peterm6881> back
<peterm6881> im on the server now
<Xogium> # micropython gpstime.py
<Xogium> Traceback (most recent call last): File "gpstime.py", line 6
<Xogium> SyntaxError: invalid syntax
<Xogium> well that settles it
<peterm6881> lol
<peterm6881> wait, is that that stupid print sysntax between different python versions
<peterm6881> syntax
<Xogium> maybe ? Is it python 2 or python 3 ?
<peterm6881> i dont think thats anything to do with micropython
<peterm6881> i honestly dont know but i thikn the github is like 2013
<peterm6881> so its old old old
<peterm6881> whats on line 6
<peterm6881> the problem is with the word print
<Xogium> er
<Xogium> probably. Must be python 2
<Xogium> I'll try and fix it
<Speedsaver> Title: The key differences between Python 2.7.x and Python 3.x with examples (at sebastianraschka.com)
<peterm6881> needs brackets of some kind
<Xogium> ah nop needed to be changed to ("")
<Xogium> in print
<Xogium> but we're not much better off
<Xogium> ImportError: no module named 'gps'
<peterm6881> thersa fix forthat, i got the script working in Lubuntu
<Xogium> I guess buildroot doesn't install python-gps module
<peterm6881> theres a
<peterm6881> sounds about right
<peterm6881> so far so good though
<peterm6881> the speedsaver connected here now has a fix
<Xogium> well yes and no, we don't have the gps module and there is no option to install that in buildroot lol
<peterm6881> check you can access it through ttyUSB0
<Xogium> I'm on it already
<peterm6881> what fun
<peterm6881> let me just quickly check the current date on it
<peterm6881> you must be connected
<Xogium> yes I am
<Xogium> Fri Oct 29 09:43:53 UTC 2021
<peterm6881> i have to go out for a bit
peterm6881 has quit [Ping timeout: 240 seconds]
Speedsaver` has joined #Speedsaver
Speedsaver has quit [Ping timeout: 240 seconds]
peterm6881 has joined #Speedsaver
peterm6881 has quit [Read error: Connection reset by peer]