×
INDI Library v1.8.5 Released (19 Apr 2020)

April 2020 release of INDI Library v1.8.5 introduces new drivers while providing fixes and improvements to existing devices and core framework.

Need help operating an arduino uno and kstars

3 months 3 weeks ago
wotalota
Expert Boarder
Expert Boarder
Posts: 140
More
Need help operating an arduino uno and kstars #49338
I have an indi driver that communicates to a arduino client. I wrote the serial communication between the two using an ASCII protocol. Since then I see there are libraries that would have probably saved a bunch of code. But it is generally working. It is a modification of the rolloff roof simulator driver and works with the observatory control so it can close the roof during bad weather. The functions are as you describe open, close abort. I can post the code of both sides somewhere for you to copy which will give you an example of one approach.

If you have not already done so, I would suggest you at least browse the material under the develop menu at the top of the web page.

Regards
Tom

Mach1, TS86SDQ, ASI071, ASI174, OAG, focusPro

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

3 months 3 weeks ago
constant1462
Expert Boarder
Expert Boarder
Posts: 84
More
Topic Author
Need help operating an arduino uno and kstars #49343
Hello Tom
then I'd be interested in an example or the code you've developed.
And see if there's anything I can do to adapt it to mine.

Hello, Wolfgang.
My problem is I don't know how to write a driver and I'm not sure how to do it.
I've tried to understand, but since I use translators (since my English is not very good).
And I'm not even sure that even without that I'll understand how to do it.

best regards
Christophe

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

3 months 3 weeks ago
wotalota
Expert Boarder
Expert Boarder
Posts: 140
More
Need help operating an arduino uno and kstars #49346
See if the following folder and file is accessible to you.

my.pcloud.com/publink/show?code=kZaL7skZ...2bLwxV56lCGRESSCCYz7
rolloffino.tar.gz

It contains the Arduino sketch, the rest is the INDI driver and what is needed to build it as a 3rd Party driver and make it accessible in Ekos. There are a couple of notes to myself in there since I forget everything after a week or two. A first step might be to learn how to build INDI and a 3rd party driver. If you are using the nightly builds this can be reduced to a few directions and scripts. I have not tried to locate the sources for a particular stable release but expect that is possible.

Mach1, TS86SDQ, ASI071, ASI174, OAG, focusPro
Attachments:

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

3 months 3 weeks ago
constant1462
Expert Boarder
Expert Boarder
Posts: 84
More
Topic Author
Need help operating an arduino uno and kstars #49357
hello
Thanks for the files!
But could you explain a little bit about your files.
Because I don't understand them all, alas.

Because the ready file on the arduino program is much shorter than the rolloffino files and what is the difference between the two files?
rolloffino?

As you can see, I'm a beginner.

Thanks again for your help

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

3 months 3 weeks ago
wotalota
Expert Boarder
Expert Boarder
Posts: 140
More
Need help operating an arduino uno and kstars #49364
Lets look at the files.

drwxrwxr-x. 3 tg tg 4096 Feb 10 15:58 .
drwxrwxr-x. 5 tg tg 4096 Nov 7 11:47 ..
-rwxrwxr-x. 1 tg tg 1363 Nov 7 11:51 build.sh
-rw-rw-r--. 1 tg tg 1184 Aug 16 2018 CMakeLists.txt
-rw-rw-r--. 1 tg tg 297 Aug 16 2018 config.h.cmake
drwxrwxr-x. 4 tg tg 4096 Aug 3 2018 .idea
-rw-rw-r--. 1 tg tg 313 Apr 27 2019 indi_rolloffino.xml.cmake
-rw-rw-r--. 1 tg tg 6224 Aug 10 2019 readme.txt
-rw-rw-r--. 1 tg tg 6621 Aug 10 2019 rolloff.ino
-rw-rw-r--. 1 tg tg 30830 Nov 9 16:30 rolloffino.cpp
-rw-rw-r--. 1 tg tg 2753 Jul 11 2019 rolloffino.h

First you can delete the .idea directory and all the files.
They shoul not have been included, they are from an IDE that
was used.

Just consider the source files:

rolloff.ino is the Arduino sketch, the equivalent of the
program you posted. Instead of reading the state of a button
is reads input from a USB connection which tells it when to
open or close a relay.

The usb cable connects to the computer running the INDI programs.

The rolloffino.cpp and rolloffino.h are the source files for a
variation of the INDI rolloff roof driver. This driver is to
be compiled and linked into the INDI environment alongside the
standard drivers.

Perhaps we could discuss he basic questions, needed changes and
how to build off line, I sent you a message with my email.

Tom

Mach1, TS86SDQ, ASI071, ASI174, OAG, focusPro

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

3 months 3 weeks ago
wotalota
Expert Boarder
Expert Boarder
Posts: 140
More
Need help operating an arduino uno and kstars #49365
I wonder if it would be practical to have something for roll off roofs similar to the Weather Meta driver. A built in driver that could send/receive a set of generic commands to a controller so that one did not need to be able to program and maintain a driver in the INDI environment in order to automate a roof.

Mach1, TS86SDQ, ASI071, ASI174, OAG, focusPro

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

3 months 3 weeks ago
constant1462
Expert Boarder
Expert Boarder
Posts: 84
More
Topic Author
Need help operating an arduino uno and kstars #49405
hello Wolfgang
Do you have an example of the simplest possible code (C language) that works with the Kstars interface.
I don't need the dome to have the goto function, since I only have the roof.
So that I can understand it and see what it does when I modify it.

because so far I've only found super complicated code.

Thanks
Christophe

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

3 months 3 weeks ago 3 months 3 weeks ago by sterne-jaeger.
sterne-jaeger
Platinum Boarder
Platinum Boarder
Posts: 497
Karma: 6
More
Need help operating an arduino uno and kstars #49412
Hi Christophe,
well, at the end all code is complicated - except for the own code :-)

Lets give it a try. If you really want to integrate your roof into Kstars, you need to write your own INDI driver. It might look very complicated at the beginning. So a good point for starting to program INDI drivers, take the examples distributed with the INDI sources. There is a good tutorial available.

If you are familiar with building INDI from its sources and first basics of INDI drivers, you could continue playing around with the DomeSimulator. This simulator has more or less all functionality on board except for the connection to a real dome via USB or similar.

On the other side, you need to add functionality to your Arduino driver so that it can be controlled via the Serial device. Here is a snippet from my weather station that shows how this works in principle:
<code>
void setup() {
Serial.begin(9600);
// wait for serial port to connect. Needed for native USB
while (!Serial) continue;
}

...

void loop() {


while (Serial.available() > 0) {
switch (Serial.read()) {
case 'v':
sendCurrentVersion();
break;
case 'w':
sendSensorData();
break;
}
}

delay(50);
}
</code>

This simple code recognises two single character commands: 'v' and 'w'. If a 'v' is received, the current version is printed, if 'w' is received, the sensor data is printed to the Serial interface.

So in your case, as a first step, it would be sufficient if the commands like 'o' for opening the roof and 'c' for closing the roof are recognised. As a first step, simply use the Serial Monitor of the Arduino IDE to test your driver.

OK, ok, I know, that was quite lengthy. Maybe you start first with the Serial communication of your Arduino. As soon as it is working, just come back and we will do the next step.

- Wolfgang

TSA-120 + FSQ-85 + GSO 150/750 | Avalon Linear + M-zero | Moravian G2-8300 + ASI 1600mm pro + ASI 294mc pro | KStars/INDI on Raspberry Pi 4 with Raspbian 10

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

3 months 3 weeks ago
constant1462
Expert Boarder
Expert Boarder
Posts: 84
More
Topic Author
Need help operating an arduino uno and kstars #49417
hello Wolfgang
Then I think you trust me too much.
I just figured out the code for my arduino in C.

what I manage to do, and I have no merit, is to make the relays work with firmdata from Kstars...

But I'm willing to learn ..............
Christophe

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

3 months 3 weeks ago
sterne-jaeger
Platinum Boarder
Platinum Boarder
Posts: 497
Karma: 6
More
Need help operating an arduino uno and kstars #49422
Aaah, never surrender. Coding is just about bringing characters into the right sequence :-)

Give it a try with the serial interface, that's by far the easiest part.

- Wolfgang

TSA-120 + FSQ-85 + GSO 150/750 | Avalon Linear + M-zero | Moravian G2-8300 + ASI 1600mm pro + ASI 294mc pro | KStars/INDI on Raspberry Pi 4 with Raspbian 10

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

3 months 3 weeks ago
constant1462
Expert Boarder
Expert Boarder
Posts: 84
More
Topic Author
Need help operating an arduino uno and kstars #49437
've been trying this copying the tutorial, just to see.
Doesn't it work?
Can you explain to me why he won't
#include "indibase/defaultdevice.h"

Well, I'm sure I did, but I'll give you the code. I'm sure you know it.
#include "indibase/defaultdevice.h"
 
class SimpleDevice : public INDI::DefaultDevice
{
public:
    SimpleDevice();
 
protected:
    bool Connect();
    bool Disconnect();
    const char *getDefaultName();
 
};
#include
 
#include "simpledevice.h"
 
std::unique_ptr simpleDevice(new SimpleDevice());
/**************************************************************************************
** Return properties of device.
***************************************************************************************/
void ISGetProperties (const char *dev)
{
 simpleDevice->ISGetProperties(dev);
}
 
/**************************************************************************************
** Process new switch from client
***************************************************************************************/
void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
{
 simpleDevice->ISNewSwitch(dev, name, states, names, n);
}
 
/**************************************************************************************
** Process new text from client
***************************************************************************************/
void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
{
 simpleDevice->ISNewText(dev, name, texts, names, n);
}
 
/**************************************************************************************
** Process new number from client
***************************************************************************************/
void ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
{
 simpleDevice->ISNewNumber(dev, name, values, names, n);
}
 
/**************************************************************************************
** Process new blob from client
***************************************************************************************/
void ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
{
    simpleDevice->ISNewBLOB(dev, name, sizes, blobsizes, blobs, formats, names, n);
}
 
/**************************************************************************************
** Process snooped property from another driver
***************************************************************************************/
void ISSnoopDevice (XMLEle *root)
{
  INDI_UNUSED(root);
}
**************************************************************************************
** Client is asking us to establish connection to the device
***************************************************************************************/
bool SimpleDevice::Connect()
{
    IDMessage(getDeviceName(), "Simple device connected successfully!");
    return true;
}
 
/**************************************************************************************
** Client is asking us to terminate connection to the device
***************************************************************************************/
bool SimpleDevice::Disconnect()
{
    IDMessage(getDeviceName(), "Simple device disconnected successfully!");
    return true;
}
/**************************************************************************************
** INDI is asking us for our default device name
***************************************************************************************/
const char * SimpleDevice::getDefaultName()
{
    return "Simple Device";
}

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

3 months 3 weeks ago
sterne-jaeger
Platinum Boarder
Platinum Boarder
Posts: 497
Karma: 6
More
Need help operating an arduino uno and kstars #49440
The right way to include defaultdevice.h is:
#include "defaultdevice.h"

TSA-120 + FSQ-85 + GSO 150/750 | Avalon Linear + M-zero | Moravian G2-8300 + ASI 1600mm pro + ASI 294mc pro | KStars/INDI on Raspberry Pi 4 with Raspbian 10

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

Time to create page: 0.585 seconds