Blog


Comments Off

Arduino to Mac OS X Serial Communication

06.01.09 Posted in Uncategorized by

I ran into a snag when trying to get an xcode project to talk to an Arduino in April. After a bit of researching, I finally got things working with AMSerialPort from Andreas Mayer. I had to tweak it a bit…the method to change the baud rate didn’t work at first, but it’s fixed now. Also, the part of AMSerialPort that waits in the background thread for incoming data was modified a bit to play nice with Arduino serial messages. I re-packaged everything into a new Xcode project with a simple interface that let’s a user select an attached serial device and then send messages to it as well. My code has the incoming messages just go straight to the console instead of being displayed in the view. I could have done otherwise, but each implementation of this will require vastly different interfaces when completed. I know that I will never need to display the incoming messages on the screen, so I didn’t bother.

The modification the background-thread-waiting is by my design. It waits for a newline character, or more specifically, a serial message that is sent with

Serial.println()

So Serial.print() can be used several times without the Xcode project reporting any incoming data. What it is really doing is storing up the data until a newline character. Just end your bout of serial messages with a Serial.println() for the message to come through to the console. If you’d prefer every message to come through, just always use Serial.println().

The project is hosted here on Google Code.



Comments Off

Arduino Mega

06.01.09 Posted in Uncategorized by

It’s been a while since my last post, but now the semester is over and my summer schedule is in full swing. I just had to express my joy at the release of the Arduino Mega. For some reason, I’m still scared to enter into the realm of AVR and ARM, so I’ll stick with the Arduino for now.

I actually already have my hands on one from Sparkfun. It’s absolutely sensational. No longer do I have to worry about running out of analog ports.



3 Comments

Quadcopter On-Board Video

04.09.09 Posted in Quadcopter by

Success! Taking video from the quadcopter is about three weeks premature, but I couldn’t resist. I definitely should’ve waited for a roll-cage over the electronics, and this is made apparent by the fact that my front motor isn’t working after a few crashes today.

I wanted to take some aerial shots of Lake Osceola on campus, but I thought it would be more interesting to switch the camera into ‘video’ mode first. It worked out OK because the winds were too strong for me to attempt keeping the quad stable. The few pictures I took in the air turned out to be very blurry. I really need to do some solid testing of my PID parameters before I try anything this crazy again. Next time though, I will go much higher (with calmer winds).

Anyways here is the video that was captured (with an epic last crash) and two pictures extracted from the video.



Comments Off

Research and Creativity Forum and More Pictures

04.08.09 Posted in Quadcopter by

I presented my quadcopter work at the Research and Creativity Forum yesterday. It was a great time. A couple of my professors stopped by and the judges seemed very impressed. It’s always good to get some motivation to continue working on this. The poster that I had at the event is linked in PDF format on the right. It’s a good summary of the project so far with applications of the quad, hardware relationships, and a couple graphs generated by in-flight data. Last Saturday I flew it again and even had a three minute flight getting as high as 30 feet (slightly terrifying because I haven’t built a ‘roll cage’ yet). There seems to be a bit of a ‘fishbowl’ effect when transitioning from motion to hover. Maybe I’ll try to add some of the “I” to the PID controller to help with this. Right now I’m using these constants: P = 1.7, I = 0.0, D = -1.4, xMitFactor = 0.2. This weekend I’ll try to take some aerial photographs. Here are some pictures of the quad. I just added the XBee shield recently (turns out my first microcontroller was busted) and I’ll add some shots of that soon.



Comments Off

AR500 PWM Output Order

03.29.09 Posted in Quadcopter by

So I didn’t want to throw down several hundred dollars for a TxRx combo, so I went with the $99 solution. The Spektrum DX5e is a five channel, full range transmitter that comes bundled with the AR500 receiver. Since I am reading the PWM in parallel and not the PPM, I needed to determine the output order.

Why is the output order important? In code, the pulseIn command is used to read the pulse width on a digital pin. It looks like this (only three below).

roll = pulseIn(ROLLPIN, HIGH, TIMEOUT);
pitch = pulseIn(PITCHPIN, HIGH, TIMEOUT);
yaw = pulseIn(YAWPIN, HIGH, TIMEOUT);

The ROLLPIN is the digital pin connected to the roll axis gyroscope, HIGH means it is going to measure the width of how long the pulse is at a logical 1, and TIMEOUT specifies how long to wait for anything to happen. You can omit the third parameter, but speed is a necessity. This is why the order is important. The outputs of the receiver come in a specific order. In code, you need to read all of the PWMs sequentially (in my case, all 5). For example, look at the above code. Roll is read right before pitch. Pretend there are no TIMEOUTs. The arduino will wait around until there is a pulse for roll. It reads it successfully. However, what if pitch was the pulse right before roll? The arduino will wait around almost an entire cycle before reading the pitch pulse. The same disaster could happen for the yaw pulseIn. So of course, if we determine the proper output order of the pulses, all of the information could be read in a fraction of the time when incorrectly ordered.

I took my TxRx to the best oscilloscope I could get my hands on. Using both channels of the ‘scope, I probed two of the channel outputs. An example of it is below. You can see that there is about a 3 millisecond gap between the pulses. This means that there are two pulses in between the ones I have selected, so I probe around the second channel (green line) until it comes right after the first channel’s pulse.

Read More…


Comments Off

Quadcopter First Flights

03.29.09 Posted in Quadcopter by

Haha, it flies! I had no idea what to expect for the first series of flight…at least nothing broke.

Here is one of the indoor tests. I had the stability turned off for the yaw axis, and that’s why it spins around in the air like that. It’s kind of cool to see how necessary the gyroscopes are for stability. Clearly, it would be impossible for me to control the quadcopter if it was like this all the time.

Check out the really awesome styrofoam cups for “landing gear”. It’s quite a juxtaposition with all of the technology on the quad. I’ve placed an order for a better solution.

Read More…


Comments Off

MIX 09 Keynote

03.18.09 Posted in MIX09 by

Well, for some reason I’m in Las Vegas attending MIX09. I’ve got bags full of swag and every other person in the Venetian has a laptop out (even while walking). I just attended the keynote, and it was awesome. It seems Microsoft has been pretty busy giving web developers some really powerful tools. First, Bill Buxton (principle researcher at Microsoft Research) spoke about the necessity of good design saying:

“If you are a trained programmer, the last thing you should do is start programming.”

He emphasized the importance of having a clear vision of the product – not just the individual states that it can take on, but the transitions between them as well. A demo he had bombed, but thankfully all of the other demos went very well.

Next up was Scott Guthrie (VP of .NET and director of Silverlight), and he had a lot of awesome stuff to show us. He showed us demos of Microsoft Expression Engine 3, Expression Blend 3, a new MVC, Silverlight 3.0, and a few others.

I was very impressed with both the new versions of Expression Blend and Silverlight. The coolest demo was of a company that is helping Rolling Stones and Playboy archive all of their old magazines. It was just the slickest interface built using Silverlight, and I can’t wait to try it out. Unfortunately, the Rolling Stones site doesn’t go live for a couple more months, but the Playboy site will go live tonight. Link here. (As you can imagine, possible NSFW).

Now I’m off to some sessions detailing the Azure Platform.



Comments Off

New Rx Tx and Debugging

03.14.09 Posted in Quadcopter by

The replacement AR500 receiver came in the mail the other day. I managed to power it up without killing it like last time. I got a brand new transmitter too because the first one was the wrong mode. Mode 2 has the throttle on the left stick (which is standard in the US), and what I expected when I bought the first one. I was just unaware of the difference.

I used two servo extensions across the main data lines (instead of the usual configuration where the also connected to the power) and used a separate servo extension to go into the batt port. To my surprise, the receiver and transmitter connected automatically, so I was in business.

To read in the values of the receiver, I connect the lines to digital pins 2-7. I’m still a little shaky on just how the PWM output works, but I do know that there is one best way to read it in. Basically, I have six pins that I need to pulseIn( ) to get the pulse width. From what I understand, the receiver outputs a pulse in a very specific order for the channels. So the output may look like this:

Read More…


Comments Off

Sensor Debugging and Deans Connector Success

03.01.09 Posted in Quadcopter by

Today was a very productive day for the quadcopter. I had already converted the 4000mAh beast to a Deans setup, so I had to get all of the ESCs and Arduino power cables to join the battery in parallel. I bought a very cool 1 male to 2 female Deans parallel connector at the hobby shop, so I decided one side of that would wire two ESCs, while the other would take care of the remaining two ESCs and the Arduino. I’m not very good at joining wires mid-air, but it worked out alright.

Read More…


Comments Off

Low Latency Audio on iPhone

03.01.09 Posted in iPhone Apps by

I’ve been meaning to post about this for a while now. I’ve successfully achieved super low latency audio on the iPhone. The app is using RemoteIO, which is a super-duper-under-documented audio unit. Much of my success is due to Mike, and his blog is here. It’s running at about 5 milliseconds latency right now to allow for a more accurate fast fourier transform (although you can set a smaller size in my code). Right now it has a gain slider, a mute switch, and a ‘Write to Console’ button. The button prints all of the PCM values into the console for one instance of the audio callback. I’ve been taking that data and feeding it into MATLAB to make sure things are working properly. Check out this page to see what my MATLAB verifications look like. As mentioned above, FFT is working and I am performing a rudimentary frequency analysis. I am getting pitch detection with a resolution of 43 Hz because of the 5ms buffer and 44.1kHz sampling rate. Obviously that isn’t good enough for an application like a tuner, but the code could be adjusted. I’ve made the code open source and you can view the project on Google Code here. My next goal is to implement a very simple delay line and then start networking devices.



Social Networks
Links
Search the Archives: