First steps with Arduino
This is the second post in a series to come. Recently, I have taken on the challenge of building a quadcopter, and I will report about my progess on this blog.
Read the first post, about part of my plan, here.
My quadcopter will be an AeroQuad, a design which is based on the Arduino Mega 2560 microcontroller. The board arrived in the mail last Saturday, and since I haven’t owned an Arduino before, everything about it was kind of new to me. So, I did some small experiments.
My laptop runs Debian Wheezy these days, and the Arduino IDE is packaged for that, so installation was as easy as typing:
[code]apt-get install arduino[/code]
The Arduino IDE is a Java application, that has a simple code editor and some built-in tools for compiling your code and uploading it to the Arduino. It comes with some example programs, the simplest of which is called ‘Blink‘ and does little more than make a LED on the board blink on and off.
That worked nicely, and as a first-time Arduino user, it is fun to make the LED blink in a variety of patterns. That grows old quickly though, so on to more challenging tasks.
The next experiment was to download the AeroQuad software and see if I could get that built. It took me a while to figure out where to put the AeroQuad libraries so that the IDE can find them, because the installation instructions described two options, both of which I didn’t like, but in the end, it was obvious.
The default setting in the Arduino IDE for ‘sketchbook location’ (where you keep you Arduino sketches) is $HOME/sketchbook. This means that the AeroQuad libraries need to live in $HOME/sketchbook/libraries, and they will be found.
Something else noteworthy is, that you cannot change the name of the folder containing the AeroQuad software itself. When you unpack the archive, you get a directory named ‘AeroQuad’. I changed it to ‘AeroQuad-3.0.1’, but that doesn’t work. The IDE told me that ‘The file “AeroQuad.ino” needs to be in a sketch folder named “AeroQuad”‘, so I renamed it back.
Now, compiling the code is generally just a matter of clicking a button, but when I tried that with the AeroQuad project, the compiler crashed:
[code]collect2: error: ld terminated with signal 11 [Segmentation fault][/code]
I did try to find out why, but Googling around for a while didn’t give me anything useful, except that the Arduino IDE, when downloaded from the official website, ships with GCC version 4.3.2, while Debian Wheezy is at 4.7.0 at the moment. That’s a rather big difference.
I decided to try the easy way, and just get the official Arduino IDE and install it in /opt/arduino-1.0.1. Clearly a good choice, because compiling the software just worked now. I even uploaded it to the Arduino, but since I don’t have anything to connect to it yet, that was pretty pointless.
The next step will be to assemble the AeroQuad v2.1 Shield, which is a print board that will contain sensors like triple-axis gyroscope, accelerometer, magnetometer and barometric pressure sensor; all the neat stuff that will make the AeroQuad stay up in the air. Today, after being underway for almost three weeks, they arrived at my doorstep. Well, after paying 37 euros for VAT and customs handling costs…
Next stop: “Hardware Assembly 2.1 Shield“…
Continue here: Quadcopter Project Rebooted