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 wonder if it's possible to simplify this for people by having the Arduino output an analog voltage instead of a trying to do PWM?  If the you could make it output analog voltage that would mimic the signal coming from a pot, people could simply remove their Ch5 pot, and solder in the output from the Arduino.

    I think that would be possible, but I'm not sure?

  • Stefan, It's no trouble at all for the 328 because everything is driven from timer interrupts and each frame is started with the first pulse from the Tx after the sync(long) pulse at the end of the frame. In fact my head tracker is an imu3 with a 328 and it's running a full DCM calculation, reading the mpu6000 and a magnetometer. No jitter at all, that's the beauty of hardware interrupts.

  • Developer
    I've been wanting to do this for years. Nice job!
  • Forgot: The 5V reg on the Mini Pro SHOULD handle up to 20V.

  • Yeah, I have a Turnigy 9x with OpenTX software. That allows free assignment, but in my code you can as easy have the values fed to Ch5 or 8. Just change 4 or 5 lines. I could even make the channel configurable via a #define statement.

    So you grab the PPM stream from the TX, decode it, add your values, reencode it and then feed it to the TX module? That's quite some work for a poor small ATMega 368 ^^. I hope, you don't get jitter problems.

  •  I like it, very  nice  . I think   this is the step to full working coptit in GCS ...

  • Wow, I am almost done soldering my set up for a Hitec optic6. I assume that with your Tx you can program the trainer function as to with channels it switches? I thought channel 1 was for roll and mode on some other channel.

    Any how, the Hitec trainer port ppm is at full bat voltage so I hacked directly into the Tx board to "intercept" the ppm stream at 5 v. All channels are read by Arduino mini and the control sticks are passed directly to the output ppm generator. Other channels can be changed/rearranged or generated from buttons pots ect. I originally developed this system for an imu3 head-tracker. To keep thing in sync the timing of the pulses is inteript driven using the "interrupt capture pin", D8. In fact it will only run if it is receiving a ppm signal. I am using the gear switch for mode selection. If there is a problem with the Arduino mini I have a bypass switch on the ppm line, so I can switch back to stock mode and will still have manual and one other mode with the 2 pos gear switch. Will post everything as done as the hardware is done and tested.

    3692792301?profile=original3692792215?profile=original

  • @R.D.:

    The tray is from Hobby King - Link. It needs some improvement but it's a kit for $10 - if you anyways order something there...

    @Göran:

    I agree absolutely! That's one of the reasons why I started my integrated GCS project some time ago. The project is currently stalled because I'm waiting for materials and data, mainly from FrSky, but on my desk are already plans for extensions, as some components such as the Sky9X-board which I wanted to use are not available any more. I'm probably going to do the RC part myself also to have a truly fully integrated system. The mode switch was basically one step in my evaluating new possibilities - here, creating a stable PPM stream with an Arduino.

  • I like it Stefan, nice work!

  • Good idea but the problem still remains, traditional RC transmitters aren't very well suited for drones.

    Ideally, a dedicated drone TX needs to be produced, perhaps with a touch screen and serial link to FC?

This reply was deleted.