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 –


        • 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:


    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:


    Some pictures while building it:

    Placing the parts:



    After soldering:


    The final cable:



    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!



    • 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


            thanks a lot! Greatly appreciated!

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



This reply was deleted.


DIY Robocars via Twitter
RT @TinkerGen_: "The Tinkergen MARK ($199) is my new favorite starter robocar. It’s got everything — computer vision, deep learning, sensor…
Nov 23
DIY Robocars via Twitter
Nov 23
DIY Robocars via Twitter
RT @roboton_io: Join our FREE Sumo Competition 🤖🏆 👉 #sumo #robot #edtech #competition #games4ed…
Nov 16
DIY Drones via Twitter
First impressions of Tinkergen MARK robocar
Nov 16
DIY Robocars via Twitter
Our review of the @TinkerGen_ MARK robocar, which is the best on the market right now
Nov 15
DIY Robocars via Twitter
RT @Ingmar_Stapel: I have now explained the OpenBot project in great detail on my blog with 12 articles step by step. I hope you enjoy read…
Nov 15
DIY Robocars via Twitter
RT @DAVGtech: This is a must attend. Click the link, follow link to read the story, sign up. #chaos2020 #digitalconnection #digitalworld ht…
Nov 15
DIY Robocars via Twitter
RT @a1k0n: Got a new chassis for outdoor races (hobbyking Quantum Vandal) but I totally didn't expect that it might cause problems for my g…
Nov 11
DIY Drones via Twitter
First impressions of the Intel OpenBot
Nov 10
DIY Robocars via Twitter
Nov 9
DIY Robocars via Twitter
Excellent use of cardboard instead of 3D printing!
Nov 7
DIY Robocars via Twitter
RT @chr1sa: We've got a record 50 teams competing in this month's @DIYRobocars @donkey_car virtual AI car race. Starting today at 10:00am…
Nov 7
DIY Robocars via Twitter
Nov 6
DIY Robocars via Twitter
RT @a1k0n: Car's view, using a fisheye camera. The ceiling light tracking algorithm gave me some ideas to improve ConeSLAM, and having grou…
Nov 5
DIY Robocars via Twitter
RT @a1k0n: To get ground truth I measured the rug, found the pixel coordinates of its corners, calibrated my phone camera with my standard…
Nov 5
DIY Robocars via Twitter
RT @a1k0n: @DIYRobocars is back in December, but outside. Time to reinvestigate ConeSLAM! I rigged up a quick and dirty ground-truth captur…
Nov 5