Control your plane via your computer - no expensive cable needed
After some discussion in the FPV threads I decided to show it's possible to generate perfectly good PPM with a computer and feed the Spektrum DX7 with it.
Actually, the PPM generated is much higher quality and precise than most of the USB devices you'll find. It cost barely nothing: just a stereo or mono audio cable (or a trainer cable for JR/Spektrum.. they're audio cables)
Note that the final quality depends on your sound card, but most sound cards can produce this signal perfectly well.
The PPM can be adapted to other brands if you modify the cable, I'll provide at least Futaba support when I get the time. Contributions welcome.
A demo, open source, Linux program is available here, with complete explanation and Spektrum DX7 PPM signal specifications:
A Windows program with joystick interface (basically, control your plane with a joystick) will be available later, I have yet to program it.
Here's a proof and demo:
think it'll work with a Spektrum DX5e?
looking forward to see the futaba/windows version.
thanks for sharing!
(edit: just found the manual and it says it does. it defaults to PLINK, meaning rates/trims are set on the DX5e which is good for this application)
if you want to see your PPM signal supported, the easiest is to make a sound capture of it.
Make the cable as specified on smartpropoplus website ( http://www.smartpropoplus.com/dnn/Ha...7/Default.aspx )
Check it works for sending PPM (you can install Smartpropoplus and use the PPM monitor e.g., when your RC Radio is connected to the sound input)
When that works, use your favorite sound recorder (even sndrec32 should be ok i think), set 16bit and 44100hz, stereo, leave all stick centered except throttle to zero and record.
while recording, after a few secs, put full throttle, wait 1 or 2 sec and stop recording. then host the recording somewhere.
if the quality is good enough i'll try to figure out the PPM signal and include it. Same for PCM if the radio does not support PPM.
jimbob00 great news
i used smartpropplus and ppjoy for years and i knew someone someday will be able to reverse it
cant wait for the windows version!
Thank you for sharing your success and your code.
A PPM pulse is between 0.5msec and 1.5msec wide: 1msec end-to-end. I notice that your Python code uses a 44100 sampling rate: 44,100 samples per second or 44 samples per millisecond. Your sampling rate limits your resolution to 44 steps per channel. By way of contrast, the USB device you link to advertises 10-bit resolution (1024 steps per channel). 44.1kHz is close to the maximum you can get with standard sound hardware; some cards support 48kHz, not a meaningful improvement.
I went through this exercise 4 years ago after I wrote a Python program to generate PCM modulation for AeroAce: http://www.rcgroups.com/forums/showthread.php?t=508749. The AA modulator worked well. PPM generation ran into hardware framerate limitations.
that's why i say "most"
lets say the one i tested wasnt as precise. some could be, but i know of none. you can also have up to 96000 samples per second but its not necessary for regular flying. Most cards are supporting 48 i think. Bad/old cards could be a problem. My code is precise enough at 44100 to produce nearly 0.00001s precision which is just fine :) At 96000, its producing "real" nearly perfect 0.1ms precision. You'll notice values are sometimes rounded up so its not "100% perfect precision" but you won't notice it while moving the sliders, its still higher resolution than most. (i used 44100 in the sample in case people just try it with cards that don't have high enough resolution since it works fine - even my laptop supports higher)
the big difference with the usb devices, is that they usually have some electronic interface generating an analog signal, which is nowhere near as clean as the audio signal we're sending. Even the signal from your link is much cleaner than the PPM signal the DX7 itself produces.
here is the dx7 signal (its not too bad):
the usb interface i have:
theres no timing but it gives a good idea how clean the signal is (because its what important in fact, see near the bottom of this post)
i'll record the soundcard output a bit later (im at work), via a cheapo AC97 it looks jsut a lil better than the DX7 signal, via hd audio it looks quite clean.
Edit: did not type everything i wanted, kinda had to work so here goes :P
so, at high sampling rate with good audio you get a really nice signal, but of course i wanted, like you, to have PPM over cheapo cards and at 44100. The PPM the program i uploaded produce precise enough PPM in theory, but not as good while going through audio out. This depends a lot on the soundcard. That's why there's a setting to change the audio output power.
I used my laptop because its the "worse" sound card I have. It even have some noise cause it's not shielded properly :)
So the key to have it working properly (on a soundcard!) is to play with the sound output power. Pretty sure you can get your own program to work that way.
Note that this same problem can occur while using smartpropoplus (reverse way), changing the mic volume/gain can fix the signal.
The easiest is to link your mic to your speakers and watch the signal (try wavesurfer, its more precise than xoscope), so you can watch the resulting signal, play on the gain until the signal looks "better".
When you can't do that, you can just play around until your RC radio recognise the PPM signal (won't be as good but good enough for regular RC flying. For 3D heli pilots, probably they're better off with PCM or direct radio anyway, but that's waaaaaaay beyond the scope of the project, as the radios induce too much latency during the "buddy box" conversion anyway)
I hope that clear it up / helps you
haven't took the samples from the python program yet i've been busy looking up stuff
most pcs uses Intel HD Audio audio nowadays
Intel HD Audio audio boards support 192khz 16 and 24Bit audio
so most pc actually support the high precision "mode" (then again it works fine in 44100 for most uses)
Suppose i'll just make the windows program detect that at some point.
Sounds pretty cool. I have a converter to use either Spektrum or Futaba radios with my controller for the RealFlight G5 R/C simulator. I wonder if that would work with this setup.
Now they just need to make a Futaba FASST 2.4GHz to USB receiver (or the equivalent for other brands), and we'll have computers controlling on-board computers. I guess at that point it might just be better to use 802.11 wireless networking. But, who knows?
to use your radio as controller for a simulator, its going to the other way around (radio=>pc) this already exists with a pretty good solution: http://www.smartpropoplus.com/dnn/
for RealFlight you need additional software so that RealFlight recognizes your controller, this is not legal in countries with a DMCA or similar law afaik. that's because RF uses the USB converter/controller as dongle and integrate the joystick signal into this. (probably a forced "vendor lock-in" to sell more hardware....)
Look on torrent search sites for it, you'll find it.
the solution above does the opposite anyway, its computer=>radio (so your computer flies the rc thingies, via joystick e.g. or preprogrammed, or whatever u like)
Thank you for the Wikipedia link Jim.
I don't recall seeing any of these high-resolution audio devices in the wild. It's possible I've not looked hard enough.
You get 44 steps when you generate your signal. When you sample your input, you by definition get at most half that.
Again, I congratulate you on your success. I encourage you to clarify your goals and acceptance criteria for this project.
I was just wondering if the adapter plug from my Futaba transmitter to the proprietary RealFlight controller (which also converts to the headphone style plug for use with other brands of radios) would work to connect the sound output on a sound card to my transmitter. I don't know if it's backwards compatible.
I guess I could try recording the output from my transmitter to a sound file, then playing the sound file back to it.
the HD audio chips were just starting around 2006 i think, now they're getting quite widespread (as much as AC97 was)
however, i do not lose half my samples, where do you get that from?
otherwise it should work
If you didn't read my previous link, read that one then http://developer.intel.com/design/chipsets/hdaudio.htm
this is the most common audio chipset on recent pc. older pcs have AC97.
I'm repeating myself now :p
192khz already gives nearly twice as many samples than necessary to achieve a resolution which the DX7 cannot actually read, but likely some JR/Futaba would read them.
are you another hardware reseller or smth like that? Declaring that intel hd audio is resampled in software is quite wrong :( in my world its called FUD :P
Note that the theorem you provide here is different. I will dumb it down a lot:
it is applied when you eg sample analog audio to digital and back to analog.
what happens, is that analog has "infinite" resolution while digital has finite resolution.
This is a problem for e.g. music, as the digital signal will represent the shape from one point to another as a straight line. At this point you're already losing definition. By doubling the sampling rate, you get a more accurate definition, which is close to the original, this is what the theorem states.
If you reproduce the digital to analog again, without doubling the sampling rate, all these "shortcuts" the digital signal takes will be converted back to "wave like" (or "sinus like") and you'll have lost enough definition that the audio won't sound quite the same.
However, we're only generating analog from digital, so we're actually losing definition once. Additionally, we're generating a signal that's going to be digitally interpreted, we actually only need the "front" or "up/down" part of the signal to be at the exact correct position, the rest of the signal can be slightly incorrect, it will no difference.
This will give you a proper, visual idea of what's happening here:
set the applet original analog frequency at 100hz
set the sampling at 200hz
you'll be getting approximilatly what happens in our PPM case, except that we're only doing digital to analog (high precision here)
at 44.1khz the signal is more like the one with settings at 100 and 100, slightly better tho (one conversion only) and is enough for the PPM to work reliably at good precision.
Feel free to point me wrong, but at some point you'll just be able to plug it in your PC and check by yourself (granted that I work around window's Xaudio2 limitations, or make something with ASIO drivers instead :P)
|All times are GMT -5. The time now is 12:31 AM.|