![]() |
Forum Index : Microcontroller and PC projects : GPS clock
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
Talbit Senior Member ![]() Joined: 07/06/2011 Location: AustraliaPosts: 210 |
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. Trevor Talbit |
||||
cwilt Senior Member ![]() Joined: 20/03/2012 Location: United StatesPosts: 147 |
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 StatesPosts: 147 |
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: AustraliaPosts: 935 |
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 StatesPosts: 147 |
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: AustraliaPosts: 935 |
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: AustraliaPosts: 239 |
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: AustraliaPosts: 935 |
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: AustraliaPosts: 3270 |
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: ThailandPosts: 2209 |
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: ThailandPosts: 2209 |
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: AustraliaPosts: 210 |
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 Talbit |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
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. Microblocks. Build with logic. |
||||
cwilt Senior Member ![]() Joined: 20/03/2012 Location: United StatesPosts: 147 |
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: AustraliaPosts: 210 |
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 Talbit |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
![]() 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: AustraliaPosts: 210 |
Sorry, you are are too fast. Did you see my edited version? Talbit. Talbit |
||||
Talbit Senior Member ![]() Joined: 07/06/2011 Location: AustraliaPosts: 210 |
TZadvantage wrote: 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: ThailandPosts: 2209 |
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: AustraliaPosts: 239 |
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 |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |