×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Relays for shutter release

  • Posts: 421
  • Thank you received: 102
I can't find any place in the code that would change the port to /dev/ttyUSB0 in case of failure. So that one is a mystery to me.

If you want to recompile the indi_gphoto_ccd driver, you can change the commands that it sends to match the serial relay board that you are using. If you want to try that, in file gphoto_driver.cpp, at line 649 is the command to close the shutter, and line 1223 is the command to open the shutter. Be sure to change the 3's to 4's, since that indicates the number of bytes, and it looks like your serial board takes 4 byte commands instead of 3.
 
Last edit: 2 years 5 months ago by Kevin Ross.
2 years 5 months ago #76858

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

  • Posts: 169
  • Thank you received: 3
Thanks. I thought a bit more about recompiling, and I don't think that would gain me anything as it would then be an either/or situation. Best I can think of would be to "scrap" the KMTronic relay board and find more of these others, then recompile. That would be a shame, though. I like the KMTronic board. ;)
2 years 5 months ago #76881

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

  • Posts: 169
  • Thank you received: 3
I've been looking at dsusbdriver and think I see some hope for the HID relays. I was going to experiment with creating a variation of that driver just for this purpose, but I don't seem to be able to get the sources with apt-get, so more thought required.

Since I can drive the HID relays using usbrelay, the specific commands to open and close the relay should be straightforward. I'll report back if I get anywhere.
2 years 5 months ago #76952

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

  • Posts: 421
  • Thank you received: 102
There's an alternate method you might want to look into. In Ekos, on the Capture tab, towards the bottom right there's a button titled "Scripts Manager". Click that button. There you will see pre-capture script and post-capture script. I think you can create a "startCapture.sh" and "stopCapture.sh" script in your home directory, where you execute the usbrelay commands necessary.
The following user(s) said Thank You: Paul Nixon
2 years 5 months ago #76958

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

  • Posts: 169
  • Thank you received: 3
Sorry if this is a repeat - I thought I'd already replied.

I really like your idea - thank you! I notice the option is available in 3.5.4 but not 3.4.3, so I got my "newer" pi fired up and wrote the two scripts -one to close the relay (open the shutter), and the other to open the relay (close the shutter).

My "scripts", such as they are- 
shutter_open:
#!/usr/bin/python
import os
os.system("usbrelay S2OD2_1=1")

shutter_close:
#!/usr/bin/python
import os
os.system("usbrelay S2OD2_1=0")  

I can get the shutter to open, but I'm having to run my shutter_close script to manually close the shutter when using the Nikon driver, and when I am using the gphoto driver, I get the following error even though I have "port" blanked out.

2021-10-28T01:52:01: [ERROR] Error starting exposure
2021-10-28T01:52:01: [ERROR] Failed to open serial port: /dev/ttyUSB0
2021-10-28T01:52:01: [INFO] Starting 10 seconds exposure.
2021-10-28T01:52:01: [ERROR] Error starting exposure
2021-10-28T01:52:01: [ERROR] Failed to open serial port: /dev/ttyUSB0
2021-10-28T01:52:01: [INFO] Starting 10 seconds exposure.

I rebooted the pi to make sure it wasn't just a glitch. I know 10s is within the camera's capabilities without bulb mode, but I have force bulb mode on and am just trying to make sure I can control the relay correctly.

EDIT: unfortunately, I'm seeing this with the Nikon driver, too. Seems the camera is getting confused.

Thoughts?
Last edit: 2 years 5 months ago by Paul Nixon.
2 years 5 months ago #76976

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

  • Posts: 421
  • Thank you received: 102
I think I may have led you down the wrong path. I think the driver will try to complete the exposure and download the image before it considers the capture to be complete, and therefore running the close shutter script. But, the close shutter script must be run first, before the exposure can be completed and the image downloaded.

So I don't think that will work. :(

Your best bet is probably to modify one of the existing drivers to match the relay hardware you have.
The following user(s) said Thank You: Paul Nixon
2 years 5 months ago #76978

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

  • Posts: 169
  • Thank you received: 3
Shoot - that makes sense. ;)

So, I'll see about modifying the existing dsusb driver.
2 years 5 months ago #76979

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

  • Posts: 169
  • Thank you received: 3
I found the dsusb driver source online and feel confident I can make the changes. What do I need to install on my pi to compile the new driver? This thread: www.indilib.org/forum/astroberry/7751-libindi-compilation.html seems to suggest this is a huge undertaking. Does it have to be?

Thanks.
2 years 5 months ago #77007

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

  • Posts: 421
  • Thank you received: 102
Well, I might not be the absolute best person to answer. I'm a software engineer of over 30 years. So what seems quite simple to me might not seem simple to you.

But, basically just install the build tools, the INDI headers (libindi-dev package), grab the indi-3rdparty from git, do the usual cmake; make; make install routine. See? Easy! :)
2 years 5 months ago #77011

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

  • Posts: 169
  • Thank you received: 3
Well...uhhhhh...yeah, easy. ;)

It's been 30 years since I built anything in Linux, and even then I don't recall mucking about too much.

Is there no way to build just the driver? Or would this create a mismatch in dependencies, etc.?
2 years 5 months ago #77018

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

  • Posts: 421
  • Thank you received: 102
Yes, but you still need the build tools and INDI headers. For your particular driver, you would create a build folder, run cmake (with the path to the source files), make, and make install.

You should be able to follow the instructions here: github.com/indilib/indi-3rdparty

See "Building individual 3rd party drivers"
2 years 5 months ago #77022

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

  • Posts: 12
  • Thank you received: 3
Thanks for this thread - really helped me in getting a USB relay to work with my Nikon D90.
A few notes about what I found with recompiling indi-gphoto-ccd to get this working.
  • I think I'm using the same relay as mentioned in this thread - LCUS-1 (from amazon) - it uses the same trigger strings (A0 01 01 A2  &  A0 01 00 A1)
  • recompiling is really as easy as indicated (it's been more than 12yrs since I did any coding and it wasn't in C or C++ when I did) - but you may want to change the default install directory and install your compiled version in /usr/local/bin - that way new downloads from INDI ppa won't over write your compiled driver - but you'll still need to know when indi-gphoto-ccd is updated in case you have to migrate your changes to a new version and recompile your driver to work with new changes in the rest of INDI.  Unless you've modified your PATH on RPi or Linux - /usr/local/bin executables should be run (found) before /usr/bin (use "which" on command line to verify if not sure)
  • the LCUS-1 usb relay requires writes to it to be at 9600 bps (baud) and the default connection seems to be 19200 - so I had to add code to set the terminal speed (4 or 5 extra lines plus an include). I'm guessing the KMTronics is 19200 so doesn't need this.
  • With the Nikon D90 - if you are using a shutter release port - you MUST force bulb mode.  If you don't - any time you select a shutter speed less than 31 seconds - the camera goes into PC mode and you can no longer use the shutter release port without disconnecting and stopping and then restarting your Ekos profile. (This one took the longest to figure out - I'd take a 1sec preview and the relay would stop working - drove me nuts)
  • If your running remotely (Kstars/Ekos inside - RPi controlling the camera outside) you only need to modify and install the changes on the RPi
If anyone wants the changes I made - I should be able to supply them in a Diff file.  I only had to change gphoto_driver.cpp (and I modified the minor version in CMakeLists.txt - but that's not necessary if you don't want to)

I looked into trying to make trigger string and terminal speed something you could enter in the INDI control panel - but that's currently over my head for programming - maybe I'll revisit in the future. I'm still very new to INDI and Astrophotography and have too much to learn.

Cheers!
The following user(s) said Thank You: Luis G.
2 years 2 months ago #80650

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

Time to create page: 1.068 seconds