Showing posts with label code camp. Show all posts
Showing posts with label code camp. Show all posts

Friday, October 14, 2011

Quadcopter Tutorial 3: Messing around with code and the Arduino

EDIT: Someone is helping me out with the quadcopter, and recommended the beta code and configurator (AeroQuad_v2.5_Beta1.zip and AeroQuadConfiguratorFull_v3Beta2.zip in the AeroQuad downloads section). The code is edited the same way as in this documentation, but I'm also changing my style from plus configuration to x configuration.

So I've finally decided to be productive and post another tutorial. This one will be better because it's more of a documentation, not just a tutorial. I'm writing and taking pictures of what I'm doing as I'm doing it and not afterwards. The reason I didn't do that before is because I had already done those before deciding to make a tutorial. Also, the Aeroquad tutorial on their wiki might be easier, so go there if I don't explain it clearly enough or if I'm more boring-er than them.

1. Installing the Arduino Software:

First, I'm going to download the software for the Arduino, which can be found here. I chose my operating system, which is Windows. You need to download a zip file. If you don't have a program that can unzip these, I found a good one here. Be careful when installing it and look carefully at every page. Don't let them trick you with sneaky text into installing some crappy useless Bing toolbar. I unzipped the file into a folder called "quadcopter".

2. Downloading the AeroQuad Code:

I went here and downloaded the configurator as well as the code and put them in the same folder as the Arduino software. The links should be the two at the bottom: "AeroQuad_v2.4.2.zip" and "AeroQuadConfigurator_v2.7.1.zip". Simply put, the code tells the quadcopter what to do and the configurator troubleshoots if something doesn't work. My folder now looks like this:

3. Testing the Arduino:

To connect the Arduino, I needed the USB A to B cable, which looks like this:
By the way, I definitely took that picture, and my desk definitely is that blindingly perfect and white. I just opened the Arduino.exe in the folder I unzipped. AeroQuad recommends that I test the Arduino out with the "blink" code first, so I will. Basically, this just blinks an LED on the Arduino every second.
It opens another window with code on it. It looks like Java, but somewhat simpler. I went to the tools tab, then to board, and chose "Uno", because I have the Arduino Uno. The program can't find my Arduino because it can't find the com port. This told me to go to Control Panel>System and Security>System, so I did. I opened the device manager, found the Uno, and browsed for the driver, which was in the folder arduino-0022>drivers. I chose the folder and the drivers were installed. Now on the device manager, this is what I see:
I can finally get back to testing. I chose the now-available com port:
As you can see, uploading now works and I see the LED blinking on for one second, then blinking off for one. Now to the real code.

4. Editing and Uploading the Code:

I needed to open the AeroQuad code to start with, so in the Arduino program, I went to File>Open>...>AeroQuad>AeroQuad.pde:
This is extremely simple. Just uncomment whatever you're using (take away the "//"), so I uncommented "#define AeroQuad_v18" since I'm using an Arduino with the AeroQuad 1.9 shield (which is essentially the same as the 1.8).
The flight configuration is how the propellers are arranged relative to the front of the quad. The basic ones are X and +. X is meant for fpv quads, or quads with cameras on them so the propellers aren't blocking its view, but it seems more complex for me, and I'm not using a camera, so I chose the + configuration:
There are three optional sensors: the barometer, magnetometer, and battery monitor. I don't have either of the first two, and I'm not using the battery monitor until I'm already finished, so I uncommented only the last choice:
The next section has to do with flight angle calculations. Basically, you uncomment the ARG line if you don't have a magnetometer and otherwise leave it. I don't have a magnetometer, so I uncommented it:
The remainder of the user-definition section is about camera stabilization and stuff that I don't care about (currently), so I'm done!
I uploaded the code to the Arduino with no problems. If you need any help, comment.

Saturday, May 14, 2011

Code Camp

Today, I did something cool. I went to Charlotte Code Camp. It was pretty amazing. If it seems like I'm typing in a monotone... tone, it's because I'm tired. Code Camp really was awesome. We (my father and I) didn't really 'formally' sign up, because I went to the site too late, but we went anyway because a fraction of the people expected don't show up to events like these.

When we arrived, we got a schedule and several pieces of paper with the sponsors on them, which was completely interesting and definitely not a waste of ink and paper. So, I chose an event to go to, on XNA particle systems, which is basically programming things like snow, clouds of dust, and fire. I want to look into XNA because I'm really looking into game/app development as at least a hobby. It wasn't really as much of a tutorial as I would have hoped, but it gave me ideas about what I could do in the future. I also won a free textbook on C++ or C# or something like that, which I'm definitely reading later. At the same time, my dad was in a class on making Windows Phone 7 apps, which I want to look into as well. He got another textbook from that on how to make Windows Phone 7 apps, to be redundant.

Afterwards, we both went to a lecture on Netduino, a microcontroller like Arduino, but with more memory and arguably much better for the same price. The guy who gave it was pretty cool. He made a water jet by his pool powered by the Netduino. He could tap places on the pool from his phone for the water jet to squirt. He showed us a basic program made to blink an LED on and off, which I just learned how to do with the Arduino last Sunday. That code was shorter than the code for the Netduino, although they were both simple.

When that lecture was over, we went to lunch. They gave it to us for free. I'm sure you're interested in what I had. I had some macaroni and cheese, if I remember. I also had garlic bread and salad. They tasted like garlic bread and salad, respectively. They provided free soda, chips, and junk food. I got lots of each. If you read that paragraph, I can tell you two things: first, you are at least semi-literate, and, second, you probably have no life, like me, which is perfectly legitimate to some people, including, but not limited to, me.

After lunch, I went to a lab. It was about a tool called Microsoft LightSwitch. I made an application that basically took information about authors in a form-like way. It allowed you to pair them up with one or more books. Although it's nothing I would use normally, it was still interesting to learn and may serve a purpose some other time.

The last thing I went to was a lecture and demo on mobile sites. I learned several interesting things from that. First, Windows Phone 7 doesn't support touch in its browser, so you can't click on things with your finger normally. That eliminates any chance that I'm going to get one. I also learned that websites with mobile versions get bumped up in a Google or Bing search, which is cool because it makes more people want to create mobile sites. That was cool, and I just want any website developers (maybe me in the future) to know that they need to make more mobile sites, because barely any normal sites are user-friendly.

There was another section, but none of the classes during it interested me, so I sat in the car reading video game stuff on my phone and looking through the textbooks we got. I went back in, and they had a raffle for stuff. The first person to win got an Xbox with a Kinect, but there were two envelopes with keys to $2000 windows software he could have also chosen, but didn't. I can't say I would do differently, though, because I don't know enough about the software to be trusted with it. Overall, it was awesome, and I'm hoping to go next year.