Tuesday, September 30, 2008

Interpreting Sharp IR sensor values

We're using the Sharp 2Y0A021YK IR sensors (10cm-80cm), but unfortunately it's not a linear output.  The datasheet has a graph, but it's print-only, they don't give you either values or a formula.

So, I plotted out about 50 points, put them into an excel spreadsheet, built a XY chart out of them, then used "Add Trendline" to get a line that fit the graph, and then got the formula from that.  So now we have the function that converts the voltage the sensor puts out into the actual distance (sure would be nice if this were on the datasheet)

dist_mm = 1085534.81 * (float)pow((float)voltage_mv, -1.2);

Where voltage is in in milivolts, and the returned distance is in milimeters.

Really sharp, put this on your datasheet!

Kallahar

First code

After all the parts came in we had to put them together.  Some soldering was involved to connect the vehicle power to the arduino board, to put in a power switch, and how to mount all the sensors and board and everything.  None of it was complex, just some detail.  If I can create a "kit" that has all the wires and such that a team would need then you wouldn't even need to solder to enter the contest.

The first software read the IR sensors and spit out the values, we used that to make sure they were working at all.  Then we got the servos working.  Then a simple routine to try to keep the wall distance at a set value (too close, turn away, too far, turn towards).  We left the speed control on the remote, and let the software control the steering.

We built a little course using whatever white flat surfaces we could find, then started debugging what went right and wrong.  It turns out that the angle the wheels can turn out is really important when trying to figure out how much to turn.

Kallahar

Components

The first idea was robot pong, but when we tried to build a prototype we found out that the contest would be mostly about hardware, which meant we would be excluding a lot of people.  So we canned that idea.

Idea #2 is the one we're going with.  Take a small R/C car, throw some sensors on it, and have it race autonomously.  This obviously isn't a new idea, so I decided to throw guns into the mix.  I think the idea of having two bots racing around a course shooting at each other, all autonomously of course, sounds really exciting :)

So I asked a friend who does embedded work what we should use to control it and he recommended the Arduino board.  I also searched around and found a cheap 1/18th scale R/C car, and the IR sensors we had used on another project seemed good.

So I think the prices were around this:

Car: $80, 1/18th scale, comes with assembled car, remote, batteries, charger

Controller: $35 arduino decimila

Sensors: 3 Sharp IR's, $8 each

The arduino can drive the servos directly, can be powered directly off the vehicle battery, and can read the sensors directly.  So just that one board will do everything we need.  The board we got has an on-board USB connector already, so you just plug in the cable and you can reprogram it right there.  It's really convenient.

Kallahar

Initial ideas

We started asking around and thinking of ideas as soon as the 2008 contest finished.  Many people contributed and there are a lot of good ideas out there.

This is the 4th year (I think) that I've been running the defcon contest.  I think I've got a good feel for what we need to make the contest a success.

1) Defcon tends to have software people, not hardware, so anything that is hardware heavy will have less contestants.

2) The cost needs to be kept low.  Since these are hackers and not professional engineers, we don't want an expensive project.

3) It shouldn't require a ton of time.  Again, defcon isn't a robot convention so we're not staging a contest for robot pros.

It's pretty tough to come up with a contest that fits all these criteria, but when you get the idea right, it's great!

Kallahar

Welcome!

For this year's contest we've decided to share the rule and bot development process for the DefconBots robot contest at  defcon.  In the past it was always an open process, but the rules and design and such just came out in a pretty much finished form.  The goal of this blog will be to give some insight into the process that the rules and robot design followed.

The main site is at http://defconbots.org and that's where the actual code, photos, rules, etc are at.

Kallahar