Hello crew, i want to pull data from stellarium software to my arduino serial monitor , anyone have related solutions.
Thanks in advance.
Hello crew, i want to pull data from stellarium software to my arduino serial monitor , anyone have related solutions.
Thanks in advance.
Hello,
do you have a complete system description?
At this stage I'm using arduino mega , i just want to print targeted object Alt&AZ data in arduino serial monitor form Stellarium.
Hello
Do you have a Stellarium interface specification ?
Yeah i gone through LX200 protocol sheet, i tried few codes with mega to print RA& DEC data, I'm looking for simple codes & flow for printing alt az data.
Then provide information on how you get the data from your software! Does the software have the ability to output the information through a serial connection?
I'm using this code , this one included with many extra lines , but i'm trying to get the data from stellarium software specific data only.
/
#include <AFMotor.h>
#include <stdlib.h>
AF_Stepper motor_AR (48, 1);
AF_Stepper motor_DEC (48, 2);
char data [30]; // Data read by serial port
// Telescope and target coordinates
char RA_telescope [9];
char DEC_telescope [10];
char RA_target [9];
char DEC_target [10];
long DEC_dd, DEC_mm, DEC_ss;
long RA_hh, RA_mm, RA_ss;
long RA_tel, DEC_tel, RA_obj, DEC_obj;
// We initialize the data
void setup () {
Serial.begin (9600); // Serial port at 9600 bps
motor_AR.setSpeed (100); // We create the AR and DEC engines
motor_DEC.setSpeed (100);
// This must be modified, the initial coordinates must be given
RA_obj = RA_tel = (long (42) * long (60)) + long (42);
DEC_obj = DEC_tel = long (41) * long (3600) + long (16) * long (60);
}
void loop () {
if (Serial.available ()> 0) {
read_series_data ();
}
compare_coordinates ();
}
void increase_ra () {
RA_tel ++;
if (RA_tel> = long (86400)) {
RA_tel = RA_tel-long (86400);
}
motor_AR.step (1, FORWARD, DOUBLE);
}
void decrementar_ra () {
RA_tel--;
if (RA_tel <long (0)) {
RA_tel = long (86400) + RA_tel;
}
motor_AR.step (1, BACKWARD, DOUBLE);
}
void increase_dec () {
DEC_tel ++;
if (DEC_tel> long (324000)) {
DEC_tel = long (324000);
}
motor_DEC.step (1, FORWARD, DOUBLE);
}
void decrementar_dec () {
DEC_tel--;
if (DEC_tel <long (-324000)) {
DEC_tel = long (-324000);
}
motor_DEC.step (1, BACKWARD, DOUBLE);
}
void compare_coordinates () {
if (RA_tel <RA_obj) {
increase_ra ();
}
if (RA_tel> RA_obj) {
decrementar_ra ();
}
if (DEC_tel <DEC_obj) {
increase_dec ();
}
if (DEC_tel> DEC_obj) {
decrement_dec ();
}
}
// Collect the data on the serial port
void read_series_data () {
int i = 0;
data [i ++] = Serial.read ();
delay (5);
while ((data [i ++] = Serial.read ())! = '#') {// I read to the end of the command, which is a # symbol
delay (5); // I wait 5ms in case the following data is not available yet
}
data [i] = '\ 0'; // I complete the chain with the end of chain symbol, C stuff
parsear_data (); // I call the function that interprets the received data
}
// Interpret the data that has been received on the serial port
void parsear_datos () {
// #: GR # -> Get RA position from the telescope
if (data [1] == ':' && data [2] == 'G' && data [3] == 'R' && data [4] == '#') {
RA_hh = RA_tel / long (3600);
RA_mm = (RA_tel- (RA_hh * long (3600))) / long (60);
RA_ss = RA_tel- (RA_hh * long (3600)) - (RA_mm * long (60));
sprintf (RA_telescope, "% 02d:% 02d:% 02d", int (RA_hh), int (RA_mm), int (RA_ss));
Serial.print (RA_telescope);
Serial.print ("#");
}
// #: GD # -> Get DEC position of the telescope
if (data [1] == ':' && data [2] == 'G' && data [3] == 'D' && data [4] == '#') {
DEC_dd = DEC_tel / long (3600); // 148560 -> 41 16
DEC_mm = (DEC_tel- (DEC_dd * long (3600))) / long (60);
DEC_ss = DEC_tel- (DEC_dd * long (3600)) - (DEC_mm * long (60));
sprintf (DEC_telescope, "% + 03d:% 02d:% 02d", int (DEC_dd), int (DEC_mm), int (DEC_ss));
Serial.print (DEC_telescope);
Serial.print ("#");
}
// #: Q # -> Stop the telescope
if (data [1] == ':' && data [2] == 'Q' && data [3] == '#') {
} // <<< ---- This must be left well
//: Sr HH: MM: SS # -> RA direction of the target
if (data [0] == ':' && data [1] == 'S' && data [2] == 'r') {
for (int i = 0; i <8; i ++)
RA_target [i] = data [i + 4];
Serial.print ("1");
RA_obj = long (atoi (data + 4)) * long (3600) + long (atoi (data + 7)) * long (60) + long (atoi (data + 10));
}
//: Sd sDD * MM: SS # -> DEC address of the target
if (data [0] == ':' && data [1] == 'S' && data [2] == 'd') {
for (int i = 0; i <9; i ++)
DEC_target [i] = data [i + 4];
Serial.print ("1");
DEC_obj = long (atoi (data + 4)) * long (3600) + long (atoi (data + 8)) * long (60) + long (atoi (data + 11));
}
//: MS # -> Start slew
if (data [0] == ':' && data [1] == 'M' && data [2] == 'S' && data [3] == '#') {
Serial.print ("0"); // <<< ---- This must be left well
}
}
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.