Category : Nerd Stuff

AeroQuad build, part 2

  1. Building a quadcopter
  2. First steps with Arduino
  3. Quadcoper project rebooted
  4. AeroQuad build, part 1

Another week or two has passed, and although I have mostly been waiting for ordered parts and materials to arrive, I did some work on the AeroQuad, mostly soldering.

Power Distribution Hub

In my previous post, I showed the work I had done on the power distribution hub. After I received the EC3 connectors that I ordered, I finished the hub, so now it looks like this. In the second picture, the hub is mounted on the bottom plate of the Talon frame. The only thing missing from this part is the power line for the AeroQuad flight controller. The Arduino will get a direct feed from the battery.

I also equipped all the ESCs with the male end of the EC3 connectors:

Also, in my last post I wrote that I extended the three motor-side wires on each ESC with 18AWG silicone wire. At some point, I decided that 18AWG would be too thin for the motors, and I redid the work with 14AWG wire.

Extra materials bought in this episode:

Total expenses so far: US$ 579.15 + € 12.90.

AeroQuad Flight Controller

The second part of this post is about the flight controller. If you go back to my very first post about this project, you can see that the flight controller is made from an Arduino Mega 2560 microcontroller, expanded with a custom-made AeroQuad Shield, that looks like this when it comes in the mail:

AeroQuad shield

After soldering all the pieces together, carefully following the AeroQuad manual, the shield can be mounted on the Arduino. The result looks like this (hopefully I’ll be able to replace the picture with a better one sometime):

Today, I hooked it up to my computer, after installing the following software (* unfortunately, the AeroQuad Configurator only runs on Windows and Mac, not Linux, so for someone using Linux for almost everything, that’s a really sad thing):

The software looks overwhelming at first, but once you click around a little bit, it all seems easy enough. All the necessary steps (uploading software, initializing settings, sensor calibration) are all lined up in easy to find buttons, and so far everything I have tried just worked.

There’s probably a lot to tell about the software, and I have only just made my first steps, but I’ll give you one screenshot. After initializing the software and performing some sensor calibrations, you can select a screen called ‘Sensor data’, that presents a real-time graph of all the sensor output from the AeroQuad shield:

That’s all for now. Next steps:

  • Connect motors to ESCs
  • Add Arduino power feed to power distribution hub
  • Create extra level for mounting the flight controller on the frame

Next: AeroQuad build, part 3

AeroQuad build, part 1

A few weeks ago, I rebooted my quadcoper project and ordered a lot of parts from Hobbyking. In the mean time, the parts arrived, and I have been making my first steps in actually building something.

The first thing was assembling the Talon V2.0 carbon fiber frame and mounting the motors. That’s a very easy task, except when trying to fit some props on the motors after mounting them on the frame, I discovered that the Turnigy 2217 motors should be mounted up-side down, so the motor-mounts on the frame had to be flipped. Click the images to enlarge.

The next thing on the list was the power system, meaning everything to connect the motors to the ESCs and the ESCs to the battery. For this, I needed some extra hardware, that I got from different sources:

Total expenses for these parts: € 12.90.

First I extended the 3 motor-side wires of every ESC to make them long enough to span the booms of the frame. I just soldered the wires together and covered the joint in shrink tub02e.

Next, I prepared the power distribution hub, by soldering the wires and the HXT connector to it:

To complete the power system, I need 12 connectors to connect the motors to the ESCs. I probably should get some of these 3.5mm “PolyMax” connectors, but I’d rather get them at a local shop and I haven’t been able to find any just yet.

So that’s what has been done so far.

In the mean time, I ordered some more stuff from Hobbyking:

  • the Turnigy 9X Transmitter & Receiver (Mode 2). Hey, it’s probably a piece of junk, but I have to start somewhere, and this one I can afford right now. Cost: US$ 53.82 and US$ 27.55 for shipping, makes US$ 81.37 in total.
  • a bunch of EC3 connectors , that I am going to use to connect to ESCs to the power distribution hub. Cost: US$ 6.88 including shipping.

That brings the grand total of all expenses so far at US$ 573.19 + € 12.90.

And there is one more problem to solve. Since the Talon frame is pretty compact, it doesn’t offer enough space for all the components. The top plate will used to house the ESCs, like so:

An extra level on top of that is needed to house the Arduino with the AeroQuad shield and the R/C receiver. This level has to be a little bit bigger than the plates of the Talon frame, otherwise there will not be enough room for all the parts.

Fitting an extra level on top of the Talon frame is easy enough. I could use the nylon spacers that came with the frame, or I could easily make some custom spacers using threaded wire. An important question is what material to use: aluminium, wood, plastic? It should be strong, yet light. And affordable. I decided to go with 1.5mm thick epoxy plate. Unfortunately, due to a small error on Conrad’s website, I now have a piece of 0.5mm thick epoxy plate at home, which is too flexible to use. I’ll have to exchange that for the right stuff.

So, the current situation is:

  • Frame needs an extra level. Correct epoxy plate not yet ordered. Also need a dome or some other protection for the electronics during flight.
  • Power system: need to buy connectors for motor-to-ESC connections and waiting for EC3 connectors to connect ESCs to power distribution hub. Otherwise finished.
  • Flight electronics: AeroQuad shield soldering halfway finished. Pictures of that in the next post. Software not yet loaded onto the Arduino, but installed on my computer.
  • 2.4 GHz transmitter/receiver pair is on its way.

Next: AeroQuad Build, part 2.

Quadcoper project rebooted

A year ago tomorrow, I wrote about building an AeroQuad open source quadcopter.

At that time, I had ordered the electronics for the flight controller:

but I left it at that and didn’t actually build anything. I won’t go into the reasons why, I just didn’t.

But! That doesn’t mean that I haven’t been thinking about the project in the mean time. I have been studying the do’s and don’ts of building a quad, reading about motors, ESCs, LiPo batteries, propellors, currents, temperatures, frame characteristics and lots of other complexities. I also tried to get an idea of what flying a quadcopter is all about.

As a matter of fact, I purchased a really small and cheap toy quad from DX a while ago, that has been a lot of fun and it taught me the basics of how to fly a quadcopter. Last weekend, I got to fly a Parrot AR Drone with an onboard camera, and that got me excited enough to reboot the AeroQuad project!

So last night, I sat down to take a last long hard look at all the components I had considered before, and placed a big order with Hobbyking. These are the components I ordered. All prices in US$.

So that amounts to a total of US$ 257.66, excluding an outrageous amount of US$ 35.80 for shipping. That brings the total investment so far up to US$ 484,94. Damn, this better become one hell of a flying machine 😉 And I still need to buy a 2.4 GHz transmitter/receiver, too…

I bought two different kinds of props: two sets of 10×4.5 SF props and three sets of 10×6 props. These give different amounts of thrust and flying time, but also a difference in handling and stability of the quad. I’ll have to experiment with those.

One of the high-impact decisions I made, both in terms of cost (probably) and in complexity of the build, is to buy a ready-made frame. I chose Hobbyking’s own Turnigy Talon Quadcopter (V2.0) Carbon Fiber Frame, and it looks like this:

Talon frame

Of course it still going to take some time and effort to get everything mounted on there, but at least I can be sure that the frame is well-balanced and light, yet very strong. The frame only weighs 280 grams, and hopefully this will allow me to keep the total weight of the quad, including motors and battery, around 1 kg. If my (or rather: eCalc’s ;-)) calculations are correct, the quad will be able to carry a payload of at least another 1 kg, which should be plenty for a camera of any sort, and leaves room for more accessories.

Now I’ll have to wait for all the parts to arrive, and then the building can begin. More later!

Next: AeroQuad Build, part 1

Docker on Debian Wheezy

Maybe you have already heard of the next revolution in application deployment called Docker. I quote:

Docker is an open-source engine which automates the deployment of applications as highly portable, self-sufficient containers which are independent of hardware, language, framework, packaging system and hosting provider.

On the getting started page, you can see that you need an Ubuntu machine to get it running:

Requirements

  • Ubuntu 12.04 (LTS) (64-bit)
  • or Ubuntu 12.10 (quantal) (64-bit)
  • The 3.8 Linux Kernel

One thing that is missing from this list, is AUFS support in the kernel, which isn’t a sure thing these days in Ubuntu.

However, I was interested in running Docker on a 64-bit Debian Wheezy machine, and this post explains how to do it. It’s not really hard, but you need to install an Ubuntu kernel. At least, I haven’t been able to find a 3.8 kernel for Wheezy just yet.

Your best bet is the 3.8 kernel from Ubuntu 13.04 Raring, backported for Ubuntu 12.04 LTS Precise. If that link is broken, try this one or get the right page from here. I have tried a kernel from Ubuntu’s mainline kernel PPA, but the 3.8 and 3.9 kernels for Raring from there seem to lack AUFS support.

I downloaded the deb named linux-image-3.8.0-23-generic_3.8.0-23.34~precise1_amd64.deb, which installs on Wheezy without problems. Just do:

$ sudo dpkg -i linux-image-3.8.0-23-generic_3.8.0-23.34~precise1_amd64.deb
$ sudo reboot

Now find a Docker package on Launchpad. Get the one that is built for Precise.

First install the dependencies:

$ sudo apt-get install lxc bsdtar

and then Docker. This will not succeed:

$ sudo dpkg -i lxc-docker_0.4.0-1_amd64.deb
Selecting previously unselected package lxc-docker.
(Reading database ... 40929 files and directories currently installed.)
Unpacking lxc-docker (from lxc-docker_0.4.0-1_amd64.deb) ...
Setting up lxc-docker (0.4.0-1) ...
/var/lib/dpkg/info/lxc-docker.postinst: 4: /var/lib/dpkg/info/lxc-docker.postinst: /sbin/start: not found
dpkg: error processing lxc-docker (--install):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 lxc-docker

This is caused by Docker’s Ubuntu package trying to use upstart to start the daemon, which does not work on Debian. Disable that:

sed -i 's~/sbin/start~#/sbin/start~' /var/lib/dpkg/info/lxc-docker.postinst
sed -i 's~/sbin/stop~#/sbin/stop~' /var/lib/dpkg/info/lxc-docker.prerm

If you now have apt-get fix its state, it should work:

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up lxc-docker (0.4.0-1) ...

That’s it!

Now continue with the examples on Docker’s website. Happy Docker’ing!

Rpmrebuild FTW!

A problem that I faced today, summarized in a tweet:

After some Googling, I found this blog post about a tool called rpmrebuild.

I decided to give it a go on the Oracle-supplied RPM for JDK6. It is called jdk-6u45-linux-amd64.rpm in the current directory.

$ rpmrebuild -n --change-spec-preamble='sed -e "s/^Name:.*/Name:jdk6/"' -p jdk-6u45-linux-amd64.rpm
result: /home/martijn/rpmbuild/RPMS/x86_64/jdk6-1.6.0_45-fcs.x86_64.rpm

Comparison of the original and resulting RPMs showed the following:

  • file size of the original RPM is 57MB, the result is 50MB
  • Reported Size in the output of rpm -qpi only differs 60kB
  • Name, Build Date, Build Host and Size are the only meta-information fields that changed
  • The file list of both RPMs (output of rpm -qpl) is exactly the same

This looks good, so let’s try installation:

$ sudo rpm -ivh jdk6-1.6.0_45-fcs.x86_64.rpm                                                          [0]
Preparing...                ########################################### [100%]
        file /etc/.java/.systemPrefs/.system.lock from install of jdk6-2000:1.6.0_45-fcs.x86_64 conflicts with file from package jdk-2000:1.7.0_21-fcs.x86_64
        file /etc/.java/.systemPrefs/.systemRootModFile from install of jdk6-2000:1.6.0_45-fcs.x86_64 conflicts with file from package jdk-2000:1.7.0_21-fcs.x86_64
        file /etc/init.d/jexec from install of jdk6-2000:1.6.0_45-fcs.x86_64 conflicts with file from package jdk-2000:1.7.0_21-fcs.x86_64

These file conflicts were to be expected, since the installed JDK7 also ships them. So we need more trickery, in the form of a –change-files option to rpmrebuild.

export RPMREBUILD_TMPDIR=`mktemp -d`
rpmrebuild -n \\
  --change-files="sed -i '/^%config.*\"\\/etc/d' $RPMREBUILD_TMPDIR/work/files.1" \\
  --change-spec-preamble='sed -e "s/^Name:.*/Name:jdk6/"' \\
  -p jdk-6u45-linux-amd64.rpm

$RPMREBUILD_TMPDIR/work/files.1 is the file that lists all the files to be included in the RPM. Using sed -i, we remove all the lines from that file that name a configuration file under /etc, represented by the regular expression /^%config.*\"\/etc/.

The resulting RPM seems to install nicely on a RHEL6 system that already has a Java7 SDK installed. Win! Of course, for the sake of consistency, I need to do the same thing to the Java7 RPM. Unfortunately, the Java7 RPM had one more problem, being that the postinstall scriptlet would give errors, due to the files we deleted now being missing. My final invocation for the Java7 RPM is as follows:

export RPMREBUILD_TMPDIR=`mktemp -d`
rpmrebuild -n \\
  --change-spec-preamble='sed -e "s/^Name:.*/Name:jdk7/"' \\
  --change-files="\\
    sed -i '/^%config.*\\"\\/etc/d' $RPMREBUILD_TMPDIR/work/files.1; \\
    sed -i 's/\\/etc\\/init.d\\/jexec start/#\\/etc\\/init.d\\/jexec start/' $RPMREBUILD_TMPDIR/work/post.1; \\
    sed -i 's/\\/usr\\/lib\\/lsb\\/install_initd jexec/true; #\\/usr\\/lib\\/lsb\\/install_initd jexec/' $RPMREBUILD_TMPDIR/work/post.1; \\
    sed -i 's/\\/sbin\\/chkconfig --add/true; #\\/sbin\\/chkconfig --add/' $RPMREBUILD_TMPDIR/work/post.1" \\
  -p jdk-7u21-linux-x64.rpm
1 2 3 4 5 12