Question Controlling Polar Alignment Programmatically?

  • Samuel
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
18 Nov 2023 14:30 - 18 Nov 2023 14:31 #1229 by Samuel
Hello,

I'd like to have a go at implementing an application for automated polar alignment with the Motorized Polar Alignment upgrade and iPolar. iPolar outputs the plate solving results to a log file, so that's easy enough to interface with.
However, is there a way to programmatically access and control the azimuth and altitude polar alignment motors? For example via the ASCOM CommandString method  or some other simple API?

Thanks and best regards,
Samuel
Last edit: 18 Nov 2023 14:31 by Samuel.

Please Log in or Create an account to join the conversation.

  • Stefano82
  • Stefano82's Avatar
  • Offline
  • Administrator
  • Administrator
  • Don't panic
More
22 Nov 2023 16:37 #1234 by Stefano82
Replied by Stefano82 on topic Controlling Polar Alignment Programmatically?
Hello

Is not possible to access the azimuth and altitude polar align motors via ASCOM since currently there are not ASCOM commands available for such a feature.

But you can write a program that read the log file and send simple commands through the COM PORT.

Stefano
Avalon Instruments Team
The following user(s) said Thank You: Samuel

Please Log in or Create an account to join the conversation.

  • Samuel
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
22 Nov 2023 18:13 - 22 Nov 2023 18:17 #1235 by Samuel
Hi Stefano, thanks for responding!
I've been experimenting a bit and by intercepting the COM port traffic I've managed to figure out that I can actually control the azimuth motor over ASCOM by sending the string ":X16547129#" via ASCOM's CommandString method. That moves my azimuth motor to position 124!
Now I just have to figure out how that string is constructed and then I should have everything I need.
Last edit: 22 Nov 2023 18:17 by Samuel.

Please Log in or Create an account to join the conversation.

  • Samuel
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
22 Nov 2023 18:24 #1236 by Samuel
Ok, I think I've figured it out.
The command for the azimuth motor seems to be ":X165{arcmin*Aux1StepsPerArcMinute}#" where Aux1StepsPerArcMinute is the corresponding value configured in the StarGo application under the AUX tab.
I'm assuming the same is the case for the altitude motor, just with a different number prefix.

Please Log in or Create an account to join the conversation.

  • Samuel
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
22 Nov 2023 20:20 - 22 Nov 2023 20:21 #1237 by Samuel
In case anybody else is interested in this, here are my findings:

Note that the positions in {} must always be 5 digits and if too short be 0 padded in front.

Set azimuth motor positive position:
:X165{arcmin*Aux1StepsPerArcMinute}#

Set azimuth motor negative position:
:X164{100000-arcmin*Aux1StepsPerArcMinute}#

Continuously increase azimuth motor position:
:X08AUX1UP#

Continuously decrease azimuth motor position:
:X09AUX1DN#

Stop azimuth motor:
:X0AAUX1ST#

Sync azimuth motor:
:X0C500001#

Set altitude motor positive position:
:X175{arcmin*Aux2StepsPerArcMinute}#

Set altitude motor negative position:
:X174{100000-arcmin*Aux2StepsPerArcMinute}#

Continuously increase altitude motor position:
:X0DAUX2UP#

Continuously decrease altitude motor position:
:X0EAUX2DN#

Stop altitude motor:
:X0FAUX2ST#

Sync altitude motor:
:X11500001#

I don't think there's a way to read out the current motor position since ASCOM's SendCommand doesn't actually seem to return anything useful.
However, by always sending a sync command before a set position command I can emulate a relative move which is all that's needed for automated polar alignment.
Last edit: 22 Nov 2023 20:21 by Samuel.
The following user(s) said Thank You: Planet30

Please Log in or Create an account to join the conversation.

  • Samuel
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
24 Nov 2023 15:33 #1238 by Samuel
I've got an initial prototype here: github.com/TheCyberBrick/Auto-Polar-Align
Both the StarGo control component and iPolar plate solving component on their own seem to work, but I couldn't test it yet under real conditions due to bad weather, so for now it just runs a simple simulation.

Please Log in or Create an account to join the conversation.