Camera triggering using transistors (APM 2.5)

3689517713?profile=originalI Just found a quick way to hook up APM2.5 to take photos using transistors .

What we need

2 x npn transistors 

2 x 10K resistors (Rc)

2 x 6.8K resistors (Rb) ( this was sufficient for me to saturate the transistor )
And a small pcb and some wires .

I had a nikon coolpix lying around so I opened it up to access the switches.Carefully remove the
upper cover which covers the switches within .You can just google how you can open it (Be carefull about
the Capacitor which is used by flash , you may get a sting if u touch its leads ).

Find the switch which is just below the trigger of your camera . Check its leads (normally its a
small push switch ) . Check which of its terminals are connected to the ground using a multimeter .
And do check the voltages on the other leads when powered on ( They are normally pulled up and may show you
voltage little less than battery ) .Normally there will be 2 such leads which are not grounded and other two grounded.Connect wires ( blue and purple ) to the 2 leads which are not grounded.One will be for focusing and the other one for clicking . Connect 2 wires to battery +ve and -ve terminal (Red and Brown ) .

So just to check whether all is going well and connections are made proper . You can try connecting one
of these wire to battery ground . If nothing happens try grounding other wire . One of them will
let you focus the camera ( you can see it on lcd ). Just when u get the green square on lcd connect the
other wire to ground while still holding the previous wire grounded . If all connections are proper
,the camera should take a picture.

Now we will have to achieve this with a digital signal from APM .For which we are using transistors as switches to
connect those wires to ground .
Just check the circuit diagram( very simple ).3689517549?profile=original

3689517775?profile=originalIn the above image the wires i hold go to APM ( brown - gnd ; red (AN2) and yellow(AN3) focus and trigger pins ) .

While soldering make sure you connect both the grounds together the APMs and camera battery's .


Now for the code ( I have attached it with this post ). I took a simple bypass . I used ch6 input to trigger camera overriding the normal ch6 function .So if you plan to use my code you better be sure you are not using ch6 input .You 
can see it in mission planner config screen . Just make sure ch6 function is set to none .
The code that i have added is in the CONTROL MODES tab in function read_trim_switch ( 10 Hz)

/* This part is to trigger camera transistor pins */
static bool trigger_flag_my = false; //flag to keep track once the ch6 switch is pressed
static char trigger_count_my = 0; // to count the number of times it comes to the function to keep track of time . each count represents 0.1 sec .

if( trigger_flag_my ) // if triggered
{

digitalWrite(AN2, HIGH); // focus pin
trigger_count_my++;
if( trigger_count_my > 10 ) // wait till its 1sec
{
digitalWrite(AN3, HIGH); // capture pin
}
if( trigger_count_my > 12 ) // wait till capture input taken
{
trigger_count_my= 0 ; //Reset all variables
trigger_flag_my = false ;
digitalWrite(AN2, LOW);
digitalWrite(AN3, LOW);
}

}
else
{
digitalWrite(AN2, LOW);
digitalWrite(AN3, LOW);

if( g.rc_6.radio_in > 1500 )
{
trigger_flag_my = true ;
trigger_count_my = 0 ;
}
else
trigger_flag_my = false;
}

/// END OF CAMERA TRIGGER

Add this at the start of the function .

And add this to initialise the pins in SYSTEM tab in the function init_ardupilot just below led pin definitions ( just to make it easy to locate in case u want to remove it later )

// setup IO pins
pinMode(A_LED_PIN, OUTPUT); // GPS status LED
digitalWrite(A_LED_PIN, LED_OFF);

pinMode(B_LED_PIN, OUTPUT); // GPS status LED
digitalWrite(B_LED_PIN, LED_OFF);

pinMode(C_LED_PIN, OUTPUT); // GPS status LED
digitalWrite(C_LED_PIN, LED_OFF);


//---------------------------------
pinMode(AN2, OUTPUT); // Cam focus
digitalWrite(AN2, LOW);

pinMode(AN3, OUTPUT); // Cam trig
digitalWrite(AN3, LOW);
//--------------------------------


Once done with the code the last thing to do is hook the ch6 of your Tx to APM
and go to radio calibration tab and check the ch6 value . Make sure you set it up such that when u
switch the value goes above 1500 and when normal its value is less than 1500 .If not you can change
it in Transmitter setup .

Hope it works for you ! Thank you !

3689517740?profile=original

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Nice job, I am also trying to use transistor based trigger to activate shutter, my question is how to make APM to supply +5V on signal pin instead of PWM? When I choose Shutter trigger type as "transistor" will  it change the output on given channel ? If it works it will be much more reliable than using servos.

  • If by chance your camera has a facility to trigger using an audio jack input ( I have seen it in my friends DSLR ) . You can view this post http://hackaday.com/2011/02/03/triggering-a-dslr-shutter-with-an-au... . It would be risk free , we can get it working without opening those expensive cameras .

  • I had a class once in digital logic where low and high and pullup resistors was something we had to know.  I dont remember half of it anymore and nowadays is when I could use it. :( 

    Good job on using what you have to do what you want!!  That's a great skill.

  • I had all the stuff with me already ( bought it for some other projects ) . Should not cost more than half a dollar .

  • Why not using an optocoupler like the TLP621? You only need a resistor (similar to a LED). 

  • I wish I understood more about electronics. This stuff is COOL!

  • :) . yup 

  • Yes, I should point out, it might not work with every camera as you said normally they are pulled up, but not all the time. Your method will work all the time, what I would check is what logic signal the shutter switch actually wants, ie is it HIGH or LOW. I do notice that your camera wants a LOW signal to trigger, if it wanted a HIGH all you need is to stack another inverter on there or just change the code to do the exact opposite of what it is doing now. Annnnny way, I am bored and just telling you stuff you clearly know :)

  • Agree with you Craig . Normally these switches are internally pulled up .Hence it should work .

  • Very cool, but there is no real need for the transistor inverters you have built. If you use a 2N2222 you can simply connect the collector to the + side of the switch and the emitter to the - or signal side of the switch. Then plutting a HIGH on the base through a 10K resistor will do the trick! I did exactly that on an old Pentax that I had, it worked perfectly.

This reply was deleted.