RobotC: NXT Beach Buggy Controlled via NXT2WiFi

PDF24    Send article as PDF   
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.

Beach Buggy -7.png

This Beach Buggy is the same as used in my previous post: LEGO NXT Beach Buggy Controlled via Web Browser. The primary difference being that the Beach Buggy is programmed with [robotc] using Xander Soldaat’s 3rd Party RobotC Driver Suite. I have also modified and simplified the Webserver code as well. I also beautified the the Webpage Interface as well.

Beach Buggy Control

Beach Buggy Webpage Control The [robotc] Code listed below, is just a very simple example to get you started. The Motor Control could be greatly improved upon. The purpose is purely a guide as I’ve moved onto another more complex project using the [NXT2WiFi].

RobotC Source Code: BeachBuggy.c

The [robotc] code relies on Xander Soldaat’s ‘benedettelli-nxt2wifi.h‘ driver which will be released in his forthcoming 3rd Party RobotC Driver Suite. It also relies on my ‘WiFiConnect.h‘ file which simplifies connecting to a Wi-Fi Network using you Connect Custom Profile.

RobotC Source Code: WiFiConnect.h

When it comes to the Webserver Pages and Scripts, I’ve streamlined them somewhat and made the labels/variables meaningful. The Webpage Control Interface relies on the ‘buttonEvents.js‘ in the webserver’s script directory. I removed unwanted ‘Button Events‘ and made their labels more user friendly.

JavaScript Source Code: buttonEvents.js

The HTML file used to display the Webpage Control Interface is the ‘index.htm‘ file. This version is far more simpler and easier to read than the previous version used with my NXC example. The main changes are the removal of excess JavaScript code in the ‘index.htm‘ file’s <Header>, and change the Button ID’s to match those used in ‘buttonEvents.js‘ file.

HTML Source Code: index.htm

 


NXT Beach Buggy
 

 
 

CONTROLS

 
 
 
 
 
 

 
 
 
 
 
   

 

The Table below shows the various Variable Names associated to each of the Robots Actions. The variables in ‘BOLD BLACK‘ type, correspond to the actual name used in the relevant source codes.

Robot Action Table

This article should help you get started using the [NXT2WiFi] as a BASIC Web based Remote Control Receiver for vehicle programmed in [robotc]. As mentioned above the code can certainly be improved upon.

Download all the associated files: BeachBuggyRobotC.zip

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!

@NXT2WiFi

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.

Previous Post

RobotC & Logitech F710 Joysticks with Windows7 amd64

ROBOTC has Joystick Controller stations built into the interactive debugger. "Joystick Control - Simple" is a debugger window to control the NXT via a Logitech USB remote control. "Joystick Control ... Read more

Next Post

NXT2WiFi: Using Webpage Sliders to Control Motors

This tutorial follows on from my previous NXT2WiFi Articles. In this example [robotc] is used to program the NXT. Using Webpage Sliders to Control LEGO Mindstorms NXT Motors with your [NXT2WiFi] ... Read more

Short URL: http://tinyurl.com/hrw7thq

Leave a Reply

Your email address will not be published. Required fields are marked *



Do NOT follow this link or you will be banned from the site!
error: Content is protected !!