# Multiple PWM signals from a single audio channel

Here's my project in a nutshell: I'm building a quadcopter and I need to control each of the four motors independently. I'm using an iPhone as the "brain" of the quadcopter, with of all the control logic being implemented in software on the phone.

Somehow, I need to interface my iPhone with the ESCs for each of the brushless motors. I don't have access to the Lightning port (or the money to join Apple's MFI program), so that leaves me with the headphone jack. It would be reasonably simple to control the frequency/amplitude of the two audio channels and convert the signals to PWM, but I need to extract FOUR signals from the two channels.

My idea is this: "encode" two signals per channel by dedicating two different frequencies (say, 100Hz and 1000Hz) and modulating their amplitude in the software. Then I need a way to split the frequencies into their own independent signals to convert to PWM, before reaching the ESCs. What could I do to make this work?

Or, is there an easier way to accomplish what I need? I'm a Software Engineer by trade and a wanna-be EE by hobby, so my electronics experience is limited. A Fourier Transform would be the answer in the digital world, but I'm not sure how to make this work in the analog world. If somebody has a better solution, I'd love to hear it!

sounds like you want to use a PPM signal. Instead of modulating the pulse width, you're modulating the time between pulses.

Say you want to control six servos using a single channel: You'll build a 'packet' with seven pulses, the time between the pulses indicates to the receiver the desired servo position, nominally 1500uS. Let's say we want all six servos to be at dead center. In this case you'll send the seven pulses, each separated by 1500uS. On the receiver end, you'll map each gap between pulses to a servo where you can generate a continuous PWM signal with the desired period and duty. I'll throw up some code if you'd like.

• Unless I read the ESC documentation incorrectly, my understanding is that the width of the pulse is what determines the motor speed, regardless of the frequency. An example suggested that 1ms on, 19ms off is pretty typical - but the frequency can vary without affecting the motor too much. However, your solution is interesting so I'd love to hear more about it. Commented Sep 20, 2015 at 1:04
• Maybe I wasn't clear. You will still need a PWM to control your ESC. How do you transmit info on the pulse-width over a single channel? PPM is one way. This is a typical method used in RC vehicles. There are multiple ways to do this, potentially using a BLE SOC since you could interface with that nicely from your iOS device; I don't think you're going to be able to get away without a micro onboard. Btw the 'duty' or duty cycle is basically the pulse width as a percentage. It is more general to use this metric as the frequency can vary, but the percent of pulse with on or off will be constant.
– RYS
Commented Sep 20, 2015 at 1:06
• Ok, I think I understand you now. So you're saying that I build my own "receiver" that accepts a PPM signal over BLE, rather than attempting to convert an audio signal to PWM? I'm still not sure what components I would need to accomplish that. Commented Sep 20, 2015 at 1:36
• Getting closer. You can readily buy the RC transmitters and receivers and transmitters that will send the ppm via RF directly. If you wanna go the BLE route, your iOS device already has BLE so you'd just need some micro controller with BLE to receive packets. In this case you'd just build a struct, dict or json packet specifying the desire PWM duty. No ppm required in this case.
– RYS
Commented Sep 20, 2015 at 1:39
• Ok, that's very helpful. Would I need something as complex/large/expensive as an Arduino or Pi, or are there simpler BLE receivers out there that would suit our needs? If I use something like a Pi I might as well forgo the iPhone altogether... but I'm trying to keep as much on the phone as possible :) Commented Sep 20, 2015 at 1:55