Get Stellarium RA and DEC and calculate number of step for step motors

Hi, i'm simone!

I'm working on a project that the final goal is to make a GoTo Equatorial mount...

I'm interfacing to stellarium with arduino, and i'm trying to learn how to make it works properly.

I know that the protocol thai i have to use is the LX200, but i have some problems on getting the selected coordinates (of an object/planet) from stellarium.

This is the code that i'm running on arduino:

int casualDEC;
int casualRA;
void setup() {
Serial.begin(9600);
}
String stringOne = "";
void loop() {

casualDEC = random(0, 90);
casualRA = random(0, 24);
String PROVA = (String)casualDEC;
String PROVARA = (String)casualRA;
if (Serial.available()){
while (Serial.available()>0){
char a=Serial.read(); // Stores current byte
stringOne += String(a); // Append current Byte to message String
delay(10);
}
if (stringOne == "#:GR#"){ // if command received = get RA do...
Serial.print(PROVARA + ":00:00#");
}
if (stringOne == "#:GD#"){ // if command received = get DEC do...
Serial.print("+" + PROVA +"*00#");
}
stringOne = "";
}
}

This code will interface to stellarium and get some random RA and DEC values...and it's working! (in fact i see the telescope moving random in stellarium!)

But basically i need some help to solve this problems:

1.) Retrive the DEC and RA values from selected object in stellarium and send it to arduino....what i can do that? which command i have to use?
2.) How i calculate the number of steps that i need to make to align my telescope?

...Here there are the technical data of my stepper motors:

Phases: 4

Torque: 34,3mN m

Step/turn: 2048

Thanks in advance.

Simone. :slight_smile:

LX200 is not that simple. It specifies that the mount move to a given RA and DEC coordinates, but you have to do all of the mapping to convert these values into a distance each motor has to travel given that you know the current RA/Dec that the mount is pointing at. You also (if you want it to be reliable) have to account for errors in polar alignment amongst other things.
This I fear is a very complex task for an Arduino to carry out - though you are welcome to prove me wrong :smiley:

This is the LX200 command set: http://www.meade.com/support/LX200CommandSet.pdf

From that you get:
:SdsDD*MM#
Set target object declination
:SrHH:MM:SS#
Set target object RA
:MS#
Slew to Target Object


In the code below you are clearing 'stringOne' after each time Serial.available() goes to zero. You won't necessarily have retrieved all characters by that point (they may not have all arrived yet).


You could also have a look at this:

While not related to LX200, it is a controller which interfaces with EQMOD to control stepper motors to form a Goto Telescope. EQMOD is software installed on your computer which connects to Stellarium via Ascom.

Ok, but how i will get the value of selected object on stellarium?

And so, how i calculate the numbers of steps that the motor have to execute to run into the specified position?

Thanks. :slight_smile:

Hi, your project sounds interesting!

To know how much to turn the telescope motors you need to know where the telescope thinks it is pointing and where the target is.
The position of the telescope should be available by querying the telescope using LX200 commands (and provided the telescope is initialized and aligned first ...); the coordinates of the target should come from the PC running the Stellarium software - you could read this off the PC serial port using, again, LX200 syntax.

There are many details beyond the above - but I'd start with getting your Arduino to

  1. read the coordinates you want from the PC, and
  2. asking the telescope where it is pointing.

I think driving stepper motors is simple in principle - but moving the telescope in one go from where it is to where you want it is difficult to get right. You need some encoders to monitor how the motion is going and ways of knowing how to slow down in time, do meridian flips and so on.

Good luck!

A telescope does not know where it is pointing unless it already has goto software installed, in which case it can already probably be controlled by a pc making arduino redundant