Friday, November 4, 2016

How I Got My Dragonboard 410C Airborne

I was recently a guest on 96Boards OpenHours to demonstrate how the Aerocore 2 for Dragonboard 410C can be used to quickly and easily build a working quadcopter.   I even powered it up and tested it out indoors live.

If you want to see what happened, check out the YouTube video. The test flight happens at around the 40-minute mark.


Drones are awesome and not that hard to set up.  You can follow along with me if you're building your own.  Once you've got your rig put together, then you can start adding software to the Dragonboard -- or Any 96Boards CE SBC -- to turn it into a self-piloting, obstacle-avoiding, object-following marvel of automation... or whatever it is you plan to do with it.

To find out more about the Aerocore 2 for Dragonboard 410C, you can read my previous post or watch this promo video

The Parts

 The first step in building your quadcopter is to make sure you have all of the hardware you'll need.  Here's what I had on-hand:



You know you work somewhere cool when you can assemble a drone from hardware lying around the office.

The Prep

To keep this post brief, I'm going to glaze over the following steps.  They're fairly straightforward and unrelated and ubiquitous in MAV deployment so there are plenty of instructions available on the web.


  1. Assemble your drone kit.
    • Do not attach the rotor blades yet. You really don’t want your drone unexpectedly taking flight in the middle of your office/house/garage.
  2. The 12V battery connector and regulator on the Aerocore can handle the main battery’s output but there is no built-in connector on the drone or the battery.  
  3. solder-highlight.png
    • You can solder some jumper wires onto one of the motor power terminals on the base plate of your drone (circled in green here)
  4. Make sure you’ve flashed your Dragonboard with Linux. Linaro’s Debian 16.09 was used for this demo.
  5. Build QGroundControl.
  6. On your dragonboard 410C install the necessary packages
    • $ sudo apt-get update && sudo apt-get install python-wxgtk3.0 python-pip python-numpy python-dev libxml2-dev libxslt-dev gstreamer1.0-tools
    • $ sudo pip install pymalink
    • $ sudo pip install mavproxy
  7. Bind your satelite DSM receiver with your radio

(UPDATE:  Since the original project was completed, something about the pymavlink pip package has changed and will no longer install dependencies correctly.  therefore, add python-lxml to your apt-get command before installing pymavlink and mavproxy)

Put It All Together

Now the fun stuff can begin!  It's time to get everything hooked up and ready to fly.

Step 1: Attach your boards

With this thing going up in the air, you won't want your hardware sliding around at all so it's good to put some thought into how your boards are mounted.  The chassis I'm using doesn't have what I'd call a universal mounting system, so I made my own.  The box for an Intel Edison turned out to be just the right size and very sturdy.  I've already been using one on the rover in my RTK project to house a Beaglebone Black.

Some zip ties, screws and risers quickly transformed the cardboard box into a mounting bracket for my Dragonboard.  A touch of shameless self-promotion and it's ready.

Board goes on brackets, Aerocore on board.  I used a bit of electrical tape to hold the receiver in place and was ready to wire it up.

Pro-Tip:

MAVs tend to have alarm buzzers, used to indicate low battery and signal loss.  This is very important when in flight, but when you're setting everything up it can be really annoying.  Thankfully, the buzzer on the Aerocore 2 has a bypass circuit. After soldering a 2-pin header on the underside of the Aerocore, directly underneath the buzzer, you can use a jumper to deactivate the alarm.  For obvious reasons, I don't recommend hard-wiring the alarm bypass.  The picture to the right should help you find the two vias to connect.


  Step 2: Connect Wiring

One benefit of using a box as a mounting bracket is that it has proved to be the ideal place to hide excess wiring.  I cut a small opening in the bottom of the box and fed all of my wires in and through.  I got my hands on a webcam and managed to squeeze its base and cable in there too.  I labeled the following image so you can see where the various connections are.

Not having previous experience with MAVs, I had no idea what order to hook the electronic speed control PWMs in.  It took me a while, but I figured it out.  I put together an infographic for the rest of the amateur MAVers so that you don't have to struggle like I did.

Step 3: Software

The final pre-flight step is to configure your software.  There are three steps:
  1. Flash PX4 firmware to the MCU
  2. Start data pipeline on the Dragonboard
  3. Calibrate on-board sensors

QGroundControl makes programming and configuring your drone a snap.  Open up the program and go to the setup tab (Selection_065.png).  Along the left-hand side will be a button labeled “Firmware”. When you click on this button and then connect the Areocore 2 MCU’s “stm console” via USB, QGC will guide you through the flash process.
microcontroller-console.png

The rest of the pre-flight work can be done over WiFi on the Dragonboard. Going wire-free will also make calibration a little easier.

Disconnect the USB cable from your Aerocore and connect the battery. Once the MCU and Dragonboard boot, SSH into the Dragonboard and enter the following command:

mavproxy.py --master=/dev/ttyMSM1 --baudrate 115200 --out xxx.xxx.xxx.xxx:14550 --aircraft MyCopter
Where xxx.xxx.xxx.xxx is the IP address of your PC.

Once the MAVlink command interface comes up on the Dragonboard, QGC should be able to connect to your drone. If it does not connect correctly, you may have to add a UDP connection to QGC’s settings.  The setup screen should look simmilar to the following screenshot:

drone_setup.png

If this is the first time your Aerocore has been configured, the cicles that appear green in this shot will be red and you will not be able to deploy your drone until they all appear green.

Configuring your drone and calibrating the sensors is very straightforward thanks to the self-explanatory interface in QGC.  Click on each item along the left-hand side in turn -- apart from “Firmware”, which you have already done -- and follow the on-screen instructions.  Once all the lights are green, you’re ready to fly.

The final, and completely optional steps are getting the camera feed from the Dragonboard to QGC, and attaching a Pre-GO GPS module.  

Adding a GPS module is very easy.  Once it’s connected, it will work right away.  Connect it to the 5-pin molex connector next to the DSM satellite receiver connector.  Power down your drone and plug the module in using the included cable, and it's ready.  I added mine last thing right before the live test flight and it worked with no set-up required.

The video streamer, like the MAVlink proxy, is a single command on the Dragonboard:


gst-launch-1.0 uvch264src initial-bitrate=1000000 average-bitrate=1000000 iframe-period=1000 \
   device=/dev/video0 name=src auto-start=true src.vidsrc ! video/x-h264,width=1920,height=1080, \
   framerate=24/1 ! h264parse ! rtph264pay ! udpsink host=xxx.xxx.xxx.xxx port=5600


With both the proxy and the video feed running on the Dragonboard, your flight screen will look something like this:

in-flight.png

If you have added a Pre-GO GPS module, your drone’s location will appear in the navigation map seen here in the inset. You can switch the primary view between the video stream and the navigation map by clicking on the inset in the bottom left-hand corner.

 

And There You Have It...

You now have yourself a working drone.

1 comment: