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 –


            • Note my previous posts...using 1/8 watt 220k resistors works as well....I'm taking 5v off the receiver into the pixhawk main I/o rail.

              Relay duration is set to minimum @ 1/10 every time. Using KAP, I've got it set to instantly execute the script w/o delays etc.

      • T3

        Hi Theo,

        well, it seems you are right! Thanks!

        I checked my order and it is indeed 220 Ohms instead of 220k Ohms. I should better have double checked the colors.

        However, it is working... 

        Can anyone with some background in electronics comment on this - especially on the potential consequences?

        As a side note: this is working with the 5V provided by the AUAV-X2. So there is no additional BEC required to power the output rail (just bench tested). But I am a little scared now because of the R2 "shortcut". As R2 seems not to be required... 



    • Thorsten - I built the cable using the circuit board from OSHPark..soldered-up and connected to my Iris.

      Camera is a Elph 330HS with CHDK loaded...the script i'm running works if I plug a USB into a fires right off.
      I connected to AUX 5 and configured in MP per the forums etc.  I connected +5 and ground from the receiver channel 4 connector into position 8 on the "main out" area of the px4.

      Set Aux 5 to trigger via relay, set pin 54 as relay pin.

      Commanded a camera trigger from MP...nothing....

      Tthhe receiver 5v output provide enough amperage? I checked on my voltmeter...there is indeed 5v there.

      • UPDATE - I did not check the EBC layout on the transistors I bought (store said they were a replacement for the BC547)....and of course the notation in the vendor data on-line (NTE Electronics) said the EBC was 180 rotated from the BC547.

        So....built another cable and voila!  very slick.

        Here is my install...not elegant, but functional and it works. +5v from the receiver on the white/black leads into the main out bus on the PX4. Connected the CHDK cable onto AUX 5, set the signal to relay per my previous post. The circuit board is wrapped under some rather thick shrink tube ("its what they had"). USB cable from an old Motorola phone charger.




    • Cheers Thorsten, I am happy I managed to help someone :o)  You can also use this to operate leds or other things you need to switch on and off ..current is only limited by the transistor specs, you can also increase the voltage supplied if you may need 12v ..

      • T3

        Hi Reuben,

        yes, thanks! :-)

        Previously, I used  Marco's design. It works great and reliable as well but the advantage of your circuit and ZaPf's layout is, that it has less parts and that you can order the board form OSH Park for $1.15 for three of them - which is perfect!

  • MR60

    Here now the correct circuit to trigger a Sony Alpha 5000 with one transistor (tested succesfully by configuring one of the Aux port as a relay):

    3702059444?profile=original(This is real live diy !)

    • Hi hugues i have some problems with your circuit. What is the usb pinout connection ?. Shutter and focus goes to V+?

    • Developer

      Nice job Hugues! ;)

    • Hi..

      Is this woks for RX100m2 ?


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…
DIY Robocars via Twitter
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