Polar alignment by declination drift

Scripts and programs to automate Astroart
Post Reply
fabdev
Posts: 558
Joined: 03 Dec 2018, 21:43

Polar alignment by declination drift

Post by fabdev » 13 Jul 2025, 01:46

Hello, here is a script for performing the polar alignment by declination drift (Bigourdan method).
This method is the slowest but it's the most precise, so it's recommended only for fixed setups, or if North is not visible.
See for example: https://canburytech.net/DriftAlign/DriftAlign_1.html

The script allows to move the telescope by hand or by GOTO to the two testing position, which are close to the celestial equator at South and at East.

In the script there's a parameter, "waitTime" that must be set according to the precision you want to achieve, the default is 60 seconds. For extremely precise pointing it must be increased to 200-300 but then the whole procedure becomes very slow, so I recommend high values ​​only for a fixed mount.

Code: Select all

' ******* Polar alignment via Declination Drift *******
' Before using this script verify that plate solving is
' correctly set up, with a precision of 2%
' Verify also that the Observatory Coordinates and the
' PC time is correct. 
' The telescope must be tracking.
' Connect the camera and verify the focus.

lon = Observatory.Longitude
lat = Observatory.Latitude
exposure = 10.0
waitTime = 60  ' Time to wait for drift
r = InputButton("Which axis do you want to align?", "Left-Right", "Up-Down", "EXIT")
Pause(0.5)
confirm = CRLF + "Press OK when done."
if r = "Left-Right" then AlignLeftRight
if r = "Up-Down" then AlignUpDown
end

sub AlignLeftRight
  ra,de = AltazToEquat(182, 45, lon, lat)
  if not PrepareTelescope(ra,de) then
     coords = CRLF + "Approx. " + RaToString(ra) + "  " + DecToString(de)
     Message("Point manually the telescope at South, altitude approx. 45° " + coords + confirm)
  end if
  while true
    TakeExposure
    if not WidePlateSolve(ra,de) then ShowFail
    ra,de = Image.RaDec
    WaitForDrift
    TakeExposure
    if not WidePlateSolve(ra,de) then ShowFail
    ra2,de2 = Image.RaDec
    error = Round((de2-de)*3600*10)
    hint = ""
    if error < 0 then hint = "Move the mount Clockwise (telescope towards West)."
    if error > 0 then hint = "Move the mount Anticlockwise (telescope toward East)."
    msg = "The error is: " + Str(error/10) + " arcseconds. " + hint
    r = InputButton(msg, "Continue", "I'm satisfied")
    if r <> "Continue" then break
  end while
end sub

sub AlignUpDown                                 
  ra,de = AltazToEquat(90, 45, lon, lat)
  if not PrepareTelescope(ra,de) then
     coords = CRLF + "Approx. " + RaToString(ra) + "  " + DecToString(de)
     Message("Point manually the telescope at East, altitude approx. 45° " + coords + confirm)
  end if
  while true
    TakeExposure
    if not WidePlateSolve(ra,de) then ShowFail
    ra,de = Image.RaDec
    WaitForDrift
    TakeExposure
    if not WidePlateSolve(ra,de) then ShowFail
    ra2,de2 = Image.RaDec
    error = Round((de2-de)*3600*10)
    hint = ""
    if error > 0 then hint = "Move the polar axis Up (toward Zenith)."
    if error < 0 then hint = "Move the polar axis Down (toward Horizon)."
    msg = "The error is: " + Str(error/10) + " arcseconds. " + hint
    r = InputButton(msg, "Continue", "I'm satisfied")
    if r <> "Continue" then break
  end while
end sub

sub PrepareTelescope(ra,de)
  r = InputButton("Automatic(GOTO) or manual movement of the telescope?", "Automatic", "Manual", "EXIT")
  if r = "Automatic" then
     Telescope.Goto(ra, de)
     Telescope.Wait
     return true
  end if
  if r = "Manual" then
     Pause(0.5)
     return false
  end if
  Script.Stop
end sub

sub TakeExposure
  Image.Close
  Camera.Start(exposure)
  Camera.Wait
end sub

sub ShowFail
  Warning("Cannot plate solve image.")
  Script.Stop
end sub

sub WaitForDrift
  for i = waitTime to 0 step -1
    cls
    print i
    pause(1) ' Waiting for drift ....
  next i
end sub

function WidePlateSolve(ra,de)
  if Image.PlateSolve(ra, de, 6, 4.0) then return true
  if Image.PlateSolve(ra, de, 6, 15.0) then return true
  offs = 14.5
  for j = -1 to 1
   for i = -1 to 1
    if Image.PlateSolve(ra+i*offs, de+j*offs, 6, 15.0) then return true
   next i
  next j
  return false
end function

Post Reply