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).
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.
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.
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.
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:
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.
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.
This may be obvious to those who have experience with RC stuff, but I figured I would share my experience anyways because I think a couple of people on the forum face the same challenge. The problem with the most popular battery mentioned on the forum (Zippy Lightmax 4000mAh) is that it has bullet plugs for the discharge connectors. Not only that, but there’s one male and one female. Weird.
Google Maps found a hobby store about 35 minutes south of here, and I made the epic journey this afternoon. It’s called Hobby Shop World and the man who owns the place was very helpful. He even gave me 10% off some of the parts! Anyways, I picked up some Deans connectors and four 9 inch servo extension wires. The servo extensions will be used to connect the receiver (after I buy a new one) to the Arduino. Thanks to sumsumdum on the forum for this post.
So everything was coming along just fine until I just broke the AR500 receiver. I was being a noob and was probing 5 Volts around the pins as if it was no big deal. The LED stopped flickering (which is always bad) and when I touched the receiver, it was extraordinarily hot. I’m pretty sure it is dead to the world.
The good news is that the frame, motors, and props are all assembled. Also, the new XBee shield came in the mail today. The old one was no good because it didn’t allow any room between it and the protoshield. All of that soldering for nothing! The new one (as you can see below) is shaped like an ‘L’ and allows us to mount the IDG300 gyroscope vertically to detect yaw. Sweet.
I just posted on the forum over at RCGroups begging for help with my current problems. Hopefully they will be kind enough to provide some insight to get over this 43 foot speed bump.
I have written code to test the 5DOF and it is working very well. I’ll post screenshots soon if I get it looking pretty.
This was one of those things that needed to be done, but just difficult to get around to. It actually turned out to be much more interesting that I expected. Here’s the problem: the EPP1045 propellers had a hole that was too small in the center. We needed to bore a wider hole so that they could slide onto the brushless motors. What good is a helicopter with no props? José and I went to the machine shop on campus and they were extraordinarily helpful. It turns out the brushless motors had a 10/32″ diameter and the attendant (appropriately named Angel) set us up with a drill press and a special vice and bit. We even went a step further and threaded the inside of the widened hole to match perfectly with the motor’s threading. Quite a learning process. It was very cool to see how the machine shop works, and it is good to know they are very supportive of our project. We’re going to have to go back soon to cut and drill into some carbon fiber. Now we can assemble the props to the motors, mount them on the frame, place the ESCs on the frame, and fire up some test code to see if we can successfully arm the system. Pictures are below. Click on any to enlarge.
The 5DOF unit from Sparkfun came in the mail today. Also, the Rx Tx José and I ordered came a couple of days ago. Below are some pictures. Click on any to enlarge. The quarter is just so you can get a sense of scale. I just soldered some headers to the sensors so soon they’ll be attached to the protoshield.