Intro
My name is Jake, and this is my
post all about my path to try and build my own drone. To give you a little bit
of background, I’m an engineering student at Utah State University pursuing my
bachelor’s degree in mechanical and aerospace engineering with a minor in
computer science. I love the idea of creating things, of taking a bunch of
useless parts and putting them together in a way that takes advantage of
principles of engineering, physics, and chemistry and gets it to carry out a
useful task, giving my creation “life” so to speak.
I have worked on cars for many
years and have also been studying engineering for a while now which has allowed
me to work on and study the physical side of things, what I like to think of as
the body of a creation. However, I recently discovered coding which opened a
whole new world to me. If mechanical engineering is the creation of the body of
an invention then coding and computer science is the creation of the mind. It
amazes me as a sit at my computer and type in code that I’m teaching my
creation how to think. The commands that I type in are the logic that it will
live by and it will carry out what I want it to do without fail (ok, actually
it fails to do what I want it to quite a bit, but after enough debugging
everything complies in the end… hopefully).
Anyways, that’s just to give you a
little history on me and why I feel the way I do about this stuff. I originally
started college with the goal of going to med school (I kind of feel like
everyone did that though) so I was doing pre med but by a happy accident I was
majoring in mechanical engineering and after the first semester I was hooked. I
realized nothing else as a career would make me as happy or leave me feeling as
fulfilled as engineering had managed to do after only a few months. It gets me
excited just thinking about it. I wish other people could understand what I do
about this process of creation. I feel like they would be just as excited about
making things as I am if they did.
How I Ended Up Here
Several engineering friends and I have always
thrown ideas around about projects we want to try to build. Usually everything
is just hypothetical because of the money and time restraints of being a
student, however over the summer break of 2017 my friend Caleb and I decided we
would try to go through with one of our projects. The ideas we’ve played with
have ranged from building things like a tank to a rail gun. I think it’s the
inner child in us that wants to build something cool and destructive. However,
for this summer we decided to build our own drone. Studying the flight
mechanics and optimal design of a drone will help us in our future studies in
aerospace engineering and if I’m being honest this was one of the cheaper
projects we could have gone through with.
In order to get
as much as possible out of this project we wanted to build the drone completely
from scratch. Looking up how individual pieces worked, such as an Arduino function
or an accelerometer calculation, were acceptable. The idea, however, was to
avoid following a cookie cutter recipe that we found online. We aren’t doing
this so much to have a drone to fly (if we wanted to do that we could have
bought one for much cheaper). We’re trying to learn the ins and outs of how all
the different parts come together and work (I even have the goal to figure out
how all the parts of an Arduino work, but that might be a little out of the
scope of this project). After mentioning the project to a neighbor he suggested that I write my process down in a blog to have a record of it, so here it goes.
Anyways, enough
background, let me tell you about our process.
Methods
The
first thing we needed to do was create our parts list. The first thing that
came to mind was motors. I looked around online for some options but just left
more confused than anything, so we went to a local hobby shop that specialized
in remote control flight parts. They had several motors available but we ended
up just going with the cheapest ones. Eventually I would like to build a drone
that has some real power but for right now I just want one that can get off the
ground, keep its balance, and hopefully not run into anything.
I bought
one Suppo M2204 2350Kv brushless motor. I wanted to just get one and make sure
I could get it to work before I spent sixty dollars on an entire set. The
motors are servos so they require an electronic speed controller, or ESC for
short. These basically allow you to adjust the speed of the motors, which is
essential since the voltage for a digital logic circuit only allows for one
speed which would make for a pretty boring drone. The guys at the hobby shop
said they didn’t sell any ESC’s that they would recommend using (I really
appreciated their honesty), so I got online to try looking again. This time I
got lucky and found a good ESC for a cheap price. I bought a hobbymate 15 amp
BLHeli ESC, just getting one to test with before going all out. Caleb and I also bought a 2250 mAh 3S LiPo battery from the hobby shop.
The next
step was the brain of the drone. At first we thought we’d use a raspberry pi 3
because it has built in Bluetooth and WIFI which we thought would be a good way
to control the drone. I had this crazy idea that I was going to develop an
android app with a controller interface to run the drone through Bluetooth. It
makes me laugh thinking back about that. Besides the fact that Bluetooth has an
extremely short range, I barely know a thing about android development and the
one tutorial I followed on how to make a ‘hello world’ app left me more
confused than enlightened. So I’m sure that would’ve been a disaster.
I had an
Arduino Uno microcontroller board that I decided to use for the initial tests
with the motor and ESC (I’ll tell you about that in a minute). After running a
few tests with the Arduino I realized that we would be able to run the entire
program on the microcontroller. I feel like it was a good decision since Caleb
and I know how to code best in C++ which is what Arduino runs on. Buying a
raspberry pi would have required learning a whole new system, and we already
had enough new things to learn.
So now that I had a motor, ESC, and a battery I wanted to test how it worked. I didn't know what kind of signal an ESC needed to receive so I did have to google that, but it turned out to be pretty simple.
This website explained it pretty well. First you need to download the servo library for Arduino. Once you have that you can create servo objects that you simply send a number to, either through the serial monitor or a radio controller.
I hooked the ESC signal pin into the arduino and loaded up the sketch so that I would be able to send numbers to the ESC through the serial monitor. I wasn't sure what number to send at first. The website that I referenced earlier said the HobbyKing ESC ranges from 700 to 2000, so I tried that. Sending 700 didn't do anything, I later found out that was below range, but at the time I thought I might have done something wrong. Just to check I decided to send 2000. Unfortunately, I didn't have a very good grip on the motor (I was just barely holding onto the bottom in my hand) and 2000 turned out to be max velocity for this ESC. So as soon as the ESC recieved the signal the motor flew right out of my hand, the nut came off of the motor (I had the propeller spinning the wrong way for the threads), and the propeller shot across the room. It all happened in a second, the motor got all wound up in it's wires and the propeller almost took my eye out. So if you try this make sure you're careful.
I needed to find the minimum and maximum numbers that could be sent to the ESC. But since I just learned these can vary by ESC some experimenting had to be done here. In the end I figured out that the upper limit was 2000 and the lower limit was around 1100.
So now that I had a motor, ESC, and a battery I wanted to test how it worked. I didn't know what kind of signal an ESC needed to receive so I did have to google that, but it turned out to be pretty simple.
Set up of the motor, ESC, and arduino
The ESC has three wires running out from it that connect with the three wires coming out of the servo motor. The order that you connect them in determines whether it spins clockwise or counterclockwise. However, because the three wires coming out of the motor and ESC were all black I'm not really sure how they need to be connected to get it to spin in a certain direction. My solution in the end was to just test it by trail and error until I got the connections right.
On the other end of the ESC there are four wires. There is a red and black wire on the sides that connect to the lipo battery (not shown in picture) and a black and white wire in the middle that will go to the arduino. The white is the signal wire and the black is the ground (it's important to note that this ground wire needs to be grounded to the arduino or wherever the signal is coming from, not the lipo battery).
Initially I wasn't sure what kind of signal the ESC needed to receive so I had to search around.
http://www.instructables.com/id/ESC-Programming-on-Arduino-Hobbyking-ESC/
This website explained it pretty well. First you need to download the servo library for Arduino. Once you have that you can create servo objects that you simply send a number to, either through the serial monitor or a radio controller.
I hooked the ESC signal pin into the arduino and loaded up the sketch so that I would be able to send numbers to the ESC through the serial monitor. I wasn't sure what number to send at first. The website that I referenced earlier said the HobbyKing ESC ranges from 700 to 2000, so I tried that. Sending 700 didn't do anything, I later found out that was below range, but at the time I thought I might have done something wrong. Just to check I decided to send 2000. Unfortunately, I didn't have a very good grip on the motor (I was just barely holding onto the bottom in my hand) and 2000 turned out to be max velocity for this ESC. So as soon as the ESC recieved the signal the motor flew right out of my hand, the nut came off of the motor (I had the propeller spinning the wrong way for the threads), and the propeller shot across the room. It all happened in a second, the motor got all wound up in it's wires and the propeller almost took my eye out. So if you try this make sure you're careful.
I needed to find the minimum and maximum numbers that could be sent to the ESC. But since I just learned these can vary by ESC some experimenting had to be done here. In the end I figured out that the upper limit was 2000 and the lower limit was around 1100.
No comments:
Post a Comment