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?
do you provide 5V to the output rail of the Pixhawk form a BEC?
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.
Yep I have a bec plugged in on the output rail giving 5v. I run a lidar-lite this way.
A little frustrating the issue is not hardware or circuit related but settings within the pixhawk is what has given me the headache!
Anyway, glad to have it sorted now and an easy fix is always the best!
Just need to test with the camera...
Depending your model of Pixhawk, you have only servo output on the first 4 aux channels. Take a look at my posts yesterday.
I'm using aux 5, relay signal, relay id'd as that on aux 5, 1tenth secont pulse andim taking 5 v power off the receiver to the main out bus...easy setup once I figured out the transistor EBC order.
LOL. Where were you two months ago when I needed you. Thanks for your post it's much appreciated. Just about to start my business here in NZ.
Hi Thorsten, could you please confirm the resistors in your photos are R1=R2=220K ?
I see both resistors marked RED/RED/BLACK/BLACK and BROWN which is more like: R1=R2=220 (Ohms) 1% Tolerance. Am I wrong? Thanks.
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...
OK, I know where it comes from...
Marco is using a 220 Ohm resistor in his setup - which I used so far - and I simply overlooked the "k". The other resistors Marco uses in similar places as the 220k ones on Reuben's design are 1k. So maybe 1k is the better option compared to 220...
One resistor limits the current going to the transistor and the other is a pull-down resistor that pulls 5V to ground when the camera is triggered. They both basically limit the current @ 3,3 and 5V respectively.
Even 100 ohm resistors should be fine.
For 5V, I=U/R=5/100=0,05 A=50 mA;
for 3,3V I=33 mA.
Oh, and R2 should definitely be used.
thanks a lot! Greatly appreciated!
I just made a 1k version, which works as well.
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 sec...works every time. Using KAP, I've got it set to instantly execute the script w/o delays etc.