×

INDI Library v1.9.3 Released (11 Nov 2021)

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

Relays for shutter release

  • Posts: 148
  • Thank you received: 3
I have a D5100 that works fine using the KMTronic relay board for shutter release. I have two other relay boards, one is an HID-based board, the other sets up like a regular COM port.

From the command line using usbrelay S2OD2_1=1 and usbrelay S2OD2_1=0 I am able to toggle the relay on and off. In Ekos, when I set the port to /dev/hidraw0 and attempt to take a 1sec exposure, the relay closes but does not open. Subsequent attempts cause "Error opening /dev/ttyUSB0" though I've no idea why it is attempting to open /dev/ttyUSB0 when it should be trying /dev/hidraw0. I asked some time ago about such relays and was told dsusb *might* work but it would depend on the device ID or something. So, is there hope?

The other relay does show up as /dev/tyyUSB0, but when I try to activate it, I see no activity. usbrelay doesn't see it. I tested this relay in Windows so it is a working relay. 

I'm wanting to have a second USB shutter release for my second Nikon D5100. The KMTronic relay boards are available still, but of the two I previously purchased, only 1 was actually working. These other boards I have them in hand. Suggestions? Thanks.

 
1 month 1 week ago #76853

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

  • Posts: 304
  • Thank you received: 76
INDI supports a few different types of relay controls for external shutter release.

DSUSB is a special device made by Shoestring Astronomy. In the Nikon INDI control panel, you would just set the port to "dsusb" and it will look for that special device plugged into a USB port. If it finds it, all is good in the world, and it should "just work".

The KMTronic relay boards present themselves to the system as a USB-to-serial adapter, and it listens for special commands to open and close the relay.

If you put anything other than "dsusb" into the port field in the INDI control panel, it will assume it is a serial port (such as /dev/ttyUSB0) and will attempt to open it as such. If it's a Nikon camera, it will send the special KMTronic commands over the serial port to open or close the shutter. It will also toggle the RTS line on the serial port to open and close the shutter. So if you attach a USB-to-serial adapter that isn't a KMTronic relay board, you would have to wire up a relay to the serial port's RTS line to control the shutter.

If you have some type of relay control board that expects commands over the serial port, and those commands aren't the same ones that KMTronic uses, it probably won't be usable with INDI.
1 month 1 week ago #76854

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

  • Posts: 148
  • Thank you received: 3
Hi Kevin and many thanks for the quick reply!

I was able to get the UART-based USB relay to toggle by setting the port with
stty -F /dev/ttyUSB0 speed 9600 cs8

and then sending the on/off commands:

echo -n -e '\xA0\x01\x00\xA1' > /dev/ttyUSB0

echo -n -e '\xA0\x01\x01\xA2' > /dev/ttyUSB0

Those are very different from KMTronic's so not helpful, unfortunately. Unless the KMTronic commands were changed out somehow. I imagine that would require recompiling at least.

I am puzzled about the HID relay. I set the port to /dev/hidraw0, and the relay closes when I tell it to take a pic. It just doesn't open again, and subsequent attempts have it looking to /dev/ttyUSB0. Would I possibly be correct in assuming that once the relay is triggered, the pi (or driver) can no longer communicate with /dev/hidraw0, defaults to /dev/ttyUSB0, and then errors because that device is not present?
1 month 1 week ago #76856

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

  • Posts: 304
  • Thank you received: 76
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: 1 month 1 week ago by Kevin Ross.
1 month 1 week ago #76858

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

  • Posts: 148
  • 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. ;)
1 month 1 week ago #76881

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

  • Posts: 148
  • 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.
1 month 1 week ago #76952

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

  • Posts: 304
  • Thank you received: 76
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
1 month 1 week ago #76958

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

  • Posts: 148
  • 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: 1 month 1 week ago by Paul Nixon.
1 month 1 week ago #76976

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

  • Posts: 304
  • Thank you received: 76
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
1 month 1 week ago #76978

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

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

So, I'll see about modifying the existing dsusb driver.
1 month 1 week ago #76979

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

  • Posts: 148
  • 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.
1 month 1 week ago #77007

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

  • Posts: 304
  • Thank you received: 76
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! :)
1 month 1 week ago #77011

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

Time to create page: 0.953 seconds