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?
Replies
Anyone have any ideas why I'm not seeing any voltage from the middle pin when the Pixhawk tries to trigger the camera? I do see 3.3v from the signal pin.
CAM_TRIGG_TYPE = 1
CAM_TRIGG_DIST = 1
CAM_DURATION = 100
RELAY_PIN = 54
I'm getting the same result no matter which relay pin I use.
Pixhawk is a 3.3V system. You need to step up the voltage from 3v3 to 5V
I see where I got confused. In order to use Marco's circuit you need to provide 5v to the middle row of the AUX pins from an alternate power source. Is this correct?
Correct, but first check if there's now +5V in the middle row.
I grabbed some transistors from Radio Shack and had Marco's circuit working in short order. It outputs a 5v signal with both a relay (pin 54) and PWM (pin 52). I successfully bench tested a CHDK script (CAM_TRIGG_DIST= 1) using the relay pin. I'll try it in the air tomorrow.
I tried to pass the PWM signal to a GentWire USB2, but the GentWire wouldn't trigger. I didn't spend much time on it. I'd like to make that work so I can use the 2nd servo connection to tell it to open/close the lens for takeoff/landing as well as set some options in the script.
Thanks Marco for the circuit!
@Tom,
I had the same kind of issues, that is Pixhawk unable to drive an external IR device connected on the AUX ports. I solved it by adding a 5V BEC connected to the Pixhawk output rail, so that there is enough voltage and current to drive the IR device.
Maybe you could try that too ? (in my case 5V was needed. I do not know which input voltage you need on your device you are talking about, so please adapt the voltage of your BEC accordingly).
Also, you say "CAM_TRIGG_DIST: 10" equals a meter. I think this is incorrect, it indicates 10 meters, not one (anyway it is in meters when used in servo mode or type=0; maybe it is different in relay mode but I doubt it).
Thanks Hugues! I already have the 5V BEC from my electronic speed controller connected to the output rail via the THROT channel. Also, the AUX signal pins of the Pixhawk are 3.3v and I don't believe sourced by the rail when configured as a digital relay. Correct, my typo, CAM_TRIG_DIST: 1 is my setting. Thanks for catching this error :)
Has anyone had luck implementing the Pixhawk camera trigger with the Sparkfun Step-up Converter NCP1402 https://www.sparkfun.com/products/10968 ? It's not working for me. I believe I have the Pixhawks settings correct:
BRD_PWM_COUNT: 4
RELAY_PIN: 54
CAM_TRIGG_TYPE:1
CAM_TRIGG_DURATION: 50 (5 sec)
CAM_TRIGG_DIST: 10 (1 meter)
On the bench I can measure the relay voltage on pin Aux 5: 54 change from 0v to 3.3v without the level shifter connected. It holds for the 5s duration time then turns off and repeats every couple of moments. Using the USB trigger cable with SparkFun step-up converter in series and the CHDK script from the APM to CHDK Camera Link Tutorial I can trigger the camera to take a photo by using a 1.5v battery connected to the 3-pin connector I plug into the Pixhawk Aux port 5. However, when I connect the cable w/level-shifter between the PixHawk and camera I get no trigger at the camera. The input voltage to the level-shifter (from the PixHawk Aux 5 pin) varies from 0v to 0.1v and the output voltage from the level-shifter (to the camera) varies between 1V and 3.8v . It's almost as if the PixHawk does not have the current/drive required by the level-shifter. Does anyone have the same issue or have any idea how I might get this working. I see robustini has a circuit posted on DIYDRONES but I'm looking for an out of the box solution without building a circuit with discrete transistors/components. Thanks!
@Tom,
I get similar results using the Sparkfun step-up converter. Without the converter, it works as it should with the 3.3v output. I can't imagine that the converter draws any significant amount of power. Maybe someone with more knowledge of the Pixhawk power system will chime in. Otherwise, we'll have to go Marco's way.
Are those BC547 & BC 557 transistors in his diagram? Hard to read the image.
Same here. No dice on the converter this weekend. Components and proto board have been ordered for the circuit Marco posted. If I get it working I'll post some pics.
BTW - Sparkfun has a promo code (SXSW2014) for $10 off orders over $20 that's good through April 30th.