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

  • 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.

  • If you set up your mixing screen like in the pictures it will work. (probably)  I should have posted those pictures here instead of in the messages part. The Arduino program sets the value of PPM-1 to a set number for each output. If it's working you can go to the CHANNELS MONITOR screen (three PAGE button pushes from the main screen) and you will be able to see the values change as you push different buttons. Unless you get into the code you will have to manually match the outputs to your lights and switches once you get it working.

  • On your back board next to the right had ribbon connector is a pattern of six solder pads. In that six pad pattern the left pad is the signal and the lower right, or second from the right is a ground. Those are coming from your trainer port. On your front PCB there is a pattern of four holes in a white square printed box just right of the right plug. The hole with the square shaped solder pad is 3.26 v+ on mine. The test. Turn on the radio and put one probe on the ground point on the back PCB and touch the square framed hole on the front PCB. Hopefully you will see 3.26v. That should give you the three contacts you need to run the Arduino. You might be able to trace them to more convenient places to run the wires from. Be careful with the probes so you don't touch thinkgs you don't want to.

    Good luck

  • There aren't any labels around the ribbon cable sockets? Maybe on the back side? Looks like you are going to have to get out the multi meter and find the 3.26 volts (on mine)  and a ground. those are fairly easy to find. I'll trace my signal wire for more clues.

  • There should be a wire on the back cover PCB that is marked TR_PPM. That is the signal. There are also two wire positions marked Vcc and GND next to each other. That's where the 3.26 volts comes from.

  • I say Hmm.... I'll take my radio apart later tonight and see if we can find some common markings. Is your radio the new one? The plus or something like that? Mine is an "old" one but the PCB is probably printed with common markings. 

  • First off a disclaimer. I have not had to play with the Arduino coding. I've looked at it and modified it but have not written a program from scratch. I've put Stefan's code in several radios and haven't had to modify it. That's a great little piece of code. Thank you again Stefan.

    The momentary toggle switches will work just fine as long as you have a LED to tell which one is active and I see you do.

    You don't need a regulator because the radio voltage at those points is 3.26v, perfect for the Vcc input (I think, double check your Mini input). I think the Vcc on any Mini will take 3.5v directly but any higher and you have to use the RAW hole. The RAW hole goes through an on-board regulator on some Mini's. I blew the regulator off the board I'm using (with high voltage) but it still works on Vcc.

    The signal goes into the #10 hole at the bottom right of the picture.

    And I don't know if the Trainer port still works. I think the TR1 Source is the Trainer port but I also seem to remember that there are two Trainer Sources.

  • The third picture is of the bottom edge of the LCD screen. Open the radio and remove the 5 screws that hold the screen in and tip it up and you will see the pins I soldered the wires to. The picture attached here shows where the connections are on the back of the main board. You can follow the wires to the back board and make your connections there. It's easier that way. The connection marked + goes to the Vcc terminal on the Pro Mini, the - connection goes to the any Gnd terminal on the Mini and the signal connection goes to terminal #10 on the Pro Mini.

    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=Replace

    That should work using the program from Stefan Gofferje. Any momentary contact switch should work.

    The push buttons are really the hot setup. Fast and intuitive. I love them.

    I may put this and all the pictures on page on my website eventually.

    3702052491?profile=original

This reply was deleted.