On-board Elevon/V-tail mixer

Arduino projects on the go
Post Reply
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

On-board Elevon/V-tail mixer

Post by Martin »

Normally you wouldn't need such a thing because you can do the mixing on the transmitter.

A friend who I've been teaching to fly has a receiver with a built-in autopilot system that does auto-level, return to home, and such: it came in a foamy carbon cub, and it worked great in that. But after he crashed the cub, he's built it into a flying wing and for that we need elevon mix. We don't think the autopilot system can do elevon (or at least we don't know how to enable it, if it can) so we need an on-board mixer. I thought I had a commercial one somewhere, but I've not been able to find it, so this morning I programmed an Arduino to do the job.

My mixer is better than the commercial ones because it has four outputs that servos can be plugged into. If you call the two input channels A and B, then it provides A+B, A-B, -A+B and -A-B outputs. So there's no need to reverse any servo outputs (we're not sure if the autopilot system can do that) You just plug each of the servos into one of the four possible positions, and then swap them around until both controls operate correctly for both input functions.

I built the prototype using a DiyMore PRO-MINI Expand, but any AtMega328 16MHz Arduino would work: Nano, Uno, Pro-Mini, etc.

The code uses pins 2 and 3 for the two input channels. These are the pins that have hardware interrupts available, so they give the most accurate position sensing with the least possible jitter into the Arduino. Some receivers output the servo pulses in sequence, and some start two or more of the pulses to different channels at the same time; by using interrupt routines to measure the widths of the pulses, the code works equally well with either type.

Then the four outputs, A+B, A-B, -A+B, and -A-B, are put out on pins 4, 5, 6, and 7. It uses Timer1 in interrupt mode to control the pulse widths. If you edit the code, you could any pins for those, but it made a neater set-up on the DiyMore board to use six consecutive pins.

I've attached the code ("sketch"), which doesn't rely on any libraries. I can make a circuit diagram and a YouTube video of it working if anyone's interested.
Attachments
ElevonMixer.zip
Modified 2023-Mar-06 to use accurateMicros() in place of micros() See the thread "Accurate microseconds" in this forum.
(2.1 KiB) Downloaded 118 times
Last edited by Martin on 06 Mar 2022, 16:46, edited 2 times in total.
Tobe
Posts: 665
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

Re: On-board Elevon/V-tail mixer

Post by Tobe »

Brilliant as usual Martin!

Cheers 6 All the best

Tobe
Cheers,

Tobe
User avatar
Phil_G
Posts: 596
Joined: 15 Feb 2018, 23:32
Contact:

Re: On-board Elevon/V-tail mixer

Post by Phil_G »

My Wildthing is very pitch sensitive so I'm using a 75:25 version of Martins mixer. This replaces the 9-year-old PIC 75:25 CPPM mixer which on sub-zero mornings up the slope had started to drift slightly off neutral with its internal RC clock. Its a true 75:25, its a personal preference but I'm not a fan of over-mixing where the stick corners are clipped or constrained, especially for aerobatics, so this amended version remains proportional right to the corners :D
Flown many many times as Shaun will confirm.
Cheers & thanks Martin
Phil
Attachments
ElevonMixer_ceptimus_mod_7525.ino
(4.14 KiB) Downloaded 84 times
Post Reply