Wednesday, August 26, 2009

Robotics Crash Course, Part 3

Ok, so after some drama, some bullcrap, and a temporary bout of homelessness, I'm back. Let's try to put something on this dang blog...

So in Part 2, we had managed to find a way to get our laptop to charge from the robot. Catch was, the laptop was always charging from the robot. We don't want that. Let's fix that...

Read More!

What we need is some way of selectively connecting or disconnecting the laptop's power supply from the robot. A common light switch would do, but that kind of defeats the whole autonomous charging ability thingie we're going for. So we want some sort of computer controlled switch: a relay.

But our little OLPC laptop has no way of controlling a relay by itself. Maybe there's some sort of USB gizmo out there to do this, but screw that: let's build something. So I picked up a little Arduino microcontroller board (in this case, it's actually a Seeeduino.) Add in a breadboard, some resistors, a diode and transistor, and we have a working relay circuit. By flipping one of the I/O pins on the Arduino, we can flip the switch and charge the laptop whenever we want. And since we can control the Arduino through the laptop, the robot can do this whenever it needs to.

From crashbot

What you see up this is the setup. Here's the schematic. I simply took the power cord running from the robot to the laptop, cut one of the wires, wired the relay into the gap, and presto!

Since we got this fancy microcontroller thingie here, why not get a little more use out of it? You might notice those extra wires taped off to the side. One of those goes to the power toggle pin of the robot's cargo bay connector. By sending little pulses to this pin, we can turn the robot's power on or off. We couldn't do this before. Sounds like something that might come in useful...

Another one of them connects to the "charging source available" pin in the cargo bay connector. We can pull sensor data from the robot and tell this, but this seemed like a nifty thing to have (especially since we can't pull sensor data if the robot is off but charging.) This way, I can just poll one of the Arduino pins and can quickly tell if the robot is connected to a charging source (docking station or plugged in). I thought about using this pin to drive the relay by itself, but there's advantages to having the relay controlled via the computer.

Another one of those wires simply connects to the robot's 5v reference voltage. This allows us to tell if the robot is on or off (sounds like a stupid thing to need. It isn't.)

From crashbot


The black thing in the picture is a little piece of 3-ring binder I cut and shaped to serve as a cover/deck for the cargo bay. I tucked as many wires as I could into the cargo bay, fed them through a little hole, then screwed down the binder piece. I stuck the little arduino and breadboard to a harness that came with the arduino, and used a piece of velcro to stick it to the binder piece. I also screwed on top of all this a plastic clipboard, using long screws, some nuts and washers. This clipboard serves as the deck for the laptop. (I'm actually thinking of ditching this design in favor of a piece of sonotube, since it'd make it look nicer and might a bit better.)

From crashbot


From crashbot


And, while we're at it, let's throw a pan/tilt webcam on there. That way, we can look around with the robot. Logitech Orbit AF will do nicely:

From crashbot


From crashbot

Word of warning about the webcam: it was a pain in the butt to get the pan/tilt working with this thing. Something about the uvcvideo drivers in the newer kernel, blah blah blah. Bottom line? You need to compile and install libwebcam. You'll get a little program called uvcdynctrl that will allow you to control pan/tilt, plus a bunch of other advanced controls. Until I'm ready to start posting the code up (it's a mess at the momment: held together by digital duct tape) you'll have to poke around the libwebcam forums and documentation.


So how about that? Some nice little upgrades there. Currently, I've been debugging and cleaning up the code, and since that means I have to teach myself Python, it's taking a while. Feel free to take a look at all the crappy pictures I took while building it thus far...
crashbot

Labels: , , , ,


Read more!

Sunday, July 19, 2009

Robotics Crash Course, Part 2

Ok, so if you've been following us from part 1 of the crash course, you'll know that we're beginning to build a very simple robot. So simple, it's effectively a laptop duct taped to a robot vacuum cleaner. Since Damon has done such a good job of documenting the process up to here, i'm just going to refer you to his Instructables page. But let's talk about the important improvements in this step...

In case you're wondering, i did the optional power step he describes. *THIS* is why I'm using the OLPC laptop for now: nothing else is this flexible with their power inputs. I can't hook up anything else this easily. My eeepc 701 for example wants a nice clean 9.5 v at 2.5 amps. Not happenin' (yet)...

The really important thing to note here is we have just potentially made our robot self-sufficient. The robot base AND the laptop can now dock with the docking station and recharge their batteries whenever they see fit. You could easily make the "low battery" warning trigger the dock-seek subroutine, set it up on a schedule, whatever. Point is: our robot can now (potentially) function indefinitely without the need of a human to refuel it. Obviously it can't wander off too far, or it won't make it back to the docking station, but hey, big step here.

Of course, there is a really big drawback here as well: the laptop will suck power from the robot constantly. Which means less battery life for the robot. We'll fix that in our next step...

The other thing to note here is we now have some nifty software! It's not perfect, but it's better than VNCing into the laptop and some other craziness. Pretty basic for now, but we'll upgrade that later. It's made in Python, which means it'll run on pretty much anything with a little tweaking. It also means it can run a tad slow, but for now it works. Much expansion here in the next step too...

So tune in next time, you damn kids with your music...

Labels: , , , ,


Read more!

Monday, July 6, 2009

Robotics Crash Course, Part 1

Ok, let's say you wanna build some robots. Maybe you want something to automagically feed the dogs for you. Maybe you want something to fetch you a beer. Some sort of robo-butler, perhaps. Or maybe you're looking at a world domination bid, whatever. Let's build some robots.

Oh wait, all I know about robots come from movies and TV. That might be a problem. Better start small and simple. Crawl before you walk before you run and so on. How's about a simple as hell, darn-near idiot proof, ultra-n00b's guide to building your first robot?

Hell, why not...

Turns out that robots, much like everything else, are nothing more than a carefully arranged pile of parts, held together by screws and software. So the question is: how "made from scratch" do you wanna go? If you're really ambitious, you could go mine some copper ore, refine it into wire, build the motors yourself, and so on. I don't know about you, but that ain't happening...

You could buy some basic motors and wheels and bearing and all that junk, and build a robot up from the ground up. Maybe, someday. Not today...

How about we cheat a little? Let's take a ready-built robot: the iRobot Create. It's basically one of those robot vacuum cleaners, except without the vacuum cleaner.



Yay! We have a robot now! Let's take over the world! Ok, well, not quite. It's a robot by some measure of the word, but it doesn't really do anything useful. Yet...

Here's what it DOES do usefully: moves around based on serial commands, avoids obstacles, provides battery power from it's 14.4v battery to anything you can wire into the cargo bay connector, and it can find it's own charging station.

In fact you can pull it out of the box, slap in a battery, and hook the included cable up to the serial port of a computer, and drive the little robot with the computer!

Now imagine you have a laptop. If you don't know how to do it by now, it's pretty easy to connect to a laptop and remotely control it. You can use Remote Desktop Connection or VNC and control it like you were sitting right there if you wanted to keep it simple (and avoid writing code). Most laptops come with a webcam these days, and usb webcams are cheap. Laptops have wireless too...

...so duct tape the laptop to the robot!



You now have a self-mobile, remotely connectable, WiFi enabled robot with webcam and microphone. It can find it's little charging station all by itself, and can avoid obstacles in some fashion. It even has a nice juicy screen to display stuff to people, and speakers to talk or play music with. It ain't R2-D2, but you could easily use it as a remote surveillance / telepresence type thingie. Hostage negotiators could send one in to teleconference with the bad guys, while SWAT sneaks one in the back to map out the interior and looks around. In this case, it's an OLPC XO laptop, which is nifty because of the swiveling screen, built in WiFi, webcam, microphone, and uber-long battery life. However, any laptop you have laying around can be used, but it seems like a cheap little netbook is particularly suited. I used the included iRobot cable and a cheap serial-to-usb converter to connect the robot to the laptop.

Now, granted, our robot still isn't much to brag about. But if you didn't get 100 ideas about how to IMPROVE on this little thing, you need to put down the internet and step away. Slowly.

That's the beauty of this thing: it's a simple yet marginally useful and functional platform to start with. Building a robot from scratch to this point is a long a frustrating process for beginners, and is usually the main barrier keeping them from really building anything. But now, we can focus on learning about the smaller and funner things. As time marches on, this little platform will become insufficient. By then, I'll be ready to build one from scratch.

And there you have it. With about $400 and a bit of ducktape, you can "build" a somewhat useful robot! Don't worry, more to come. Gotta make it cooler after all. Relatively soon.

And if this looks oddly familiar, it's supposed to. I'm going to be building up his Fido robot (or as close as I can) as my personal starting point, and then tweak/hack/rebuild from there. I don't want nobody thinking I'm stealing credit for this, give credit where credit is due and all that happiness. Updates during the process are the plan, but plans never survive first contact, so we'll see when they get up.

and riboflavin...

Labels: , , , ,


Read more!