Arduino-based mode switch

FILE0080.jpg?width=750First, I used combinations of switches to select the mode of my APM. But IMHO, there is hardly anything more counter-intuitive and if things hit the fan, you can be sure to switch to the wrong mode out of pure hectic.

Next, I replaced a pot of my transmitter with a 6-position switch and variable resistors. That is already better, but to get to one mode, you likely have to switch through other modes. Also, without any markings, again, not very intuitive and it's impossible to see at one glance which mode you are in.

Finally, I hacked together a small board with 6 pushbuttons, 6 LEDs and an Arduino Pro Mini. The Arduino creates an 8-channel PPM stream of which channel 1 contains the data for the mode. The whole thing connects to the trainer port of my 9x. Additionally, I steal 5V from the display output of my FrSky module but theoretically, the Arduino could also be powered by the 3S transmitter LiPo. The program is pretty easy. Check the buttons and set the respective PPM value. The LEDs are not set by the buttons but by the actual value of PPM1 - just to be safe, in case e.g. the Arduino resets or something.

Here's the schematic:

APM_mode_switch_schem.png?width=750I'll attach design files for the PCB and the source code in the comments then.

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • IIRC the problems was that when using the T9X as a slave, the TX module needed to be removed or a small resistor soldered in. If you use the trainer port as an input, there's no such problem.

    I use the OpenTX firmware on my 9x. In the mixes menu, I can simply assign PPM1 to any channel (5 for APM:Copter) and it works. I have no idea how it works with the stock firmware. I think, in the stock FW, channel 5 is hardcoded to gear, so you would have change ppm[0] in my code to ppm[4] (for copter) and then set the gear channel to trainer or something like that.

  • MR60
    That is great. Can you explain how the output of the arduino is "connected" (via trainer port) to the channel of the radio that controls mode selection?
    Second question, is there a physical hack required on T9x to use its trainer port ( i have read it does not work out of the box?)
  • A small suggestion: tie the modes you would want in PANIC situations (RTL and stabilise?) to the arduino ports with a interrupt function (2 and 3), so you can programme it to REALLY switches back quickly (use AttachInterrupt() ).

  • mP1

    Put one button away from the others and program it to whichever mode you want for a panic button?

  • Nope, haven't seen that before. It's pretty nice too, but not very universal :).

  • Hi, Stefan, nice work! But did You seen this?

  • That's easy to make, BUT has the same problem as some other solutions. In a hectic situation, it's easy to select wrong. One switch per mode is the most intuitive and that's what you want for safety. That might not be of large consequence if you fly around a Bixler or a small quad. But imagine, you fly a UAV-3000 or a 5kg hex. You don't want THOSE biggies to get out of control!

  • FIxed broken Gerber download.

  • PWM converts to analog with simple r/c circuit (resistor and capacitor).

    Values need to be balanced according to PWM update frequency.

    Additional resistor and capacitor with reference voltage input can permit output voltage greater than max PWM voltage.

    An Op amp in line can drive higher load.

    If resolution required is low as above 6 position switch, should be fairly easy to get 6 position switch to work.

    Interesting might be to hack into open source transmitters firmware (FRSky and Turnigy) and use trainer port to control variety of things.

  • Well, the board is CC-BY-SA and the Software GPL... I have no problems if anybody wants to make a bunch of those.

    Besides, I was thinking of having a small batch of the PCBs made if nobody else makes them and there's interest. Just the naked PCBs - for people who know how to solder :).

This reply was deleted.