(this is page 51 of 121)





Latest

Moving alongThis blog post will show you how to build an autonomous robot that seeks out light based on a toy with a low power DC motor, an Arduino board, and a host of electronic components. Look at the pictures or go and check out a movie of the end product— the robot on a flashlight "leash." I built it with my 6 and 3 year olds over Thanksgiving weekend in stages, and we had a blast doing it. I'm putting the assembly process down as a blog post to get all of the information in one place for people who might be interested in these types of projects. It is written from the perspective of an electronics noob so hardcore hardware hackers or Arduino experts will be bored.

Modern day workbenchTo begin I should say that this is the most fun I've had on a hobby project since I set up my first server on the Internet back in 1996. As in back then, the best part was how little I knew going into it and how quickly I was able to make progress due to the many smart brains that contribute to the collective fabric of our group brain— so thank you web!

A few weeks ago, the kids had seen a cheesy robot in a toy store and thrown a tantrum about getting it. Promising them that we would built our own, I've spent weeks scouring the Internet for the hardest part of a low end hobby robot to find— a cheap and easy drive system. Servos, stepper motors, gearboxes all turn out to be relatively expensive, and the electronics required seem to be overly complex for anyone who isn't either a dedicated amateur or Macgyver on a deadline.

Tin can robotLast week I happened to come upon a fun kit called the "Tin Can Robot Science kit" which is nothing but a low power 1.5v DC motor hooked to a gearbox and a set of oblong wheels that cause an anthropomorphized beer can to wobble along like a drunk guy along a quasi-straight line. It's a cute 45 minute project and I would recommend it for anyone who wants to "build something" though I suspect that most of the fun in this toy comes from the assembly.

In our case, the fun was just beginning. Having built a light-sensitive Mindstorms robot that would chase a flashlight, I was pretty sure that the beer can equivalent would be fun to play with for a while. So our blueprint effectively consisted of 3 parts which I will describe in turn, along with some instructions:

The drive system: This proved the hardest to build for two reasons: 1. most lightweight toys tend to be very carefully balanced to move with low-power motors and are thus are not often capable of taking extra weight (in the form of the Arduino board and more batteries), and 2. it turns out that you can't just hook a motor into one of the digital pins on a microcontroller like the Arduino, turn the pin on HIGH and expect the motor to go (at least not without burning something out in a hurry).

The undercarriageI can not overemphasize point number one enough: in fact, I would advise anyone building am ambulatory robot to get the mechanical bits working first by simply building the robot and setting it to move with nothing but power to the drive. The Tin Can robot was designed as a standing beer can but as it turned out, there was no place to attach the Arduino board that wouldn't tip the robot over or render it totally motionless, to say nothing of the additional power required to run the motor. The design compromise in this case turned out to be putting the can on its long side and building something that looks much more bug-like, as well as getting rid of the 1AA power supply of the original kit in preference of the +3V that the Arduino board provides.

Coming from the world of software engineering, the best analogy I can think of to describe the process for getting the can moving was that of iterative development. Do something. Hook the motor up to power and see if it moves. If it does, take the next step; if not, iterate on the design. This will take a while, but the less you think of any part of your design as being fixed, the better. What can I say? The physical world is a bitch with all of its gravity and stuff.

Noob schematic for WallyThe second bit of the drive system that baffled me was that there is not way to drive a motor from one of the digital pins on the Arduino. The short answer is that most things draw way too much power (current) relative to the 40-50 milliamps that each of the pins on an Arduino puts out, something which you quickly discover by the way in which an IC near the pins gets hot enough to boil your skin (amazingly, this as well as other noob mistakes don't tend to damage your Arduino if you catch them quickly enough— have I mentioned how awesome Arduino is?)

Once you realize this, you can find many options online for driving motors, servos, and all sorts of things that move— from full on "shields," or boards that you snap on top of your Arduino with as many chips as the Arduino itself (and often about as expensive) to all sorts of motor control circuits. It turns out that most robotics folks know that what you would want is something called an "H bridge" which uses a bunch of transistors and diodes to give you fine grained control over the direction and speed of multiple motors and servos. But even this was too much work for us— we just wanted the motor to move when the robot sensed light irrespective of speed and only in its ambling forward direction. Fortunately thanks to the web (or more specifically, the wonderful LetsMakeRobots.com), I discovered that you can actually use one transistor, an NPN silicon one from Radio Shack (part #276-2016) to build a simple circuit that lets you control current from the 3V power supply on the Arduino from one of the digital pins. Think of a transistor as a big electronically controlled switch and you'll get the gist of it (but have a look at my monkey circuit diagram to figure out how to wire it up).

The light-detecting circuit: I had the leg up on this one as I did one of these circuits for a science fair about 20 years ago (my dad's idea for how to make me popular as a recent non-English speaking immigrant in the public school system in the US— and no, it did not work). Surprisingly, it even worked the first time. The basic circuit requires placing another resistor (I used a 1k ohm one but the value will depend on what kind of photo resistor you have on hand). A photo resistor (you can Google "CDS" to find one) seems to be hard to find these days, but you can get them from Radio Shack online for about $2. The other step is taking measurements on the analog pin from the circuit you build; you will basically get values from 0 to 1023 depending on the ambient light of the room you are in and will have to tweak your program to determine what the "move robot" threshold should be (in our case, with the circuit detailed above, values above 200 trigger the robot to move).

The "mouth" circuit: this is a standard yellow LED plugged into one of the digital pins and buried deep inside the can. When the robot moves, the LED comes on. Note that all of the tutorials for Arduino say to use a resistor with the LEDs but as a master of burning out LEDs I can tell you that you won't need it on the digital pins of the board.

The final step was getting the software written which proved to be the easiest part of the project (and I suspect it was not just that that is my background but that the Arduino folks have done a great job on their IDE). You can see the "sketch" (Arduino/Processing for program) here. After some initialization, it simply goes into a loop reading the photo resistor circuit and when appropriate turns the pin connected to the NPN transistor to HIGH and the mouth LED pin to high as well.

DSC_0067We live in wonderful times— and nothing like the ability to take on a weekend project like this with little prior training in electronics proves it as well. So now it's my turn to give back to the collective brain— please feel free to either leave me comments with questions/clarifications or send me email at antrod at gmail dot com.

And happy hacking!

Comments Permalink

Back when I was in college, I thought UNIX was the worst thing to ever happen to computing. The arcane commands coupled with a crappy text interface and the lack of root access on the SunOS machines on the campus created an experience so utterly frustrating that I found myself wondering what all of the hoopla was about.

Two years after graduation though, all the rage was this free OS called Linux and so I decided to take the plunge and spend a little time trying to see if I could get over my UNIX hate. While I'd love to claim that it was the older, calmer me that re engaged with pipes and processes, the reality was that back in 1998, there was this thing called Alta Vista that made life much more bearable. Instead of paging through cryptic man pages on a terminal screen, the combination of the Linux community and the mountains of content on the web made for a much smoother learning experience. No matter what you wanted to do, there was a chance that someone out there had done it (or something close enough) and written it up on some mailing list or some other webpage (blogs would come later).

Overnight UNIX went from sucking to being incredibly empowering.

Which is why when people write about how Google (today's Alta Vista) is making us dumber, I find the proposition ridiculous. Part outboard brain, part wisdom of the crowds, the powerful combination of the web and the latest of the search engines is probably the best thing that has happened to skill acquisition since the written word.

I am writing about this again now, because for the past six months I've been having a similar experience to that original Linux/Alta Vista one except that the subject of my fascination has been microcontrollers and circuits, or more specifically, the emerging Arduino community of hardware hackers. Knowing little about electronics in general, I am been amazed again and again by how Googleable everything about hardware hacking is. Thanks to active forums/blogs/etc. and clear part numbers, it is relatively straight forward to learn how to wire up just about anything.

I've still got to write up the two projects I've been working off lately, but here is a small example: just this morning I was struggling to figure out how to make an electronic switch for a small DC motor in a toy I've been tinkering with. It took about 15 minutes of Googling to find out what the general approach I was supposed to take was, and about another 45 to figure out exactly what I needed.

I can not imagine what it must be like for kids growing up today— the empowering feeling that this combination of outboard brain and collective intelligence must be.

Comments Permalink

Cracking an iPhone

It seems that in just under two years, folks have been able to port the beginnings of Linux on to the iPhone hardware, which is both an awesome feat of reverse engineering, and sort of ironic since there were apparently folks at Apple arguing to use Linux in the first place.

Along the same vein, what really blew me away this morning was a story on CNET's Crave blog about a Vietnamese entrepreneur who is unlocking iPhones "old school" with a soldering iron and a chip reader (go check it out, great pictures included).

Neither of these things by themselves are going to make a meaningful dent in the torrent of soccer moms and "cool" tech company executives currently driving Apple's resurgence as the premier tech company. I don't ever expect to run Linux on my iPhone, or have its guts extruded on to the table of the cellphone equivalent of a tattoo parlor, but I do love to see the raw power of ingenious hacker/entrepreneurs at work. Outside of the sheer amount of learning they are doing about the brains of the next major computing platform, it makes me feel as though Zittrain's apocalypse may be averted yet.

Comments Permalink

CNET has a story about some Intel exec making disparaging comments about the new "netbook" category (very small laptops with diminutive specs and low price tags) which argues that people in the industry are beginning to see the netbook as an extension at the bottom of the traditional laptop category instead of a new category in and of its own.

For a while, the dream of the netbook as a new type of computing device was fueled by the OLPC foundation and its mission to equip the other 6 billion people in the world with $100 laptops. Since Asus jumped into the game with its $400 EeePC last year though, netbooks have become broader all-purpose computing devices with even giant PC companies like Dell and us jumping into the game. I have HP's first entry, the 2133 and have written about how while it is a well built piece of hardware, as a "cloud computer" it's got some fairly crippling limitations.

In my view what has really killed the emergence of a potential new type of product from the netbook form factor is not the inherent weaknesses of underpowered hardware and small screens but rather the emergence of smart phones— and especially devices like the iPhone with screens that are not that much smaller, constant high-speed connectivity, instant-on browsing of the Internet, and perhaps most importantly, software that is tailored specifically to that all important 15-60 second usecase that could have given the netbook its true opening. In the time that it takes the latter to come out of suspend, a user has pulled out his iPhone (or Gphone or Storm, etc.), accessed the Internet, read something, posted something, and put it back in his pocket.

Until the netbook manufacturers (us most significantly) begin to appreciate the need for fundamentally new types of software in the devices, all the emergence of this new ultracheap laptop will achieve is an erosion of the healthy premiums that laptops have carried since the beginning of the personal computer industry.

Comments Permalink