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.


Gremsy liked Gremsy's profile
Mar 12
DIY Robocars via Twitter
RT @chr1sa: Donkeycar 4.4 released with tons of new features, including path learning (useful with GPS outdoors), better Web and Lidar supp…
Nov 27, 2022
DIY Robocars via Twitter
RT @NXP: We are already biting our nails in anticipation of the #NXPCupEMEA challenge! 😉 Did you know there are great cash prizes to be won…
Nov 24, 2022
DIY Robocars via Twitter
RT @gclue_akira: レースまであと3日。今回のコースは激ムズかも。あと一歩 #jetracer
Nov 24, 2022
DIY Robocars via Twitter
UC Berkeley's DIY robocar program
Nov 24, 2022
DIY Robocars via Twitter
RT @chr1sa: The next @DIYRobocars autonomous car race at @circuitlaunch will be on Sat, Dec 10. Thrills, spills and a Brazilian BBQ. Fun…
Nov 24, 2022
DIY Robocars via Twitter
RT @arthiak_tc: Donkey car platform ... Still training uses behavioral cloning #TCXpo #diyrobocar @OttawaAVGroup
Nov 20, 2022
DIY Robocars via Twitter
RT @emurmur77: Points for style. @donkeycar racing in @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video.…
Nov 20, 2022
DIY Robocars via Twitter
RT @SmallpixelCar: Going to @diyrobocars race at @UCSDJacobs
Nov 8, 2022
DIY Robocars via Twitter
RT @SmallpixelCar: Race @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video.
Nov 8, 2022
DIY Robocars via Twitter
RT @PiWarsRobotics: Presenting: the Hacky Racers Robotic Racing Series in collaboration with #PiWars. Find out more and register your inter…
Oct 23, 2022
DIY Robocars via Twitter
RT @Hacky_Racers: There will be three classes at this event: A4, A2, and Hacky Racer! A4 and A2 are based around UK paper sizing and existi…
Oct 23, 2022
DIY Robocars via Twitter
Oct 23, 2022
DIY Robocars via Twitter
Oct 19, 2022
DIY Robocars via Twitter
Oct 18, 2022
DIY Robocars via Twitter
RT @NeaveEng: Calling all UK based folks interested in @diyrobocars, @f1tenth, @donkey_car, and similar robot racing competitions! @hacky_r…
Oct 13, 2022