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 –


  • Any chance you could post a photo please Reuben? This is technically challenging for some of us, LOL.

    • Hi Martin have you succeeded yet? ..if not I will make you a cable and send it to you :o)

      • Just waiting for the components to arrive, will 0.5w resistors be ok to use? and should I mount the transistor and resistor on a piece of circuit board.

        Thanks for the offer though Reuben, I may have to take you up on it if I come unstuck!

        • Hi Martin.

          Yes 0.5w is fine as there is hardly any load .. you can mount everything to a small piece of proto board or just solder the legs of the components and use heat shrink.

  • Man this is a mess. I can't get this to work with the current version of apm plane. I have a proper cable made with the sparkfun voltage converter.

    I need clarification here, or I'll go insane!

    Will this work using the sparkfun converter and "relay" mode on a pixhawk? OR Do I need to build Marco's circuit. I don't want to use a PWM switch.

    How did this get so messed up? Any help will be very much appreciated!

    • Paul,

      The short answer is no. The Pixhawk has the right voltage but cannot supply enough current to power the sparkfun voltage converter. You need to build Marco's circuit.

      • What a mess indeed.  The wikis and forums are littered with false and misleading information on this topic.  I wasted the better part of a weekend trying to get the Sparkfun voltage converter and/or a Turnigy relay switch to work.  Even *with* good clean 5v being supplied to the rails, I could not get either device to work.  Marco's circuit worked great and *that* should be the solution on all of the wikis.  In particular, the APM wiki has the following misleading statement:

        "For Pixhawk, connect the CHDK cable to aux out pin 5. However, this pin outputs only 3.3V, and 5V are required to trigger CHDK. To convert to 5V, you’ll need to integrate a step-up converter (like the one here from Sparkfun) in-line with the cable to trigger CHDK."

        There is a tutorial video on showing the use of LED light controllers with the Sparkfun voltage converter.  This arrangement seems to work, but I don't understand why/how and it doesn't seem like a good solution.

        Does anyone know how to get the APM wiki fixed?


        • Developer

          Gary, the wiki is correct.  Either the sparkfun converter or Marco's circuit work fine.

          • Craig,

            I have to agree with Gary. I, too, purchased the SparkFun converter and found that it would not work with a PixHawk. The PixHawk has 3.3 volts alright, but cannot supply the current to drive the SparkFun converter to deliver the 5v output while Marco's circuit worked just fine. 

            • Developer

              It works on all the vehicles we have here.

              I'm going to guess what your trouble is.  The Pixhawk does not supply 5V to the converter.  You have to supply it from a separate source. i.e. a second power module or BEC.

This reply was deleted.


DIY Robocars via Twitter
How to use the new @donkey_car graphical UI to edit driving data for better training
DIY Robocars via Twitter
RT @SmallpixelCar: Wrote a program to find the light positions at @circuitlaunch. Here is the hypothesis of the light locations updating ba…
DIY Robocars via Twitter
RT @SmallpixelCar: Broke my @HokuyoUsa Lidar today. Luckily the non-cone localization, based on @a1k0n LightSLAM idea, works. It will help…
DIY Robocars via Twitter
@gclue_akira CC @NVIDIAEmbedded
Nov 23
DIY Robocars via Twitter
RT @luxonis: OAK-D PoE Autonomous Vehicle (Courtesy of zonyl in our Discord:
Nov 23
DIY Robocars via Twitter
RT @f1tenth: It is getting dark and rainy on the F1TENTH racetrack in the @LGSVLSimulator. Testing out the new flood lights for the racetra…
Nov 23
DIY Robocars via Twitter
RT @JoeSpeeds: Live Now! Alex of @IndyAChallenge winning @TU_Muenchen team talking about their racing strategy and open source @OpenRobotic…
Nov 20
DIY Robocars via Twitter
RT @DAVGtech: Live NOW! Alexander Wischnewski of Indy Autonomous Challenge winning TUM team talking racing @diyrobocars @Heavy02011 @Ottawa…
Nov 20
DIY Robocars via Twitter
Incredible training performance with Donkeycar
Nov 9
DIY Robocars via Twitter
RT @JoeSpeeds: Sat Nov 6 Virtual DonkeyCar (and other cars, too) Race. So bring any car? @diyrobocars @IndyAChallenge…
Oct 31
DIY Robocars via Twitter
RT @JoeSpeeds: @chr1sa awesomely scary to see in person as our $1M robot almost clipped the walls as it spun at 140mph. But it was also awe…
Oct 29
DIY Robocars via Twitter
RT @chr1sa: Hey, @a1k0n's amazing "localize by the ceiling lights" @diyrobocars made @hackaday! It's consistently been the fastest in our…
Oct 25
DIY Robocars via Twitter
RT @IMS: It’s only fitting that @BostonDynamics Spot is waving the green flag for today’s @IndyAChallenge! Watch LIVE 👉…
Oct 23
DIY Robocars via Twitter
RT @IndyAChallenge: Congratulations to @TU_Muenchen the winners of the historic @IndyAChallenge and $1M. The first autonomous racecar comp…
Oct 23
DIY Robocars via Twitter
RT @JoeSpeeds: 🏎@TU_Muenchen #ROS 2 @EclipseCyclone #DDS #Zenoh 137mph. Saturday 10am EDT @IndyAChallenge @Twitch
Oct 23
DIY Robocars via Twitter
RT @DAVGtech: Another incident:
Oct 23