Chris Anderson's Posts (2718)

Sort by
3D Robotics

Basic Stamp autopilot tutorial, part 3


[UPDATE: We no longer recommend this GPS module, since it's incomptible with GPS simulators. The module we do recommend, the EM406, is described here.]


Now you've got the hang of connecting components to the development board, you'll be pleased by how easy it is to include GPS. Parallax sells a pretty inexpensive ($70) GPS module that has a simplified "smart" mode that only sends the data fields requested. It's not the best GPS chip (only 12 sats), so you'll need a pretty clear view of the sky and it probably won't work indoors (but a little balsa or foam in your plane shouldn't be a problem). This is the easiest GPS module to use with the Basic Stamp board, but if you think you're going to want a more advanced module with better reception, skip to the next tutorial

I had a little trouble when I first tried to get the Parallax GPS working, so this tutorial will help you avoid my mistakes.

First, DON'T place the GPS board right on your development board's breadboard. For some reason the GPS reception is terrible there, due to noise from other components. Instead, use another female-to-female servo connector cable (at least ten inches long; one of these is fine) and with it connect the three GPS pins other than /RAW to one of the dev board's servo ports that you're not using, as I've show in the picture.

Second, you're going to have to modify the demo code for the particular BASIC Stamp chip you're using. This took me forever to discover and it's definitely a shame that neither the manual or demo code mention this. You'll see in the code that there is this line:

T4800 CON 188

It tuns out that that 188 is just for the BS2, BS2e, and BS2pe chip. If you've got one of the other chips (I've got the BS2p) you need to change it. For the BS2sx and BS2p the number should be 500. For the BS2px it should be 813. (This info is buried in the BASIC Stamp Editor's help file in the SEROUT entry)

Also, change this line:

Sio PIN 15

To reflect whichever pin you've actually connected the GPS's SIO pin to.

Once you've made those modification the demo should run and you'll be able to copy the relevant code from that to your autopilot program.

If you're finding that this GPS just doesn't give you reliable enough performance, you may want to upgrade to a more advanced GPS module based on the 20-sat SIRFIII chipset. A good choice is this one from SparkFun, which is $10 cheaper than the Parallax module but offers much better reception. It's a bit trickier to interface with the Basic Stamp chip, so that's what we'll look at in the next tutorial.

Previous posts in this series:

Tutorial 1 -- Servos
Tutorial 2 -- Reading the Rx
Read more…
3D Robotics

Basic Stamp autopilot tutorial, part 2

Okay, now that we have the BASIC Stamp board driving the servos, let's now have it read the R/C receiver signals. This is a simple matter of plugging in two cables from the receiver to the board. I've shown two ways in the photo here: one is with a female-to-female cable, if you have one, plugged straight into the board servo ports (I used port 13 in this example); the other is to strip and tin the wires from a regular servo cable and push them into the breadboard, then connecting another wire to one of the Stamp pins (that's the white wire that goes from the breadboard to pin 5)

The code here will test your hardware and see if it's working. The aileron stick on your RC transmitter should drive the servo (it's a little jerky, due to processor delays, but nothing too serious). When you flip the gear switch (channel 5) on your transmitter, the board will go into "autonomous mode" and move the servos itself. Flip the switch back and you're back in manual control.

Next, we'll connect the GPS in this post.

Previous posts in this series:

--Getting started with servos
Read more…
3D Robotics

Basic Stamp autopilot tutorial, part 1

Over in the discussion sidebar, Wayne Garris and James Hall have been working through the details of how to build a BASIC Stamp autopilot, which we use in in GeoCrawler3 (formerly 4--sorry for the confusion!). They're doing a great job of catching bugs and otherwise sharing tips, but this has been a reminder to me that I should post a tutorial on setting up the hardware. So this will be the first of several posts on assembling the board and components for this autopilot, and customizing the software for your own needs.

First, let's just set up the board to control a single servo with the FT639 chip on the Parallax development board (later on I'll show you how to do it using the Parallax servo controller board, if you prefer that). The single FT639 chip has the advantage of being small and easy to integrate into a single-board autopilot, but it's not the greatest servo controller in the world and doesn't handle high-speed applications well (we're just using it on the rudder, so it's fine for our purposes).

In this case I've connected the FT639's serial-in pin to the Stamp's pin 8 (yellow wire), and the FT639's servo 1 output pin to the signal pin to servo connector p15 (blue wire). The black and red are ground and power, of course. Couldn't be easier.

Here's the code that just tests this servo in several position. Once you get this working, the next step will be to read the R/C receiver input signals and pass them through to this servo. Go to this next post here.
Read more…
3D Robotics
The Crossbow MNAV autopilot system is a pricey (starting at $1,500) package of sensor and GPS hardware that has received a lot of attention in the amateur UAV world because Crossbow, to its credit, open sourced the autopilot software. This has provided a useful learning tool for all of us writing our own autopilots, since the source code shows examples of everything from Kalman filtering to crosstrack waypoint following.

Curtis Olson, best known as the creator of the open-source FlightGear flight simulator, has done the best work of building on the Crossbow code. He's recently released the source code to his Microgear autopilot, which uses the Crossbow IMU hardware and replaces the Crossbow processor unit, known as Stargate, with a much more powerful Gumstix Linux single-board computer. He's also released the groundstation software (shown), which naturally works with FlightGear. He describes the project well here.

This is a little out of our league at DIY Drones, both in price and complexity, but for those you who want to go deeper on autopilot theory, a browse through Curtis's source code is very instructive. He's written it in C++ and done a pretty good job with comments, so it's not too hard to parse. The Kalman filter is still a little over my head, but I thought the waypoint handling was very clear.

If you're interested in learning more about the Crossbow (often known as Xbow) hardware and software, Tony Truong Giang Le has some good tutorials here and here.
Read more…
3D Robotics
What do you get for the hundreds of thousands or millions of dollars cost difference between our UAVs and those of the pros? Well, a lot (even after you take out defense contractor markups). Ours are one-offs that need a lot of hand tweaking, care and knowledge to use. They have limited range and altitude, and as we know all too well, sometimes they don't work at all. (But hey, losing a $1,000 UAV doesn't hurt as much as losing a $10 million one!)

In addition, they have only a small fraction of a pro UAV's feature set. I was reminded of this as I was looking at the source code for the Micronav software for the Crossbow hardware (shown), which one of the more sophisticated open source autopilot programs (but is still at the bottom end of the pro autopilot range).

Here are some of the things the Micronav software code has that we don't:

--Full avionics and telemetry data downlinked to the ground.
--A proper custom inertial measurement unit (IMU), using gyros and accelerometers and Kalman filters in software
--Data logging
--Smart ("look ahead") waypoint finding algorithms, that don't just get to a point but get to it efficiently and along a predictable line.
--Corrections for what part of the Earth you're flying over (northern or southern hemisphere).
--Use standard UAV commands for dynamic mission/waypoint changes, such as "loitering" over a target.
--Ground station software

Other autopilots have such features as:

--Automatic adaptation to different airframe platforms after inputting a pre-recorded flight from that aircraft.
--Auto-land and take-off
--Communications between camera and autopilot so you can steer the camera and let the plane steer itself
--Etc...

We'll get some of those feautures someday in our own UAVs, but for now we take all sorts of shortcuts to stay within the reach of amateurs. For instance, we usually don't build our own IMUs. The DIY Drones approach is to let some off-the-shelf hardware handle the tricky job of stabilization and our custom hardware and software just handles the easier 2D job of GPS navigation. We don't have any ground station software for real-time control and communications (just software for post-processing of imagery). You've got to hand-tweak the autopilots for each new airframe. And we let commercial GPS receivers handle the job of data logging.

Anyway, if you want to be reminded of how much math you've forgotten since college, check out the source code. And then be thankful for all we've spared you!
Read more…
3D Robotics
The University of Michigan is working on a very interesting 7ft-wingspan electric UAV that is designed to decide for itself whether to float or fly. It's shown here with the electronics of an ocean buoy with which it can interact. It's modeled after sea birds such as the pelican, which fly close to the water.

ZDNet has a good article on it here, including this quote from project leader Ella Atkins:.

“Flying Fish, an electric vehicle, drifts until its onboard GPS tells the craft it has floated too far. That triggers the takeoff sequence, which gets the plane airborne in just 10 meters. Other GPS coordinates trigger the landing sequence. The craft accomplishes both in simple ways, explained Atkins.”

Surprisingly, Atkins adds that during takeoff, the UAV is blind. “The plane takes no measurements of its surroundings. The waves would confuse it. ‘Most people wouldn’t do it this way,’ Atkins said. ‘The plane puts the motors on at full throttle and sets the pitch elevator enough to break out of the water. Then it counts and pitches forward. We believe that if we had done it any other way, we would have basically dived into the ocean on takeoff because the plane would have detected huge oscillations due to the waves.’”

And here's an interesting observation from the project's home page:

"For a small vehicle like this, most waves look like those in the "the perfect storm." By flying over them we minimize energy used in transit, maintain a long-term energy balance (i.e. no refueling required), and give more time for sensor operations without noise from the vehicle. We envision fleets of these vehicles deployed for a variety of environmental monitoring applications."

Sounds good, but I wonder how it would hold up in a storm.
Read more…
3D Robotics

Basic Stamp Autopilot Tutorial Series

This is the front page of the multpart tutorial series that teaches you how to build and test the Basic Stamp Autopilot used in GeoCrawler 3.
Read more…
3D Robotics

UAV use skyrocketing

The latest stats out of the Pentagon show that UAV (or UAS--unmanned aerial systems--as they're known in the miltary) flight time is rising faster than ever. It climbed from 160,000 hours in 2006 to an estimated 250,000 this year--up 56%.

And with that has come increased spending, from $400 million in 2002 to more than $2 billion next year to an expected $3.5 billion by fiscal year 2010.

Source: Wired's Danger Room blog
Read more…
3D Robotics

Global Hawk first impressions

Well, both Global Hawk models I wrote about the other day arrived, and I've just had time to open the boxes and quickly look them over. But four things are already clear:
  1. They're basically the same model, from Haoye Models.
  2. The one from Singapore was rubbish, unpainted and missing all sorts of necessary parts such as the carbon fiber wing rods.
  3. The one from Sonic Electric looks better, with painted body parts (gray elements in the picture at right), and most of the necessary elements. Go for the combo pack, with motor and ESC, if you don't already have spare equipment to use.
  4. There's not a lot of room in the equipment bay for autopilots, cameras etc. This is foam, of course, so some cutting is possible, but it's going to be a tight fit. This is NOT an ideal UAV plane, but in the interest of equal scale opportunity (we've been showing Predator favoritism!) I'll have a go anyway.
Now to build and fly. Of course neither model had an instruction manual (the Sonic one has an unreadable one-page photocopy of what looks like a different version--no ducted fan--and it's not in the slightest helpful). Fingers crossed and stay tuned...

Read more…
3D Robotics

LEGO autopilot code updated

Just a quick note to say that I've updated the code to both the GPS-based Lego autopilot and the compass-based Lego autopilot. The only major change is that the motor functions are more effecient and reliable. The old code reset the motor encoder with each turn and this was leading to some pretty serious drift after just a few turns. The new code uses a proportional turn algorithm that is not only more flexible but also eliminates drift.

GPS-based LEGO autopilot code (RobotC)


Compass-based LEGO autopilot code (RobotC)

Read more…
3D Robotics

[UPDATED: paper is finished and available below]

I've put together a technical assessment white paper for the FIRST robotics league, proposing an indoor aerial robotics contest for 12-17 year old kids (and coaches). Target price is under $1,000 and safety is of prime importance. This paper lists the possible platforms--microplanes, helis, quadcopters and blimps--and discusses the pros and cons of each. At this point I've tried most of the options, from helicopters to quadrotors to blimps to ultralight planes and I'm leaning towards quadcopters and blimps as the best choice.

  • Quadcopters: Pros: very maneuverable, already have a full IMU onboard. Cons: very expensive to do well, hard to fly, can do damage to vehicle or people when things go wrong.
  • Blimps: Pros: cheap, safe, easy to fly. Cons: hard to maneuver precisely, requires inflation, can't lift much weight at indoor size. Cheap UAV versions neither commerically available nor open sourced.

Cost, simplicity and safety pushed me towards the blimps, but I'm concerned about having the kids having to build the autopilot from scratch. Check out the draft of my white paper and tell me what you think.

Read more…
3D Robotics

Keep those Google ads or lose them?

Speaking of redesigns, I'd like your opinion on whether to keep those Google ads at the right. I don't make any money from them (the revenues go to Ning, our social network hosting service, but I'm a premium member so I can turn them off), but I have to admit that I think it's kind of interesting to see what the Google relevancy machine turns up. I've even clicked on a few! But this is a community site, so I'll go with the majority view.
Like 'em or Lose 'em? Vote here:
Read more…
3D Robotics

Updated GeoCrawler 1-5 instructions

Just a quick note to say that I've updated all the instructions to GeoCrawlers 1-5 (and changed the numbering, so they now start with the Lego UAV). Some changed a little, and some changed a lot, but all reflect improvements and lessons learned since the original designs. If you're building any of these, check the instructions again. Also, we have a site redesign coming, so if you have any suggestions for additions or subtractions, now's the time (in the comments, please)
Read more…
3D Robotics
I spent a few hours yesterday trying to perfect the gyro-stabilized camera (shown) in preparation for a test flight today. But even when I tweaked the settings it wouldn't take long before the gyro lost track of where "down" was and it ended up with the camera assembly at one side or another when it should have been level. It turns out that the drift cancellation wasn't perfect, which isn't too surprising. Unfortunately I really did need to it be perfect to avoid the little errors adding up over time and rendering the whole thing useless.

And then it struck me. I'm an idiot. The PLANE knows where down is! In many of our UAVs we're using IR stabilization to keep the wings level, and the way that works is that a FMA "Co-Pilot" sensor measures the infrared gradient between sky and earth on both sides and front and back, and uses that to establish a vertical axis. Then it just moves the ailerons and elevator to keep the plane flying perpendicular to that axis.

All I needed to do was to let that same FMA Co-Pilot drive the camera stabilization, too. Once I'd slapped my head and realized that the solution was right in front of me, it was a simple matter of removing the gyro, attaching the camera tilt servo to the aileron output of the Co-Pilot via a Y-harness (it's still driving the ailerons with same channel) and putting on a longer arm on the tilt servo to compensate for the lower throw distance of the Co-Pilot's signals. (All the other components and build instructions are as described here)

Today we tested it, and it work brilliantly. It's SO much better than the gyro-driven model. Here's a video of it in action:

The advantages include:
  • Doesn't need special calibration and doesn't drift. "Down" is alway down.
  • Much cheaper. Without the gyro, the cost drops from $100 to $25 (two servos and some aluminum)
  • Doesn't take up a separate channel. The camera stabilization automatically comes on when I turn on the plane stabilization.
  • Saves power because the tilt servo isn't always jittering with every gyro twitch.

But what about our UAVs that use gyro-based autopilots, rather than IR, for stabilization? There's no good way to have those autopilots drive the camera assembly, too. The answer is to bolt on a cheap ($49) and simple Futaba "pilot assist" sensor and controller, which uses visible light to do what our FMA units do with IR. You can just put it on the camera mount where the gyro was and it will keep the camera pointed down. It's not quite as neat as the ones that use the same stabilization system as the entire plane, but it's equally effective.

Read more…
3D Robotics

UAV report: Tel Aviv

For UAV geeks, Israel really is the promised land. No country is more advanced in the use of UAVs, small and large, and the second Lebanon war was a state-of-the-art example of ubiquitous eye-in-the-sky presence. I'm in Tel Aviv today, and I took the opportunity to hang out with the best of the bunch. Here's a brief report.

The picture at right is me at an Air Force base near Tel Aviv with an IAI Heron.(minus its single or twin dome camera assemblies). A few cool things I learned hanging out with a combat UAV squadron this morning:

  1. Israel has UAVs in the air 24/7, mostly on its borders. Unlike the piloted Air Force squadrons, where most flights are training, 90% of UAV missions are "operational", meaning that they're actually tracking targets and watching for bad guys.
  2. They've been working to eliminate "flying" altogether. The UAVs take and land themselves, and "R/C" piloting skills, which were once prized, are now discouraged. It simplifies the training, lowers costs, and mimimizes human errors. Often the joysticks are linked only to the camera, and the aircraft is only guided by clicking on a map.
  3. Another advantage of a small country (about the size of New Jersey): all the UAVs above hand-launch size are launched from Air Force bases like this one and communicate with the ground with direct radio links. No need for satellites. They can usually get an aerial camera on any spot along the boarder within three minutes. Aerial imagery is shared between Army and Air Force in real time, so there are few of the intramural battles the US has over chain of command and airspace control.

I then went to a small town outside Tel Aviv to a converted barn to visit a small private UAV maker, Top I Vision, which make some of the best gyro-stabilized pan-tilt camera assemblies in the world (along with a lovely hand-launched, UAV, the Casper 250). The difference between a UAV system costing $200,000 and our own $1,000 systems suddenly became clear as I toured their R&D facility. Everything was hand-made and of top quality, from the fiberglass, carbon fiber or kevlar body parts to the the machined gears and motors that make up the custom camera actuators (no shaky commercial servos, like those that we use). That's the difference between pros and us amateurs.

The result is what amounts to a steadycam in the sky. You point the camera at a target and a combination of GPS, barometric altitude sensors and incredibly accurate encoders in the pan-tilt assembly will tell you the exact lat-lon of what you're looking at (accurate enough to give to artillery). You steer the camera, and the plane will figure out how to steer itself to give you the optimal viewing angle.

Here's a video of the UAV in action:


And here's a picture of the CEO, in front of one their latest birds.

Read more…
3D Robotics

A Global Hawk model ready to be UAV'd

There are plenty of Predator R/C models ready to be turned into proper UAVs, but where are the Global Hawks? One of the answers is that the full-size UAV is a jet, not a prop plane, so that complicates the power plant, and then there's the small matter of its huge wingspan and stumpy ("short-coupled") body, which doesn't bode well for stability. No matter. I'm going to give it a go. There's a store in Singapore that's selling a pretty basic-looking foam one with a ducted fan, and I've ordered one. There's also one here (video below). If nothing else, they will give us a starting point for our CNC friends to make something better.
Read more…
3D Robotics

BASIC Stamp UAV code now in beta

This post describes the beta version of BASIC Stamp autopilot code. As mentioned in my last post, the two main challenges in this project were dealing with the constraints of integer-only math and a severely restricted variable space (just 26 bytes!).

The first one I got around by treating fractional degrees as full degrees (since the UAV is never going to travel more than one full degree away from launch) and essentially treating them as integers. This was a little tricky, since I'm limited to word-length variables (with a max value of 65,535, which is essentially 4 and half digits of precision) and the GPS natively generates six and half digits of precision (360.9999 W/E). But I truncated the full degrees to just 1 and -1 from the current position, and that let me retain the full precision of the fractional degrees.

The second problem I got around by splitting the program up into five sub-programs (each one is allowed to reuse the variable space in RAM) and switching in real-time between them. I also used the Stamp chip's 121 bytes of "scratchpad" memory to store a lookup table of all the waypoints, and that's available to all the programs, although you can't manipulate the scratchpad memory directly without copying it into a variable.

The current program does three things:

  1. It intercepts R/C receiver commands to the rudder, elevator and gear switch and translates them into computer commands, which drive the servos through a Parallax servo board or FT639 chip. When it detects that the gear switch has been thrown, it transfers control of the rudder and elevator to the autopilot program, and back again when the switch is returned to its manual position.
  2. When under autopilot control, it reads GPS coordinates and headings and translates them into directional vectors to the next GPS waypoint. It uses those vectors to steer the rudder.
  3. It also uses GPS altitude readings to do a crude sort of altitude hold. Because the GSP altitude data is so noisy, the autopilot averages over three readings and treats that as accurate +- 10 meters. It uses that data to adjust the elevator to try to keep the plane within a range of +- 10 meters of the original altitude at which it was put into autopilot mode.

The code has been tested on several different kinds of servo driver chips and GPS modules, as well as with GPS simulators, but not yet in the air. So consider it just instructional at this point. I'm sure there are some bugs, and a lot of settings that need to be tweaked. Also, we have not yet added camera controls and other more sophisticated in-air options, such as circle and hold (although these aren't hard to add, not that we've got the basic hardware interfaces working).

You can download the code at the following link. Load the first program (uav.bsp) and it will call the others at compile and download time.

The recommended hardware is a Basic Stamp BS2p on a dev board using the FT639 servo driver chip and a standard GPS module such as the EM406. Details on these hardware configurations can be found in the main post on this UAV. Other servo drivers, such as the Parallax board can be used, and the details on how to modify the code for them is in the comments of the code

------------------------------------------------------- [Older code, no longer supported but may be useful for instructional purposes]
  • Code for the Parallax servo board and Parallax GPS module is here.
  • Similar code for the FT639 servo controller chip and Parallax GPS module is here.
Read more…
3D Robotics

OpenAerialMap: like a wikified GoogleMaps

We love GoogleMaps, but one of the problems with it is that you can't really add your own data to it. Sure, you can superimpose your imagery on a GoogleMaps layer, but it won't show unless people use a special URL. That's the reason for the creation of OpenAerialMap.

Pict'Earth's Jeff Johnson explains:

"OAM gives us a place to publish the imagery so that it easily reused. Basically the imagery that Google and MS Aggregate is not truly 'free' in the sense that it cannot be used in any useful sense outside of their programs without an overbearing license. Its kind of like Navteq or Teleatlas data. It may be freely available, but its not really free. So then, the goal of OAM is to provide a place where people like us (doing DIY stuff) can publish our imagery in a central place, but also a place for governments and other organizations that pay for imagery to get help publishing their data into the public space in an open/free way."

O'Reilly's Brady Forrest has great post that explans more here. (He also mentioned that I'm going to be giving a DIYDrones presentation at ETech on March 3-4 in San Diego. More on that later.)

You can see one example of one pass I took of the Alameda Naval Air Station runway that was orthrectified and stitched by Pict'Earth and is now part of the standard OAM map at that lat-lon (our imagery circled in the screen shot above).

(credits: Christopher Schmidt set up OpenAerialMap and the servers are hosted by Telascience, SDSC and bandwidth comes from CalIT)

Read more…
3D Robotics

Finally, FAA rules on small UAVs in the works?

If you missed it in the news feed at the lower left, the FAA is making some progress on a common-sense regulatory framework for small UAVs like ours (at the moment, we're all flying under some outmoded 1980s guidelines that are, to be generous, a legal gray area). I like the sound of a category for small UAVs that recognizes their limited risk, but my concern in the below is the phrase "vehicles would have to be kept within sight of the operators" part (it's not clear if that would apply both to the under 4 lbs and under 35 lbs category, or just the second one).

That seems to invalidate the whole point of UAVs, so I'm hoping that it doesn't apply to the smallest category, which is limited to 400ft altitudes and thus doesn't really present a danger to other aviation.

From the article:

Bruce Tarbert, the National Airspace System team lead for the FAA, says the agency is working to speed approval of certificates of authorization for unmanned vehicles to fly, but "we understand we need to pursue a small UAS regulatory basis ... we want to do this in the fastest timeframe we have."

Tarbert says it's possible that some regulation recommendations could be produced by July 2008, although he calls that "a big, big if." Even then, a Notice of Proposed Rulemaking wouldn't "hit the street" until a year later, and a public comment period of 90 days would follow after that, so any regulations likely wouldn't come into play until the middle of 2010.

.....

One problem is that there's no definition yet for what a small unmanned aerial system is. MITRE Corp. has taken a stab at defining it for the FAA, and Charlotte Laqui, the UAS project team leader for the company, also spoke at the Wednesday meeting.

Stressing that the definition is just a "starting point," and certainly hasn't been accepted by the FAA, Laqui says MITRE has roughly defined possible operations for two classes of small vehicles.

One would have a maximum weight of four pounds, a flight ceiling of 400 feet above ground level and could fly in all classes of airspace. Such vehicles could fly over even heavily populated areas without posing a big risk to people on the ground or other vehicles in the air. Another class of vehicle could weigh up to 35 pounds, fly up to 1,200 feet above ground level only in Class G, or uncontrolled, airspace. Those vehicles would pose an acceptable risk in more lightly populated areas.

Vehicles could not operate within three miles of a chartered airport and would have to be kept within sight of the operators, she says.


Read more…