Pic Of The Week
When Good Plastic Goes Bad    
main | login

  Battle Photos
  Battle Videos
  The Graveyard
  Upcoming Battles
  Battle Types


  About Battle Bricks
  Discussion Forums
  Remote Control
  Message Ownership
  In The Classroom
  Early Days
  The WiigoBot
  iPhone NXT Robot
  Lego Skill Crane: The Claw
  EV3 Android Player


  Lee Cheng
  Joe Czechowski
  Mike D'Amour
  Will Gorman
  Tom Kiehl
  Shannon Hastings
  Steve Langella
  Doug Moran
  Dan Morrill
  Scott Oster
  Mike Petersen
  Bill Seyler
  Gregg Steuben
  Steve Zingelewicz

 iPhoneRobot: The iPhone Lego NXT Mindstorms Robot Demo
This is a demonstration of iPhone to Lego NXT Robot communication via the Safari browser and Lego's Light Sensor. To build this, you'll need a laptop, two iPhones, and a Lego NXT Robotics Kit. First, build your robot. Second write some Java LeJOS Robot code. Third write some Google Web Toolkit web application code. Fourth, plug in your iPhone into the robot, and use either a browser or another iPhone to drive the Lego Robot! Full details on building your own, and using this approach for other robot ideas are below. Now wouldn't it be great if the next Lego Mindstorms Robot Brick had Wifi?

Step 1: Build your Robot

Check out these detailed instructions on building the iPhone Robot. Any one directional remote control idea that can support 8 states can work with the iPhone communication design. Other ideas that come to mind might be building a remote rubberband launcher, or possibly an iPhone docking station that animates when the phone rings or an alarm goes off on the phone.

Step 2: Program your Robot

I used LeJOS NXJ for this robot. The program for the robot is quite simple. The robot determines which direction to move based on the color value from the light sensor. Download the LeJOS source here.

while (true) {
   // normalize to 5 bins, 0 thru 4
   rawval = center_light.readNormalizedValue();

Step 3: Program your Web Application

We need to adjust the color of the iPhone display to trigger the Lego NXT light sensor. I wrote a very simple Google Web Toolkit client server app that has two modes. The first is the mode the robot uses, which changes to different shades of grey depending on the other client, which has a simple control screen. The server simply recieves messages from the control client and sends them to the iphone client. I used Eclipse to write the webapp, you can download the source code and try it out.

Step 4: Drive your iPhone Lego Robot around the Office!

Once you've got the LeJOS NXJ app uploaded to your NXT Robot, and have the Google Web Toolkit webapp running on your laptop, visit the website with the Robot's iPhone and select "Robot". I adjusted the iPhone's Auto Lock setting to be Never, and the Brightness for the most constrast in color changes.

Comments? Check out our forums.

ars technica: Lego Mindstorms Rover driven by a pair of iPhones
Hack a Day: Hackit: What to do with a 1st gen iPhone?
Engadget: Video: iPhone + LEGO robot = superfluous genius
TUAW: iPhone-powered Lego vehicle
Make: Online: iPhone controlled LEGO robot
iPhone Hacks: Control Lego Mindstorms Rover with iPhone Lego NXT Robot App
The NXT STEP: iPhone and NXT

Mindstorms, RCX, NXT, and LEGO are trademarks of the LEGO Group.  BattleBots is a trademark of BattleBots, inc.  iPhone is a trademark of Apple. This site is in no way affiliated with The Lego Group, Apple or BattleBots, inc.