TELESCOPE INTERFACE NOTES 10JUN05/22JAN06

GENERAL NOTES

GPS INTERFACING

Before connecting the GPS handset to the PIC unit, check its manual for the output connections. Only those for the output signal and 0V are required. Via a suitable socket pair and cable connect the GPS to the PIC PCB at the designated pins.

Set the GPS handset to output GPS data according to NMEA 0183 protocol at 9600 Baud (although other Baud options can be set - see later).

Once the GPS has aquired signals from the "local" satellites, data is output from it comprising many sentences prefixed by a variety of codes and containing many sets of data. Only one sentence is needed by the Telescope Interface, that commencing $GPRMC. All sentences are input by the PIC but it only accepts the data in that commencing $GPRMC. An example of this sentence is:

$GPRMC,182923,A,5122.921,N,00007.027,E,000.0,360.0,290603,003.1,W*62

The fields that are required are time (which is in UTC - Universal Time Coordinate - the same as GMT, Greenwich Meridian Time), date, latitude plus N/S, longitude plus W/E.

The Meade telescope protocol requires time to be sent to it as Local Time referenced to the location at which the telescope is mounted. This necessitates UTC to be converted to Local, along with the date if that is different between the time zones.

Simultaneously, Daylight Saving Time (DST) must be taken into account and used in the conversion. Failure to do so could cause the telescope to be mis-directed by an hour, resulting in a 15^ viewing displacement.

In addition to the UTC conversion, global positioning data (latitude and longitude) must be converted to the format needed by the telescope. 

Following the conversion, data is ready to be output to the telescope. This can be sent when required by pushing a switch on the unit. It is output at 9600 Baud (or as set - see later) as in the following formatted sentences:

:SL HH:MM:SS#   hours, minutes, seconds (local time)
:SC MM:DD:YY#   month, day, year
:St +DD*MM#     sign (+/- = N/S), degrees, minutes
:Sg DDD*MM#     degrees (out of 360), minutes
:SG sHH#        sign (+/-), hours for UTC Offset.

The UTC Offset is the difference between UTC and the local time zone.

UTC Offset and DST are not supplied by the GPS handset, but are previously supplied to the PIC from the PC.

PC SCREEN

Note that most options on the PC screen are only available when the PIC unit is connected to the PC.

When first run, this program's screen will show the settings last used by the author. After they have been changed as described below, the new settings will be loaded each time the program is then loaded and run.

COM1 & COM2 BUTTONS

Click the COM1 or COM2 button to select the PC serial port through which you wish to communicate with the PIC unit. The PIC unit cannot be used with a USB port. The selected setting is saved to PC disk when the Save Settings or Send To PIC buttons are pressed.

SET BAUD RATE

Any one of four Baud rates may be used with this system (provided the GPS unit can also handle the selected rate):

2400  Baud
4800  Baud
9600  Baud
19200 Baud

The default when the program is run for the first time is 9600, To select the PC's Baud rate, click on the Baud rate combo box on the screen and click on the required rate. Then click Save Settings in order to store it for future use.

To select the PIC's Baud rate, first switch off the PIC. Then press switch S4 and hold it pressed. Switch on the power to PIC. The screen will show the message Set Baud and the current Baud rate. The latter changes its value approximately every one second. It continues to cycle through the four possible rates until S4 is released. When the Baud rate you want is seen, release S4. The Baud rate is then stored for future recall.

To select the GPS unit's Baud rate, consult its manual.

The Baud rates may be changed by the same method whenever desired.

Note that all three units, GPS, PIC and PC, must be set for the same Baud rate. A failure of communications will occur if they are not.

CUSTOMISED CODES PANEL

It is into the Customised Codes panel that you enter the latitude, longitude and UTC offset values for your locality. Latitude and longitude can be derived from a map of your area, or a GPS receiver screen.

Latitude is prefixed by N or S, depending on whether you are in the northern or southern hemisphere. It is followed by a space, then the degrees as two digits (prefixed by 0 if less than ten), then a decimal point, followed by the minutes (fractions of a degree), also as two digits.

Longitude is prefixed by W or E, depending on whether you are west or east of Greenwich UK (the Meridian). It is followed by a space, then the degrees as three digits (prefixed by 00 if less than ten, or 0 if otherwise less than 100), then a decimal point, followed by the minutes (fractions of a degree), also as two digits.

UTC Offset gives the basic the number of hours difference between your time zone and Greenwich UK (the Meridian). It does not include any correction for daylight saving time (DST). The value is preceded by plus or minus (+ -) symbols depending whether you are west (-) or east (+) of Greenwich, thus the USA requires a minus (-) sign, and Australia needs a plus (+) sign.

DAYLIGHT SAVING TIME

Information for Daylight Saving Time is normally taken direct from the PC, which automatically updates its settings twice a year when DST is started or ended. When DST is on (1) one hour is added to the basic local time. When DST is off (0), basic time applies. This corresponds to the UK's BST and GMT conditions, respectively.

You do not need to take any action in respect of DST, the PC program itself obtaining the information from the PC system. (Thanks to Joe Farr for providing the author with the VB6 code for doing this.)

MANUALLY SET DST

For those who wish to set DST manually, i.e. those who have not installed the RTC and do not wish to interface to a PC, the procedure is similar to setting the Baud rate.

To select the PIC's DST value, first switch off the PIC. Then press switch S3 and hold it pressed. Switch on the power to PIC. The screen will show the message Set DST and the current DST value. The latter changes its value approximately every one second. It continues to cycle through the values 0 and 1 until S3 is released. When the DST value you want is seen, release S3. The DST value is then stored for future recall.

SEND TO PIC BUTTON

The data in the Custom panel is sent to the PIC using the allocated button. This action also sends the current time and date as known to the PC. It is important that PC's clock is correct before the data is sent. The basic data is stored to the PIC's non-volatile memory, with the time and date data being set into the unit's realtime clock chip (RTC). This chip retains the data even after the main power has been switched off, providing the 3V lithium battery (B2) has also been installed.

The action also stores the Lat/Long, Offset, Baud and COM port data to the PC's disk as file TelescopeSettings.txt, held within the same folder as the main code.

To send the data to the PIC, switch off its power, then switch S2 (GPS/PC) to PC, and switch on again. In this condition, the LCD screen shows data held within the PICs non-volatile memory, with the clock being updated from the PIC's realtime clock chip (RTC) - assuming that its battery is installed, see below.

When this data is seen, switch on S3 (Get PC Data) to display the message Waiting PC Data, plus the currently selected Baud rate. Now click the Send to PIC button. The PIC handshakes with the PC in response to receiving this data, and the PC confirms it in its List panel.

PIC confirms data receipt with the message Data Recd OK, plus the Baud rate. Switch off S3 when this message appears. The clock will then be seen to be updating with the current real time, and the date display will show the current calendar data. The Latitude and Longitude values will be those you have selected via the PC screen.

It should be noted that the first time the PIC unit is ever switched on, or if the 3V backup battery (2) is not installed, the RTC will at first be inactive, and the time will appear unchanging as 00:00.00L, with the date as 01:01:00. In this case, Latitude and Longitude will be seen as the values last set by the author. The Send To PIC option must be used to start the RTC running.

SAVE SETTINGS BUTTON

Clicking this button stores the Lat/Long, Offset, Baud and COM port data to the PC's disk as file TelescopeSettings.txt, as with the Send To PIC button, but without sending it to the PIC.

START INPUT BUTTON

The Start Input button allows data processed by the PIC, for normally sending to the telescope, to be input to the PC for display in the left-hand panel.

To set the PIC unit for outputting data to its RS232 connector (SK1), first switch off the unit, switch S2 (GPS/PC) to the PC setting and then switch on the unit again. Plug the selected PC COM port (see above) into the PIC's socket SK1. Now click the Start Input button. The button then disappears and a Stop button appears.

When switch S4 (Data output) is pressed, data is now sent from the PIC to the PC in the code format required by the telescope. It is received by the PC as a non-synchronous stream of data. After each block of 64 bytes is received the sentence is parsed into its various sub-sections. Using the prefix codes of these sections, they are allocated to the respective display lines in the left-hand panel.

You may also examine each data block and its sub-sections by clicking the List On/Off box so that a tick appears. Data is then also output to the main List area as text. Clicking the List On/Off box again turns the Listing facility off. It is an alternating cycle.

To stop data input, click the Stop button.

When the PIC is in this mode, the data may also be input by the PC through its Hyperterminal function (Baud rate as selected, 8 data bits, 1 stop bit, no parity).

Be aware that as data aquisition is asynchronous, the clock seconds value may sometimes miss a second, jumping, say, from 1 to 3. This is unimportant to the data sent to the telescope.

TELESCOPE CODES PANEL

The Time, Date and UTC Offset data output from the PIC to the Telescope Codes panel (as well as to the telescope) is corrected to Local Time. The time and date are both corrected for local Daylight Saving Time (DST).

Time is shown in order of hours (24hr clock), minutes, seconds. Date is shown in order of month, day of month, year.

Latitude is shown prefixed by plus or minus symbols (+ -). A plus symbol indicates that the latitude is in the northern hemispere, with minus for the southern hemisphere.

Longitude is expressed relative to 360 degrees. Thus if the latitude is West (of Greenwich UK), the value can be 0 to 180 degrees. For example, if the latitude is 85 degrees 15 minutes west, it will will be shown as :St 085*15. If the latitude is 12 degrees 00 minutes East (of Greenwich UK), it will be shown as :Sg 348*00#.

GPS input data for latitude and longitude are accompanied by the symbols N or S for latitude, and W or E for longitude. The PIC code uses these to structure the output codes correctly.

The UTC offset is that required by the telescope for use in relation to its calculation of UCT. It gives the number of hours difference between your time zone and the Greenwich meridian, as stated earlier. Offset is also corrected to take into account DST, i.e. if DST is in operation, the offset shown in the left hand-hand panel will have a value that is one greater than the offset value set into the right-hand panel.

SEND TEST BUTTON

Clicking the Send Test button loads a pre-recorded data file to the program, which then outputs various GPS sentence codes to the PIC for processing as though it were real GPS data coming in from a handset. This allows the unit to be tested without a GPS handset connected.

The file was recorded in June 2003 and shows data applying at that time. It includes all the possible GPS code sentences which are likely to be received by GPS receivers. It is the $GPRMC sentence which includes the data used by this telescope interface.

To use this option, the unit must be connected to the selected PC COM port. Then, before clicking the button, switch S2 (GPS/PC) to the GPS setting and then switch on the unit. When the LCD screen shows the Waiting For Signal message, switch S2 back to the PC setting. Now click the Send Test button. The unit will receive the data from the PC, but process it as if it were from a GPS unit, displaying the information on the LCD.

Having output the data block to the PIC, it starts from the beginning again, so only two different times are ever shown. Click the Stop button to end the output.

The purpose of this option is to test the PIC, not for sending code to the telescope.

SEND GPRMC BUTTON

This is similar to the Send Test Button, but the GPS sentence sent is just $GPRMC data with your current local time converted to UTC. Because the data sending is not fully synchronised, a CHECKSUM error may occasionally be reported by the PIC. Correct receipt should resume automatically.

During this mode, the list box is hidden and instead the GPS sentence details plus UTC and PC time are displayed.

The purpose of this option is to test the PIC, not for sending code to the telescope.

In addition to outputting the GPRMC sentence, the current Sidereal time is also shown on the PC screen. It is purely for interest. The data can be viewed without the PC connected to the PIC unit.

SELF-CONTAINED UNIT

This unit may be used to send data to the telescope without a GPS unit connected, provided the required Settings and time/date data has been sent to the PIC. 

To set the PIC unit for outputting to the telescope via its RS232 connector (SK1), first switch off the unit, switch S2 (GPS/PC) to the PC setting and then switch on the unit again. Plug the telescope into the PIC's SK1. The PC does not need to be connected for this mode.

When switch S4 (Data output) is pressed, data is now sent from the PIC to the telescope in the code format required. Check that the telescope confirms that it has received the data.

GPS ONLY UNIT

The unit may be used without the RTC and PC interfacing, relying on GPS handset data input only. All data then comes from the GPS handset, except for DST and UTC Offset which must be set manually.

MANUALLY SET UTC OFFSET

To set the UTC Offset manually, switch off the PIC. Press S3 and S4 together and hold them pressed, then switch on the power.

The screen will show the message OFFSET and the offset value, initially as +00. The latter changes its value approximately every one second. It continues to cycle through the values +00 to +12, and then -00 to -12 until S4 is released. When the Offset value you want is seen, release S4. Then release S3. The Offset value is then stored for future recall.

*********

MODE SUMMARY

SET PIC BAUD RATE

Switch off PIC
Press S4 and hold it pressed
Switch on power to PIC
Release S4 when required Baud shown

SET RTC DATA

Switch off PIC
Switch S2 (GPS/PC) to PC
Switch on power to PIC
Press S3 (Get PC Data) and release
Click PC's Send to PIC button

SET DST MANUALLY

Switch off PIC
Press S3 and hold it pressed
Switch on power to PIC
Release S3 when required DST shown

SET UTC OFFSET MANUALLY
Switch off PIC
Press S3 and S4 together and hold them pressed
Switch on power to PIC
Release S4 when required Offset shown
Release S3

SEND TEST DATA TO PIC

Switch off PIC
Switch S2 (GPS/PC) to GPS
Switch on power to PIC
Switch S2 (GPS/PC) to PC
Click PC's Send Test button

SEND GPRMC DATA TO PIC

Switch off PIC
Switch S2 (GPS/PC) to GPS
Switch on power to PIC
Switch S2 (GPS/PC) to PC
Click PC's Send GPRMC button

OUTPUT TO TELESCOPE OR PC (GPS use)

Switch off PIC
Switch S2 (GPS/PC) to GPS
Switch on power to PIC
Press S4 (Data output) to output data
Release S4 to stop output

OUTPUT TO TELESCOPE OR PC (no GPS)

(RTC must be installed for this mode)
Switch off PIC
Switch S2 (GPS/PC) to PC
Switch on power to PIC
Press S4 (Data output) to output data
Release S4 to stop output

JOHN BECKER

john.becker@wimborne.co.uk


