Close

Adding a RTC Module

A project log for Raspberry Pi Driven Telescope Mount

full telescope control over WiFi using INDI on a RPi Zero W

dane-gardnerDane Gardner 11/14/2018 at 01:161 Comment

I am finding that using NTP for automatically setting my hand controller's time is great, but only when I'm home on my WiFi network.  To get accurate time setting done in the field, you have two options.  Use a real-time clock (RTC) module that keeps track of time using a small internal battery for power, or use a GPS module that will pull time from satellites signals (and may even have a RTC module built in).

To start, I've settled on using a RTC module (DS3231) from AdaFruit.  The DS3231 more accurate than I probably need it to be, but given the wild changes in temperature that my poor telescope experiences throughout a trip, I figured it was worth the extra expense.  One could easily go with a less expensive module if price is a concern.

The module fits inside the hand controller without any problem, and keeps with the "sleeper" look that I like.  I really haven't been able to find a GPS unit that can fit inside the controller --if anybody knows of one small enough, let me know in the comments!

Following these directions, I wired up the RTC to my Raspberry Pi Zero W, and secured it in my hand controller.  Configuring the Pi took all of ten minutes, and after rebooting I was able to confirm that it worked.

RTC module wired in, ready for testing

In my previous build log, I wrote a script that forces a wait for NTP time to set the system clock before pushing the time to the hand controller over serial.  Now that we have an onboard clock, we no longer want to fail before setting the hand controller if the NTP update doesn't succeed.  This forces the most accurate method of time setting possible.  This can be accomplished by simply commenting out one line:

[...]
  # if we couldn't get the time in 30s, give up
#  if [ ${code} != 0 ]; then exit; fi
[...] 

Discussions

Jaime Machuca wrote 12/14/2022 at 20:17 point

Sparkfun has a small GPS and a flexible antenna https://www.sparkfun.com/products/15193https://www.sparkfun.com/products/15246
Since we would only have a need for very accurate time, and not really very accurate position, this should work.

  Are you sure? yes | no