Hello everyone from Russia! I am new to this forum and am very glad that there is such a project as INDI. Thanks to him, we almost finished the construction of a robotic observatory. THANKS to INDI developers!
Now about the problem. It is necessary to make control of a self-made rolling roof through the indi_rolloff_dome driver (for example). Use Arduino as a controller with a relay that is connected via USB to the INDI server. I can’t find the driver documentation anywhere, or the protocol, or the examples.
Please help with an example of Arduino firmware for working with drivers:
- indi_rolloff_dome OR Talon6
So for INDI rolloff driver to work you need your Arduino to provide the following:
1. Open roof command.
2. Close roof command.
3. Open roof sensor (roof is fully opened).
4. Close roof sensor (roof is fully closed).
Yes, I made a roof drive using a gearbox and a stepper motor. Now the roof is controlled by a remote control.
I wrote a program on Arduino + Ethernet W5100 + 2 relays. This program creates a web server where there are two buttons, they control the relays, which in turn close the contacts of the roof drive and the roof closes / opens. I want to make it controlled via INDI (for example, I saw in INDI the possibility of NOT closing the roof while the telescope is NOT parked).
The following commands are implemented:
1. Opening the roof
2. Closing the roof
3. Contact position sensor "ROOF CLOSED"
4. Contact position sensor "ROOF OPEN"
I don’t understand how INDI drivers (for example indi_rolloff_dome OR Talon6) send commands to the microcontroller (Arduino). For example on TTL port? Any text commands? For example, if I knew that the indi_rolloff_dome driver sends the OPEN command via the TTL port, I could easily accept it on Arduino and close the necessary relay.
Help understand what commands send drivers to the microcontroller?
I can offer: github.com/wotalota/indi-rolloffino.git as an example from which you can develop your own.
It is a INDI rolloff roof driver and includes two different implementations of Arduino programs communicating over
USB. It presently only works using USB, I have not looked into what it would take especially on the Arduino side to
support Ethernet. The driver is packaged as a third party driver except for the install directions being from the
perspective that it is not already included. I mean to ask Jasem if it can be included as an option.
See readme.txt for a brief overview of the protocol and INSTALL for build directions.
After the build you should be able to see the rolloffino as an option under Dome when you edit the EKos profile.
The driver works with the Observatory module and weather drivers as you would expect. I am presently using it with
the Vantage, WeatherMeta and WeatherProxy for a rain detector.
If you study the included rolloff.ino programs I think it will be straight forward to include the I/O interface into your own.
rolloff.ino.boutons written by forum member Christophe, maintains state and controls relays to stop roof movement
when end of travel is detected. rolloff.ino.ar1450 which I use relies on the stop built into an external motor controller.
Both will signal the fully opened/closed condition back to the driver.
Thank you so much, everything worked out! I figured out how to write drivers and how INDI interacts with Arduino thanks to you! I wrote my own firmware for Arduino, because the algorithm of the roof is slightly different for me. Now, one of these days I will install the telescope parking sensors, limit switches for the roof position and I will install all of this. The main thing is that now everyone is working. Thank! When I finish, I'll post the photos and show the result.
Congratulations on getting it all figured out and working. When you update to KStars 3.4.3 and INDI 1.8.6 there will be an error from the roof driver. The roof driver build procedure will need to be repeated. I just made the correction today, it was using a routine which is no longer available to check for a weather alert before opening the roof. The watchdog driver now provides improved handling to protect the observatory against bad weather.
If you wish, I can add your Arduino sketch and any notes about the motor control you provide as another example in the git repository.
Just to make sure you are using a recent version. At the time of this entry the example was for the Arduino Due with its SerialUSB call. Now there is also rolloff.ino.standard, could be an closer match for the Mega without the Due specific selections? Quick link to the overview doc: filedn.com/lbwlawm4qYUuekxBMA2mvSS/indi/rolloffino.html
The meld editor is a nice way to see the differences.
Thanks so much, Tom! Yup, I am using the most recent version from Github. I appreciate the link to the overview doc, missed the HTML doc in the repo!
My plans are to implement this code then add a few things on the Arduino side and modify the INDI driver accordingly
- Rain detector that will force a safe mode to park the scope/roof immediately
- Voltage detection for two power buses, one for telescope and one for observatory where under-voltage on either bus puts the observatory in safe mode (since eventually, my obs will be solar)
- Hall Effect switches on the mount to confirm park - not closed, no roof movement allowed
I can open a pull request for this when it's done to merge if you wish thx!
Only just made the connection, I've been following your high speed micro build, even the grass fills in quick.
- Rain detection and closing of the roof can be obtained using the builtin INDI Dome class that the rolloffino driver inherits without any changes to the driver.. Choose a weather driver, the Watchdog timer and alert the weather driver that it is raining. I'm using the WeatherSafetyProxy driver which supports an external local script or a URL interface for notification depending on what you want to do. I did a weather station as a learning project so tied the RG11 into that and updated the weather driver using a URL. I can provide code examples along the path from RG11 to the weather driver.
- Hall effect switches. I just rely on the interlocks provided by INDI between the mount and the roof. I have a simple clasp to lock the roof down which also closes a switch. That switch feeds the driver's Locked state that prevent roof movement commands from being effective. User Christopher's Arduino example (buttons) tied the builtin Lock command/response into the mounts parked condition to restrict movement commands. Some functions might be able to be decided and contained locally meaning in the Arduino.
My preference is to keep the roof driver functionality constrained to just opening and closing the roof. Thinking about what responsibility belongs in the individual roof drivers and what in the Ekos Observatory. Mine is a backyard obs so I have not thought much about the needs of a remote installation. But if the Ekos Observatory does not cater to those needs perhaps drawing up a set of requirements would be helpful. There was a discussion of possible extensions that suggested some independence from or communicating with Ekos. It has to be robust and reliably available. Also if and how it might relate to the scheduler. It could include power management, external monitoring of KStars operational status. Perhaps able to operate the mount and the roof using some minimal secondary shutdown/startup using indiserver drivers in case of KStar crashes. Some kind of resolution script for if the mount will not park and it is blocking the roof with rain forecast. In the meantime, some time back in the forum there was an interesting Python script working with the mount, cameras and so on I could look for. I find myself in the obs quite a bit, why didn't the computer reboot properly and so on. Having to drive 50 miles would get tired.
Thanks, Tom not sure how high speed my build is since I'm actually disappointed with how slow it's going Just need to weld the pier to the plate and at least I can get the scope back in operation while I work on the observatory electronics!
I guess my theory was I wanted some way to counter a situation where INDI failed by including separate rain and low power close options in the driver with park detection so the roof won't close unless the scope is parked. Then again I guess if the mount isn't parked it's all futile.... food for thought.
Anyways looking forward to getting the whole think hooked up over the next couple of weeks!