That's GREAT! I'm glad my little script is useful.


If it works connected directly, then it's not my script... sounds like a compatibility issue with your IR shutter cable. I can't help... but I think it's cool you're messing with it. :)

Out of curiosity, What are you trying to solve using the IR remote if you can already control the shutter with a cable? If your answer is "fun thing to try" I'd totally understand.


My script was written on an Astroberry. I do not know what is included on Stellarmate. Sorry.


The latest Astroberry included a slightly broken indi_setprop command. The workaround is to specify the INDI server host. To test if this is your issue, bypass the script and just use the following command line tools.  (note the -h part)

indi_setprop -h "EQMod Mount.SNAPPORT1.SNAPPORT1_ON=On"
indi_setprop -h "EQMod Mount.SNAPPORT1.SNAPPORT1_OFF=On"

If that works, you can set a temporary alias in the script or just hardcode the host on all indi_setprop and indi_getprop commands.

Something like this at the top of any bash scripts that use these commands will work around the issue for now.
# Temporary aliases to work around localhost issue.
shopt -s expand_aliases
alias indi_getprop="indi_getprop -h"
alias indi_setprop="indi_setprop -h"
alias indi_eval="indi_eval -h"


My scripts make use of the bc command. The most recent Raspbian updates to Astroberry took this away.

It's simple enough to get back though.

sudo apt install bc

I'm not sure if I'm using other stuff that isn't installed by default. I'm glad I had internet access when I found out last night. :)


I agree. I believe this code should be in Astroberry already (???), but it does not appear like the fix was enough to correct the issue. I am still not able to slew to that tiny strip of sky between 0 and -1 degree using SkySafari. There might be more changes required.


I've been asked about how I'm using the GPIO pins to control the shutter.

A good tutorial on how to wire optoisolators can be found here. For astrophotography we don't usually need to control focus, but if you do, there are units available with two optoisolators built in. I'm actually using this board , but I don't recommend it. I was required to use power from the camera (by leaving the focus pin off) in order for the transistors on the board to work. The method in the first link is easier and better.

You can then use the /sys/class/gpio interface to control the pins. For example, I'm using pin 23 for the shutter. The following code will control the pins and includes the needed exposeSensor and closeShutter functions needed in the script I posted earlier.

# Set GPIO path

# Define Pins

# This is backwards because of the board I'm using.  
# You likely want to swap values here.

# Function to export a pin if not already exported
exportPin() {
  if [[ ! -e $GPIO_PATH/gpio$1 ]]
    gpio export "$1" out

# Function to change state of a pin
setState() {
  echo $2 > $GPIO_PATH/gpio$1/value

# Function to expose for for a given number of seconds.
exposeSensor() {
  setState $SHUTTER $ON
  sleep $1
  setState $SHUTTER $OFF

# Function to close the shutter.
closeShutter() {
  setState $SHUTTER $OFF

# Export pins and set initial state.
exportPin $SHUTTER
setState $SHUTTER $OFF

exportPin $FOCUS
setState $FOCUS $OFF

By the way, audio header cables used on old CDROM drives have the right pin spacing for the raspberry PI. :)


I feel like I'm somewhat different in how I am using Astroberry. I want to share some things about my setup and how I use it. This first topic will be about how I control the shutter on my camera.

I have a Fujifilm X-T20. It is not possible to control the shutter and download images at the same time. More expensive Fujifilm cameras support tethered shooting, but not the X-T20. It is possible to use external intervalometers, but this makes it nearly impossible to dither. Controlling the shutter from an INDI client (I use CCD Ciel) while also dithering in PHD2 was my ultimate goal.

I also have a Sky-Watcher EQ6-R Pro. Many Sky-Watcher mounts have "snap" ports that can be used to control cameras in the same way intervalometers can control cameras. The snap port on my Sky-Watcher mount controls my X-T20 using a simple 2.5mm to 3.5mm stereo audio cable. If I use the mount's hand controller, I can access a menu that work just like an intervalometer would.

I don't use a hand controller though. Instead I connect the Raspberry PI directly to the mount using a USB cable. I then use the EQMod Mount INDI driver. Recent versions of this driver include INDI parameters for controlling the snap ports on Sky-Watcher mounts. The parameters to look for are "EQMod Mount.SNAPPORT1.SNAPPORT1_ON" and "EQMod Mount.SNAPPORT1.SNAPPORT1_OFF". Note: The driver looks at a mount identifier to determine if the parameters should be enabled. If you have a mount with a snap port, but the parameters do not exist, the EQMod driver developer might only need to add a mount identifier to the code to enable support.

This means we can control the shutter from a shell prompt with the following command.

indi_setprop "EQMod Mount.SNAPPORT1.SNAPPORT1_ON=On"
And similarly, this command will close the shutter.
indi_setprop "EQMod Mount.SNAPPORT1.SNAPPORT1_OFF=On"

So now we have a way to control the shutter from the command line, but in order to use an INDI client, we need something that looks like an INDI camera. The secret to making all of this work, is to enable the "CCD Simulator" driver. This is a fake camera in INDI. We setup our INDI client to use the CCD Simulator camera as the main camera. When the client tells the camera to take a picture, it sets the "CCD Simulator.CCD_EXPOSURE.CCD_EXPOSURE_VALUE" to the length of the exposure needed.

The next trick is to watch that CCD_EXPOSURE_VALUE parameter from a shell script, catch the new exposure length when it increases in value, and then open the shutter for the specified number of seconds. Ok, I admit that sounds a little complicated, so I've included my script that does just that. The snap_port_listener script (attached with a txt extension) uses an indi_eval command to wait for the exposure value to change. To use this script, just open a shell window and start the script before using the camera in your favorite client. The script will keep track of the cumulative exposure time as well as the total number of exposures. When you're done capturing, just issue a Ctrl-C in the window running the listener, and the script will stop. If you kill it while an exposure is taking place, it will close the shutter.

File Attachment:

File Name: snap_port_listener.txt
File Size: 2 KB

This script can be easily edited if you have a different way to control your shutter from the command line. I actually use a similar script that controls my shutter using an optoisolator circuit and the GPIO pins on the Raspberry PI. The only thing that needs to change in the script to use a different shutter control method is the exposeSensor and closeShutter functions.

It is also worth noting that if the INDI client cancels an exposure, the script will not see it. In that case, you would want to kill the script, or wait for the exposure to finish, before starting a new set of exposures using the client.

You may need to check the values of the parameters on the CCD Simulator driver to ensure the exposure is set to zero before starting the script. Also, the CCD Simulator creates simulated image files. You will want to note where these get saved so you can purge them later, or block them from being written all together. I actually tell CCD Ciel to write the files to a directory that I have set with 000 permissions. It happily fails to write them and continues with exposures anyway... which is handy in my case. I also configure the CCD Simulator to use a smaller resolution (600x400) and scale the pixel size so the field of view actually matches my camera. This is not necessary, but results in less IO for the simulator driver, and any client that uses the sensor for field of view estimates will draw the correct sized box.

I hope someone finds this script helpful. I'm sure there are many other ways to do this, and many different ways to write this, but this is working well for me. Feel free to use it as a starting point for your own script.