Boris Smus

Software Designer

Android-powered Mindstorms

A few projects around the internet use an Android phone to control the LEGO Mindstorms NXT brick. Most involve an ugly hack in which the phone communicates with a computer over WiFi, and the computer (paired to the NXT through bluetooth) submits the command to the brick. These projects typically use Android as a remote control for the NXT robot, and not as part of the robot itself. Here is a missed opportunity: the NXT could be augmented by an impressive list of sensors, GPS and Internet access provided by an Android phone.

This project does just that, while eliminating the need for a computer in the loop, so that the Android directly communicates to the NXT. This allows for more powerful Android-powered NXT robots. As an example, I made a fully autonomous twitter-controlled robot. The NXT uses two motors to spin in place or move forward, and a third motor to control the tilt of a Android phone cradle. The Android phone keeps track of its orientation (compass heading and tilt), polls twitter search for new commands and sends commands to the NXT brick. After each command completes, the Android phone takes a picture and sends it to twitter. Any twitter user can look at the last few photos, decide which command makes sense to perform next, and issue it. This approach can be summarized succinctly as “crowdsourced teleoperation“.

Here’s a demonstration video of the robot in action:

I think that this marriage of Android and NXT can fuel a very interesting set of robots impossible to build with the NXT alone. @mindstorms is offline for now to save some battery life, but code is available at my new github. If you make use of my code or have some feedback, please reply below!

7 comments:

Brett Holcomb

Very cool, particularly that it’s autonomous. If only it could plug itself in to charge.

Did you use twitter because it had a familiar API, because it has good exposure on the net for crowdsourcing, or for some other reason? Just wondering.

on June 28th, 2010 at 10:27 am
Boris Smus

Thanks Brett!

Twitter and twitpic have very convenient and minimalist APIs. Uploading an image and posting a tweet is a single POST to twitpic. Check it out: http://twitpic.com/api.do

on June 29th, 2010 at 9:56 pm
ClaytonJr

I’m following the article from Makezine blog. Very interesting, congratulations! But I’m still curious about some details: The phone communicates with the NXT by Bluetooth? Wich language do you use with the NXT? Do you plan to release the NXT program too? Thank you! =)

on July 2nd, 2010 at 2:06 pm
Anonymous

How is is autonomous if it’s remote controlled?

Also… these three unlabeled boxes in the comment section may look cool, but is kinda UI fail, cause i can’t tell which box is for what.

on July 3rd, 2010 at 4:37 pm
Florian

This is awesome. I have a Android phone and am still searching for a direct way of communication, since the Android has so many features that could be used as sensors. Can’t wait to see more and I hope you make it available so everyone can use it :D

on July 5th, 2010 at 7:08 am
Boris Smus

@ClaytonJr I put no extra code on the NXT. All of the computation is done on the Android.

@Anonymous It’s not remote controlled. The Android phone is “built” into the robot. Thanks for pointing out the UI issue. It should be resolved now.

@Florian The code is available on github.

on July 6th, 2010 at 4:30 pm
dmjlevy

Hi Boris,
Very clear example but I’m having a problem connecting to the NXT via HTC Evo with andriod 2.2. The android can successfully pair to the NXT but the NXTcontroller is failing on connection. I changed the deviceId in tbe program. Do I also need to change this hardcoded value as well :nxt.createRfcommSocketToServiceRecord(UUID
.fromString(“00001101-0000-1000-8000-00805F9B34FB”)); ?

thanks

on September 3rd, 2010 at 9:10 am

speak your mind