Telescope Control with ASCOM platform and Wolfram Language

I have a telescope that I have built out of surplus components. Some of you may remember this image of M27, the famous Dumbbell Nebula, acquired my home-brew 90mm astrograph and inexpensive equatorial mount:

from my blog post on using Lucy-Richardson deconvolution to correct tracking errors in astronomical images:

Fixing Bad Astrophotography Using Mathematica 8 and Advanced Image Deconvolution

I recently upgraded to a new Losmandy G11 mount with a Gemini II controller and here I will explain how to control it with Mathematica.

==============
Initialization
==============
Although I’ve used a Losmandy mount for this example, many other computerized telescope mounts can also be controlled using the ASCOM interface.

First, make sure you have the latest version of the ASCOM platform installed on your system. You can obtain it for free from here: www.ascom-standards.org Also make sure you have the correct drivers specific to your mount installed. Links to many popular telescope mounts can be found on the ASCOM site. Finally, this following code presumes your mount is properly set up and polar aligned.

.NET/Link installation

Needs["NETLink`"];
InstallNET["Force32Bit" -> True];

Load ASCOM Assemblies

loadASCOMNETAssembly["All"] := 
 Map[LoadNETAssembly, 
  Map["ASCOM." <> # &, {"Astrometry", "Attributes", "DriverAccess", 
    "Exceptions", "Helper", "Helper2", "IConform", "Interfaces", 
    "Utilities"}]]

loadASCOMNETAssembly["All"];

Load the ASCOM.DriverAccess.Telescope type so we can call the Choose static method

LoadNETType["ASCOM.DriverAccess.Telescope"];

======================
Working with Telescope
======================

Choose telescope dialog

telescopeDriver = Telescope`Choose[""];

myTelescope = NETNew["ASCOM.DriverAccess.Telescope", telescopeDriver];

Telescope set up dialog (optional)

myTelescope@SetupDialog[];

Connect to scope

myTelescope@Connected = True;

Unpark scope

myTelescope@Unpark[];

Start tracking

myTelescope@Tracking = True;

Utility function for object location

SlewToObject[telescope_, object_String] :=
 Module[{ra, dec},
  Speak["Looking up coordinates for " <> object];
  ra = AstronomicalData[object, {"RightAscension", DateList[]}, 
    TimeZone -> $TimeZone];
  dec = AstronomicalData[object, {"Declination", DateList[]}, 
    TimeZone -> $TimeZone];
  Speak["Slewing to " <> object];
  telescope@SlewToCoordinates[ra, dec];
  ]

Slew to some objects

SlewToObject[myTelescope, "Mizar"]

SlewToObject[myTelescope, "Arcturus"]

SlewToObject[myTelescope, "M81"]

SlewToObject[myTelescope, "M82"]

SlewToObject[myTelescope, "Alkaid"]

SlewToObject[myTelescope, "M42"]

Park scope

myTelescope@Park[];

Disconnect from scope

myTelescope@Connected = False;
12 Likes

news-congrads-kkluyshnik-02-04-19.jpg – you have earned Featured Contributor Badge 2015-11-02_10-07-11.png
Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!