<img src="http://b.scorecardresearch.com/p?c1=2&c2=6036030&c4=rcgroups.com&cv=2.0&cj=1" alt="" /> Controlling external devices like Gimbals and lights with APM - RC Groups
Thread Tools
This thread is privately moderated by mike_kelly, who may elect to delete unwanted replies.
Jan 26, 2015, 09:07 PM
Wisconsin
Mini-HowTo

Controlling external devices like Gimbals and lights with APM


************************************************** ************************************************** *******************************
* Be advised that this article is now obsolete for Pixhawk. I have written a new article for Pixhawk.

************************************************** ************************************************* *******************************


I have been wrestling with this issue for weeks and I thought I should document what I discovered. Many people these days need to use more channels to control external devices like Gimbals, Lights, Retracts, Camera Shutter and Video switches. For more traditional buillds it is not hard to take the pwm outputs of your reciever and directly connect them to your devices, by-passing the APM flight controller...until you run out of channels. But for newer builds with PPM or S.bus receivers you may not have any pwm outputs to use directly from your receiver. Yes with many Frsky receivers you can do both s.bus and pwm but that is a different story.

So if you are using ppm input to your APM how do you control extra devices?
Mission Planner provides a optional hardware page in setup for APM, it is labeled "Camera Gimbal". It allows you to map input channels from your transmitter to an output pin on the APM board. This is where the documentation gets a little tricky. First APM does not support more than 8 channels. Pixhawk does but not APM. Second the documentation is poorly written and uses duplicate names/labels to refer to multiple different pins.

On the gimbal hardware page there are three control options for gimbal tilt, roll and yaw. But these control options can control other devices than just gimbals. This is not clear in the 3DR wiki.

You can control from your RC Transmitter on channels you have assigned to certain tasks. Say you want to control lights from your RC channel 8. You have assigned a switch on your RC Transmitter and mapped it to channel 8. On the Gimbal Setup page on the right side of say the top "Tilt" Mission Planner calls this input RC8.

Don't get confused when the wiki calls the input channels RC5-RC8 and the output pins RC5-RC11.

The wiki should be labeled like this -

The input pins are your virtual channels coming from your transmitter through your ppm receiver via a single wire connected to input 1 (with pins 2and 3 jumpered) or RCIN on the Pixhawk or from the separate PWM channels from your recevier on APM. What the wiki calls input RC8 means your transmitter channel 8 etc.

The output pins you select are mapped this way:
RC6 is motor output pin 6 labeled OUT on the APM board.
RC7 is motor output pin 7 labeled OUT on the APM board.
RC8 is motor output pin 8 labeled OUT on the APM board.
If you have an octocopter your 6,7, 8 motor outputs are already in use for the motors. Same for out 5&6 with a hex. So they can not be used for optional devices.

RC9 is an aux pin A9 labeled on the APM board and AUX 1 on the Pixhawk
RC10 is an aux pin A10 labeled on the APM board and AUX 2 on the Pixhawk
RC11 is an aux pin A11 labeled on the APM board and AUX 3 on the Pixhawk
RC12 is not available on the APM board and AUX 4 on the Pixhawk
RC13 is not available on the APM board and AUX 5 on the Pixhawk
RC14 is not available on the APM board and AUX 6 on the Pixhawk

APM does "massage" these semi-passthrough paths so some devices may not work.

You can have APM/Pixhawk just pass through the signal without modification on RC6,7,8 using the RCx_function parameter. In the full parameter list there are parameters named RCx_function( where the little x means 6,7 or8). This is the parameter that is changed by the optional hardware gimbal page when you click on the input/output options. One of the values is "1" which is labelled in the description as "RC Passthrough". This means that the input 6, input 7 or input 8 from your transmitter can be passed through the APM/Pix, without change, to motor out6, 7 or 8 as a pwm signal.

>>>
>>>But RC_Pass_through does not work in any version of Arducopter except 3.2! (and I assume above)
>>> Also note that on the Pixhawk the outputs are not enabled until you press the arming switch or disable it.
>>>

So you can control two devices that don't mind being "filtered" by APM on aux output pins A10 and A11. You can passthrough full control of channel 6, channel 7, and Channel 8 via the motor out 6, 7 or 8 if they are not being used by your motors.

In the full parameter list you can control all these things directly without using the Gimbal Setup page at all. You can control much more than just pwm devices with APM/Pixhawk.

First is a set of parameters that tell APM what you are controlling and from what channels.
MNT_TYPE,1
MNT_RC_IN_PAN,0
MNT_RC_IN_ROLL,0
MNT_RC_IN_TILT,8

MNT_TYPE = which sets the kind of device we are dealing with and for PWM devices we choose 1.
Mount Type (MNT_TYPE)
Mount Type (None, Servo or MAVLink)
Value Meaning
0 None
1 Servo
2 MAVLink
3 Alexmos Serial
4 SToRM32 MAVLink
5 SToRM32 Serial

For each axis of the gimbal there is a parameter to define where control is coming from.
So setting mnt_rc_in_tilt to 8 would cause your RC Transmitter switch mapped to channel 8 to be the input to the Gimbal Tilt control. There are similar parameters for ROLL and PITCH.

tilt (pitch) RC input channel (MNT_RC_IN_TILT)
0 for none, any other for the RC channel to be used to control tilt (pitch) movements
Value Meaning
0 Disabled
5 RC5
6 RC6
7 RC7
8 RC8

To tell APM/Pix what output you want to control your Tilt in our example, which might be lights instead of a gimbal, we use the RCx_Function. If we are using passthrough we set this parameter to 1 and it will bypass the whole gimbal page. Input from RC transmitter on channel 8 will be connected to motor out 8 and that is it. But using outputs 9-14 we can map an input to a different output. So if we want our input channel 8 to go to output 9 (AUX9 on APM and AUX1 on Pixhawk) then we set RC9_Function to one of the GImbal setup page options tilt, roll or pan which would be 7,8 or 6 in that order. So RC9_Function=7 which is tilt. Then go to the Gimbal setup page and set tilt to RC9. This tells APM/Pix to get input from channel 8 and output it on Aux output 9 (Aux9 on APM/Aux1 on Pixhawk)

Servo out function (RC9_FUNCTION)

Setting this to Disabled(0) will setup this output for control by auto missions or MAVLink servo set commands. any other value will enable the corresponding function
Value Meaning
0 Disabled
1 RCPassThru
2 Flap
3 Flap_auto
4 Aileron
6 mount_pan
7 mount_tilt
8 mount_roll
9 mount_open
10 camera_trigger
11 release
12 mount2_pan
13 mount2_tilt
14 mount2_roll
15 mount2_open
16 DifferentialSpoiler1
17 DifferentialSpoiler2
18 AileronWithInput
19 Elevator
20 ElevatorWithInput
21 Rudder
24 Flaperon1
25 Flaperon2
26 GroundSteering
27 Parachute
28 EPM
29 LandingGeari

As you can see by the above list of devices there are lots of other things you can control and I have not figured out anything about the other ones ... yet.
Last edited by mike_kelly; Apr 19, 2017 at 07:55 AM.
Sign up now
to remove ads between posts
Jan 27, 2015, 12:11 PM
Registered User
Mike very good info , Thank you.
just curious if you were talking CPPM not S bus for the input of APM ?
I am just starting back to this hobby now , I have been gone for almost a year and I try to refresh my setup again before purchase any additional new stuff.
I follow your threads especially that I want to use LRS and plan to buy Taranis
and and I want to stick with APM and Pixhawk for the FC.
I am planning to buy APM mini and want to have simple set up with Flipflap LRS so I can use telemetry with the same receiver.
I might need your big help
Thank you again
Jan 27, 2015, 05:11 PM
Wisconsin
Quote:
Originally Posted by car2carl
Mike very good info , Thank you.
just curious if you were talking CPPM not S bus for the input of APM ?
I am just starting back to this hobby now , I have been gone for almost a year and I try to refresh my setup again before purchase any additional new stuff.
I follow your threads especially that I want to use LRS and plan to buy Taranis
and and I want to stick with APM and Pixhawk for the FC.
I am planning to buy APM mini and want to have simple set up with Flipflap LRS so I can use telemetry with the same receiver.
I might need your big help
Thank you again
Actually there is a mod to reprogram the ppm encoder on the APM so that it will accept s.bus. But I used the cppm ( same thing as ppmsum which some people shorten to just PPM) converter from Frsky with my FrSky receivers (pre-FlipFlap)

I really like simplifying the build by eliminating the separate telemetry radios and FlipFlaps design is centered around reliability rather than tons of features. Also I am really happy with my Taranis. It is more radio than I will ever need. It can be a little intimidating figuring out how to program it because it is so flexible that you can do most tasks in more than one way. But there is so much user support you can find a youtube or RCGroups post on how to do what you need.

Well welcome back and have a lot of fun with your new build.
Jan 27, 2015, 08:59 PM
Wisconsin
Car2carl,

I feel compelled to add a caveat. I have spent a lot of time working on these projects. I mean hundreds of hours. Partly because I have never done RC before. But I do have 35 years of experience in digital electronics. I certainly don't want to discourage you from this adventure but I don't want to make it sound too easy. I enjoy the build as much as the flying and the harder the project the more fun. But it does get exhausting some times. There is lots of information out there but often is it broken into lots of pieces and some of it is wrong. Searching for answers can involve a little snippet here and there and a lot of digging. That is one reason I try and document the hard fought info here so someone else doesn't have to go the same route. But sometimes you will have to, just don't give up.

So just be advised that you need to be "in" for the long haul. Then have a great time.
Jan 27, 2015, 09:58 PM
Registered User
Mike

thank you for your advice it is very encouraging.

The way I see you with humble tread by letting other people know what you found and what you learned is a plus. so I sub you blog . I wish I have as big RC knowhow as you. and English is as second language is another barrier for me too.

Thank you again
Thank you again.
Jan 27, 2015, 10:18 PM
Wisconsin
Well you are way ahead of me with languages. I have tried to learn french, italian and spanish but I am not very good with languages.

All the best
Jan 27, 2015, 10:24 PM
Registered User
Mike
Can you help me, when I have PPM connection from receiver to APM,
In my case I have spektrum receiver which I plan to connect the satellite only (some people call remote receiver only) to APM
The channel sequence is different with APM default firmware so I need to play with RC Mapping input setting. is the failsafe still can be triggered by ppm encoder from the APM. if the signal lost?
Do we need to bypass the ppm encoder chip at the APM board as some people stated in the forum.
I am coming home from overseas assignment and about to start this hobby again this week.
thank you
car2carl
Jan 28, 2015, 09:08 AM
Wisconsin
Quote:
Originally Posted by car2carl
Mike
Can you help me, when I have PPM connection from receiver to APM,
In my case I have spektrum receiver which I plan to connect the satellite only (some people call remote receiver only) to APM
The channel sequence is different with APM default firmware so I need to play with RC Mapping input setting. is the failsafe still can be triggered by ppm encoder from the APM. if the signal lost?
Do we need to bypass the ppm encoder chip at the APM board as some people stated in the forum.
I am coming home from overseas assignment and about to start this hobby again this week.
thank you
car2carl
The issues with failsafe operation are complicated because APM does it's own failsafe and most receivers can do their own failsafe. So it can be a task to get them tp work together. I have no knowledge of spectrum radios so I can't help with that, sorry.
Feb 04, 2015, 04:04 PM
Arrière pays Niçois
salience's Avatar
Salut Mike !
Your information comes at just the right time for me - I'm just installing/setting up my first gimbal, in a "sort of" TRex 500. The "sort of " is a rather long story so I won't go into that for the moment.

I've got an X-Cam 2 axis, and I've also been looking at the setup details for other gimbals as well, and been a little puzzled at the connection of the gimbal controller to the AIL & ELE channels of the Rx. This is of course independent from the separate connection for controlling tilt. I assume that the gimbal can get "advance information" of what the aircraft is about to do from the AIL & ELE PWM signals, and act accordingly without having to wait and see exactly what the aircraft movement is that needs to be corrected to keep the cam steady. Is that logical?

However, using a FC such as the APM would mean that the Rx signals wouldn't necessarily supply the right signals, since the APM modifies or "filters" as you say, the Rx signals and merely "takes them into consideration". And of course in some of the APM flight modes, the signals from the Rx don't mean anything at all to the gimbal since they are unchanging, as in auto or loiter mode for example, where you are not even touching the sticks.

SO, it seems to me the gimbal needs somehow to get "advance notice" of what the aircraft is about to do from the APM, not the Rx. To this end, I checked out the parameters in MP, and see that Ch7 and Ch8 RC7&8_function can be set to Aileron and Elevator. Again I must assume that then the OUTPUT of Ch7 and Ch8 from the APM is a duplicate of the Pitch and Roll mix supplied to the 3 head servos.

Think I'm on the right track here or just way off in right field? In any case, I'm going to wire things up like that and see what happens.

BTW, I too have gotten more than slightly confused/annoyed by the contradictions, bad terminology, and outright mistakes in the various "guides" to the APM and Arducopter, but I havent crashed too many times as a result, so it remains mostly an interesting puzzle!
Feb 04, 2015, 04:35 PM
Wisconsin
Quote:
Originally Posted by salience
Salut Mike !
Your information comes at just the right time for me - I'm just installing/setting up my first gimbal, in a "sort of" TRex 500. The "sort of " is a rather long story so I won't go into that for the moment.

I've got an X-Cam 2 axis, and I've also been looking at the setup details for other gimbals as well, and been a little puzzled at the connection of the gimbal controller to the AIL & ELE channels of the Rx. This is of course independent from the separate connection for controlling tilt. I assume that the gimbal can get "advance information" of what the aircraft is about to do from the AIL & ELE PWM signals, and act accordingly without having to wait and see exactly what the aircraft movement is that needs to be corrected to keep the cam steady. Is that logical?

However, using a FC such as the APM would mean that the Rx signals wouldn't necessarily supply the right signals, since the APM modifies or "filters" as you say, the Rx signals and merely "takes them into consideration". And of course in some of the APM flight modes, the signals from the Rx don't mean anything at all to the gimbal since they are unchanging, as in auto or loiter mode for example, where you are not even touching the sticks.

SO, it seems to me the gimbal needs somehow to get "advance notice" of what the aircraft is about to do from the APM, not the Rx. To this end, I checked out the parameters in MP, and see that Ch7 and Ch8 RC7&8_function can be set to Aileron and Elevator. Again I must assume that then the OUTPUT of Ch7 and Ch8 from the APM is a duplicate of the Pitch and Roll mix supplied to the 3 head servos.

Think I'm on the right track here or just way off in right field? In any case, I'm going to wire things up like that and see what happens.

BTW, I too have gotten more than slightly confused/annoyed by the contradictions, bad terminology, and outright mistakes in the various "guides" to the APM and Arducopter, but I havent crashed too many times as a result, so it remains mostly an interesting puzzle!
I should edit my post and mention that the APM can do three types of gimbal control
Firstly,it can act as a gimbal controller itself. If you click on the check box "stabilize" it will actually control the gimbal for stabilization. I am not sure I would subscribe to this approach because the APM 8 bit controller is at it's limits. I would be concerned about over taxing the cpu.

Second it can simply send commands to the external gimbal controller, which does the real stabilization, to control pitch, roll and yax movement. This mode allows limits for movement and setting the pwm ranges.

Third you can use rc_pass_through to simply use your radio commands to directly control your external device. This is handy for people using PPM to strip out a pwm signal to use for an external device like a gimbal.

I am not sure what your documentation is trying to say, and a lot of the docs for these devices are very confusing. I have never run across a gimbal that wants to have knowledge of the position of the aircraft. (unless it wants to be controlled by the flight controller) Most common gimbal controllers have their own sensors to determine position and requirements to move the camera. Those RC7/RC8 function settings are to control AL/ELEV on a plane I think. But you can pass through, using RC7 and RC8, to the motor output pins (if you don't use 8 motors) the radios direct control of channel 7 and channel 8. But it still sounds strange to me that your gimbal controller wants it. But I have very narrow experience being a newbie myself.

Good Luck and have fun with it.
Feb 04, 2015, 04:55 PM
Arrière pays Niçois
salience's Avatar
Well... check out this diagram from the X-CAM manual - see the 4-wire connection "To R/C Receiver." There is a wire for the TILT control channel, and two wires to the AIL and ELE channels. Note they are optional but "improve the gimbal's dynamic performance". Now what function can they serve? My guess is that they provide the gimbal with a "preview" of what is about to happen when you will move the AIL/ELE sticks. But as I mentioned, since it is APM that is doing the actual controlling, the Rx AIL&ELE signals are moot at least in some flight modes. The gimbal would need the equivalent AIL&ELE signals from the APM and that couldn't be OUTPUT 1-2-3 which control the CP servos.

Edit: and you wdnt want the "feedthrough" since as I say, the Rx signal may not mean a thing in certain flight modes.
Given the limitations of APM I wouldn't try to use it as a gimbal controller, I don't even control my main and tail motors with the APM but with direct from Rx. (I have built an experimental gearless TRex 500, double direct drive).
Midnight here, yawn, signing off
'till the morrow.
Last edited by salience; Feb 04, 2015 at 05:06 PM.
Feb 04, 2015, 05:41 PM
Wisconsin
Quote:
Originally Posted by salience
Well... check out this diagram from the X-CAM manual - see the 4-wire connection "To R/C Receiver." There is a wire for the TILT control channel, and two wires to the AIL and ELE channels. Note they are optional but "improve the gimbal's dynamic performance". Now what function can they serve? My guess is that they provide the gimbal with a "preview" of what is about to happen when you will move the AIL/ELE sticks. But as I mentioned, since it is APM that is doing the actual controlling, the Rx AIL&ELE signals are moot at least in some flight modes. The gimbal would need the equivalent AIL&ELE signals from the APM and that couldn't be OUTPUT 1-2-3 which control the CP servos.

Edit: and you wdnt want the "feedthrough" since as I say, the Rx signal may not mean a thing in certain flight modes.
Given the limitations of APM I wouldn't try to use it as a gimbal controller, I don't even control my main and tail motors with the APM but with direct from Rx. (I have built an experimental gearless TRex 500, double direct drive).
Midnight here, yawn, signing off
'till the morrow.
Sure enough! I think you have guessed correctly as far as implementing with APM. I am guessing they eliminate some of the expensive sensors on the gimbal by using the information from the channel...

NO wait, normally the Ail/Elev are two of the first four channels. You could do a "Y" cable I suppose off the receiver to do what they want? The question is if the ch7/ch8 info is a pwm signal that echos the Ail and elev signals or a special signal designed for to control a special aircraft.

Well I think you have a plan for the best possible way to make a go of it.

Let me know how you do!

Cheers
Mar 10, 2015, 09:48 PM
Registered User
jfrabat's Avatar
Great info, Mike. One question, though; is it possible for Pixhawk to pass through PPM instead of PWM? I have a video switcher/Strobe controller/ shutter controller that accepts PPM which I would rather use like this instead of having to use 3 wiresnfor PWM....
Mar 25, 2015, 08:47 AM
Wisconsin
Quote:
Originally Posted by jfrabat
Great info, Mike. One question, though; is it possible for Pixhawk to pass through PPM instead of PWM? I have a video switcher/Strobe controller/ shutter controller that accepts PPM which I would rather use like this instead of having to use 3 wiresnfor PWM....
Sorry I did not get a notice of your post.

No APM can not pass through a PPM signal. If you are using RCCC for your video switch it can "strip out" a PWM single channel from the PPM stream that you can then use.
May 21, 2015, 02:12 AM
Registered User
Hi
I have a R6308SBT receiver connected and working fine with Pixhawk via SBUS. I want to passthrough channel 7 or 8 and connect it to my gimbal input pins to control the pitch of my camera.
Still struggling to make this work on my Pixhaw, but no success yet. I cannot understand which of the RCx_FUNCTION are mapped to which AUX output on the Pixhawk? Please help!

EDIT: Discussion goes to http://diydrones.com/forum/topics/ho...age=4#comments
Last edited by bortek; May 21, 2015 at 07:14 AM.