×
INDI Library v1.8.3 Released (02 Jan 2020)

Minor monthly bugfix release with a new RainbowAstro mount driver and improved pier side simulation.

What are the kstars orders for arduino

1 week 6 days ago
constant1462
Junior Boarder
Junior Boarder
Posts: 35
More
Topic Author
What are the kstars orders for arduino #49152
Hello
I've created a program to control the opening of the roof of my observatory by means of POWER, OPEN, CLOSE and STOP buttons.

Now, I would like to parallel the kstars commands to be able to do it remotely.
But I haven't found it and I don't know how to do it.

Who can help me, thank you.

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

1 week 6 days ago
knro
Administrator
Administrator
Posts: 7611
Karma: 51
What are the kstars orders for arduino #49153
You need to create an INDI Dome driver for this. Fortunately, there is a simple driver you can base your work on: github.com/indilib/indi/blob/master/drivers/dome/roll_off.cpp

So just edit the driver and put your commands in the right places.

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info

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

1 week 6 days ago 1 week 6 days ago by constant1462.
constant1462
Junior Boarder
Junior Boarder
Posts: 35
More
Topic Author
What are the kstars orders for arduino #49154
hello
so I'm putting in my code that I wrote for my observatory.
Do you think I can adapt it to the one you gave me?

But unfortunately I wrote it in French

<code>// OUVERTURE TOIT OBSERVATOIRE
// Avec fin de 2 fin de course et une position Parc
// Commande manuel Open,Close et Stop
// commande a distance

const int ledRepos = 3;
const int RelaisOuverture1 = 4;
const int RelaisOuverture2 = 5;
const int RelaisFermeture1 = 6;
const int RelaisFermeture2 = 7;
const int BoutonOpen = A0; //8
const int BoutonClose = A1;
const int BoutonStop = A2;
const int FinOuverture = 12;
const int FinFermeture = 10;
const int Telescope_Parc =2;
const int BoutonRelais =A3;
const int pinRelais =8;

int BoutonOpenState = 0;
int BoutonCloseState = 0;
int FinOuvertureState = 0;
int FinFermetureState = 0;
int Telescope_ParcState = 0;
int BoutonStopState = 0;

bool BoutonRelaisState = LOW; // *****

//les états possible
enum {Repos, Ouverture, Ouvert, Fermeture, Fermer};
int etat = Repos;

bool estAlimente = false; //*****

// le N° des connection et fonction
void setup() {
pinMode(ledRepos, OUTPUT);
pinMode(RelaisOuverture1, OUTPUT);
pinMode(RelaisOuverture2, OUTPUT);
pinMode(RelaisFermeture1, OUTPUT);
pinMode(RelaisFermeture2, OUTPUT);

pinMode(BoutonOpen, INPUT_PULLUP);
pinMode(BoutonClose, INPUT_PULLUP);
pinMode(BoutonStop, INPUT_PULLUP);
pinMode(FinOuverture, INPUT_PULLUP);
pinMode(FinFermeture, INPUT_PULLUP);
pinMode(Telescope_Parc, INPUT_PULLUP);


}// fin setup


void position_toit () { // début des statuts pour le loop
switch (etat) { // début du switch avec les possibilté
case Repos:
digitalWrite(ledRepos, HIGH);
digitalWrite(RelaisOuverture1, LOW);
digitalWrite(RelaisOuverture2, LOW);
digitalWrite(RelaisFermeture1, LOW);
digitalWrite(RelaisFermeture2, LOW);
if (BoutonOpenState == LOW && Telescope_ParcState == LOW ) {
etat = Ouverture;
delay(30);
}
else if(BoutonCloseState == LOW && FinFermetureState == HIGH ){
etat = Fermeture;
delay(30);
}
break;
case Ouverture:
digitalWrite(ledRepos, LOW);
digitalWrite(RelaisOuverture1, HIGH);
digitalWrite(RelaisOuverture2, HIGH);
digitalWrite(RelaisFermeture1, LOW);
digitalWrite(RelaisFermeture2, LOW);
if (FinOuvertureState == LOW) {
etat = Ouvert;
delay(30);
}
else if(Telescope_ParcState == HIGH || BoutonStopState == LOW) {
etat = Repos;
delay(30);
}
break;
case Ouvert:
digitalWrite(ledRepos, HIGH);
digitalWrite(RelaisOuverture1, LOW);
digitalWrite(RelaisOuverture2, LOW);
digitalWrite(RelaisFermeture1, LOW);
digitalWrite(RelaisFermeture2, LOW);
if (BoutonCloseState == LOW && Telescope_ParcState == LOW ) {
etat = Fermeture;
delay(30);
}
break;
case Fermeture:
digitalWrite(ledRepos, LOW);
digitalWrite(RelaisOuverture1, LOW);
digitalWrite(RelaisOuverture2, LOW);
digitalWrite(RelaisFermeture1, HIGH);
digitalWrite(RelaisFermeture2, HIGH);
if (FinFermetureState == LOW) {
etat = Fermer;
delay(30);
}
else if(Telescope_ParcState == HIGH || BoutonStopState == LOW) {
etat = Repos;
delay(30);

}
break;
case Fermer:
digitalWrite(ledRepos, LOW);
digitalWrite(RelaisOuverture1, LOW);
digitalWrite(RelaisOuverture2, LOW);
digitalWrite(RelaisFermeture1, LOW);
digitalWrite(RelaisFermeture2, HIGH);
etat = Repos;
break;
} //fin switch

}// fin void

void loop() {
BoutonRelaisState = digitalRead (BoutonRelais) ;
if (BoutonRelaisState == HIGH) {
estAlimente = !estAlimente; // ****
delay (30);
}
if (estAlimente) {
digitalWrite (pinRelais, HIGH);

// début du programme des fonctions
BoutonOpenState = digitalRead (BoutonOpen) ;
BoutonCloseState = digitalRead (BoutonClose) ;
FinOuvertureState = digitalRead (FinOuverture) ;
FinFermetureState = digitalRead (FinFermeture) ;
Telescope_ParcState = digitalRead (Telescope_Parc);
BoutonStopState = digitalRead (BoutonStop);
position_toit() ;

} else digitalWrite (pinRelais, LOW);

} // fin loop ou programme
</code>

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

1 week 6 days ago 1 week 6 days ago by constant1462.
constant1462
Junior Boarder
Junior Boarder
Posts: 35
More
Topic Author
What are the kstars orders for arduino #49155
What you need to know is how to find the name of the order,
like open, close, and power.

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

1 week 2 hours ago
constant1462
Junior Boarder
Junior Boarder
Posts: 35
More
Topic Author
What are the kstars orders for arduino #49478
Hello Knro
Then I have a problem with the driver you gave me.
When I put it on the arduino, it tells me it's got some code errors.

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

1 week 1 hour ago
knro
Administrator
Administrator
Posts: 7611
Karma: 51
What are the kstars orders for arduino #49479
That an INDI driver, it shouldn't be on Arduino, it's the C++ code that should be compiled on your Raspberry PI (or PC).

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info

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

1 week 54 minutes ago
PDB
Senior Boarder
Senior Boarder
Posts: 68
More
What are the kstars orders for arduino #49481
Hi,

you need to create a serial event in your arduino code. That need to process charachters coming from the rpi or linux machine.
Then you define some commands like "#OPEN", "#CLOSE" (or whatever you like)
In the the loop where you process the buttons you should tes t if a valid command has arrived and act upon.

Then you change the driver that Jasem suggested and insert your commands there in the right place. Compile and test ....

(I can dig up some arduino examples, need a bit of time though)

Hope this helps

Paul

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

6 days 20 hours ago
constant1462
Junior Boarder
Junior Boarder
Posts: 35
More
Topic Author
What are the kstars orders for arduino #49486
I don't understand anything anymore...
I have to create an indi driver that I have to put on the PC?
And how do I install a new driver on kstars, if that's what I have to do ?

And then I have to create a link between the indi driver and the program on the arduino, is that right ?

So if I understood well, I will need help, guys, anyway I need help because I don't understand the C language or the others, alas.

I just created the program in C language for my arduino, with the help of some guys who helped me a lot and explained me how to do it and corrected the code.

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

6 days 16 hours ago
PDB
Senior Boarder
Senior Boarder
Posts: 68
More
What are the kstars orders for arduino #49500
Had a look at the "dome controller" code that Jasem suggested. Need to investigate how that works first. Then I can maybe create an example.

Paul

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

6 days 13 hours ago
constant1462
Junior Boarder
Junior Boarder
Posts: 35
More
Topic Author
What are the kstars orders for arduino #49504
So we agree that Jasem's link is the driver in Kstars and we have to write the code in C for the arduino?

If that's the case, how do I get the Roll_off driver to connect to the arduino and what are the relevant commands to make my roof work?

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

6 days 1 hour ago
PDB
Senior Boarder
Senior Boarder
Posts: 68
More
What are the kstars orders for arduino #49524
Hmmm; see you have cross posted this under a different name in another section of the forum. Seems you get help there, saves me valuable time!

Yes EKOS talks to a dome via a dome-driver. The dome driver talks to the dome controller (in this case an arduino) So you need to make:
1 : A driver on your indi machine accordining to the specs of a dome driver. And in this case talks to the Arduino
2: An arduino program that controls the hardware (difgital pins) and can get commands and report status to the "driver". This is usually done via serial commands.

Paul

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

6 days 38 minutes ago
constant1462
Junior Boarder
Junior Boarder
Posts: 35
More
Topic Author
What are the kstars orders for arduino #49526
Hello
how to install an indi driver in kstars.
that's why I opened this position here.
And the other post will be how to communicate between the kstars driver and Arduino.

But the most important thing is that I didn't manage to install the indi driver that Jasem advised me to be able to modify it.
I even tried to create a driver as simple as possible according to a tutorial, but then how do you install it?

Thanks
Christophe

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

Time to create page: 0.958 seconds