Monday, May 18, 2015

Presentation Agenda

Here's what I'm going to cover in my presentation.
Introduction
This is my senior project. I hope you enjoy it!
How I Did It
The process of building a quadcopter.
Demonstration Video
It's flying!
How It Works
What goes on in this quadcopter, huh?
Demonstration Flight
It's flying in front of you!







Saturday, May 16, 2015

Not-so Emergency Broadcast

May 16, 2015:

Turns out, the parts did arrive in time for replacement. On Thursday, I received my order for replacement parts (paid for by my dad. It's his fault after all.) and today I finished putting together Quadcopter, part 2!
Out with the old parts, in with the new!
In the end, here's the breakdown (heh):
  • One frame arm was broken, so I ordered an entire new frame because they didn't sell replacement arms.
  • Testing revealed two of the Electronic Speed Controllers were broken. Ordered two new ones and soldered the bullet plug connectors on again.
  • One motor had a bent shaft, another one had the shaft pushed through the motor slightly. Also, one of the things that attached the propeller to the motor was broken. Ordered two new motors, and replaced the propellers from the spares that I had ordered in bulk.
  • I wasn't sure the radio receiver was working; testing it after the crash proved that something was broken, either with the flight controller or the receiver. Ordered a new receiver, bound it to the transmitter, and hoped that the flight controller was still working (It was. I tested it today.)
So it looks like we're getting that demonstration flight after all! Hooray!

Saturday, May 9, 2015

EMERGENCY BROADCAST

May 9, 2015:

You know how I planned on doing a demonstration flight?
Can't win against gravity.
That might not be possible.

So I went down to Lynwood with my dad because he wanted to try flying the quadcopter. It was supposed to be just for fun so I didn't think any videos were necessary. I did a short demonstration flight and then handed the controller to him.

As it turned out, though, my dad crashed the quadcopter.

For explanation, the throttle on a quadcopter is the equivalent of the gas pedal on a car. At low throttle, it won't generate enough lift to fly. After you turn the throttle high enough, it starts flying up into the air. Like a gas pedal, it makes the quadcopter accelerate. Upward. As long as the throttle makes the quadcopter generate more lift than gravity, the quadcopter will keep going higher. If it generates less, gravity is stronger and the quadcopter accelerates downward, with the lift slowing its descent.

With the throttle off, the quadcopter enters free fall.

When the quadcopter is too high up, it's basically vulnerable to any winds it comes across because I sure as heck can't see which way's forward for steering.

In the end, my dad didn't understand how throttle works, and flew it too high and it drifted too far. The throttle shut off and the quadcopter fell, right on the concrete. A modern day Icarus, if you will.

The picture above is a dramatization, sort of. What actually happened was that it landed upside down, and the pieces flew everywhere. As you can see, one arm broke off completely, the propellers fell off the motors, and at least one metal piece snapped. I flipped it back up and gathered all the pieces for this shot.

In all honesty, this is probably the end of my senior project. There is no way for me to order parts in time for the presentation. Even if I put the order in right now, there's no guarantee they'll work, given my history with that site. And who's to say I found all the parts that needed replacement in my post-action examination?

For now, though, this is how it ends. Rest in pieces, quadcopter. I never named you and you were a lot of trouble, but in the end I'm glad I made you.

Thursday, May 7, 2015

Really bugging me

May 7, 2015:

And what, you might ask, have I been doing this past nearly-a-month? Well, essentially, running into dead ends and bugs, before finally getting stuff to work.

So, WebIOPi turned out to be another dead end. The server could only send on/off signals through the board to the test LED. Looking into the source code for it was a mess, so I moved to a different, more simple idea.

RPIO, the thing I use to send PWM signals, is coded with Python, and the great thing about Python, or so I've heard, is that you can combine modules and functions as long as they're installed.

I wouldn't know for sure; this is my first time working with Python.

So now, the Raspberry Pi is running a simple server using Twisted. It's a Websocket connection, which for my rudimentary purposes is basically the same as a standard internet connection. No web pages, just listening for a client to connect.

Originally, I modeled it off some really complicated Autobahn Twisted Server setup, but something about the code prevented the client and server from connecting.

I picked up pretty much the basic framework of a Twisted server-client pair, and modified them to suit my purposes: create a little window with clickable buttons to change the brightness of the LED!

Okay, that's simplifying things a lot. The basic idea was for the client to send a word to the server, have the server recognize it and change the LED brightness with PWM, then send the word back to the client as confirmation. What follows is a list of problems, solutions, and programming jargon.

First problem: Server crashes when client connects.
Solution: RPIO can't clear the signal if it hasn't been set up. Gonna have to manually clear it every time to send a new signal...

Second problem: The server can receive and echo the message back to the client, but it can't recognize it.
Solution: Refer extensively to documentation. Change the imported module to match the class that the client imported.

Third problem: Using Tkinter as a GUI (application window with buttons) can't work with the server-client communication.
Solution: Hey, documentation says I just have to import another module and change how the GUI is run! Easy!

Fourth problem: Commands queue up and execute all at once after the GUI window is exited.
Solution: Change where the code is being executed. Instead of creating it when the client connects, move it somewhere else. Crash the server and client. Examine the code and realize that python classes are really complicated. Crash the client again. Move the code somewhere else. Crash the client once more. Take it out of the initial input/output class. Crash client. Fix variable references. Crash client. Research Python error messages. Refer to specific instance of the class instead of the general case. Crash. Examine source code and realize this is going to be even harder. Give up, take a break. Get prodded back to work. Override event on the connection-making class. Crash. Fix variable references again. Crash. Correct several bugs lying around. Finally get it to work. Celebrate by messing with the LED for half an hour.

Programming in a language you're unfamiliar with is hard.

But now I've got it working in concept! Press and hold a button to (theoretically) tilt the quadcopter in that direction. For now, it's not linked up to the flight controller and so it's just attached to the proof of concept LED. In fact, given the deadline coming up, I'm not sure if I can get everything stuck into the quadcopter board and find time to test it out for an actual flight and recalibrate the flight controller to receive the PWM signals form the Raspberry Pi correctly and wonder if it works on places other than our home network and fix it if it doesn't...

There's a lot of stuff left to do and I was thinking I was too ambitious with my initial goal.

In the end, though, I have a working, flying quadcopter, and working code that I could theoretically use to fly it with a laptop. I'd call that a pretty good success!

Saturday, April 18, 2015

Written in code

April 18, 2015:

So it's a bit late, but I still want to try to fit in at least some programming, like I intended to do when I set out. Change of plans, I won't try to replace the flight controller in its entirety, but I can replace the remote control receiver/transmitter pair with something of my own!... I hope. Anyway, yesterday I began reading up and trying things out.

My dad had various little boards and pins and connector circuit things, and I'll spare you the details, but my first attempt didn't work out. The work other people did with this board that was documented online was nowhere near developed enough for me, a fairly beginner programmer, to try to do anything with it. If you're wondering, the board was ESP8266 ESP-201, a wireless transceiver board, intended to communicate through WiFi.

After that didn't work out, my dad recommended a Raspberry Pi, a board he had from one of his old projects. With research and fiddling, we worked with it until we had success tonight!

What, you want details? Fine.

Okay, so the basic plan was to get a board to receive signals wirelessly and translate them into PWM (pulse width modulation) signals, wired to the flight controller. Now, my current remote control setup does exactly that, but I want to be able to build it with my skills.

If you're wondering what PWM is, it's basically the digital way to send analog signals. Binary digital signals only can send on or off (1 or 0) signals. This means you can only go full speed or completely stopped on any single signal. Analog signals say "at this point between stopped and full speed," something digital signals can't do. The way around that is repeatedly flickering between on and off, too fast to be noticeable by humans. If the signal is flickering so that half the time you're sending an on signal, you're saying "half speed." If the signal is sending "on" only a quarter of the time, you get "quarter speed." Make sense? Moving on!

So, there's been a lot of work done with the Raspberry Pi board already, so it's perfect for someone like me to fiddle with. I approached this from several directions. One, find a way to interface between the Raspberry Pi and something else wirelessly. Two, find a way for the Raspberry Pi to send PWM signals that the flight controller can interpret.

For the first part, there is WebIOPi, a project to get a Raspberry Pi to host its own local website. Anything connected to the same wireless network that has the IP and login information can enter the website and send signals for the Raspberry Pi. I worked with this first, trying out how to make a webpage with buttons and sliding controls that would send signals through the Raspberry Pi to whatever it's connected to. I got the basic stuff to work, by testing with a simple on/off switch for an LED. Trying to make a dim/brighten slider didn't work, though. That's when I moved on to the next part.

Next, there's RPIO, a module for the programming language Python for GPIO (general-purpose input/output). It had the ability to send PWM signals if I coded it correctly, and after a bit of work, I was able to set the test LED to whatever brightness I wanted!

Next up, sticking all of this together and onto my quadcopter!

Friday, April 17, 2015

Up in the Air

April 17, 2015:

Okay, now flight has really been achieved! I went down to Lynwood Elementary for the nice big grassy field to test out my quadcopter in a place where we wouldn't break anything. I mean, a few days ago I tried it on our front lawn, but I just ended up crashing it against the parked car (broke the propellers, but nothing else, thankfully).
Start the quadcopter up on level ground...
And with the preparations complete, It's time for a test flight! The first few did okay, but at the end of each one, a propeller detached itself and I had to screw it back on.

But then...


That's right! The sturdy little quadcopter flew over 40 meters, lengthwise. Fiddling with the throttle was hard, though. I could never get the quadcopter to stop flying upward or downward. Still, even when it bounced against the ground it kept intact and flying. I'd call this a huge success!

See, it's intact after the flight!
Compare the camera's position of final landing to me in the back, where we started.
My high-tech equipment. From left to right: Launch pad, remote control, quadcopter.

Sunday, April 5, 2015

Head in the clouds

April 5, 2015:

I have achieved flight!

Where we last left off, I had been waiting for replacements to arrive. Well, no longer! For this Thursday the new flight controller that I had ordered (from Amazon, there's a reliable company!) had arrived. And just yesterday I made sure all the software was up to date!
Also, soldering the ends on the replacement ESC. Only burned myself once!
This afternoon I set everything up again. Now my motors are calibrated, my remote control is working (albeit slightly jury-rigged to make up for the previous problems about transmitting channels)
Pictured: Said jury-rigging. No setup wizards here, no sir!
Now everything is ready for the final touches: rearranging everything to fit into the quadcopter!
Duct tape works for everything!
Stick the power distribution board back on...
Wrap up all the loose wires to prevent short circuits and tangled wires
Final step: Put on the propellers!
And it's time to try it out!

It's a start, right?

Now I need to get better at actually steering the darn thing, maybe somewhere that doesn't have wind...

Monday, March 16, 2015

Customer Disservice

March 16, 2015:

So! You want to know why there hasn't been an update on this for months, huh?

Well sit back and relax as I tell you the tale of return policies and warranties and bad customer service!

Where we last left off, there were several parts of my quadcopter that had broke. The flight controller and an ESC to be exact.

That was months ago. I filed the warranty claims and made the explanatory videos of the problems, and waited for Hobbyking to get back to me.

Three weeks pass, and still no response. They couldn't have taken that long to confirm that the parts weren't working, right? I expected replacement parts to be sent!

So turns out that when I checked their website and the status of my warranty claims, one of them was resolved and reimbursed with store credit (but I specified a replacement part in the claim!) and the other one had remained under initial evaluation for the entire three weeks since the parts arrived at their warehouse! This is ridiculous!

On Friday I chatted with a representative, and a crudely cut transcript is below. Click to enlarge.


Well, at least I'm getting one replacement. The biggest obstacle for this project is turning out to be getting the parts, not putting them together.

Sunday, February 1, 2015

Suspect is armed

February 1, 2015:

This has been an incredibly frustrating turn of events.

My dad had ordered a new flight controller board to replace the one we didn't know how to fix. This turned out to be for the better, as this board had tons of documentation, and supported OpenPilot software, which is nice and user-friendly. Now I might be able to go somewhere!

The work started on January 31. I reconnected everything, double-checked the instructions ,and spent the better part of an afternoon reading up on how to set up OpenPilot software on my new flight controller. Going through the steps to load the software to the board and confirm that everything would be in working condition was simple enough, until I got to configuring the controls.

Evidently there's something wrong with the radio transmitter and receiver I got, because one channel doesn't work, and that throws off a bunch of the other channels. I spent an hour trying to get the controls to transmit correctly, but I gave up, and decided: No big deal, I just have to remember what throttle and yaw are actually controlled by.

And so everything should work now, right? Well actually... the accelerometer and gyroscope are having trouble, so I have to redo the process that clears the software and flashes a copy that's up to date onto the board.

NOW, everything should work, right? Well, I have to check all my wire connections, because I need to do the whole setup wizard all over again, because clearing the board to default removed the settings.

Well, surely now it'll work right? Actually, now one of the motors isn't responding! So now there's a problem there! Let's shuffle the wires around to pinpoint the problem... and it's the electronic speed controller. Something must have messed with the connections to the signal wire, because now when the board tries to communicate with the speed controller, all I get is a constant vibrating motor.

You know what? I'm giving up for now and returning to this problem when I feel better about all this.

Saturday, January 24, 2015

Remote location

January 24, 2015:

It's been a while since my last update! A few days ago, I got my replacement battery in the mail, so now I've been trying to get the quadcopter working.

No pictures this time. I didn't have someone around to take 'em.

Battery's plugged in, the motors are armed, they're beeping in wait for a signal, so I turn on the remote transmitter and... nothing.

I puzzled over this for a bit, when I realized I had forgotten something basic.

I never bound the receiver to the transmitter.

Whoops.

In my attempts to bind the two, I found another problem: My flight controller board couldn't power the receiver. I don't know what's going on there, but a little fiddling around and following YouTube instructional videos let me at least bind the transmitter and receiver, taking power from one of the ESCs.

Now, the problem with the flight controller could be from any place, really. The Electronic Speed Controllers could have faulty connections to the board or something.

To test that, I ignored the flight controller entirely and plugged each electronic speed controller directly into the receiver. After a little period in which the motors stopped beeping, they all began spinning.

No problem there.

So I tried connecting everything back to the flight controller, and then supplying it with an external power source. Really, it was just a USB-to-miniUSB wire that led to a outlet. The transmitter is on, the motors are armed and... still nothing.

I even reloaded the software on the board, double-checking the configuration file. It still didn't work.

There's definitely something wrong with my flight controller. This requires further investigation...

Friday, January 16, 2015

I warrant there's a reason to all this.

January 16, 2015:

Wow, it's really been a while since my last post. I should start catching up, even if nothing has really happened.

So, I asked about my defective battery on live chat. The person directed me to fill out an RMA Form. This was on January 7th.

Live chat! Hopefully it'll work out...
The form filled out and the battery sent, all I have to do now is wait!

...and keep waiting. What's the holdup?

So tonight, more than a week later, I entered another live chat session with support.

Time zones, how do they work?
Well, there's your problem! Turns out they thought I was past the 30 day warranty period because of timezone differences! At least that's cleared up, so now instead of waiting for a response, I'll be waiting for the shipment to arrive.

It's still waiting, but hey I'll take what I can get.

Sunday, January 4, 2015

Free of charge

January 4, 2014:

No pictures this time, just a quick update.

So some online research over the past few days has told me the most likely problem that's affecting this project. Apparently, if the voltage in one of the cells is too low, the charger won't charge the battery as a safety measure.

Why a safety measure? Well, there are some people who have given advice on how to force a charge on your lithium polymer battery, and they say that you should not attempt this without professional guidance, preferably in an open area.

Because there's a chance that the cell is dead and charging it will cause it to explode.

...I'm just going to leave this to the experts. My dad thankfully has a coworker who can force a charge on it, so I'm trusting him to return the battery in a state that's chargeable, or I'm gonna have to buy either a new battery or a higher-quality charger.