ThisIsJustARandomGuy / dobson-star-tracker

This project aims to enable makers to motorize their dobson-style mounted telescopes using easily sourced hardware
MIT License
39 stars 9 forks source link

It doesn't work in my stellarium #4

Open cernyvpdp7 opened 2 years ago

cernyvpdp7 commented 2 years ago

I managed to move the stepper motors through the commands in the Arduino IDE Serial Monitor. But there are still intermittent small movements of the steppers (tracking?) If I enter the command: TRK0 # then the steppers will stop. OK. I close the monitor and start Stellarium, fill in the parameters according to your input and connect to the telescope. A yellow cross will appear with the name I entered, select the object in the sky> the current object and click on the slew. The steppers start making the same small movements as I wrote above and nothing more, the yellow cross does not move. I dont know what to do next :(

cernyvpdp7 commented 2 years ago

I use Arduino MEGA2560. Those small steps of the steppers happen about every 10 seconds. I also rewrote all the headers from Time.h to TimeLib.h in the source code because Time.h was not found. I don't know if I did well.

cernyvpdp7 commented 2 years ago

I just found out that it works in an older version of Stellarium (I tried 0.16.1 and 0.18.2). So I don't know what has changed there. But even so, it happens that if I select an object low above the horizon, it stops somewhere halfway and can no longer be selected (it freezes).

cernyvpdp7 commented 2 years ago

I apologize for the bad information. It does not freeze on objects low above the horizon, but it applies to all objects that have a negative declination value. The conversion.cpp file has a bad notation for the sprintf function, which returns a response in the format --DD * -MM: -SS #. Stellarium does not understand the need to write there sprintf(txDEC, "%+03d%c%02d:%02d#", deg, 42, mins < 0 ? -mins : mins, secs < 0 ? -secs : secs);

tubar72 commented 2 years ago

Hi everybody,

I found fix for last Stellarium version 0.21.2

1/ Fist fix inlcude in every file where is include Time.h

from #include <Time.h> to #include <TimeLib.h>

2/ Fix in conversion.cpp getDeclination method

void getDeclination(Mount &scope) {
  ...
  // '\xDF'; // = 223, degree symbol (This is always printed as asterisk in the specs, very confusing)
  sprintf(txDEC, "%+03d%c%02d:%02d#", deg, '\xDF', mins < 0 ? -mins : mins, secs < 0 ? -secs : secs);
  ...
}

3/ Fix in conversion.cpp setRightAscension method

void setRightAscension(Mount &telescope) {
  ...
  // Pattern: SrHH:MM:SS#
  const int hrs = multi_char_to_int(receivedChars[2], receivedChars[3]);
  const int mins = multi_char_to_int(receivedChars[5], receivedChars[6]);
  const int secs = multi_char_to_int(receivedChars[8], receivedChars[9]);
  ...
}

4/ Fix in conversion.cpp setDeclination method

void setDeclination(Mount &telescope) {
  ...
  // Pattern: SdsDD*MM:SS#
  const int deg = multi_char_to_int(receivedChars[3], receivedChars[4]);
  const int mins = multi_char_to_int(receivedChars[6], receivedChars[7]);
  const int secs = multi_char_to_int(receivedChars[9], receivedChars[10]);
  ...
}

5/ Add in conversion.cpp new syncStart method

bool syncStart(Mount& scope) {
  Serial.print("0");
  DEBUG_PRINTLN("Synchronize coordinates");
  scope.setAlignment(futurePosition);
  isAligned = true;
  return true;
}

6/ Add new serial console command in conversion.cpp parseCommands method

Part starting at "} else if (receivedChars[0] == 'C' && receivedChars[1] == 'M')" That's new serial console command can by tested with :CM#

Synchronizes Telescope; Synchronizes Telescope position with the currently selected coordinates

bool parseCommands(Mount &telescope, Observer& observer) {
  ...
  } else if (receivedChars[0] == 'Q') {
    // Quit the current move
    moveQuit(telescope);
  } else if (receivedChars[0] == 'C' && receivedChars[1] == 'M') {
    // CM: Synchronizes Telescope
    // The function returning true means that isAligned was set to true.
    if (syncStart(telescope)) {
      newData = false;
      // Aligning was just performed
      return true;
    } else {
      // The telescope should not ignore movement updates once homed
      telescope.ignoreUpdates(false);
    }
  } else if (receivedChars[0] == 'M' && receivedChars[1] == 'S') {
  ...
}

7/ Aligning the telescope: How should it work?

  1. Configure Telescope in Stellarium (F2) Configuration -> Plugins -> Telescope Control [x] Load at startup configure Telescope controlled by: [x] Stellarium, directly through a serial port Name: your_telescope_name Connection delay: 0,50s Coordinate system: [x] J2000 [x] Start/connect at startup Device settings: Serial port: port of your Arduino MEGA connected to PC Device model: Meade LX200 (compatible) Start connection

  2. Manually point the telescope at a known star which you see on Stellarium too

  3. Select that star in Stellarium

  4. Open "Slew telescope to" (Ctrl+0)

  5. Click "Current object"

  6. Click "Sync" (this star is now selected as your Telescope without moving)

  7. Now point to another star and again click "Current object" but now click "Slew" and Telescope is now moving to this star.

    So, every time when You want recalibrate your Telescope, use "Current object" then "Sync".

sebaw1 commented 9 months ago

@tubar72 Your fixes are correct, but in my case I had to change in file conversion.cpp in function: void setDeclination(Mount &telescope)

const int multi = (receivedChars[3] == '+') ? 1 : -1; TO: const int multi = (receivedChars[2] == '+') ? 1 : -1;

and everything works just fine

ThisIsJustARandomGuy commented 5 months ago

@sebaw1 Thank you so much for your contribution. I have been busy but I'll try and include your fixes.