Using AUX pins as relays for CHDK

I'm confused and a bit frustrated, would appreciate any help as I'm not sure how to proceed.

Setup: I have a pixhawk autopilot running Arduplane 2.77, using Mission Planner 1.2.95

I've been following this guide to get my CHDK enabled camera working with my pixhawk. I'm interested in getting the camera triggering based on distance traveled.

Obviously the guide was written with APM in mind, so it needs to be adapted a bit for pixhawk; specifically the setting for RELAY_PIN. I've kept the rest of the settings the same as in the tutorial.

Pixhawk has 6 AUX ports according to the quick start guide, I am assuming that the numbers above the pins correspond to the AUX port numbering. When you mouse over the RELAY_PIN parameter, it says that pin 54 corresponds to Pixhawk FMU AUX1.

Tried setting RELAY_PIN to 54, no joy. Did a bit more looking, discovered in the release notes for 2.77: 

"Improved relay code
The relay and servo set code has had a major overhaul, with up to 4 relays now supported for MAVLink control and much better support for the DO_SET_SERVO, DO_SET_RELAY, DO_REPEAT_SERVO and DO_REPEAT_RELAY MAVLink commands. Along with these changes is a new parameter BRD_PWM_COUNT which allows you to specify how many auxillary PWM outputs to enable, with the remaining outputs being available as digital relays. This allows you to re-assign some of the aux servo outputs on Pixhawk for use as relays, by setting the RELAY_PIN, RELAY_PIN2, RELAY_PIN3 and RELAY_PIN4 parameters. The pin numbers for these pins start at 50 for the first aux servo pin, and go to 55 on Pixhawk."

Additionally,I found this github issue about this same problem that states that the Pixhawk can't trigger CHDK because its relay pins operate at 3.3V instead of 5V.

So i suppose my specific questions are:

1) Is AUX1 pin 50 or 54?

2) Can anyone confirm that the relays, when working properly, won't be able to trigger CHDK?

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

Join diydrones

Email me when people reply –

Replies

        • Hi Joe

          my address:

          Calle Gómez del Carpio 129. Int. 303. Barrio Medico. Surquillo.

          Lima 0034. Peru.

          My name: Juan Pablo Gayoso Mogrovejo

          Thank you very much

           I will send news when arrive ..

          thank you so much....again

    • Wiki Ninja

      When the board is available for purchase please get it added to the wiki in Camera Shutter Triggering using CHDK#chdk_cables_for_purchase. The best way to get it added if you are not a wiki editor is to add a request with the words and links to the wiki issue tracker.


      The tuffwing example there is good to copy - a few words about your board, and links to where it can be purchased and a user guide. 

  • T3

    Hi Hamish, Za Pf, Reuben and all,

    I successfully tested the Pixhawk CHDK trigger suggested by Reuben using the board layout by Za Pf.

    The basics:

    The original circuit was suggested by Reuben:

    3702061568?profile=original

    The design is based on two 220k resistors and one BC547 transistor. It requires 5v being fed to the servo-rail by an ESC or a separate BEC. Za Pf designed a board based on this circuit and published it on OSH Park:

    3702061616?profile=original

    Some pictures while building it:

    Placing the parts:

    3702061436?profile=original

    3702061574?profile=original

    After soldering:

    3702061625?profile=original

    The final cable:

    3702061447?profile=original

    3702061643?profile=original

    Two minor things:

    The holes for the resistors are a little small and for soldering it would be easier if the holes for the transistor would be a little bit further apart. 

    A big thank you to ZaPf, Reuben, Marco and all the others who contributed!

    Cheers,

    Thorsten

    • Hi Thorsten, could you please confirm the resistors in your photos are R1=R2=220K ?

      I see both resistors marked RED/RED/BLACK/BLACK and BROWN which is more like: R1=R2=220 (Ohms) 1% Tolerance. Am I wrong? Thanks.

      • T3

        OK, I know where it comes from...

        Marco is using a 220 Ohm resistor in his setup - which I used so far - and I simply overlooked the "k". The other resistors Marco uses in similar places as the 220k ones on Reuben's design are 1k. So maybe 1k is the better option compared to 220... 

        • One resistor limits the current going to the transistor and the other is a pull-down resistor that pulls 5V to ground when the camera is triggered. They both basically limit the current @ 3,3 and 5V respectively.

          Even 100 ohm resistors should be fine.

          For 5V, I=U/R=5/100=0,05 A=50 mA;

          for 3,3V I=33 mA.

          Oh, and R2 should definitely be used.

          • Martin,

            I have all the components ready to be soldered, but I am now a bit confused about the recommended resistors…

            What would be the best values for R1 and R2? Thanks.

            • Anything over 100 ohm is ok. There is no best value here. There is practically no difference if you are using 220 or 220k ohm resistors.

              • Circuit design is always a question of trade offs.  If the output impedance of the pixhawk was higher (i.e. current limited) then the value of R1 (the one limiting base-emitter current) would matter.  And if the input impedance of the camera's USB +5V pin was lower (i.e. more current needed) then the value of R2 (the one limiting collector-emitter current) would matter. As it is, the range over which R1 & R2 will work is large.   So the trade off is then the extra current used as you lower R1 & R2 (which at some point will overload the pixhawk) versus noise immunity degrading as you raise R1 & R2.   Personally, I'd go with 1K resistors given that trade off.

          • T3

            Martin,

            thanks a lot! Greatly appreciated!

            I just made a 1k version, which works as well.

            Cheers,

            Thorsten

This reply was deleted.

Activity