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

  • Tx  not2fast I was afraid I might have to do that. I have a Taranis+. Your comments above will help in tracking down the connection points  Tx

  • It's been a long time since I got into the radio but as I recall the reason I connected on the inside is that I couldn't get the Taranis to connect through the trainer port. The 9xR did work through the trainer port but not the Taranis. Plus connecting inside is much cleaner. I use this set up all the time with the APM.

  • Pleeeease, there must be somebody out there who  got this working.   Ive upgraded the software to 2.0.19. Tried changing various pulse parameters in SG's sketch. Still nothing. Im about to take the back off and examine the trainer jack. It seems to me  its not even connecting

    Tx

  • Help. I hope somebody is still watching this thread. I have built the switch as per Stefan's schematic and it appears to work . I checked the output with a scope and get the correct pulse train. As I select different pb's the ch1 pulse changes width. I used  not2fast code (above) for the Taranis: (and numerous other variants)

    Taranis Programming;   (this is what I did to get it to work)

    page 5, chan 6 EDIT

        Input name=mode

       Source=TR1

    Page 6;  chan 6, EDIT

       Source=mode

       Weight=100

       Switch=  -----

       Multpx=Repla

    It doesn't work.!!

    I upgraded the Taranis firmware to 2.0.17 and it still doesn't work.

    I have used a mono plug to connect to the Taranis trainer port. It seems that the Taranis is just not seeing the TR1 pulsetrain. I would certainly appreciate any hints on what I should try next.

    This switch is a great idea. I have used the 2 switch setup and even tried a 6 pos. rotary switch and both have their issues.

    Thanks in advance

  • It seems that I've looked in the wrong direction, regarding the use of Arduino to read and write PPM.

    Paul Stoffregen has made a multi-stream PPM encode/decode library for the Teensy boards.
    The user whimsical have used that library to make one Teensy decode two separate PPM streams, read two rows of each 6 buttons and encode everything out through a new PPM stream.

    Basically, the same project as this one - but using a more capable processor to enhance it.
    I had a mock-up running in about 15 minutes on a breadboard, using a slave transmitter and my goggles.


    I don't think that I will expand my collection of Arduino boards, anytime soon.
    The Tensy is smaller and just seems much more capable.

    It could be fun to explore Taranis a bit more, and see if it is possible to enable some kind of two-way communication between the two...

    Arduino RC library - Page 4
    Very new to arduino and C but i have a need to learn. My project is probably not too ez for a beginner but what the hell, try anything once ;) This…
  • Another option for a ~$10 mode switcher. Looks like PWM output.

    http://www.ebay.com/itm/APM-Flight-Controller-Flight-Mode-Switcher-...

  • It looks like the X-Rock switcher has a analog output. These instructions show how to cut the wires going to a pot and connecting the switcher in place of the pot.

    http://www.ebay.com/itm/6CH-Band-Flight-Mode-Switcher-For-APM-Pix-P...

  • Developer

    You cannot have slaves.. Well long ago we made one board that had this option too but it never got to market as there was not enough demand for it. :(

  • On a related matter.
    Taking up the trainer port for a mode switch like this is probably not an issue for most.

    However, If one would like to have a 2nd PPM source (i.e. slave/goggles), how would one go around that?

    It seems to me that the timer1 are already in use to generate the PPM (and we can probably not use it twice, right?), so I assume that one would need another ProMini to receive and decode the 2nd PPM stream and communicate that to the "primary" ProMini using Serial/I2C or something like it?

  • Developer

    It provides PPM signal to your trainer port, you need configure one of your channels to receive data from trainerport. Usually it's done in way that Ch1 from PPM signal that connects to trainer port is configured as Ch5 to out eg. going to your receiver. You should also see PWM levels on your radio monitor display if you have that option.

This reply was deleted.