×

INDI Library v1.9.8 Released (29 Sep 2022)

Bi-monthly INDI Library released with new drivers and bug fixes.

Power and connect devices via startup script

  • Posts: 31
  • Thank you received: 1
Hi,

we have built and set up a small observatory on our school roof. The observatory is supposed to be automated using the Ekos scheduler. The power for the mount, CCD, guiding cam, filter wheel and dew heater bands is delivered by a PegasusAstro Ultimate Powerbox v2. In order to reduce power consumption, I would like to turn on the power for and connect the above named devices using a startup script to be executed in the scheduler when an observation is about to start.

So my questions are:

1. Is it possible to turn on the 12V power outlets on the UPB with a command that can be executed via a startup script?
2. Is it possible to connect devices (once they are powered up) with a command that can be executed via a startup script?

May be someone is already doing this and could provide their startup script so I can cheat a little bit ;-)

Thanks,
Simon
1 year 11 months ago #65383

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

Hello Simon,

That's great to here. Please share some photos of this observatory with us. I am doing exactly the same thing in my home observatory, so I'm not using the Pegasus, since I built my observatory back in 2015 and went to Digital Loggers Power Switch to turn on/off the equipment when the observatory is started/closed. To answer you question:

1. Yes, it's possible, you can use indi_setprop to toggle UPB ports on/off. Though that means that A) Pegasus has to be powered at all times, and B) indiserver running UPB must be up and running.
2. Yes, as described above.

Unfortunately, I don't have such a script ready since I use the web power switch to do this and not Pegasus. Figuring out how to use indi_setprop is probably the easy part. In order to start the drivers for your equipment *after* you power them up, you also need to ask INDI server to start the respective drivers. So it goes something like this.

mkfifo /tmp/indififo
indiserver -v -f /tmp/indififo

This starts INDI server in FIFO mode.

Then open another console

echo "start indi_pegasus_upb" > /tmp/indififo

This would case the INDI server to start this driver. Next you'd use indi_setprop to toggle the 12v for them on/off. Say, you turned power for the QHY camera, then you'd this:

echo "start indi_qhy_ccd" > /tmp/indififo

Then that would start is on the server and so forth. I hope this helps.
Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
1 year 11 months ago #65415

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

  • Posts: 31
  • Thank you received: 1
Hi Jasem,

thanks for your reply!

I have attached some pics. The observatory is pretty much set up and the rig is waiting in a box to be put up in the obsy. But first I have to make sure, that it is rain tight ;-) The design of the housing is a close adoption of Magnus Eriksens project (Thanks Magnus for the great blog on Stargazers Lounge).

I am a little worried about polar alignment (the lid of the obsy is blocking the view of the north celestial pole -> so I guess I have to use the legacy polar alignment tool), but that is a different story ...

Yes, I was thinking the same. Ekos will run on a Raspberry Pi 4 and hopefully the UPB can cope with being powered on all the time.

Okay, let me make sure I get this right. I will start Ekos (graphically on the RPi 4). Then I will feed the scheduler with a sequence file, weather data and startup script. When the target is visible and weather is appropriate, the startup script starts indiserver in fifo mode and connects 1) the UPB, 2) turns on the 12V outlets of the UPB to power on the other devices and 3) starts the drivers for the other devices, right?

Above you say something about opening another console. How is that taken care of in a startup script? Just by using a new "os.system(echo "start indi_***_***" > /tmp/indififo)" call in my python script?

Thank you for the help. This is really exciting.
1 year 11 months ago #65434

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

  • Posts: 31
  • Thank you received: 1
Ok, I experimented with the startup script and scheduler but still need some help. This is what I did:

1) Created a startup script:

<code># -*- coding: utf-8 -*-

import os
import time
import sys

print "Start indiserver in FIFO mode..."
sys.stdout.flush()
os.system('mkfifo /tmp/myFIFO')
os.system('indiserver -v -f /tmp/myFIFO')
time.sleep(5)

print "Start mount simulator driver"
sys.stdout.flush()
os.system('echo "start indi_simulator_telescope" > /tmp/myFIFO')
time.sleep(5)

print "Start ccd simulator driver"
sys.stdout.flush()
os.system('echo "start indi_simulator_ccd" > /tmp/myFIFO')

exit(0)
</code>

2) I started the scheduler with a simple esq file and the startup script. I did not start Ekos (hit the play button on the Ekos setup page) before launching the scheduler, because I wanted the startup script to start indiserver and the (simulation) drivers.
3) This is the output:

<code>2021-01-09T12:51:38 Mount already unparked.
2021-01-09T12:51:36 INDI devices connected.
2021-01-09T12:51:35 Ekos started.
2021-01-09T12:51:05 Start ccd simulator driver
2021-01-09T12:49:34 Start mount simulator driver
2021-01-09T12:49:29 Start indiserver in FIFO mode...
2021-01-09T12:49:29 Executing script /home/sternwarte/Schreibtisch/startup_script.py...
2021-01-09T12:49:27 Scheduler started.</code>

4) So the startup script is starting the indiserver in FIFO mode and the drivers. But after executing the startup script, Ekos is starting the selected profile and tells me, that another indiserver is already running (the one I started with the script, I guess).
5) The devices are only showing up in the INDI Control panel after Ekos starts the profile and not when I start the devices in the startup script.

Can anyone please tell me what I am doing wrong? Thanks a lot!

Simon
Last edit: 1 year 10 months ago by Simon.
1 year 10 months ago #65679

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

  • Posts: 31
  • Thank you received: 1
Hi Jasem, hi startup script folks,

after quite a while, I am back at my startup script issues. When I start the indi_pegasus_upb driver in Ekos, I can switch Power Ports on and off with

indi_setprop "Pegasus UPB.POWER_CONTROL.POWER_CONTROL_1=On"

from the command line.

When I start indi_pegasus_upb driver via command line

indiserver indi_pegasus_upb

I can't manipulate the Power switches. Is there anything else I need to do besides starting the indi_pegaus_upb driver using the indiserver command?

Another question I have is, if it is possible to stop the indiserver in the startup script, so that the scheduler can start the proper profile with all the drivers, after I turn on my equipment via startup script.

Thanks for any help
Simon
6 months 5 days ago #83266

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

Yes, you can simply add one more command

pkill indiserver

and that would kill it so that the profile in Ekos is started fully.
Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
6 months 5 days ago #83296

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

  • Posts: 31
  • Thank you received: 1
Hi,

I want to turn on a power switch in my Pegaus UPB via a startup script. I am doing the following in the command line:

$ indiserver indi_pegasus_upb
$ indi_setprop "Pegasus UPB.CONNECTION.CONNECT=On"
$ indi_setprop "Pegasus UPB.POWER_CONTROL.POWER_CONTROL_4=On"
$ indi_setprop "Pegasus UPB.CONNECTION.CONNECT=Off"
$ pkill indiserver

When I start the Pegasus UPB via EKOS in Kstars, the power switch is NOT turned on. I guess that killing the indiserver makes the UPB turn off that switch again. This does not happen when I start and stop the UPB driver from EKOS within Kstars, even when turning the switch on via indi_setprop in the command line.

Any ideas what I could do to make the UPB keep that power switch in the On-state?

Simon
6 months 3 days ago #83337

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

Time to create page: 0.587 seconds