×

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

Bi-monthly release with minor bug fixes and improvements

Setting Snap port as external shutter in INDI

  • Posts: 3
  • Thank you received: 2
My First post here about the biggest struggle I had with my setup. Hope it will be helpful to some of you.

Recently I started to integrate my Canon 350d DSLR into my astronomy setup. It's a fairly old model and because of that it doesn't support exposures longer than 30 sec over USB. Bummer!
So i set out to solve my problem and expose as long as I want. The equipment I used to achieve this is as follows:

Mount: EQ6-R pro
Camera: Canon 350d
Controller: Raspberry Pi 4 (2Gb) with Astroberry Os (linux)
Software: Ekos, INDI, Thonny (python IDE, any python IDE can be used)
Cables: 3,5mm male to 2,5mm male shutter cable



My plan was to use the build-in Snap port on my EQ6-R pro. This port functions as a shutter release for the connected camera. Normally you would control it with the handcontroller, but recently support was added in de EQMod driver. This allowed the port to be controlled by software. Pretty neat, huh? Problem was, the Canon driver has no option to set this port as the external shutter release. Only serial ports can be set here (to my knowledge). Luckily, Linux allows the creation of "pseudo" serial ports. These ports function just like regular serial ports except that they communicate with a second port that can be controlled by software. The INDI driver doesn't seem to expect any return communication from the shutter port, so I won't have to deal with sending stuff.

My plan: INDI -> pseudo serial port -> software port -> shutter control program
INDI sends a command to the pseudo port -> The pseudo port forwards this to the sofware port -> the software port can be read by the python script -> python scripts opens or closes the shutter of the camera.

To create this port-pair the python "OS" module has the function: os.openpty() (see: docs.python.org/3/library/os.html for more details on the OS module)
This function opens the pair and returns the identifier to both. To get the file descriptor of the pseudo port, the function os.ttyname() is used. The input is the identifier from the openpty() command.
In my case, running os.ttyname() results in the descriptor looking like: /dev/pts/1
This wil be the port that you specify in INDI as the shutter release port. Depending on the existence of other virtual ports, that "1" might change. My python script prints the descriptor so pay close attention to what it says!
To read the software port the command os.read() is used. A bit more difficult because you need to specify how many bytes there are to read and I had no idea what that amount was. After some testing I figured 3 was the correct number (please correct me if I'm wrong).
The identifier of the software port is also needed.
os.read() returns the specified amount of bytes which I put into a list. The last byte is needed to see if the shutter should be opened. This corresponds to element 2 in the list (remember, lists start at 0 in python).
This whole port stuff was what gave me the most "trouble", as I was unfamilier with any of these commands/ports.

Setting the shutter port to open and close is real easy. I followed this awesome tutorial on scripting: indilib.org/develop/developer-manual/104-scripting.html
The EQMod property used is: "Mount.SNAPPORT1.SNAPPORT1_ON=On"
This opens the shutter and "Mount.SNAPPORT1.SNAPPORT1_OFF=On" closes it. These ON and OFF are two different properties but they influence each other. So setting one to On sets the other to Off. This is why I don't set the "ON" to Off in my script.
THE COMMANDS ARE CASE SENSITIVE!! BE WARNED!!

Lastly, a endless loop constantly checks if the shutter needs to be open or closed and updates the EQMod property accordingly.

See here the fruits of my labor:


settings for the shutter port in the INDI window:


Important notes:
  • first connect your equipment and start the drivers
  • Run the python script and note the port location
  • Set the shutter release port accordingly
  • restart the camera driver

So yeah, that's pretty much it. I'm sure I glossed over some stuff so any questions are welcome.
Enjoy the long exposures and clear skies!
The following user(s) said Thank You: Jasem Mutlaq
3 years 3 months ago #65104
Attachments:

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

Brilliant! You went through quite a lot to get this done. A better solution IMO is to make EQMod watch this property. Once set, it triggers the port. But this would require some driver level plumping to get done, but it's not far fetched.
The following user(s) said Thank You: Aaron Mellema
3 years 2 months ago #65143

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

  • Posts: 3
  • Thank you received: 2
Thanks for the compliment!
I agree that it would be a lot better if this was done on driver level. It'd make the process much more user friendly. I'll see if I can work out your suggestion.

Clear skies!
The following user(s) said Thank You: Jasem Mutlaq
3 years 2 months ago #65152

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

  • Posts: 1
  • Thank you received: 0
Great tutorial! Thanks AARON.
I tried your method on my raspberry3B+azgti+nikon d5100, unfortunately it didn't work out. The python script is stuck on os.read().
I have two questions:
1.os.openpty() will create a pair of terminals, "pseudo" is assigned to the DSLR's driver, but how should I assign "software" to the mount's (eqmod) driver?
2. Should I enable "Snap Port 1" in the "option" section of the EQMod driver?

Looking forward to your reply!
1 year 3 months ago #88993

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

  • Posts: 3
  • Thank you received: 2
Hi Junwei,

Thank you for finding my tutorial useful! It has been a while since I last used this method as I upgraded my camera to a ZWO this summer, but I'll see what I can do.

It could be that it is no longer compatible with the current version of the driver although I doubt that.
to answer your questions:
1.
the port "pseudo" is indeed assigned to the dslr driver as this is the fake serial port. The port "software" is used by the python script to interact with the pseudo port. There is no need to assign a port to the EQMod driver. The EQMod driver is controlled using the "Mount.SNAPPORT1.SNAPPORT1" commands. In order to check if this is the correct command for your mount I believe you can use the "indi_getprop" command in a terminal window on your rpi. It should list all the properties of your mount. This tutorial explains the use of these commands: indilib.org/develop/developer-manual/104-scripting.html

2.
If you mean the option "Snap port 1 [OFF] [ON]", it should be set to off. The options on/off refers to if the port should trigger a shutter release or not. If set to on it opens your shutter and closes it if set to off. The python script will adjust this setting to trigger a capture on your dslr.

I hope this information will help you solve the problem. If not, could you send me a screenshot of the python script output, your EQMod settings and dslr driver settings?

Kind regards and clear skies,
Aaron
Last edit: 1 year 3 months ago by Aaron Mellema. Reason: added link
1 year 3 months ago #89019

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

Time to create page: 0.891 seconds