element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Difficulties using NTP with a GPS + Raspberry Pi (HELP!)
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 7 replies
  • Subscribers 666 subscribers
  • Views 2239 views
  • Users 0 members are here
  • raspberry_pi
Related

Difficulties using NTP with a GPS + Raspberry Pi (HELP!)

vk3pb
vk3pb over 12 years ago

Hi all

 

I have been asking around for help on other forums with this problem but noone has come up with a solution thus far. I hope that someone out there can help.

 

I am trying to get my model B pi to work with a bu-353 GPS. I have achieved some success but I can't get ntp to automatically fetch the time on boot.

 

I followed the instructions here

 

http://blog.retep.org/2012/06/18/getting-gps-to-work-on-a-raspberry-pi/

 

but found that I needed to make a few modifications to get cgps working

 

Here's what I did

 

sudo apt-get install gpsd gpsd-clients python-gps

 

I then ran

 

sudo dpkg-reconfigure /etc/gpsd

 

to set gpsd to automatically boot. I added -n in the options but didn't put in  /dev/ttyUSB0 as the port but rather left it to automatically find the USB plug.

 

I then manually edited GPSD and added in

 

chmod a+rw /dev/ttyUSB0

 

The reason for these two tweaks is that the gps was not loading up properly and cgps -s just waited a few seconds and went back to the command line. The tweaks seem to have fixed that.

 

Now if I start my pi and then put in the comamnd line

 

cgps -s

 

I can see what the gps is seeing, location information sats etc all in text format. If I run xgps I can see a graphical version of this. This works every time although can take a coupel of seconds to get a fix.

 

So far so good.

 

Per the web page I now proceed to try and set up ntp

 

sudo apt-get install ntp

Installation is probably unnecessary as ntp is already installed.

 

Now I go to the /etc directory and sudo nano ntp.conf and add in the following lines

 

# gps ntp
server 127.127.28.0 minpoll 4
fudge  127.127.28.0 time1 0.183 refid NMEA
server 127.127.28.1 minpoll 4 prefer
fudge  127.127.28.1 refid PPS

 

and then type

 

sudo service ntp restart

 

Ntp restarts. cgps-s continues to work ok but my time does not update like it should. Although I can get a fix on satellites and can see the time in cgps it doesn;t get picked up by NTP like it should.

 

How can I get NTP to load up the time from satellites at boot properly with the above setup? I would be grateful for some help as I am a beginner at Linux and I think a lot of people out there would like to know how to set up a cheap gps like this with the Pi.

 

Thanking you

  

Peter

  • Sign in to reply
  • Cancel
Parents
  • vk3pb
    vk3pb over 12 years ago

    Thanks.

     

    My requirements are to set the time to within 1 second so I presume that I can dispense with PPS as you say.

     

    The reason for setting the clock is fro 2 different projects:

     


    1. A car security system with cameras mounted behind the number plates so that if anyone steals the number plates the Pi will detect this and start filming using the camera thus giving footage for later use by the Police. The footage would be time stamped.

     

    Similarly if the car is stolen the Pi could be remotely contacted using amateur radio and send back its coordinates using the GPS and APRS (automatic Positioning Reporting System) over radio.

     

    2. A self steering wave powered buoy for the high seas. It would be GPS enabled and send and receive transmissions via amateur radio. Certain specialist radio transmission modes require timing within 1 second (JT-65A).

     

    The software for both will be written in python which I am learning. It sounds like I can read the NEMA data using Python and somehow manually set the clcok in Python.

     

    cheers Peter

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • vk3pb
    vk3pb over 12 years ago

    Thanks.

     

    My requirements are to set the time to within 1 second so I presume that I can dispense with PPS as you say.

     

    The reason for setting the clock is fro 2 different projects:

     


    1. A car security system with cameras mounted behind the number plates so that if anyone steals the number plates the Pi will detect this and start filming using the camera thus giving footage for later use by the Police. The footage would be time stamped.

     

    Similarly if the car is stolen the Pi could be remotely contacted using amateur radio and send back its coordinates using the GPS and APRS (automatic Positioning Reporting System) over radio.

     

    2. A self steering wave powered buoy for the high seas. It would be GPS enabled and send and receive transmissions via amateur radio. Certain specialist radio transmission modes require timing within 1 second (JT-65A).

     

    The software for both will be written in python which I am learning. It sounds like I can read the NEMA data using Python and somehow manually set the clcok in Python.

     

    cheers Peter

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • mcb1
    mcb1 over 12 years ago in reply to vk3pb

    Peter

    selsinork is right about NTP not syncing too far.

    There are various settings (same as Windows t32), but the reality is it could be a long way.

     

    We use these commands to lock our boxes to the nearest server, and perhaps you can adapt it.

     

     

    sudo service ntpd stop

    sudo ntpdate 'server' (the server with the lowest st number)

    sudo service ntpd start

     

     

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • vk3pb
    vk3pb over 12 years ago in reply to mcb1

    Thanks Selsinork, Mark

     

    I have solved my ntp problem bygoing the python route instead. I found a python script which reads the time from GPSD and then writes the time to the system time.

    http://code.google.com/p/gpstime/

     

    It works well.

     

    cheers Peter

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube