Intro: Control a NXT Robot With Android and HTML5
The goal of this project is to connect an old Android smartphone (e.g. HTC Magic) to a Lego NXT robot, in order to get a global available WIFI GPRS UMTS camera robot.
The easiest way to monitor your household from anywhere in the world is to connect an old Android smartphone with a mobile NXT robot. A NXT robot represents a cheap and simple to handle microcontroller device in combination with two servos, that allow to build a flexible mobile platform. On top of this mobile robot we place the Android smartphone. The Android smartphone acts as high-level controller that receives commands over the Internet and transmits these commands to the NXT controller over a Bluetooth connection.
To offer the highest flexibility of control, we implement a tiny HTTP server (by using nanohttpd library) that runs as an Android background service. This HTTP server waits for incoming requests and serves a single HTML5 robot control Web page. This page shows the actual camera image, taken from the Android device, as well as basic control buttons for moving the NXT robot around.
By opening a Bluetooth connection between an Android smartphone and a NXT brick, it is possible to directly send NXT commands from an app to a NXT robot.
For details on the Lego NXT protocol specification and direct command specification please study following Lego documents: Appendix 1-LEGO MINDSTORMS NXT Communication protocol and LEGO_MINDSTORMS_NXT_Direct_commands.
The HTML5 page shows the basic controller interface the NXT robot is serving directly through its nanohttpd HTTP server.
You can find the source code and videos here: www.smartlab.at/articles/android-wifi-htm5-nxt-robot-controller/