24 June 2013

Building a 3D mapping Robot

This post is part of a series: Designing a Mapping Robot

Some of you have asked what I've been up to lately. Others have wondered why I haven't been in touch. The answer to both is the same. Also those of you who've asked me and had their ear talked off or been hit by my wild gesticulating I apologize. I sometimes get a little nerdy and excited. Also sometimes I understate things.

After seeing the movie Prometheus (which I blogged about here) I was talking with my cartographer friend Philip and we were nerding out over technology and gadgets. He was telling me how professionals in his field use technology to take readings of geographic features to make maps for use in GIS applications.

Surveyor B&W Photo used for dramatic purposes.

Sometimes they use fancy airplane-mounted super-lasers (cool!) but more often than not it's about having a stick with a measuring tape on it that you move around to different places and write numbers down. I'm over-simplifying but it's my blog so I can do what I want.

The surveyor method is as old as dirt and has lots of advantages, chief among which is accuracy. You can take measurements through things like silt and foliage that lasers can't penetrate. It's a lot more complex now too with things like total stations which can resolve GPS coordinates down to very narrow tolerances.

The disadvantages of this method side is that you might spend days with aforementioned stick and tape just to get a few hundred points.

Ground-Based Survey Method:

  • Accurate
  • Can penetrate silt/foliage
  • Established methodology
  • Finally a good use for co-ops, interns and grad students
  • Time consuming
  • Very sparse mesh (<100 points per survey)
  • Hand-entered data
  • Lacking in coolness. Not very futuristic!

Mapping robot from the movie Prometheus Mapping robot from the movie Prometheus

In Prometheus, one of the characters had these two little hovering spheres that he threw up into the air and they hummed along down the dark alien hallway shooting lasers and sending a perfect map of the structure back to the mothership.

So how far are we from having this technology? As it turns out, not that far at all but I don't want to get ahead of myself.

The Story Begins

It's a big topic so I'm going to break this down into a series of posts. It's a big story and it's not nearly done and it's taken up a good chunk of my spare time since November 2012.

Here are the posts I'm going to aim for (they'll get linked up as I write them):

  • Part 1: (this post) "I know nothing but that I know nothing... and I want a flying mapping robot".
  • Part 2: Assembly and why flying indoors is a bad idea.
  • Part 3: First flight. Everything was going so well.....
  • Part 4: Enter the 3D printer!
  • Part 3: Learning to fly outdoors and finally collecting some data
  • Part 4: Photogrammetry: Turning that data into something usable.
  • Part 5: TBA. I'll write some glassy-eyed piece about where we go from here. That or "Top 10 Kitten Videos" as a fallback

Ok, you can skip to the section you want to read or keep going.

The first step in all of this is making a flying thing.... preferably with lasers. Actually I have a set of criteria for what I need:

  • Autopilot: Flying thing must fly and land safely on its own without user input.
  • Make a satisfying humming noise. 
  • Be able to lift a small camera
  • Not break the bank.

Some friends of mine and I have been trading videos of Quadrotors (that's "quad" as in four and rotor as in...well rotors). The things seem to be everywhere and are all the rage these days. You know when you can buy something out-of-the-box at BestBuy that it's gotten into the public psyche. Unfortunately, the low-cost quadrotors you buy in stores wouldn't fit our needs of having a programmable autopilot and the commercial ones that are already out there are way to expensive ($500 and up!).

As a reference I've cobbled together a YouTube playlist of all such robots that I could find. There are hundreds already on YouTube but I've tried to pick out some of the more interesting ones:


So I decided to try to build my own from scratch. If I'm being really honest it was more about needing to understand the system and the love of electronics, hacking and flying things that persuaded me. Time to put that engineering degree to use!

But where to start?

Stage 1: Copycat

I am someone who learns by doing. Not that reading is boring or unnecessary, I just think with my hands. Step one was to find someone who was doing something like what I wanted, copy it and get it into the air as quickly as possible.

Watching dozens of university experiments on YouTube played a big part in my inspiration. I was also looking at the way they moved and listening to what people were saying about them. The tiny hand-sized copters,  were great and looked really neat but would do poorly outdoors where there is wind.

I found a guy named Russell at scoutuav.com who had built a nice carbon fiber quadcopter and had documented the process right down to shopping lists and assembly diagrams. Sweet! Even with an engineering degree behind me at this point I didn't know anything about anything between the battery and the motors except that it was vaguely "Arduino-y". Lots to learn.

Stage 2: Spend some money

This step is where mistakes are expensive but unavoidable. Simply ordering everything in the scoutuav shopping list was an easy way to get started. When the store he recommended was out of stock of a certain part it forced me to go research replacements and this, in turn, taught me about components one at a time.

I did make some mistakes and I spent some money on some parts I ended up not needing but this is all par for the course. Looking back I might be able to assemble the thing in a tenth of the time and 60% of the original cost but hindsight is missing the point. If you want to see my full shopping list I've made it available (including all subsequent versions).

Nothing to do now but wait for a confused-looking Fedex guy to arrive with lots of weird-shaped boxes!

Stage 3: Unboxing and learning

There are lots of different systems needed to keep an airplane in the air. There are still more for a helicopter. Then there are still more again for a quadrotor and finally when you're including an autopilot you need just about as many systems as you can fit into it and still lift off the ground.

We have Sensors:

  • GPS: To tell us where we are and a rough idea of altitude
  • Pressure and temperature sensors: A slightly better way to measure altitude. Not sure why temperature is there but it came on the same board as the others.
  • Ultrasonic Range-finders: Super accurate elevations up to 3M for flying near to the ground
  • Pitch, Yaw and Roll Accelerometers: tell us if we're rotating along one of 3 different axes
  • Magnetometer: Kind of like a compass. Measures changes in the magnetic field. Good for figuring out which way you're pointed when combined with the accelerometers.
Then there are communications:
  • Radio Control: For flying in manual mode
  • 2.4GHz Radio: Our data connection with the base station
Then there's the power and motor stuff that does the actual lifting:
  • 4 Speed controllers: tell each of 4 rotors how fast to spin to keep everything level
  • 4 Motors with propellers: Vrooom....
  • Lithium Ion Battery: This thing delivers 20Amps (yes Amps) of power to the motors.
Then you have the thinky bits:
  • Arducopter board: An arduino chipset soldered on a custom board designed for autopilots
  • Speed controllers: I mention these again because each one is a little computer that takes what the arducopter sends it and converts that into voltage for the motors.
Then you have the software:
  • Arducopter Firmware: Arducopter is a branch of Ardupilot which is an open-source autopilot system that uses the MAVlink protocol. It's designed specifically to be used on Arduino-based chipsets.

When all of these things arrived it was like christmas morning. I rushed home from work and immediately started the long process of learning what each thing did.

For me it was really important to work with one component at a time.  Many of the components were like little computers and each had their little quirks and pin diagrams. Only by understanding the inputs and outputs of each piece was I able to figure out how they all went together.

I had a spare Arduino starter kit and breadboard lying around and so, with the help of the product sheets and some tutorials I googled I was able to write little Arduino sketches to test things

Here's me finally getting the GPS to work

And here's the ultrasonic rangefinder

It may not look like much, and looking back it wasn't but these little Eureka moments balanced out my failures and convinced me to keep going.

Wrapping up

Starting a new project is always loads of fun. I Love that euphoria from the possibilities of creating something with your hands.

In the next post we'll actually get it all together!

This post is part of a series: Designing a Mapping Robot
  1. Building a 3D mapping Robot 24 June 2013
  2. Quadrotor Shopping List 28 June 2013
  3. Assembly and why Flying indoors is a bad idea 30 June 2013
  4. First flight. Everything was going so well..... 10 January 2014

Filed in: Nerd   Quadcopter  

Comments: This is a tiny site and comment moderation is a pain. Let's use social links to have a conversation on a bigger platform: