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 –


        • MR60

          Ok I will let you know when blog is ready. Thx.

    • Developer

      Yes, work fine also with APM Plane and CAM_TRIGG_DIST, tested now.
      And the little circuit (i mean my previous image) is the Colombo's egg... :P

  • MR60


    I have posted the same on the APM forum, but I paste it here too because you're not the only one to be frustrated about a non functioning AUX port on Pixhawk:

    I have extensively tested today the CAM_TRIGG_DIST functionality on Pixhawk, in servo mode (not relay mode). This means , if it weren't bugged, that Pixhawk should output the maximum PWM value (as defined in camera gimbal parameter screen in mission planner) on ouput AUX1 (RC9) when the multicopter has moved CAM_TRIGG_DIST meters away (defined in full parameters list). If the multicopter does not move, the AUX1 (RC9) should output the minimum PWM value (as defined in the camera gimabl parameter screen).
    However, connecting my PWM analyzer on AUX1 (RC9) of pixhawk shows that erractic PWM values are constantly changing on Pixhawk output AUX1 (between min and max values), and thus AUX1 does not behave as it should according to the CAM_TRIGG_DIST functionality.
    This is very frustrating as it is the only good way to do ortho mapping and photogrammetry.

    I already have read that CAM-TRIGG_DIST did not work in relay mode on PIxhawk in the current firmware. Can a developer confirm that it also does not work in servo mode in the current firmware (V3.1.2) ??
    Or did I miss something ?

    • Hi Hugues,

      I'm not sure if you're reading this thread anymore but I was able to get my Canon S100 with CHDK script running to be triggered by a CAM_TRIGG_DIST (=5 meter for testing indoors) on a pixhawk with my camera cable connected to RC11 (Aux 3) setup as a "servo" (or PWM) output (not relay). The crux is to supply 5v to the Aux power rail and I used some 3x AA batteries to provide power for testing purposes (simply connect some leads from battery to the positive and negative inputs on one of the Aux pins -- I used Aux 1 (RC9)).  

      Now, I think you already have this figured out (the above is for someone like me who had to discover all this) but you were seeing some erratic PWM values. While I don't have a way to analyze any PWM values, I can say that my camera would periodically get triggered when mission planner and the Flight Data screen showed my position moving off ~5m (as one would expect with GPS indoors). It all seemed to be functioning as one would expect. I have the max and min for CAM_SERVO_ON and _OFF set to 1800 and 1100 respectively though I'm not sure if this takes precedence over the RC11_MAX and RC11_MIN (1900 and 1100) that is setup in the RC11_xxx section of Full Parameters within Mission Planner.

      So, in theory, if I can supply 5v to the pixhawk via a BEC or some other source it should work fine.

      My camera cable is a E-Flite EFLA600 where I have one of the leads converted to a servo cable.

      Anyway my Mission Planner settings are as follows:

      BRD_PWM_COUNT = 4  (Aux 1-4 setup as "servo" PWM outputs and Aux 5-6 as "relay" or digital outputs)

      CAM_DURATION = 10 (1 second)

      CAM_SERVO_OFF = 1100

      CAM_SERVO_ON = 1800

      CAM_TRIGG_DIST = 5 (meters for indoor testing)

      CAM_TRIGG_TYPE = 0  (servo or PWM output)

      RC11_FUNCTION = 10 (camera trigger) 


  • Developer

    About the problem with 3.3V output on Pixhawk i think the solution i propose here is easy, using the +5V in the central pin of the Aux output rail (tested with Ixus 140 and work fine):


    1 x BC547
    1 x BC557
    2 x 1 K
    1 x 220 ohm

    For test at the ground the little circuit put the "CAM_TRIGG_DIST" to "3" and walk with your copter/plane with good gps 3d fix, or assign "passthru" to the output channel for the trigger.
    Anyway there's some problems inside the Pixhawk code about the Aux port assigned to some function like the shutter/relay with APM Plane, for example the "manual shutter" with a common servo is not supported, only if you assign "RCx_FUNCTION" to "1" (passthru) and use the pwm port, not the Aux.
    I'm discussing now with other developers.

    • Hi Marco,

      I did similar think that you have done.


      I tested it without Pixhawk and is working perfectly. But when I'm using it conented on Pixhawk it isn't working. I mesured with multimeter. And I have reading when on + - about 5,2V, on S - 0,2V not pressed. If I right click in Flight data in Mission planner on Trigger cammera NOW, I get reading of 0,33V for time I set in parameters. My settings in the Mission planner are following:



      Sometimes when I have camera conected and I am changing settings in Full parameter List camera gets triggered randomly.

      If you have any idea what I am doing wrong. I will be realy greatfull if you can help me out , or anybody else on the forum.



      • Hi Nejc,

        Did u move around 1 meter and test if its triggering for cam_Trigg_dist.

        It might be triggering randomly because of gps variations, when gps loses or gains a sat signal there will be distance change so it triggers, try changing distance to 5 to 10 meters and try.

      • Hi All,

        Given that aerial survey is one of the major drivers for UAVs, it woudl be great if these issues could be detailed a little more clearly.

        I would like to trigger my camera on distance as well as triggering it by one of the switches on my remote. I have a couple of queries;

        1) Is the Ch7 option available in Arduplane? I just don't see it in the parameter list.

        2) if it is possible to trigger the camera from one of your remote channels, how do you tell Pixhawk to trigger the camera on CH10 from CH7 on your remote? Is it;

        RC10 function = 10

        RC7 function = 10


        • Ok, I have it sorted - sort of. 

          I have the camera triggering on distance, but I have no idea how to trigger the camera from the transmitter for Arduplane and Pixhawk.

          Any suggestions?

          • You can't do both. If you want to trigger by RC you need to set that channel to "pass through" in the Params.
This reply was deleted.


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…
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…
DIY Robocars via Twitter
RT @gclue_akira: レースまであと3日。今回のコースは激ムズかも。あと一歩 #jetracer
DIY Robocars via Twitter
UC Berkeley's DIY robocar program
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…
DIY Robocars via Twitter
RT @arthiak_tc: Donkey car platform ... Still training uses behavioral cloning #TCXpo #diyrobocar @OttawaAVGroup
Nov 20
DIY Robocars via Twitter
RT @emurmur77: Points for style. @donkeycar racing in @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video.…
Nov 20
DIY Robocars via Twitter
RT @SmallpixelCar: Going to @diyrobocars race at @UCSDJacobs
Nov 8
DIY Robocars via Twitter
RT @SmallpixelCar: Race @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video.
Nov 8
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
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
DIY Robocars via Twitter
Oct 23
DIY Robocars via Twitter
Oct 19
DIY Robocars via Twitter
Oct 18
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
DIY Robocars via Twitter
RT @araffin2: 🏎️ After hours of video editing, I'm happy to share a best of my Twitch videos on learning to race with RL. 🏎️ Each part is…
Oct 13