LEGO NXT Beach Buggy Controlled via Web Browser
This LEGO Mindstorms NXT Beach Buggy is controlled via an Internet Browser Interface using a LEGO Mindstorms NXT [NXT2WiFi]. This is my first project using one of Daniele Benedettelli's [NXT2WiFi]. Any Internet Browser capable device can control it. The NXT2WIFI is a miniature Webserver Module featuring a fully integrated 802.11 b/g/n Wi-Fi interface, giving your LEGO® MINDSTORMS® creations access to any Wi-Fi network.
The main code for interpreting the commands relayed from the [NXT2WiFi] is held in the WebEvents.nxc file. Each Button area of the Remote Control HTML file has a 'ctrlID Number' which corresponds to a behaviour control listed in the WebEvents.nxc file:
Move Forward: ctrlID = 1
Move Backwards: ctrlID = 7
Turn Left: ctrlID = 5
Turn Right: ctrlID = 3
Stop: ctrlID = 4
To change the ctrlID Numbers, you will need to edit the buttonEvents.js file found in the Webserver 'Scripts Folder'. You can also add extra ctrlID Numbers if required for your project.
When using Daniele Benedettelli's NXC library, for the [NXT2WiFi], the only file you need to edit for most projects is the WebEvents.nxc file. For most requirements, the other files can be left unchanged.
Download the NXT2WiFi Remote Control HTML File
When using Daniele Benedettelli's Default Webserver source code, for the [NXT2WiFi], the only files you need to edit for most projects are the index.htm and buttonEvents.js files. For most requirements, the other files can be left unchanged. You will need to rebuild the webserver compressed image. The custom webserver compressed image I have used for this project, BeachBuggy.bin, is uploaded to the [NXT2WiFi] using Daniele Benedettelli's NXT2WiFi Webtool.
The BeachBuggy.bin, image is great for use with Mobile Devices such as Mobile Phones due to it's very small footprint.
Of the [NXT2WiFi] Wi-Fi connection profiles, I just use the the default one which is adhoc. Using this is very convenient as you have no need to set-up the security for each device you wish to access the the [NXT2WiFi] with. To access the [NXT2WiFi], just type 'http://nxt2wifi/' into your browsers' address bar. Alternatively you can use http://192.168.0.18/.
If you are having issues getting the [NXT2WiFi] to start, I suggest you use a Terminal Program such as Termite, to reset and start the [NXT2WiFi]. This is done by entering te following into the Terminals Command Line: $RST, $DBG1, followed by $WFC0. If all goes well, you should see the following screen:
I have also put together a [LDD] CAD file of my Beach Buggy. You will need a number of parts not available in the LEGO Mindstorms NXT Kits to build the Robot. Extra parts can be purchased from [bricklink].
Download the Instructions in LDD CAD File or as an Adode PDF Document
The [NXT2WiFi] is far more powerful than the example I have shown here. Not only can the [NXT2WiFi] control a Robot, but it is capable of relaying Sensor Data as well. With this capabilities you can log your Data, and even automatically post the Data to Twitter and post real time graphs on @thingspeak!
The [NXT2WiFi] is not an add-on for the absolute beginner to the LEGO Mindstorms NXT system. You will need a grasp of Webpage HTML and Java Script Programming, plus your preferred NXT Programming Language of your choice. But, with some perseverance and by going through the provided examples, you should soon have a Remote Controlled Robot up and running in a few hours. Reading Sensors and Posting Data will take you some more patience and learning.