Is there any way to get PPM output from Ardupilot? I want to take the roll, pitch etc outputs and do my own mixing with an arduino, to allow complex custom control surface mixings, and more servos/functions than my FC board has pins.
Eg. let’s say my omnibus f4 has 6 output pins, but I want to run 9 unique servos, plus gear and lights. For this case the required PPM pulses could be aileron, elevator, rudder, flap, throttle, RCPassThru6, RCPassThru7.
I suppose I could make my arduino read the normal PWM outputs from Arduplane, but then I’m limited to just the 6 pins, and I need a bunch more wiring and more complex code…
Alternatively, maybe it’s feasible to read these outputs via Mavlink, and use them in real time to actually fly the plane?
hmm… that seemed very promising until I gave it a try. The channel values are detected ok but they’re jittering around all over the place making it unusable in practice.
Basically the same problem as discussed here:
At this point I’m thinking I might have to use 4 individual PWM cables from the FC to the arduino for AETR, plus a PPM cable going directly from the receiver to the arduino to handle the flaps and other stuff, since all the other channels can be done manually via simple pass-thru. I’m not planning to use auto-flaps, so I think it should be ok if Arduplane doesn’t know that flaps or any of the other functions exist…
S.Bus is your best option as you will get all 16 channels in digital form. You dont need to invert signals between autopilot and yoyr arduino board. Jittering is most like due bad library.
I am using this method every day on our big birds to control EFI etc. Ok i am running Arduino stack in STM32F103 based boards that are a lot faster than minipro etc.
Look stm32duino and SBUS-10 libraries
@jpkh That library works great, thanks! I did notice the library I was using earlier (https://github.com/bolderflight/SBUS) says it works with a bunch of STM32 devices but does not mention regular arduino, but I didn’t think too much of it, oops.
I’m guessing the arduino is not fast enough to get the job done with the loop-based method, but the interrupt-based method in the library you linked to doesn’t have that issue - at least for a simple ‘hello world’ test. It remains to be seen whether it can handle this and all the other stuff I want it to do at the same time, I might end up having to use an STM32 board after all. But at least the output from Ardupilot part is covered nicely, thanks!
Side note, it amazes me that the SBUS protocol doesn’t have any CRC validation. Every other packetized digital transmission I’ve ever come across (even those made by me for a dinky little one-day project) have some kind of proper error checking.
Side note 2, there are only 8 outputs shown in the “servo output” tab in mission planner, so I’ll not be getting all 16 channels from this, unless there’s some other way to select them. That’s no problem for me, just thought I’d mention it.
@iforce2d yep i know
I was testibg thst borderflight and few others too. They did not work well like you noticed. This lib is fast and efficient. Maybe not most optimized but it works well. Never had any hickups with it.
For crc, i think its not needed with sbus. Packets are repeated every 20ms. Basically servos sont have time to do anything funny if they miss one or two frames. Having crc would make frame too heavy. Ok we could have 1 crc byte for whole dataframe but it would not help afterall if lets say 2 channels woukd have bytes swapped. To avoid that every channel would need crc which would make frame at least 17 bytes longer.
You can get all 16 channels out. True on servo output tab. But look status tab and you see all 16 outputs. You can find all 16 channels on the tab where you can send low,mid,high,toggle values to servos.
Already talked with @meee1 that we should have one tab where we can easily program few action buttons to do vatious things. He is looking that possibility so lets hope we have new fancy “actions” tab soon on MP
As for hardware. Get those basic STM32 Blue Pill boards and flast them with stm32duino bootloaders. They are wonderful boards and wotks just like whatvever Atmel based Arduino boards. Just a lot more powerful and more mem and they are 32bit