For research in Knuthlab, I am interested in controlling the Lego NXT Bricks with Mathworks MATLAB. MATLAB is a high-level mathematical language structured much like C. The main benefit is that many sophisticated mathematical algorithms are available for immediate use in MATLAB, and that these algorithms are fast and easily developed. Furthermore, much signal processing research is performed in MATLAB; including most of my own algorithms.

The most promising solution is to have MATLAB send commands to the NXT Brick and to receive sensor readings from the NXT Brick. In both cases Bluetooth is the obvious means of communication.

At this stage, we have found three possible solutions:

- Incorporate Java Classes into MATLAB and then employ either iCommand or LeJOS NXT which both use the Java Programming Language to control the NXT Brick.
- Adopt the solution engineered by Gregory Gutt for the George Mason Neural Dynamics Laboratory, which employs RealTerm as a server to pass commands to the NXT via Bluetooth in the form of a Byte Stream. This is a very attractive solution, but would require the writing of more detailed NXT commands in MATLAB…an endeavor possibly worth the effort. Crucial to this effort are the steps of using RealTerm from MATLAB and understanding the Byte Streams used by NXT.
- The last possibility would be interfacing MATLAB to one of the various C or C-like interfaces to NXT. This would require the writing of MEX files, which I am not very excited about doing.

We will have to make some decisions in the near future, but the prospect of interfacing MATLAB directly to the Brick via Byte Streams sent by RealTerm seems to me to be the most robust and flexible solution. I will keep you posted.

Kevin Knuth

Albany NY

## Published by

### drknuth

Kevin Knuth was born in Fond du Lac, Wisconsin, USA. He received his Ph.D. in physics with a minor in mathematics at the University of Minnesota in 1995, and held postdoctoral positions studying neuroscience in New Orleans and New York City. From 2001 through 2005 he was a research scientist at NASA Ames Research Center in the Intelligent Systems Division developing machine learning techniques and their applications in the Autonomous Systems and Robotics Area. Currently he is an Assistant Professor in Physics at the University at Albany, State University of New York. His scientific interests include: probability theory, astrophysics, complex systems, earth science, and brain dynamics. For recreation, he enjoys hiking, birdwatching and poking around tidal pools.
View all posts by drknuth

Kevin,

Did find any information or figure out how to control the NXT using Matlab?

Kirk

Kevin,

maybe you should consider the RWTH Mindstorms NXT Toolbox for Matlab. It is Open Source (GPL) and available from

http://www.mindstorms.rwth-aachen.de

Andre