Arduino + Stellarium with Meade lx200 Protocol

Hi,
i'm trying to interface stellarium and an Arduino based telescope motor through the Telescope plugin using the meade lx200 protocol as described here-->http://www.meade.com/support/LX200CommandSet.pdf.
I have successfully answered to the getRA command but the getDEC command gives me problems:
in fact in the protocol documentation it says that i have to send back the value of the Declination as

sDD*MM#

i think s is the sign(+ or -) and i give random numbers on D and M (eg.

+45*00#

. this is what i send back through Serial.
But in the log message it says:

15445, 11:34:00.890104Z: Lx200Connection::sendCommand(Lx200CommandGetRa)
15445, 11:34:00.890104Z: Lx200Connection::writeFrontCommandToBuffer(Lx200CommandGetRa): queued
15445, 11:34:00.890104Z: Lx200Connection::sendCommand(Lx200CommandGetDec)
15445, 11:34:00.890104Z: Connection::performWriting: writeNonblocking(5) returned 5; #:GR#
15445, 11:34:05.904390Z: Lx200Connection::resetCommunication
15445, 11:34:05.921391Z: Lx200Connection::sendCommand(Lx200CommandGetRa)
15445, 11:34:05.921391Z: Lx200Connection::sendCommand(Lx200CommandGetDec)
15445, 11:34:15.952965Z: Lx200Connection::writeFrontCommandToBuffer(Lx200CommandGetRa): queued
15445, 11:34:15.952965Z: Connection::performWriting: writeNonblocking(5) returned 5; #:GR#
15445, 11:34:16.018969Z: Connection::performReading: readNonblocking returned 11; 03:00:00#


15445, 11:34:16.018969Z: Lx200CommandGetRa::readAnswerFromBuffer: RA = 03:00:00
15445, 11:34:16.018969Z: Lx200Connection::writeFrontCommandToBuffer(Lx200CommandGetDec): queued
15445, 11:34:16.077972Z: Connection::performWriting: writeNonblocking(5) returned 5; #:GD#
15445, 11:34:16.138976Z: Connection::performReading: readNonblocking returned 7; +45*00#
15445, 11:34:16.138976Z: Lx200CommandGetDec::readAnswerFromBuffer: error: '+' or '-' expected
15445, 11:34:16.138976Z: Lx200Connection::resetCommunication
15445, 11:34:16.202979Z: Lx200Connection::sendCommand(Lx200CommandGetRa)
15445, 11:34:16.202979Z: Lx200Connection::sendCommand(Lx200CommandGetDec)
15445, 11:34:16.202979Z: Connection::performReading: readNonblocking returned 2;

I don't know how to solve the
errot '+' or '-' expected

Thanks in advance for any help
Francesco

The documentation says on page 10:

SdsDDMM#
Set target object declination to sDD
MM or sDD*MM:SS depending on the current precision setting
Returns:
1 - Dec Accepted
0 – Dec invalid

you need to prepend Sd for the command - did you include that?

The SdsDD*MM# is only for Stellarium to tell the telescope which are is the Declination of the target he has to look for. The Sd before sDD*MM# is only a command to tell the scope Setdeclinationto...
what i was looking to was how should be the declination written by The telescope for the Pc
anyway thanks for the help
Francesco

P.S.
i tried it anyway and it doesn't worked, as expected :0 :0

Can you post the library you're using / the code of the sketch?

Maybe that helps us to understand the problem as I don't know now how the log you posted is generated.

The log i posted is generated by the stellarium telescope plugin, i'll post the sources of the plugin only as attachment, you have to take a look at Server-->the lx200 ones.

and for my sketch code, here it is:

void setup() {
  Serial.begin(9600);
}
String stringOne = "";
void loop() {
  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.println("03:00:00#");
    }
    if (stringOne == "#:GD#"){         // if command received = get DEC do...
      Serial.print("+45*00#");
    }
    stringOne = "";
  }
}

TelescopeControlPlugin src.zip (97.8 KB)

I tried everything and i think there is only one chance more, to try connecting the telescope to arduino IDE and through the serial monitor send #:GD# and see exactly what it gets.
If somebody with that mount could try it, it would be very appreciate. XD XD

Thanks
Francesco

I solved the problem two weeks ago, but want to share what the problem was;
the problem consisted in how i send the DEC back to stellarium, in fact i used the

Serial.println()

so it received the RA and after the string it added a

\n

which stellarium after appends to the DEC string and tries to analize it instead of the "+" or "-", i solved simply by using

Serial.print()

which doesn't append anything to what i send back.

Thanks anyway for the help

Actually if you look at the length of the string you'll see the RA is sent as 11 characters, but there are only 9 printable ones, so I think it's almost certainly adding 0x0D,0x0A (CRLF) - both of which are separately echoed as blank lines in the log in fact...

Hi,

I found this project on web, works great on Arduino, but I never test with a real telescope:

ArduGoTo

Google translator cannot find that page??? What language that is?

Cheers,
Kari

langauge is spanish. he is stating the page will be used for documentation and the steps he will take to development the code for his goto mount via Arduino Uno andUSB motor Shield using stepper motors

Hi, read this

http://www.stargazing.net/kepler/altaz.html

can help you

after that and understand how this work can drive for this http://www.jgiesen.de/astro/astroJS/siderealClock/ instead calculate everything manually.

I doing the same, but now i have the problem of down't know what to do with what I received.

I'm work with a digital compass and accelerometer

Hi i want to refresh the topic.
Can anyone please explain to me what should i sent to stellrium to get the coordinates of pointed object? Step by step.
Francesco94 onyly shows the part when his scope sending some coordinates to Stellrium am I right?
Thank You for Your help