×

INDI Library v1.9.2 Released (14 Sep 2021)

Bimonthly Stable INDI Library release introduces new drivers and fixes for existing ones.

Control roll-off roof with indi_rolloff driver

  • Posts: 76
  • Thank you received: 1
Hey guys,

Probably I have simple software problem but I don’t get it how the indidrivers work.
I have a split roof roll-off observatory. Now I want to automize the opening and closing. It seems to be very simple because I do not need limit switches and so on. Two roller shutter drives with internal limit switches for fully open and fully closes are moving the two parts of the roof.
In other words I just press open (till it reaches the end position) and the roof is open.
In automation I use a relay for open and one for close to override the manual switch. The signals coming from a raspberry pi. A simple Python script will do the job.
Now my question, how can the indi_rolloff driver use the Python script? Or must I write a c++ routine an integrate it into the driver?
The indi server runs on that particular raspberry pi. Btw, there Node8266 connected via USB what provides weather and cloud data for the indi_weather radio driver ( thanks Wolfgang). That shout be the step for automization for emergency weather mount and dome parking.
My imaging gear is connected to another, dedicated RPi4.
Any hint or idea? I would be very thankful and appreciate it.

CS Gunter
8 months 4 weeks ago #64818
Attachments:

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

  • Posts: 202
  • Thank you received: 49
Hello Gunter,

I use the INDI "Dome Scripting Gateway" driver to open/close my observatory roof. I use a relay driven linear actuator that has internal limit switches to stop the actuator motor at both ends of its motion ends.

As I don't have access to the internal limit switches of the actuator, I also use external limit switches to indicate roof fully closed and roof fully opened status so I can issue commands to turn off the power to the actuator. All is run using Python scripts that I have modified to control the relays and inputs of a TSIR04 USB relay board from Tinysine. Other USB relay boards could also be used.

if you want, I can provide you with the Python scripts by the end of the week, as I am not close to the observatory.

Hoping this provides you with useful info, good luck.

Gilles

BTW, I like very much the way your roof opens, as I am considering modifying mine to something similar. Any water entering during heavy rain?
Last edit: 8 months 4 weeks ago by Gilles Gagnon.
8 months 4 weeks ago #64823

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

  • Posts: 76
  • Thank you received: 1
Hey Giles,

thank you for you answer. It sounds very similar to my setup. Please send the Python scripts.
I’m not sure about those additional limit switches. Why do you need them.
In my case I would trust the internal limit switches and use a time constant ( sleep 20 s) instead.
I will check the scripting tool because I never used it. Is there a chance to use weather date from the PWS close the roof? I hope you know what I mean.

CS Gunter
8 months 4 weeks ago #64827

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

  • Posts: 76
  • Thank you received: 1
Hi again,

if you'd like I can give you more details on the roof mechanism. It's pretty simple and straight forward.

Gunter
8 months 4 weeks ago #64828

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

  • Posts: 76
  • Thank you received: 1
Hi Giles,

I found the INDI "Dome Scripting Gateway" but there is a folder and files missing /usr/share/indi/scripts/connect.py. Did you created this "connect.py"?
8 months 4 weeks ago #64829

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

  • Posts: 76
  • Thank you received: 1
I tried to use the scripting tool but again, I don't know how to connect the local python script with the Dome Scripting driver.

let me explain:
this would be my script in order to switch the GPIO Pin on the RPi 4B:


import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM) # GPIO number

RELAIS_1_GPIO = 17
GPIO.setup(RELAIS_1_GPIO, GPIO.OUT) # GPIO Mode


GPIO.output(RELAIS_1_GPIO, GPIO.HIGH) # on, opens the roof

wait(20000) # wait 20s to be sure it is completely open
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The "open.py" script is like:

#!/usr/bin/python
#
# Open shutter script for INDI Dome Scripting Gateway
#
# Arguments: none
# Exit code: 0 for success, 1 for failure
#

import sys

coordinates = open('/tmp/indi-status', 'r')
str = coordinates.readline()
coordinates.close()
str = str[0] + ' 1 ' + str[4:]
coordinates = open('/tmp/indi-status', 'w')
coordinates.truncate()
coordinates.write(str)
coordinates.close()

sys.exit(0)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I can not see the interaction between both scripts? Shall I integrate "my script" into "open.py" script????

Sorry for the stupid question.

Gunter
8 months 3 weeks ago #64838
Attachments:

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

  • Posts: 202
  • Thank you received: 49
Hello Gunter

I can't answer all of your questions now as I am not home, where the scripts are, but the reason why I used external limit switches is because here in Canada the weather can go to extremes and, as the cold weather and potential snow or solidified freezing rain slows down the linear actuator and makes it work harder, I want to be certain that the roof is fully opened (or closed) before unparking the scope. My roof not being a roll-off but rather a clamshell like the weight is a factor. I'll send a picture of it later, when I get home.

I do not recall having to write the connect script but I will provide you with the info I have.
The following user(s) said Thank You: Gunter
8 months 3 weeks ago #64844

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

  • Posts: 76
  • Thank you received: 1
Hi Gilles,

sorry for my intense asking. Ofcourse I will wait till you get home. Meanwhile I continue to experiment because I have already vacations.

thanks Gunter
8 months 3 weeks ago #64857

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

  • Posts: 202
  • Thank you received: 49
Hello Gunter,

Back home and I am sending you the Python scripts I use for my roof. As mentioned earlier, I use a USB relay board made by Tinysine, the TSIR04, so the scripts are written to be used with a series of Python tools available on github as: github.com/amorphic/tosr0x . It should be fairly simple to modify them to work with the Raspberry PI GPIO lines.

Of all the scripts in the RoofScripts.tgz file I send, only connect.py, park.py, unpark.py and disconnect.py are used. I have put comments in the Python scripts and they should be easy to follow. If you have questions, don't hesitate to let me know. The scripts normally go in the "/usr/share/indi/scripts/" folder but you can change the location in the 'Options' tab of the "Dome Scripting Gateway" driver.

Gilles

File Attachment:

File Name: RoofScripts.tgz
File Size:1 KB
Last edit: 8 months 3 weeks ago by Gilles Gagnon.
8 months 3 weeks ago #64936
Attachments:

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

  • Posts: 76
  • Thank you received: 1
Hi Gilles,

how is Christmas in Canada? Do you have snow and cold temperatures? It’s kinda rare here over in Germany.
Since days we have rain and temps about 2 to 12 C. No white Christmas.
I used to live, about 20 yr ago in Louisiana for 4 years. And a colleague of mine had the same name as you Gagnon. But Steve with his first name.
I will study your scripts. Thanks again.
But one last question, do you automatically control the roof movements with the EKOS driver buttons, do you know what I mean?

Have a good day, we go to bed now.

Gunter
8 months 3 weeks ago #64986

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

  • Posts: 76
  • Thank you received: 1
Hi Gilles,

I hope you had a nice and peaceful Christmas and you stay well.
I have studied you roof scripts with this USB relais. It is quite straight forward and I can understand it quite easily. Only thing I could not understand is how did you connect the limit switches ot the relais or to a Pi? In your unpark.py script is a comment about a Pin 2 connection but seems to be controlled by the relais driver.
I ordered 4 limit switches and a electronic lock to keep the roof tide and secured against gusts and rain. I try to incorporate this into the unpark and park scripts.

Have a good New Years Eve.

best regards Gunter
8 months 2 weeks ago #65256

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

  • Posts: 202
  • Thank you received: 49
Hello Gunter,

Sorry I did not reply to your previous message, with the COVID and my aging mother, the Christmas Holidays were a bit more ectic; but that's not our subject here. As far as the weather, we had mild and cloudy/rainy weather and on the only clear day, transparency was lousy so, no good astrophotography.

To answer your questions,

1) Roof control from KStars/Ekos/INDI: the roof can be unparked and parked from the buttons available with each application (dome conrtol in KStars, INDI dome driver tab, etc...). It even works, as it should, with the Weather Radio/Watchdog driver pair if weather is inclement.

2) Limit switches: I use a relay board that has four 10 amps relay outputs as well as four digital inputs (Tinysine TSIR04) and I modified the orifginal python script used to only drive relays, so it can now read the digital inputs. Those relay boards with inputs seem to be less used than the relay-only boards (Tinysine and Devantech make one). On a Raspberry PI or an ODroid (which I use), one could use GPIO pins to drive the relays as well as read the state of the limit switches; that would save some space as well as a USB port. I haven't looked into using the GPIO pins from my ODroid as I wasn't aware, at the time, that they could be used with Linux. I will likely consider using GPIO in a future version of the control electronics for the observatory, though.

Let me know if you have any more questions.

Wishing you all a wonderful COVID-free and cloud-free 2021!

Regards.
8 months 2 weeks ago #65262

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

Time to create page: 0.293 seconds