Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:59 12 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : GPS clock

     Page 4 of 5    
Author Message
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 05:50pm 01 Jul 2013
Copy link to clipboard 
Print this post

cwilt,
Nothing I am aware of. I think everything is now referenced to GPS. So a calibration facility would use caesium oscillators and compare them to GPS and vice versa.
TrevorEdited by Talbit 2013-07-03
Talbit
 
cwilt
Senior Member

Joined: 20/03/2012
Location: United States
Posts: 147
Posted: 03:08pm 05 Jul 2013
Copy link to clipboard 
Print this post

I was looking at using a wifly which has its own RTC and connects to an NTP server at boot up to set its time. Time is not a problem as I can extract that and set time on on my CMM. The problem is the date as the only reference to a date is via the unix epoch counter but that exceeds the precise number limit of mmbasic.
 
cwilt
Senior Member

Joined: 20/03/2012
Location: United States
Posts: 147
Posted: 01:00pm 06 Jul 2013
Copy link to clipboard 
Print this post

I am running latest beta on a UBW32 and when I try to use setpin above 28 as an interrupt I get "Error: Invalid configuration"

Is it a bug or a limitation?
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 02:35pm 06 Jul 2013
Copy link to clipboard 
Print this post

I am looking to buy a GPS module for a clock. It will be used indoors and I am concerned about the ability to see the satellites when used indoors. I have a Panasonic camera (TZ30 aka in North America as ZS20) with a GPS and it won't see the satellites until I am out in the open. The only module I have found (so far) with an external antenna capability is the EM-408. It is expensive (US$60 - 85) compared with many other units available.

Will I need an external antenna for reliable operation indoors or can I get away with a cheaper unit using the unit's built in antenna? Are there other, cheaper units with an external antenna socket?

My house is a brick veneer construction with a corrugated iron roof and aluminium foil insulation in the walls and the roof. The roof and its foil insulation is probably accidentally grounded. The foil insulation in the walls is unlikely to be grounded.

The external antenna of interest is this one.
 
cwilt
Senior Member

Joined: 20/03/2012
Location: United States
Posts: 147
Posted: 03:37pm 06 Jul 2013
Copy link to clipboard 
Print this post

Bob,

I think you will need an external antenna since you seem to live in a faraday cage. Going by you description.
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 08:29pm 06 Jul 2013
Copy link to clipboard 
Print this post

  cwilt said   Bob,

I think you will need an external antenna since you seem to live in a faraday cage. Going by you description.


I never quite thought of it like that but I knew it wouldn't be easy.

Back to the other question, does anyone know any GPS modules that are able to accept an external antenna?
 
vk4tec

Senior Member

Joined: 24/03/2012
Location: Australia
Posts: 239
Posted: 10:09pm 06 Jul 2013
Copy link to clipboard 
Print this post

Why dont you get a GARMIN GPS18

The antenna and GPS are built into one

- Andrew -
Andrew Rich VK4TEC
www.tech-software.net
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 10:13pm 06 Jul 2013
Copy link to clipboard 
Print this post

  vk4tec said   Why dont you get a GARMIN GPS18

The antenna and GPS are built into one

- Andrew -

Yeah, so have most of the GPS units available. My concern is will the unit work inside the house with only the in-built antenna.

What is your experience Andrew? Does it work inside?
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3270
Posted: 11:02pm 06 Jul 2013
Copy link to clipboard 
Print this post

  cwilt said   I am running latest beta on a UBW32 and when I try to use setpin above 28 as an interrupt I get "Error: Invalid configuration"

Is it a bug or a limitation?

It is a limitation, I put it in because I figured that checking all 40 I/O pins would add an unnecessary delay to the execution of every command.

Do you have a real need for more interrupts?

Geoff
Geoff Graham - http://geoffg.net
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 11:32pm 06 Jul 2013
Copy link to clipboard 
Print this post

  cwilt said   TZ,

I am surprised that you would say micro controllers have a solid time base.

It is actually so solid that you can even generate a VGA signal with it.

The inaccuracy comes from the very tiny error accumulating over long periods.
A VGA signal has to be very accurate, but only for the short time of one frame. Inaccuracy will therefore not accumulate.
For a digital clock, you can synchronize on startup and about once a week then it stays accurate within a fraction of a second.

A GPS is just a microcontroller with an antenna and some smart software of which part is transferred to hardware for more speed and precision. Once it is time to communicate that data out of the GPS unit, it is just a UART taking its time to send the result.
Even at 19200 baud rate it takes in computer terms ages before the message arrives and is available for further manipulation. Each basic statement adds another 100us or so.
How accurate can it be and how accurate must it be.
If you want real accuracy you have to measure how long each parts takes and compensate for it by adding an amount to the time before it is displayed.
Make sure all those IF then ELSE branches are time measured and add the right amount of compensation.
And then you have the question, how do you know it is accurate?
Because the timestamp in the message is actually a time in the future!

This is of course the reason for a PPS. You can then do all the stuff you need to parse the message and then wait for the PPS.

The PPS is generated by the microcontroller in the GPS unit, the difference is that it stays accurate because it is constantly updated with the GPS signals. It still has an inaccuracy but it does not accumulate, very critical difference.
Normally the GPS unit will send a message over its serial port and then asserts the PPS to accurately timestamp that message.

So the best way to use a GPS for an accurate time is to parse the message, store the time that was in that message and wait for the PPS.
If you use an interrupt you need to add between 500-2000 microseconds to compensate for the processing.


Microblocks. Build with logic.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 11:38pm 06 Jul 2013
Copy link to clipboard 
Print this post

  cwilt said   I was looking at using a wifly which has its own RTC and connects to an NTP server at boot up to set its time. Time is not a problem as I can extract that and set time on on my CMM. The problem is the date as the only reference to a date is via the unix epoch counter but that exceeds the precise number limit of mmbasic.

You can use string manipulation if numbers are getting to big and work on it part by part.
Can you give an example of what data you have?
A string or a byte array or something else?



Microblocks. Build with logic.
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 01:18am 07 Jul 2013
Copy link to clipboard 
Print this post

  Quote  This is of course the reason for a PPS. You can then do all the stuff you need to parse the message and then wait for the PPS.


TZadvantage,
I wish it were that easy! If you just extract the time and date and display it on the PPS, it will be 1 second behind. The PPS comes AFTER the NMEA string. I don't know of any GPS unit that does it the other way around. So you have to parse first then update the time by one second then wait for the PPS. See my posts on the adding one second.
Talbit

Edited by Talbit 2013-07-08
Talbit
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 02:42am 07 Jul 2013
Copy link to clipboard 
Print this post

Talbit,

The sequence i used, some time ago i might add was to parse the incoming message to extract the time, then wait for the PPS to mark that time exactly.
I did not have to add a second to the time i received.
Can it be that parsing the message is too slow so that you actually are one message behind compared to the PPS?
Datasheets are unfortunately not very clear about it. What i remember is that the message was sent over the serial port a few ms before the PPS.
If you have an oscilloscope or a logic analyzer you can really make sure what is send and when the PPS is active.

[edit]
After some surfing and looking at datasheets i am nothing wiser.
I do see reports about sirf modules pulsing the PPS about 100ms before the message appears on the serial port.
You would need another clock source known to be good to establish what is right as none of the datasheets actually tell when the PPS occurs. Strange to leave a detail like that out of a datasheet. Or maybe the ones i have seen on internet are shorter versions.







Edited by TZAdvantage 2013-07-08
Microblocks. Build with logic.
 
cwilt
Senior Member

Joined: 20/03/2012
Location: United States
Posts: 147
Posted: 05:06am 07 Jul 2013
Copy link to clipboard 
Print this post

  Geoffg said  
It is a limitation, I put it in because I figured that checking all 40 I/O pins would add an unnecessary delay to the execution of every command.

Do you have a real need for more interrupts?

Geoff


Nope. Don't need them all. I was working on my wifi module and needed an interrupt for when connection was made and first connected to pin 32 which it did not like. Went down a few pins and everything is moving along nicely.
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 03:07pm 07 Jul 2013
Copy link to clipboard 
Print this post

TZ,
The PPS comes first, marking the time. Then the NMEA string comes with the time string relating to the PPS just gone. So if you grab that NMEA string, parse it then display the result as quickly as you can then you will be around 1/2 second late.

But there's usually plenty of time between the NMEA string and the next PPS to do the parsing and update the time by a second. I'm using Garmins, Trimbles and the EM-406A and they all do the same thing. For my reference I use the industry standard Truetime clocks which are as about as good as you can get. We use them here at work.
You can also see the problem if you display the NMEA string using TeraTerm or the old Hyperterminal on your PC. But you do need a clock you know is spot on to see the issue.

I've found the Garmin GPS16XHVS manual but I can't copy the section on the PPS. But here's me copying it by hand...

"Regardless of the selected baud rate, the information transmitted by the GPS sensor is referenced to the pulse immediately preceding the NMEA 0183 RMC sentence."

Or maybe you can download the manual yourself.
Try here...
http://www.symres.com/files/GPS16xHVS.pdf
and go to page 18

So this says the PPS comes first.

Regards
Talbit

Edited by Talbit 2013-07-09
Talbit
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 03:28pm 07 Jul 2013
Copy link to clipboard 
Print this post

Before or after that is the question.....

To get this straight i write down a sample, i'll just uses the seconds

I get a message, extract the time, sec = 10
I wait for the PPS to 'mark' exactly the moment of second 10.

You are saying.
You get a message, extract the time , sec = 10
You add one second, sec = 11
You wait for the PPS to 'mark' exactly the moment of second 11

For me it was not really critical, because i use the NMEA message that are send to a server to track vehicles.
I only used the PPS in the tracker to synchronize its internal clock. And i followed the datasheet of that thing to the letter, that was at least 5 years ago.
Since then i sourced it out and i did not ask for an accuracy depended on the PPS.

A GPS clock is a nice thing to make, so it renews my interest, only to find out that things might have changed or i did wrong all along and that time was always a second off.

Microblocks. Build with logic.
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 03:50pm 07 Jul 2013
Copy link to clipboard 
Print this post

Sorry, you are are too fast. Did you see my edited version?
Talbit.
Talbit
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 04:05pm 07 Jul 2013
Copy link to clipboard 
Print this post

TZadvantage wrote:
  Quote  I get a message, extract the time, sec = 10
I wait for the PPS to 'mark' exactly the moment of second 10.

You are saying.
You get a message, extract the time , sec = 10
You add one second, sec = 11
You wait for the PPS to 'mark' exactly the moment of second 11


TZ,
That's exactly what I do.
By my reconning, you will be exactly 1 second behind UTC.
My time is displayed very close to the PPS. It's delayed only by the time it takes to write to the LED or LCD display. You can't see it. But my alarms I generate are within uSeconds which is what I'm aiming at.
Talbit
Talbit
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 04:33pm 07 Jul 2013
Copy link to clipboard 
Print this post

It is a pity all those missed seconds don't accumulate.
I would have had so much more time.

At least it is clear now.
Thanks!


Microblocks. Build with logic.
 
vk4tec

Senior Member

Joined: 24/03/2012
Location: Australia
Posts: 239
Posted: 10:57pm 07 Jul 2013
Copy link to clipboard 
Print this post

To truelly understand the GPS clock you need to understand

1. Is the PPS directly on UTC seconds
2. When does the NMEA come out in relation to the PPS
3. How long does the NMEA take to send
4. How long does it take to process the NMEA
5. How long does it take to display the time.
6. What can you reference your system to check ?

One of the advantages of grabbing the second before and then increment it by one and wait for the next PPS is you effectively get rid of any processing lag.

- Andrew -
Andrew Rich VK4TEC
www.tech-software.net
 
     Page 4 of 5    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025