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

  • I have seen that several places, but no one describes how it is implemented.
    Is it replacing a pot or does it provice a PPM signal to hook into trainer port?
    Can anyone here provide some enlightenment?

  • Here is another option if your time pressed, and $10 shipped;

    http://www.banggood.com/X-ROCK-6CH-Band-Flight-Mode-Switcher-For-AP...

  • Thanks Jani,
    Much appreciated!

    And I figured out the last myself (Arduino doc) - (The answer was "yes").

    Just by going through Stefan's code, I have learned quite a lot - although the timer/interrupt configuration seems a bit hairy - at least when reading up on it in the middle of the night...

    again, thanks!

  • Developer

    It's 16Mhz and 5V in generally.

  • Greetings,

    A few quick questions:

    1. Are you using the 8Mhz or the 16Mhz version of the Pro Mini?
      (I'm assuming it has some impact on the timing in the code, but being a N00b, I'm not sure)
    2. Are you using the 3.3V or the 5V version of the Pro Mini ?
      I would assume the 5V, (but as you know, assumptions is the mother of fuckups)
    3. What am I missing?
      I don't see any pullup resistor on the buttons, and with my (very) limited knowledge of electronics, coding and Arduino, the internal pullup resistor seems to be not enabled.
      Is the code compensating for this by the line "digitalWrite(BUTTON[i],HIGH);"?


    thanks,

  • hey

    Nice work done by you. Looking for similar project. Do you have the code to be written on andruino pro mini for this project? also need a proper circuit diagram. It will be very helpful if you will provide this to me

    thanks

  • hey

    Nice work done by you. Looking for similar project. Do you have the code to be written on andruino pro mini for this project? also need a proper circuit diagram. It will be very helpful if you will provide this to me

    thanks

  • I can't get the pictures to load. You got them though when we first started this. You PM'd me and I replied with pictures.But, it's pretty simple. On the INPUTS page 6/13 I renamed input 6 "MODE" and made the SOURCE TR1. 

    On the Mixer page 6/13 channel 6 Source is MODE and Multpx is REPLACE. I think that's all.

  • Ok, I got the arduino up and running with the switches and leds, works awesome, thanks for the code stefan.  Can you direct me to the page you are refering to with the mixing screen so I can get this set up with the taranis, thanks.

    https://youtu.be/mtGA07F9lCI

  • NIce, I can see movement on the channels monitor page. I will just have to figure out what's what.  Thanks again!

This reply was deleted.