740 GPS - k3ng/k3ng_rotator_controller GitHub Wiki

Operation

GPS units with a standard NMEA serial output can be used with rotator controller. The GPS unit interfaces to the Serial2 port by default. The rotator controller parses the GPS output and derives time and location information. After power up, it may take 10 seconds to 5 minutes for GPS synchronization to occur. Most GPS units will obtain a satellite fix in less than thirty seconds if they have recent almanac information stored, which is usually considered less than four hours old. If almanac information is not available, the GPS goes into a “cold start” state where it has to obtain almanac information from a satellite before it can acquire and calculate accurate time and position information.

Configuration

To enable the GPS feature, uncomment the following line:

#define FEATURE_GPS

Set the serial port baud rate here:

#define GPS_PORT_BAUD_RATE 9600

If you want the clock to synchronize with the GPS unit, set this to 1(this is 1 by default):

#define SYNC_TIME_WITH_GPS 1

Location synchronization is enabled here (this is enabled by default):

#define SYNC_COORDINATES_WITH_GPS 1

Several settings adjust the behavior of GPS synchronization. This setting determines how long the clock will remain synchronized from a valid GPS fix:

#define GPS_SYNC_PERIOD_SECONDS 10

This setting determines how old a satellite fix from a GPS will be accepted as valid:

#define GPS_VALID_FIX_AGE_MS 10000

If you wish to have an LED or output pin to indicate GPS synchronicity, define this pin:

#define gps_sync 0

This setting compensates for processing and serial port propagation delay:

#define GPS_UPDATE_LATENCY_COMPENSATION_MS 200

#Debugging

Use the \d command to see the status of the GPS. In the example below, the clock status is "GPS_SYNC", the latitude is 40.8806 degrees, and the longitude is -75.5865.

debug: 	1.9.2014021501-UNSTABLE		2014-02-16 01:38:06Z	GPS_SYNC	40.8806 -75.5865		GS-232B
AZ: IDLE	Q: - AZ: 240.0 (raw: 240.0) (raw: 0.0)  Analog: 140 (4-1009) [180+450]  AZ Speed Norm: 253 Current: 253	Offset: 0.00
EL: IDLE	Q: - EL: 24.0 EL Analog: 141 (2-1018)   EL Speed Norm: 253 Current: 253	Offset: 0.00
moon: AZ: 103.90 EL: 21.27	TRACKING_INACTIVE 	sun: AZ: 284.64 EL: -34.65	TRACKING_INACTIVE

The clock states are:

FREE_RUNNING - No synchronization with RTC or GPS

RTC_SYNC - Using the realtime clock for time

GPS_SYNC - Synchronized to GPS

If GPS_SYNC is shown and SYNC_COORDINATES_WITH_GPS is set to 1 in rotator_settings.h, the coordinates will update automatically from GPS.

GPS Mirror Port

If you wish to use the GPS data with another application, such as having a computer read the NMEA data and update its clock, you can configure the rotator controller to mirror all data coming into the GPS port out another Arduino/AVR serial port. To enable this, uncomment this line and set the appropriate serial port:

#define GPS_MIRROR_PORT &Serial3 

And set the baud rate for the port:

#define GPS_MIRROR_PORT_BAUD_RATE 9600