This is my first foray into the world of GPS, made possible by the GPS XBee kit.
With Wise Clock 4 offering support for XBee, this little GPS module from seeedstudio seemed like a nice fit. The purpose is, of course, to synchronize the clock with the accurate time received from satellites.
Note: Some time ago I tried the WWVB atomic clock radio receiver module CMMR-6. It comes with a 60mm ferrite rod, pretty inadequate for receiving the Colorado radio signal in Toronto, more than 2200km away. On top of the fact that it is finicky (never worked for me), it is also bulky (the ferrite rod) and fragile (the thin antenna wire).
First, I inserted the module into the XBee adapter from adafruit, which is connected (through the FTDI cable) to a terminal session (9600, 8, N, 1).
Messages started flowing in, right off the bat: wow!
Next, I moved the GPS module onto the Wise Clock 4 and uploaded a sketch that uses TinyGPS library (modified by Justin).
Here is the serial monitor output.
For those who require maximum accuracy on top of the one provided by the DS3231 RTC chip itself, this GPS solution should do it.
Homework
Make the "Doomsday clock", like the one by Wyolum team shown in the video below, with Wise Clock 4 and 2 displays.
Digital Voltage Regulator Control Using PMBus
5 hours ago
Fun homework problem! I will be looking forward to the result.
ReplyDeleteJ
While I'm not trying to make a doomsday clock I am trying to make a start clock for road rallies. I have a wise clock 4 board with atmega 1284p, gpsbee, and a pair of 32x16 LED Boards from Sure. I can not get any out put from the GPS when installed on the board. From the tinyGPS library static_test works fine. I try the GPS_time I get gps_time:38: error: 'set_1Hz_ref' was not declared in this scope. I've been chasing the problem for a while now and hope you and shed some light on my problem or provide me the minor changes that you made to the tinyGPS library.
ReplyDeleteThanks
Dave
Dave,
DeleteFrom what I see by looking at the gps_time sketch (coming with TinyGPS library), it requires an 1Hz interrupt on pin 2. For Wise Clock 4, this is achieved with the (red) jumper, as shown in the 3rd image of this post. (You will also need to solder R17 pullup, 10K, SMD)
Please let me know how it goes.
I've added the jumper and the SMD 10k resistor, code compiles fine but I'm not getting any output from the GPS. I've tried changing the pins from 3,4 to 2,3 and 11,12 with no change in the results. The serial monitor only returns:
ReplyDeleteCHARS=0 SENTENCES=0 CSUM ERR=0
I've tested the gpsbee with a an adaptor and it works fine.
Forgot to add that I'm testing with the tinygps12 library and the simple test example in my last post.
ReplyDeleteWhen I compile and run GPS_Time.pde I get the following:
Testing TinyGPS library v. 9
by Mikal Hart
Sizeof(gpsobject) = 103
50!=52=52 Coarse Sync
52!=54=54 Coarse Sync
54!=56=56 Coarse Sync
56!=58=58 Coarse Sync
58!=0=60 Coarse Sync
0!=60=60 Coarse Sync
60!=2=2 Coarse Sync
2!=4=4 Coarse Sync
Not sure why there is no GPS output.
Any thoughts.
Thanks
Dave
OOP's I forgot to un-comment the code. Works fine now.
ReplyDeleteBut I find that the time is 2 seconds apart. I've searched the code and changed and eliminated code but still the it only runs the output every 2 seconds.I need 1 second intervals. Any thoughts.
Dave
Dave,
DeleteUse this sketch to test that the interrupt occurs every second:
#include "Arduino.h"
#include "Wire.h"
#include "DS3231.h"
int rtc[7];
void rtc_interrupt()
{
Serial.println("inside ISR");
}
void setup()
{
Serial.begin(9600);
pinMode(2, INPUT);
detachInterrupt(2);
delay(400);
attachInterrupt(2, rtc_interrupt, FALLING);
RTC.enableSQW();
Serial.println("RTC square wave enabled");
}
void loop()
{
RTC.get(rtc,true);
for(int i=0; i<7; i++)
{
Serial.print(rtc[i]);
Serial.print(" ");
}
Serial.println();
}