Saturday, September 1, 2012

ArduPilot TX Flight Mode Switch

flight mode switch (image from seller)

I have posted several times about modifying my FlySky FS-TH9X radio.  I modified the radio for use with an ArduCopter multi-rotor UAV that I built.  The ArduCopter is controlled by the ArduPilot autopilot flight system.  The ArduPilot has several selectable flight modes that change the flight characteristics.  For example, the "Alt Hold" mode will automatically maintain the current altitude of the UAV.  "Loiter" mode holds the UAV in it's current location.  While these modes improve the flight experience, they are somewhat difficult to program and select.

Normally the six flight modes are selected based on the position of two switches on the transmitter; such as the three position flight mode switch and the two position aileron dual rate switch.  3 x 2 = 6 possible switch combinations for six different modes.  While this setup works, there are two problems.  1)  It is somewhat difficult to program the switches to work properly with the flight modes.  It took me several attempts to get it right.  And 2), it's not that easy to remember what switch settings correspond to which flight modes.  Luckily I found a simple solution one day while searching eBay.

The idea of this system is to replace one of the potentiometers (pots) on the transmitter with a six position switch.  The switch is then wired to four miniature pots.  The resistance of each pot can be adjusted separately.  With the four pots and a positive and a negative lead, you can have six different resistance values for each position of the switch.  Those six values can then be easily adjusted to correspond to six flight modes by simply adjusting the pots.  The result is easier programming and selection of the flight modes. 

parts in the kit

pots glued together

Construction

While the switch can be purchased preassembled from the same seller, I opted for the DIY kit.  Assembly was easy.  I started by gluing the four pots together with cyanoacrylate glue.  Then I folded the leads down on each side of the pots and soldered them together.  I found a piece of scrap ribbon cable and peeled off six wires.  The six leads of the ribbon cable were soldered to each of the tabs on the switch except the "brown" labeled tab.  That tab is soldered directly to the radio wiring.  The four center wires of the ribbon cable were soldered to the four center leads of the pots.  The outer wires (labeled "red" and "black" on the switch) were soldered to the outside leads of the pots.

wiring diagram

outside leads soldered together

finished switch assembly

Installation

The seller suggests mounting the switch in place of the "pit trim" pot.  However, I use that to control the vertical angle of my FPV camera.  So, I decided to mount mine in place of the hover pitch pot.  I desoldered the pot and removed the nut holding it in place.  I then soldered the red and black (+ and -) wires go to the "red" and "black" labeled tabs on the switch.  The center wire of the pot (yellow in my case) was soldered to the "brown" labeled tab on the switch.

back of TX removed

close-up of hover pitch pot to be replaced

To mount the switch I opened up the hole with a 9/32" drill bit by hand.  Then I drilled a 7/64" hole for the tab that prevents the switch from spinning in the hole.  With the switch installed I secured the micro pot array with hot glue.  The shaft of the switch was too long for the cap that is included.  I cut it shorter so that the cap would mount flush with the radio case.  I then reassembled the radio (without screwing it together).  To make sure everything was working.  I programmed channel 8 to use P1 (the designation for the hover pitch pot) and turned the switch to each position.  With the main screen displaying the value bars for each channel, I could see the values for channel 8 change as I turned the switch.  Looks like it works; time to program.

Turns out the fit was a little tight.  When I tried to close up the case, the pot hit one of the switches on the other half of the case.  I had to bend down the pot tabs and trim some plastic off the corner of one of the switches to get everything to fit.  I added a piece of electrical tape over the pot just to prevent any shorts.

new switch installed

Programming

The switch is programmed with the Mission Planner software (see step 3).  With the TX paired to the software through the APM, select the "Flight Modes" tab.  Positions 1 and 6 should correspond to flight modes 1 and 6.  Turn the switch to position 2 and adjust the pot that is wired to that tab.  Select Modes 2-4 until you see the PWM value change in the software.  Adjust the pot to get the ideal PWM value.  Repeat for switch positions 3 and 4.  When you are finished, turn the switch though all of the positions.  You should see all six flight modes get selected as you turn.  Set the modes that you want from the pull down menus and reassemble your radio.  You are done.  It took me less than 5 minutes to program and I got it right first time. Big improvement over original method.

programming the flight modes

Before, I had to remember the correct switch combination and move two switches to get the flight mode I wanted.  And, I had to pray that I didn't accidentally flip one of the switches while I was flying.  Now to change flight modes, I just turn one rotary switch to the correct labeled position.  Now if I could just get my Arducopter to fly right!

installed switch with label

2 comments:

  1. does this switch have to replace an existing 6 position switch in the TX or can it replace a 3 position or 2 position switch?

    ReplyDelete
    Replies
    1. No. That didn't start as a six position switch. It was a variable resistor. It will replace any trim pot or slider. You need 3 leads for this circuit to work, so a 2 position switch won't work. A 3 position switch may work if you have 3 leads and it outputs an analog signal.

      Delete