Cable-free flight simulator with Spektrum DSM satellite + Arduino

This video shows me flying our homebrew "Hackflight Sim" quadcopter flight simulator using a Spektrum DX8 receiver without a cable. The DX8 is talking to a Lemon RX satellite receiver connected to Teensy 3.2 (32-bit Arduino-compatible microcontroller), which connects to my Linux computer over a USB cable, as shown in the image below. A simple Arduino sketch reads the DSM-encoded values from the RX over the Teensy's RX1 (UART input) pin, and converts them to serial messages encoded using Multiwii Serial Protocol (MSP). The simulator parses these messages, converting them into stick demands to fly the simulated MAV.

Consistent with the Hackflight approach of using and re-using inexpensive, open-source hardware and software as much as possible, this hack relies on hardware (Teensy 3.2 micrcontroller, Lemon RX satellite receiver) and software (MSP parser) that we are using onboard our MAVs as well.

Although it'd be great to get this cable-free hack working with a commercial flight simulator like Phoenix, there is already at least one such solution available commercially.  

Views: 1070

Comment by Anthony on January 21, 2017 at 2:22am

Have been using this wireless adapter with Phoenix for years and works very well

https://hobbyking.com/en_us/wireless-9-in1-simulator-adapter.html

Comment by Harry on January 23, 2017 at 5:46pm

Wicked !  You sir, are clever! 

I'm struggling with MSP.  I can get USB over android(even have some simple apps I built that work)and I have tested if I can Rx the serial coming from my Multiwii.  My current problem is I cant understand why my app wont "parse" the messages.  it just sits there and nothing happens.  My usb driver reads the serial as a byte[] and I convert that to String in my other apps.  With MSP, I get serial as byte after I wrap it like so:

byte Message = Byte.parseByte(String.valueOf(SerialData));
c = Message;

That little c is a mystery to me. Some places its an int, others a byte[] and here a byte.

   

Comment by Simon D. Levy on January 23, 2017 at 6:56pm

@Harry: Thank you! It's also nice to meet a fellow hacker using MSP and Android.  My MSP parser-generator tool can be used to generate Java code, but is currently missing an Android example.  I will work on that this week and hope to have a blog post on it soon.  Stay tuned!

Comment by Harry on January 24, 2017 at 4:29am

OK, thanks Simon!  I read the readme on the tool and I see it will make a .jar of the parser.  That might be enough for me to just add the .jar as a library in android studio. 

Comment by Harry on January 25, 2017 at 9:01pm

Simon, I have your parser in my project.  I have to learn how to use it.  I printed to system.out what I'm getting from the USB connected MW. 

01-25 22:52:10.367 3258-3281/? I/System.out: [71] -17
01-25 22:52:10.367 3258-3281/? I/System.out: [72] -65
01-25 22:52:10.367 3258-3281/? I/System.out: [73] -67
01-25 22:52:10.367 3258-3281/? I/System.out: [74] 36
01-25 22:52:10.367 3258-3281/? I/System.out: [75] 77
01-25 22:52:10.367 3258-3281/? I/System.out: [76] 62
01-25 22:52:10.367 3258-3281/? I/System.out: [77] 16
01-25 22:52:10.367 3258-3281/? I/System.out: [78] 104
01-25 22:52:10.367 3258-3281/? I/System.out: [79] -17
01-25 22:52:10.367 3258-3281/? I/System.out: [80] -65
01-25 22:52:10.367 3258-3281/? I/System.out: [81] -67
01-25 22:52:10.367 3258-3281/? I/System.out: [82] 3
01-25 22:52:10.367 3258-3281/? I/System.out: [83] -17
01-25 22:52:10.367 3258-3281/? I/System.out: [84] -65
01-25 22:52:10.367 3258-3281/? I/System.out: [85] -67
01-25 22:52:10.367 3258-3281/? I/System.out: [86] 3
01-25 22:52:10.367 3258-3281/? I/System.out: [87] -17
01-25 22:52:10.367 3258-3281/? I/System.out: [88] -65
01-25 22:52:10.367 3258-3281/? I/System.out: [89] -67
01-25 22:52:10.367 3258-3281/? I/System.out: [90] 3
01-25 22:52:10.367 3258-3281/? I/System.out: [91] 0
01-25 22:52:10.367 3258-3281/? I/System.out: [92] 0
01-25 22:52:10.367 3258-3281/? I/System.out: [93] 0
01-25 22:52:10.367 3258-3281/? I/System.out: [94] 0
01-25 22:52:10.367 3258-3281/? I/System.out: [95] 0
01-25 22:52:10.367 3258-3281/? I/System.out: [96] 0
01-25 22:52:10.367 3258-3281/? I/System.out: [97] 0
01-25 22:52:10.367 3258-3281/? I/System.out: [98] 0
01-25 22:52:10.367 3258-3281/? I/System.out: [99] 0
01-25 22:52:10.367 3258-3281/? I/System.out: [100] 0
01-25 22:52:10.367 3258-3281/? I/System.out: [101] -17
01-25 22:52:10.367 3258-3281/? I/System.out: [102] -65
01-25 22:52:10.367 3258-3281/? I/System.out: [103] -67
01-25 22:52:10.367 3258-3281/? I/System.out: [104] 36
01-25 22:52:10.367 3258-3281/? I/System.out: [105] 77
01-25 22:52:10.367 3258-3281/? I/System.out: [106] 62
01-25 22:52:10.367 3258-3281/? I/System.out: [107] 16
01-25 22:52:10.367 3258-3281/? I/System.out: [108] 106
01-25 22:52:10.367 3258-3281/? I/System.out: [109] 1
01-25 22:52:10.367 3258-3281/? I/System.out: [110] 6
01-25 22:52:10.367 3258-3281/? I/System.out: [111] 70
01-25 22:52:10.367 3258-3281/? I/System.out: [112] -17
01-25 22:52:10.367 3258-3281/? I/System.out: [113] -65
01-25 22:52:10.367 3258-3281/? I/System.out: [114] -67

I guess I just need to follow the example.java to extract useful data like attitude?

Comment by Simon D. Levy on January 25, 2017 at 9:07pm

@Harry: without seeing your code, I can't make sense of your output.  I'm working on a complete example, should have something for you to look at in a few days.

Comment by Harry on January 26, 2017 at 6:37pm

Ooops, sorry about the bad form, Simon.  I was testing the USB output from the MW to my android project.  I shoe horned the example.java into my project and that output is   "+59 +76  +1".  That tells me that byte[] I get is what the parser needs and the parser actually gets it. I probably have more trouble understanding the protocol and any example you cook up can only help me.      

Comment by Simon D. Levy on January 31, 2017 at 11:34am

No worries, Harry.  I've got a simple, complete Android example for you to work with:

Video: https://www.youtube.com/watch?v=jncxOl-Xkcg

Code: https://github.com/simondlevy/hackflight/tree/master/gcs/android

Comment by Harry on February 1, 2017 at 4:23am

Holy cow, that's exactly what Ive been trying to do.  Your app even uses the same USB driver/service Ive been using.  Ill chew on this example for a while.  Thanks.

Comment by Harry on February 6, 2017 at 1:44am

I chewed on it for awhile.  I have a few examples of attitude indicators that extend View.  I got HackFlight to display a HUD but I don't know how to get roll,pitch,yaw into this View.  Its a shame, HUD is so pretty and parser is chugging away.   

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2017   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service