So after my initial UAV failures and the mild success of TTB, I’m ready to move forward with the tiny autonomous helicopter project, and to do it right this time. One of my self-imposed UAV rules is the constant wireless link to the ground, so I found these awesome 2.4GHz boards on eBay for about $2 shipped from Shenzen (how does anyone make money on that?). I spend a couple hours learning to use the SPI hardware on the PIC16F1824 and having that configure the radios, and now I have a good wireless setup for UAVs and tons of other projects. The Nordic chips are awesome, their built-in functions pretty much handle everything for you except frequency hopping, which probably isn’t necessary for most of the stuff I’ll use them for.
I also had the “no IR for altitude sensing” rule, so I ordered a cheap ultrasonic rangefinder board. This was really quick to get up and running, but it seems to give me glitchy readings sometimes. Some simple software techniques can fix that.
I finally opened the box on my third Syma S107, and did the obligatory test flight to make sure it’s stable. I also measured the stock weight so I will have some idea of how heavy my additions are. Then I stripped absolutely everything off of it that wasn’t critical to spinning the rotors, and put on some music wire landing gear, which left this funny-looking thing:
A while back, I had designed a UAV PCB and had it made on the same panel as the TTB board, but a lot of my ideas for the UAV project have changed since then. I still populated it and hooked it up to the rangefinder, but after a weigh-in I decided there was way too much extra stuff that I didn’t want and scrapped it.
I ended up using two small boards that I threw onto my last PCB order just to fill space: a little breakout board for 14-pin SOIC parts with low-side FETs on the two pins that correspond to PWM hardware on the PIC16F1824, and a generic tiny H-bridge board. I populated these two, glued them together, and wired together the power and signal lines for the tail rotor H-bridge. This was stacked on top of the rangefinder board and the total electronics size and weight is now much lower.
I threw this assembly with the stripped copter and a 130mAh (stock capacity) lithium polymer cell on the scale, and the weight came in under stock weight! It actually will be able to fly carrying the new electronics.
I spent a while staring at the two main pieces trying to figure out how to attach them, and finally came up with this goofy setup with little plastic strips and tape. It seems to hold up well, it’s lightweight, and it lets the board move around which may reduce damage in a crash. I wired the motors in and the first spin up was successful. Initial tests of simple hover algorithms were awful, I think because the rangefinder gives me a bogus number about 25% of the time. While I was trying to figure that out, I wrote a routine to play a little tune on the motors before it starts up. This idea came from Shane Colton's MIDI scooter. I just run the main rotor motor PWMs at a very low duty cycle (so low that they don’t spin the rotors), and adjust the frequency to play different notes. A bonus feature without any extra hardware! It's a little hard to hear in the video:
I took the helicopter with me on vacation (where I’m writing this from now), and I had just started to make some progress on hovering when a ceiling crash ripped one of the motor wires off the PCB, so development will have to wait until I’m back and have a soldering iron. The attached code includes playing the tune and all the basics for running the helicopter hardware, but hovering isn’t working yet. I implemented a basic slew-rate limiter to clean up the data from the rangefinder, and that seems to work well.