×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Need help operating an arduino uno and kstars

  • Posts: 311
  • Thank you received: 42
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.
4 years 1 month ago #49346
Attachments:

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

  • Posts: 250
  • Thank you received: 3
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
4 years 1 month ago #49357

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

  • Posts: 311
  • Thank you received: 42
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
4 years 1 month ago #49364

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

  • Posts: 311
  • Thank you received: 42
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.
4 years 1 month ago #49365

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

  • Posts: 250
  • Thank you received: 3
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
4 years 1 month ago #49405

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

  • Posts: 1185
  • Thank you received: 370
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
Last edit: 4 years 1 month ago by Wolfgang Reissenberger.
4 years 1 month ago #49412

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

  • Posts: 250
  • Thank you received: 3
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
4 years 1 month ago #49417

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

  • Posts: 1185
  • Thank you received: 370
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
4 years 1 month ago #49422

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

  • Posts: 250
  • Thank you received: 3
'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";
}
4 years 1 month ago #49437

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

  • Posts: 1185
  • Thank you received: 370
The right way to include defaultdevice.h is:
#include "defaultdevice.h"
4 years 1 month ago #49440

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

  • Posts: 250
  • Thank you received: 3
I always make a mistake.
4 years 1 month ago #49443

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

  • Posts: 1185
  • Thank you received: 370
Are you working on Arduino code within the Arduino IDE? The code you posted above does not contain StandardFirmata.
4 years 1 month ago #49445

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

Time to create page: 0.706 seconds