WORK IN PROGRESS (2023/12/16)
How to send commands to your Celestron mount using Visual Studio Code and ASCOM in Python
I like to program and since quite some time I have the additional hobby of astro photography. There are quite a lot of very sophisticated programs to do that but my intention is not to develop another tool. I'd like to understand how it works and want to program a simple guiding tool on my own. The goal is to understand how it works. If you want to learn ASCOM, ASCOM-ALPACA and Python this may be helpful for you. If you want to do astro photography then try other cool programs like N.I.N.A, Firecapture or other ones. But now let's start:
There is really a lot of information in the internet, you may find a lot of valuable forums and all are helpful. But when I tried to implement it on my own I faced a lot of questionmarks in my mind because it simply didn't work as explained. What driver do I have to use, is it deprecated, what libraries, how to communicate with my mount, wifi or USB, ... so, plenty of questions to solve and maybe that guidance here may help you.
My equipment is a Celestron Mount AVX, a Celestron WiFi Adapter and Visual Studio Code using Python extension.
ASCOM and ASCOM-ALPACA
If you want to communicate with your mount I found out that ASCOM is the best solution to use. ASCOM is somewhat a standard for communication from computer to different astronomy equipments like mounts, domes, filter wheels, etc. We will focus on telescope / mounts. ASCOM itself has from my perspective two main options: Option A is using the COM interfaces from your computer and Option B is using the http protocol named ASCOM-ALPACA. We will try and explain both. If you need the source code I will upload it in my Github Repository (try it here) . Lets start with the overall goal of Option A (using ASCOM without ALPACA):
Option A - ASCOM via COM interface
Next step is to find and install necessary drivers to do so. I assume you already have installed Visual Studio and Python extension and that you are a little bit familiar with python. And don't forget to use virtual environments like (venv). To start we will begin without a real mount - we will use the ASCOM simulators instead. This is much more easy because you don't need to have your mount up and running. If our VSC program can sends commands to the ASCOM simulators then we will focus on prolonging the signals to the real mount.
Step 1: Install ASCOM Platform from GitHub (latest version is 6.6.2). With that you'll get - besides the needed driver - some additional cool stuff which we will use later: "ASCOM Device Hub" and the "Telecope Simulator .NET".
That's all we need to start - communication will be done via the installed drivers.
Step 2: Now download the file myTelescope_V1_0_COM.py from my GitHub Repository and open it in your VSC.
Step 3: Run the downloaded file my_Telescope_V1_0_COM.py in your VSC. You should see a small program window like this:
Step 5: press connect and the ASCOM Telescope Chooser will open. Within that you'll find a list with all installed drivers. Choose "Telescope Simulator for .NET (ASCOM.Simulator.Telescope)" and press OK. Then automatically the Telescope Simulator will be started: