pytrack sample code
-
can somebody post sample code to get the LAT and LONG from the pytrack module and post to TTN ?
-
@abhishek2101 Hi, you can find LoRaWAN example here with OTAA (and ABP) which includes sending data. You can get the coordinates from the Pytrack example. If you merge these 2 examples, it would solve your question. Let me know if you have any other questions!
-
@dan
I am able to use above code and print the data, but out of all the data where can I find LAT, LONG and timestamp ? -
@abhishek2101 Line 37, it prints coordinates (LAT, LONG)
coordand the timertc.now() -
@dan
below is the output i am getting(None, None) - (1970, 1, 1, 0, 2, 13, 827831, None) - 2547456
-
@abhishek2101 for the time, you either have to set it yourself, or sync it with a NTP server (via WiFi or cellular). Are you inside a building? It might take a while (or even fail) to get a location, so I'd recommend trying it outside or near windows
-
@dan
i am outside on a terrace. -
@abhishek2101 it might take some time to find a GPS satellite? If the issue persists, let me know and we'll look into it in detail.
-
hi @abhishek2101, it seems you have a GPS problem. I would recommend:
- leave the pytrack for 30 mins outside, to pick-up the satellites data, as this is a cold-start, could take a while
- check, with a mobile app, how many satellites are visible on your exact position, it could be a glitch
-
@dan
can you let me know what are below lines doing in the codel76 = L76GNSS(py, timeout=180) chrono = Timer.Chrono() chrono.start() while (True): coord = l76.coordinates() print(coord) -
- Set up GPS module
- Start measuring timespan (docs) (but I'm not sure why it's there... It was probably left there by mistake, I'll look into that)
- Always get coordinates
-
@dan
timeout=180
does this mean that chip will spend 180 sec before locking onto satellites ? -
Set the
timeoutto a time period (in seconds) for the GPS to search for a lock. If a lock is not found by the time thetimeouthas expired, thecoordinatesmethod will return(None, None). -
@dan
mine is set for 180 seconds, that should be enough time to lock onto satellites, right ?if this time is less, what do you think is the ideal time ?
does this mean that every update happens after 180 seconds, or it the first one only ?
-
@abhishek2101 It's just the timeout for locking onto a satellite, so if after 180 seconds it doesn't find one, it returns
None. In the example, we have30.It's just for the initialisation. After that, if you have it in a
while(True)loop for example, it'll update around every second. -
@dan
Mine always return none even after initialising for 300 seconds.Can you help please ?
-
@abhishek2101 have you tried what @catalin recommended?
@catalin said in pytrack sample code:
hi @abhishek2101, it seems you have a GPS problem. I would recommend:
- leave the pytrack for 30 mins outside, to pick-up the satellites data, as this is a cold-start, could take a while
- check, with a mobile app, how many satellites are visible on your exact position, it could be a glitch
-
@dan
I will try and report back.But taking 30 min to lock onto satellites is simply not acceptable. It makes pytrack unusable.
-
@abhishek2101 could you check the GPS coverage at your location? I have tested it here at the office and got the coordinates within a few seconds. I don't think it's a software or hardware issue.
-
@dan
Google maps on my iPhone shows my location at the same place within few seconds.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login