Skip to Main Content
Programming LEGO MINDSTORMS NXT Robotics with MATLAB and Simulink

Programming LEGO MINDSTORMS NXT Robotics
with MATLAB and Simulink

Free Code for Remote Control and Embedded Control

The LEGO® MINDSTORMS® NXT robotics invention system lets you create and control robots using programmable motors and sensors. You can use MATLAB and Simulink to quickly program and test your NXT robots in a variety of ways.

MATLAB Based Code for Remote Control

The remote-control solution, which runs on your host computer, uses the MATLAB serial I/O capability to send commands to the LEGO MINDSTORMS NXT through a Bluetooth connection.

With the remote-control solution, you can:
  • Start programming right away without any additional toolboxes
  • Work in the MATLAB environment for development and debugging
  • Work with MATLAB & Simulink Student Version
  • Learn programming concepts such as iteration, conditional statements, and object-oriented programming

Simulink Based Code for Embedded Control

The embedded-control solution is developed using Simulink, Real-Time Workshop, and Real-Time Workshop Embedded Coder; it is then converted into machine language and downloaded to run on the NXT.

With the embedded-control solution, you can:
  • Avoid Bluetooth range limitations because the program runs directly on the NXT
  • Program the motors and sensors precisely for coordinated, real-time execution
  • Model, visualize, and test your robot’s behavior using Virtual Reality Toolbox software
  • Learn about control algorithms and production code generation using
    Model-Based Design

To submit questions or comments about these solutions, please e-mail mindstorms@mathworks.com.

Related Products

Resources

» Complete the form to download your free code.

*Choose your solution.

1. The remote-control solution includes MATLAB classes, M-files, and a GUI demo.
2. The embedded-control solution includes Simulink blocks, NXT programs, and a list of resources.