×

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

Bi-monthly release with minor bug fixes and improvements

[Solved]D5100 and Serial Shutter Bulb Control

  • Posts: 486
  • Thank you received: 87
The permissions look ok.
if it works on windows it maybe be a connection misconfiguration.

Made a simple search and it seems there are others reports on the forum:

indilib.org/forum/general/354-nikon-bulb-cable-solved.html
www.indilib.org/forum/ccds-dslrs/220-nikon-d7000.html#415
The following user(s) said Thank You: Jasem Mutlaq
7 years 3 weeks ago #15981

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

Did you update the drivers in Ekos VM? Looks like you're using old INDI drivers. Do
sudo apt-get update && sudo apt-get -y dist-upgrade

I'll be releasing a new VM once 17.04 is officially out.
7 years 2 weeks ago #15990

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

  • Posts: 8
  • Thank you received: 1
Hey Jasem

Seems like i actually was running the older version of Indi. Now the drivers dont crash or anything but it doesnt trigger at all anymore. Heres a log of the updated drivers and trying to take 2 exposures.
INFO	1.717737 sec	: Session log file /home/indi/.indi/logs/2017-04-06/indi_gphoto_ccd/indi_gphoto_ccd_08:55:47.log
DEBUG	1.717863 sec	: Requested CCD Frame is (  0,  0) (1280 x 1024)
DEBUG	1.717980 sec	: Configuration successfully loaded.
DEBUG	49.394974 sec	: Configuration successfully saved.
DEBUG	128.150412 sec	: Requested CCD Frame is (  0,  0) (1280 x 1024)
DEBUG	128.150659 sec	: Starting exposure (exptime: 10 secs, mirror lock: 0)
DEBUG	128.150668 sec	:   Mutex locked
DEBUG	128.150678 sec	: Setting radio/menu widget iso: 12 (1600)
DEBUG	128.151090 sec	: Setting new configuration OK.
DEBUG	128.151097 sec	: Setting radio/menu widget capturetarget: 1 (Memory card)
DEBUG	128.151502 sec	: Setting new configuration OK.
DEBUG	128.151511 sec	: Opening remote serial shutter port: /dev/ttyUSB0 ...
DEBUG	128.186711 sec	: Exposure started
INFO	128.186763 sec	: Starting 10 sec exposure
DEBUG	128.186851 sec	: Time left: 10000
DEBUG	129.188004 sec	: Capture in progress. Time left 8
DEBUG	130.188518 sec	: Capture in progress. Time left 7
DEBUG	131.188943 sec	: Capture in progress. Time left 6
DEBUG	132.189482 sec	: Capture in progress. Time left 5
DEBUG	133.187289 sec	: Time left: 5000
DEBUG	133.190141 sec	: Capture in progress. Time left 4
DEBUG	134.190774 sec	: Capture in progress. Time left 3
DEBUG	135.191230 sec	: Capture in progress. Time left 2
DEBUG	136.191552 sec	: Capture in progress. Time left 1
DEBUG	137.191726 sec	: Reading exposure...
DEBUG	138.187600 sec	: Time left: 0
DEBUG	138.187875 sec	: Closing shutter
DEBUG	138.201891 sec	: Exposure complete
DEBUG	138.238931 sec	: Unknown event.
DEBUG	138.248839 sec	: Unknown event.
DEBUG	139.306103 sec	: File added event completed.
DEBUG	139.309869 sec	: gp_file_new_from_fd result: 0
DEBUG	139.310466 sec	: Downloading //capt0000.nef
DEBUG	139.326264 sec	: Downloading result: 0
DEBUG	139.330065 sec	:  Downloaded 0x0 (preview 0x0)
DEBUG	139.330695 sec	: Deleting.
DEBUG	139.333426 sec	:   Retval: 0
DEBUG	139.333519 sec	: Setting radio/menu widget iso: 12 (1600)
DEBUG	139.334654 sec	: Setting new configuration OK.
DEBUG	139.334971 sec	: Setting radio/menu widget shutterspeed2: 52 (Bulb)
DEBUG	139.337848 sec	: Setting new configuration OK.
INFO	139.338006 sec	: Exposure done, downloading image...
DEBUG	139.933404 sec	: read_libraw: raw_width: 4992 top_margin 0 left_margin 0 first_visible_pixel 0
DEBUG	139.938071 sec	: read_libraw: rawdata.sizes.width: 4948 rawdata.sizes.height 3280 memsize 32458880 bayer_pattern RGGB
DEBUG	139.965855 sec	: read_libraw: memsize (32458880) naxis (2) w (4948) h (3280) bpp (16) pattern (RGGB)
DEBUG	140.048863 sec	: Uploading file. Ext: fits, Size: 32463360, sendImage? Yes, saveImage? No
DEBUG	140.337609 sec	: Upload complete
DEBUG	267.857280 sec	: Requested CCD Frame is (  0,  0) (1280 x 1024)
DEBUG	267.857502 sec	: Starting exposure (exptime: 10 secs, mirror lock: 0)
DEBUG	267.857513 sec	:   Mutex locked
DEBUG	267.857523 sec	: Setting radio/menu widget iso: 12 (1600)
DEBUG	267.858004 sec	: Setting new configuration OK.
DEBUG	267.858012 sec	: Setting radio/menu widget capturetarget: 1 (Memory card)
DEBUG	267.858642 sec	: Setting new configuration OK.
DEBUG	267.858658 sec	: Opening remote serial shutter port: /dev/ttyUSB0 ...
DEBUG	267.888008 sec	: Exposure started
INFO	267.888071 sec	: Starting 10 sec exposure
DEBUG	267.888109 sec	: Time left: 10000
DEBUG	268.888485 sec	: Capture in progress. Time left 8
DEBUG	269.889110 sec	: Capture in progress. Time left 7
DEBUG	270.889697 sec	: Capture in progress. Time left 6
DEBUG	271.890181 sec	: Capture in progress. Time left 5
DEBUG	272.888282 sec	: Time left: 5000
DEBUG	272.891587 sec	: Capture in progress. Time left 4
DEBUG	273.892451 sec	: Capture in progress. Time left 3
DEBUG	274.893035 sec	: Capture in progress. Time left 2
DEBUG	275.893437 sec	: Capture in progress. Time left 1
DEBUG	276.894489 sec	: Reading exposure...
DEBUG	277.888473 sec	: Time left: 0
DEBUG	277.888529 sec	: Closing shutter
DEBUG	277.903207 sec	: Exposure complete
DEBUG	279.172557 sec	: File added event completed.
DEBUG	279.172633 sec	: gp_file_new_from_fd result: 0
DEBUG	279.172656 sec	: Downloading //capt0001.nef
DEBUG	279.204945 sec	: Downloading result: 0
DEBUG	279.205633 sec	:  Downloaded 0x0 (preview 0x0)
DEBUG	279.205692 sec	: Deleting.
DEBUG	279.205736 sec	:   Retval: 0
DEBUG	279.205785 sec	: Setting radio/menu widget iso: 12 (1600)
DEBUG	279.206321 sec	: Setting new configuration OK.
DEBUG	279.207508 sec	: Setting radio/menu widget shutterspeed2: 52 (Bulb)
DEBUG	279.208062 sec	: Setting new configuration OK.
INFO	279.208141 sec	: Exposure done, downloading image...
DEBUG	280.041903 sec	: read_libraw: raw_width: 4992 top_margin 0 left_margin 0 first_visible_pixel 0
DEBUG	280.048865 sec	: read_libraw: rawdata.sizes.width: 4948 rawdata.sizes.height 3280 memsize 32458880 bayer_pattern RGGB
DEBUG	280.071662 sec	: read_libraw: memsize (32458880) naxis (2) w (4948) h (3280) bpp (16) pattern (RGGB)
DEBUG	280.085379 sec	: Subframing...
DEBUG	280.098898 sec	: Uploading file. Ext: fits, Size: 2626560, sendImage? Yes, saveImage? No
DEBUG	280.164340 sec	: Upload complete

The shutter never went off in both case but the pictures downloaded were pictures that were taken before starting the indi server, basically the last picture taken.
7 years 2 weeks ago #15993

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

You can see it is setting capturetarget to memory card. This is actually hard-coded in the driver as capturetarget: 0 (RAM) never worked for Nikon before. Can you capture an image using GPhoto2 form the console? You can also editing the driver to capture from RAM and see if that works for you, but it never worked for Nikon users before.
7 years 2 weeks ago #15994

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

  • Posts: 8
  • Thank you received: 1
Ive done a bit more testing and ive noticed something really peculiar. Gphoto2 is able to control my camera without any issues for anything below bulb exposures.

The interesting bit is I checked my shutter cable with DSLR Shutter on Windows, it works fine. Then checked on the same computer, on Ekos Vm whether it will trigger the camera but nothing.

Then I plugged the shutter cable into my Macbook and tried DSLR Shutter there, camera does NOT get triggered on my Mac. Then I loaded up an XP Virtual Machine, and then tested DSLR Shutter in there and it works.

I think theres something stopping software from triggering the cable from MacOs as well as Linux. Have i missed something in configuring the system?
7 years 2 weeks ago #15999

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

I don't know how the shutter cable exactly operates. From the code I see it simply opens the device for read/writing and that's it. Is this what's happening on Windows too?
7 years 2 weeks ago #16002

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

  • Posts: 8
  • Thank you received: 1
Ive done a bit of testing, and I've found something super interesting.

The reason the shutter cable isn't working, its because of any issue within Ekos or Kstars or Indi. Its something to do with Linux and MacOS or an issue with the FTDI cable I'm running.
I used a simple script on python that basically opens a serial connection to the port toggles the RTS Line and see whether the camera actually does something.
import serial
ser = serial.Serial()
ser.port = 'COM3'
ser.open()
ser.setRTS(True)
ser.setRTS(False)
On Windows, this code starts exposing and opens the shutter as long as the RTS line is held high. And when RTS is low, the shutter closes.
On Mac and Linux this code doesnt physically set the RTS line high at all.

I have a feeling theres an issue at a FTDI Driver level for my issue. Ill dig around a bit more.
7 years 2 weeks ago #16013

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

  • Posts: 486
  • Thank you received: 87
After some searching it seems FTDI chips have a lot of issues with linux kernel and RTS Line.
There are a lot of complaints about this. FTDI has specific drivers for linux on their support page, maybe installing them will solve it.
I remember having an hard time when I tried to connect my HEQ5 with an FTDI cable (5v one). I had to switch to another solution.

forum.arduino.cc/index.php?topic=50829.0
stackoverflow.com/questions/17385272/how...pins-values-on-linux
www.ftdichip.com/Support/FAQs.htm
hackaday.com/2009/09/22/introduction-to-ftdi-bitbang-mode
Last edit: 7 years 2 weeks ago by nMAC.
7 years 2 weeks ago #16014

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

  • Posts: 8
  • Thank you received: 1
UPDATE:

I managed to get Python in Ubuntu working and starting the shutter, I'm not sure what i did tbh, but I reflashed the EEPROM on the FTDI chip and something seems to have done something and opening the port and then running the ser.setRTS(1) and ser.setRTS(0) works!

No clue why it started working all of a sudden but I'm not complaining. Quick test with the indidriver doesnt seem to show any difference in starting the shutter, so ill try and edit the indi_gphoto driver to include RTS high and low.

Im just not sure how and where to begin compiling stuff for this OS, being super new to it and all...
7 years 2 weeks ago #16015

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

  • Posts: 8
  • Thank you received: 1
I can confirm that compiling and running this code is 100% able to control the shutter of my camera.

	/*====================================================================================================*/
	/* Program to access the RTS,of a Serial Port(ttyS* or ttyUSB0) using ioctl() system call.            */
	/*                                                                                                    */
	/*====================================================================================================*/
	/*                                                                                                    */
	/* If your are using FT232 based USB to Serial Converter all the pins are inverted internally         */
	/* Modem Pins of FT232 based Serial Port -> ~RTS,,~DTR.                                               */
	/* SETTING the Pins will make it LOW,while CLEARING the Pins will make it HIGH.                       */ 
	/*----------------------------------------------------------------------------------------------------*/
 
	/*----------------------------------------------------------------------------------------------------*/
	/* Compiler/IDE  : gcc 4.6.3                                                                          */
	/* Library       :                                                                                    */
	/* Commands      : gcc -o rts rts.c                                                                   */
	/* OS            : Linux(x86) (Linux Mint 13 Maya/Ubuntu 14.04)(Linux Kernel 3.x.x)                  */                              
	/* Programmer    : Rahul.S                                                                            */
	/* Date	         : 27-December-2014                                                                   */
	/*====================================================================================================*/
 
	/*====================================================================================================*/
	/* Running the executable                                                                             */
	/* ---------------------------------------------------------------------------------------------------*/ 
	/* 1) Compile the  serialport_read.c  file using gcc on the terminal (without quotes)                 */
        /*                                                                                                    */
	/*	" gcc -o rts rts.c  "                                                                         */
	/*                                                                                                    */
        /* 2) Linux will not allow you to access the serial port from user space,you have to be root.So use   */
        /*    "sudo" command to execute the compiled binary as super user.                                    */
        /*                                                                                                    */
        /*       "sudo ./rts"                                                                   */
	/*                                                                                                    */
	/*====================================================================================================*/
 
	/*====================================================================================================*/
	/* Sellecting the Serial port Number on Linux                                                         */
	/* ---------------------------------------------------------------------------------------------------*/ 
	/* /dev/ttyUSBx - when using USB to Serial Converter, where x can be 0,1,2...etc                      */
	/* /dev/ttySx   - for PC hardware based Serial ports, where x can be 0,1,2...etc                      */
        /*====================================================================================================*/
 
	/*==================================*/
	/*       MODEM bits                 */
	/*------------------- --------------*/
	/*   TIOCM_DTR --- DTR Line         */
	/*   TIOCM_RTS --- RTS Line         */
	/*==================================*/
 
	#include <stdio.h>
    	#include <fcntl.h>   	 /* File Control Definitions           */
    	#include <termios.h>	 /* POSIX Terminal Control Definitions */
    	#include <unistd.h> 	 /* UNIX Standard Definitions 	       */ 
    	#include <errno.h>   	 /* ERROR Number Definitions           */
	#include <sys/ioctl.h>   /* ioctl()                            */
    	void main(void)
    	{
        	int fd;	/*File Descriptor*/
		printf("\n  +--------------------------------------------+");
		printf("\n  | Program to Control RTS pins of Serial Port |");
		printf("\n  +--------------------------------------------+");
 
		/*------------------ Opening the Serial port ------------------*/
 
		/* Change /dev/ttyUSB0 to the one corresponding to your system */
 
        	fd = open("/dev/ttyUSB0",O_RDWR | O_NOCTTY );	        /* ttyUSB0 is the FT232 based USB2SERIAL Converter   */
			   						/* O_RDWR Read/Write access to serial port           */
									/* O_NOCTTY - No terminal will control the process   */
									/* Blocking Mode  */                       
 
        	if(fd == -1)						/* Error Checking */
            	   printf("\n    Error! in Opening ttyUSB0  ");
        	else
            	   printf("\n    ttyUSB0 Opened Successfully \n");
 
 
		/*--------- Controlling the RTS pins  of Serial Port --------*/
 
		int RTS_flag;
 
		RTS_flag = TIOCM_RTS;	/* Modem Constant for RTS pin */
 
 
		/*--------------------- Controlling the RTS pin using ioctl() system call ---------------------*/
 
		/* setting RTS = 1,~RTS = 0 */
 
		ioctl(fd,TIOCMBIS,&RTS_flag);		/* fd -file descriptor pointing to the opened Serial port */
						        /* TIOCMBIS - Set the bit corrosponding to  RTS_flag      */
		printf("\n    Setting RTS = 1,~RTS = 0 "); 
		printf("\n\n    Press any Key...");
		getchar();
 
		/* setting RTS = 0,~RTS = 1 */
 
		ioctl(fd,TIOCMBIC,&RTS_flag); 		 /* fd -file descriptor pointing to the opened Serial port */
						         /* TIOCMBIC - Clear the bit corrosponding to  RTS_flag    */           
		printf("\n    Setting RTS = 0,~RTS = 1 ");
		printf("\n\n    Press any Key...");
		getchar();
 
		close(fd); /* Close the Opened Serial Port */
		printf("\n  +--------------------------------------------+\n\n");
	}

How do i go about porting this code to the indi code so i can test whether it works in indi?
7 years 2 weeks ago #16016

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

  • Posts: 8
  • Thank you received: 1
I managed to figure out how to edit and compile the drivers, and added a small line explicitly opening the RTS line and tested with Ekos, and everything works as it should. Im assuming its somehting to do with how the kernel handles opening and closing. On Python, opening the port sets RTS line high, but on close doesnt set it low and thus the camera keeps holding the shutter open. In C++ same thing happened, and had to physically set the RTS high and low to start and stop the exposure before closing the port.
Ive forked my code on the git page, if youre interested in seeing it.
The following user(s) said Thank You: Ray Wells
7 years 2 weeks ago #16021

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

  • Posts: 8
  • Thank you received: 0
i would like to know more about this for my 7000
can you give me a link to the git page please?
3 years 11 months ago #52901

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

Time to create page: 1.059 seconds