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 –

Replies

        • 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

    Hello,

    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) 

      Carl

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

    3701676530?profile=original

    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.

      3702488357?profile=original

      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:

      3702488199?profile=original

      3702488339?profile=original

      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.

      Thanks,

      Nejc

      • 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

        Thanks

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

Activity

DIY Robocars via Twitter
Jan 28
DIY Robocars via Twitter
RT @Heavy02011: ⁦@diyrobocars⁩ : A Home-brew computer club* for Connected Autonomous Driving. talk at #piandmore ⁦@PiAndMore⁩ on Jan 23rd h…
Jan 23
DIY Robocars via Twitter
RT @a1k0n: New blog post! Deep dive into my ceiling light based localization algorithm which runs in 1ms on a Raspberry Pi 3: https://t.co/…
Jan 23
DIY Robocars via Twitter
Great new guide to using @donkey_car https://custom-build-robots.com/donkey-car-e-book-en
Jan 23
DIY Robocars via Twitter
RT @chr1sa: The next @DIYRobocars virtual AI race is tomorrow morn at 9:00am PT. You can watch live on Twitch https://www.meetup.com/DIYRobocars/events/275268196/
Jan 22
DIY Robocars via Twitter
New version of Intel OpenBot! This resolves many of the issues with the first version, including a much smoother tr… https://twitter.com/i/web/status/1352395636369313798
Jan 21
DIY Drones via Twitter
Using ArduRover with an RTK GPS https://ift.tt/2N9I3RO
Jan 18
DIY Drones via Twitter
Jan 18
DIY Robocars via Twitter
Jan 18
DIY Robocars via Twitter
Jan 15
DIY Robocars via Twitter
Jan 15
DIY Drones via Twitter
Jan 14
DIY Robocars via Twitter
RT @Heavy02011: @diyrobocars : A Home-brew computer club* for Connected Autonomous Driving on Jan 23rd, 2021 https://www.meetup.com/Connected-Autonomous-Driving/events/275728684/ #Meetu…
Jan 14
DIY Robocars via Twitter
Jan 14
DIY Robocars via Twitter
RT @Heavy02011: ⁦@diyrobocars⁩ Autonomous Driving Assembly at #rC3. join us at https://rc3.world/rc3/assembly/diyrobocars-f1tenth/ ⁦@f1tenth⁩ ⁦@DAVGtech⁩ ⁦@DWalmroth⁩…
Jan 11
DIY Robocars via Twitter
RT @chr1sa: New car designs coming for our next @DIYRobocars @donkey_car virtual race on the 23rd. Choose any one you want at race time Le…
Jan 11
More…