This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
The Neural Network Manager for NXT is a Java Graphical User Interface and allows creating, managing and training a neural network which is to be exported and used in a program that is to be designed to run the LEGO NXT. This report tells us on how to use Neural Network Manager for Lego Mindstorms NXT to analyze, design and implement the neural network into a multi-agent software system and to integrate the various components into application. .
Lejos NXT is a java programming system and allows running programs in Java. The device can build up characteristics so that the NXT can communicate with the PC which in turn can communicate with a sound sensor, hence leading the sound sensor to communicate with the NXT. The report further explains on the assessment of the systems communication techniques and the network algorithm applied in the system so as to train the neural network with simple voice command control.
Neural Network can be defined as a biological neurons circuit. Nowadays, it is usually referred to as an artificial neural network that is usually called the neural network which consists of interconnecting artificial neurons. The neural network can be explained in terms of mathematical model and is used to understand biological neural networks. It can also be used to solve artificial intelligent problems. Artificial neural network have the attributes of memory and learning.
The objective of artificial intelligence is to produce machines with mental mechanisms. "Artificial Intelligence is the discipline that aims to understand the nature of human intelligence through the construction of computer programs that imitate intelligent behaviour." Computers can be programmed to attain intelligent machines.
The Lego Mindstorms NXT is like the brain of a system, where the programs are stored. It centralizes information from the sensors, evaluates and issues commands to actuators. . The Neural Network manager for NXT is a Java Graphical User Interface and allows creating, managing and training a neural network. It is possible to design and implement the neural network into a multi-agent software system and is to be done in several steps and should be in order.
The system consists of two parts, the UI that is run on the NXT and Neural Network Manager that is run on the PC. In order to have proper communication between the systems, it is important to create a bond such that the PC can interact with the NXT, which in turn can interact with the sound sensor or enable the PC to interact with the Sound Sensor and hence allowing the sensor to communicate with the NXT itself. It is necessary to assemble and upload RecSoundSamples java class and PreProcess java class to the NXT and this can be achieved by using both the classes in Eclipse.
Communication with the NXT
Communication with the NXT can be done by downloading a few software's that is necessary to develop the Java programs for the Mindstorms NXT. The program is powerful and flexible. The Eclipse editor that can be used to write the java codes and download to the NXT, the combination of which can write the software and can test it on the NXT.
To install and run Java on Lego Mindstorms NXT using Eclipse
This is done by following the procedures below.
Install Java on the Computer
Lejos NXT is a java programming system and allows running programs in Java. The very first step is to download the java source files for PC and NXT. The compiled Neural Network Manger for PC is then downloaded as a JAR file. Java will be installed in "C:\Program Files\Java" 
Install Lego USB driver on the computer
We can connect the NXT to the computer either by USB or via Bluetooth. However, USB is more standard, faster and reliable when compared to Bluetooth. The Java has been installed and is followed by installing Mindstorms NXT Driver (Fantom Driver). Installing the program for Lego Mindstorms NXT Driver activates the connection to the computer with the USB cable. The device manager can be used to check the proper installation of the driver.
Install Lejos on the Computer and on Mindstorms NXT
Lejos is a firmware and is a substitution for Lego Mindstorms programmable bricks. The Lejos NXJ supports NXT brick. It consists of a Java virtual machine, and allows systems to be programmed in the Java language. The Lejos (version Beta 0.4) is installed. This is the program that runs on the computer and communicates with the NXT. In order to install Lejos, we create a directory called "ProgramFiles" on the hard disk and be cautious that the directory has no space characters in it. The Lejos ZIP file is un-zipped which will reveal a directory called "lejos_nxj" and this is placed in the "ProgramFiles" directory.
It is necessary to inform Java that the Lejos library exists so as to program the system. This is done by creating a new system variable and giving it a value, so as to familiarize Lejos as to where it has been installed. The proper installation of Lejos can be checked by using the DOS command prompt. If this window runs properly, would indicate the status of the work done so far and is to be correct. Failure of running the window properly would mean missing out any of the orders or a mistake in the process. In such case, the system should be checked and done correctly so as to get a proper command prompt window.
The next step is to set up the NXT to the firmware upload mode so as to restart the NXT device and replace the original firmware with Lejos. The hardware diagram below shows how to restart the NXT device.
It implements a Java Virtual Machine and can run Java programs. Installing LibUSB-Win 32 Setup Wizard allows programs to access USB device on Windows and will allow Lejos Firmware to be installed. The NXT is thus ready to run Java Programs.
Install and configure Eclipse on the Computer
Eclipse is an open source integrated development environment for programming and application development and is used with the Java language. Eclipse itself is written in Java. Eclipse has been installed so as to run Java on lego Mindstorms NXT, thus building up a connection between PC and NXT and hence enabling it to download a program onto the NXT .The display on the NXT due to the java codes ensures proper communication and hence is recognized by the operating system.
" import lejos.nxt.LCD;
LCD.drawString("Hello World!", 2, 2);
The first line of the java codes enables the programs to use the LCD display followed by the next java code lines that defines what to be displayed and when. In this case "Hello World" is displayed.
Using Eclipse to make jar file
A jar file collects a number of files and considers as one file. Jar files can be used to distribute Java applications or libraries in the form of Java class files. The JAR file is based on the ZIP file and these file are used as in terms of collection and distribution of files and implementing various libraries or components in java applications. In order to make the neural network management work, we need to make a jar file in the PC side.
Download PreProcess and RecSoundSamples files
RecSoundSamples java class and PreProcess java class should be assembled and uploaded to the NXT by having both the classes in the same project in Eclipse. The programs are saved and downloaded into the NXT. It is important to make sure that the NXT is predicted by the operating system. This can be verified in the device manager. We also need to familiarize Eclipse of which class we want to download before starting the downloading procedure. On downloading the PreProcess into the NXT, will preprocess the source files and write the preprocessed output to a file. The two java files are successfully downloaded into the NXT. On running the java program RecSoundSamples and connecting to NXT via USB will enable communication between PC and NXT.
Recording Audio Samples
Using the NXT Brick, the Sound Sensor allows the NXT device to hear. The Sound Sensor can measure noise levels in decibels and dBA of frequencies 3 to 6 kHz , as well as recognize sound patterns including differences in tones. The NXT is set up correctly and the sound sensor can now be connected to sensor port 1.We should be cautious that the environmental noise is low while recording audio samples. After the communication is built up, it is possible to train the network. The network can be programmed to attain intelligent machines.
Training the Network
Training is referred to as the learning in a neural network. Training in the neural network requires describing the neural network of what its output is as a response. The difference between desired response and the actual response is the error, a portion of which is back propagated through the network.We start with pressing "record" button to start recording and "stop" button to end the recording in the Neural Network Manager. The sample will immediately appear in the sample table. Fill in with digit 0 for "stop" and digit 1 for "start" in the output column of the sample table. Continue recording several samples of the one voice command. Once the samples are recorded and output values are assigned, the network is ready to be trained.
Values for training network
We set the number of hidden neurons at 50.The hidden neurons introduces a hidden layer training a neural network and allows to run and represent multitude functions.  The learning rate, which is the parameter to decide how fast the network can learn, is set to 0.5 by default and this indicates the increase of changes in weight. Momentum allows changes to the weights to continue for a number of cycles. "The amount of persistence is controlled by momentum factor." The momentum while training the network is optional and the number of learning iterations is set to 1000 by default.
We press the "Train network" button. This will train and the value of accuracy will appear. We can train the network again with more number of iterations if the value of accuracy is not close to 100.Thus the network is now trained.
The training here is done by supervised learning, in other words, the system is fed with samples and it has the capability to recognize the command. Thus ensuring proper communication between the systems.
Comparing The Output
The network can be trained and compared with different input values.
Percentage of Accuracy
Changing the momentum has no real effect on the output but changing the learning rate will have effect on the percentage of accuracy.
Neural Network Algorithm
The algorithm applied in this case is the back propagation which is a supervised learning method for multi-layer nets so as to teach the artificial neural network of the performance of a given task. This procedure is called back propagation and is applied to each set of inputs and respective set of outputs. When a learning pattern is secured, the activation values propagate to the output units. An error may occur in each of the output units, which is difference between the actual network output and the desired output values. This procedure can be continued so long as the percentage of accuracy is in specified level or until there are no errors.
Exporting the Trained Neural Network to NXT
After the training, the network can be exported as java class. The program auto-generates "nn java" which is then compiled and uploaded on to the NXT. The NXT is connected to sound sensor but does not generate an output as there is limited space in the memory of the NXT.
Difficulties faced and Solutions
The system faced a few difficulties during the adaptation of the "neural network manager" system but managed to overcome the problems we faced.
While installing the Lego USB driver on the computer, the system failed when downloading "Driver 1.02" but worked successfully when downloading the Fantom Driver.
When installing Lejos on the computer and on the Mindstorms NXT, we lost the original value when editing the system variable. The system requires ";%LEJOS_HOME%\bin" to the end of the original value, so we had to un-install java and Lego USB driver and had to re-install again.
The system supported Windows Seven than Windows Vista.
We could not run the command prompt window initially as Lejos had not been installed correctly as it was not placed in the correct directory.
While training the network the value of accuracy was not close to 100, so we had to increase the number of iterations.
No output was generated on communicating the sensor to the NXT as the NXT device has limited memory.
Neural Network manager for NXT is a Java Graphical User Interface. Designing and implementing the neural network into a multi-agent software system is done in a number of steps and is mandatory to be followed in order with proper downloads. Thus, leading the systems to communicate with each other. This is applicable in Windows XP and Windows Seven. Extra steps are taken for Windows Vista where it is necessary to have the user account control turned off .The recorded signal generated by the "sound sensor" is pre-processed before being used as input for training of the neural network. Other sensors can be used for the input of the neural network, provided the pre-processing is done correctly. Pre-processing is chosen to be done at the values, so as to decrease the reliance of the loudness of recorded commands and hence the network can be used for different type of sensors.