File Exchange

image thumbnail

Embedded Coder Robot NXT Demo

version 1.18 (5.99 MB) by

Offers an enjoyable Model-Based Design experience using Simulink models with Lego robots

22 Ratings



View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

News! R2012a Simulink supports LEGO MINDSTORMS NXT as a product standard feature. You can play with LEGO even without ECRobot NXT.
- This demo supports R2006a -> R2012a
Simulink plant and controller models are used with LEGO's latest high-tech robot (ARM-based LEGO Mindstorms NXT) to illustrate industrial application of Model-Based Design with Production Code Generation. Take note of the model architecture and component definition, as well as, use of fixed- and floating-point designs.

This demo includes three examples:
 Maze walking tricycle robot
 Line tracing tricycle robot
 Self balancing bi-wheeled robot
 NXT Remocon demo

In each example, you can simulate the robot on your personally designed bmp track with 3D virtual reality.

LEGO(R) is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this demo.
LEGO(R) and Mindstorms(R) are registered trademarks of The LEGO Group.

Comments and Ratings (32)

I'm working with NXT bricki.
I am trying to connect the NXT with my Matlab, 2015b, but it doesn't work.
I have tried differents ways but it does't allow this.
I think the problem could be because the Matlab i have is 64x bits and the NXT brick is 32x bits.
If someone know how to connect the NXT brick would be kind to tell me.


Nguyen (view profile)

Hello! thank you for your working.
I have some problems, it didnot work with me. I have a matlab R2013.
When I run the simulink file "nxtmouse.mdl", it has the error:
Error evaluating 'InitFcn' callback of Light Sensor Interface block (mask) 'nxtmouse_ctrl/Light Sensor Interface'.
Undefined function or variable 'NXT.Signal'.

Anyone know how to fix it? please help me, thank you very much


Did anybody figure out how to solve this problem with make? I think my 64-Bit Windows 7 might be a problem...
I'm using MATLAB R2014a.

### Executing GNU-ARM toolchain for building executable ...
Compiling /cygdrive/C/Users/LaborPC/Documents/MATLAB/ecrobotNXT/environment/nxtOSEK/toppers_osek/kernel/alarm.c to alarm.o
/bin/sh: '/cygdrive/E/Programme/cygwin/GNUARM'/bin/arm-none-eabi-gcc: No such file or directory
/cygdrive/C/Users/LaborPC/Documents/MATLAB/ecrobotNXT/environment/nxtOSEK/ecrobot/tool_gcc.mak:108: recipe for target 'build/kernel/alarm.o' failed
make: *** [build/kernel/alarm.o] Error 127

Thank you a lot for this code. I'm facing a problem when I try the nxtbuild function.

### Executing GNU-ARM toolchain for building executable ...
Compiling /cygdrive/C/cygwin64/ecrobotNXT/environment/nxtOSEK/toppers_osek/kernel/alarm.c to alarm.o
/cygdrive/C/cygwin64/ecrobotNXT/environment/nxtOSEK/ecrobot/tool_gcc.mak:110: recipe for target `build/kernel/alarm.o' failed
make: *** [build/kernel/alarm.o] Error 127

Do you have an idea for helping me?
I am on windows 7, with matlab 2012a.

Thank you a lot!

Jen-Yu Hsiao

Sorry, I have a problem...
When I doing code generation > Build Model(ctrl+B)
Simulink appear error message like this:
Data store memory with name 'ServoMotorA' was not found for block 'Copy_of_TestMotorOSEK/Servo Motor Write/Data Store Write'

edris farah



VV (view profile)

That's happening to me too. It builds the code but then it stops in "### Executing GNU-ARM toolchain for building executable", but doesn't build executable. That happens sometimes, not always...and it's happening now with a very important project. Help, please!


Didem (view profile)

### Executing GNU-ARM toolchain for building executable ... and nothing else for long time. Test for motors was working but that code is not working. What can I do?


ehs (view profile)

fremond khoo

im sorry..i face some problem while installing..can u tell me what's wrong??
and how to solve it??..thanks

Install cancelled
??? Error using ==> install_ecrobot_tools>do_unzip at
Problem unzipping D:\Documents and Settings\user\My
Documents\MATLAB\ECRobotDownloads\ to

Error in ==> install_ecrobot_tools>do_unzip at 456
        error('Problem unzipping %s to %s', zipfile,

Error in ==> install_ecrobot_tools>install_ecrobot at

Error in ==> install_ecrobot_tools at 68


Paul (view profile)


when it comes to compiling the files with gnu-arm, i get a lot of the following error messages

C:\cygwin\GNUARM-402\bin\arm-elf-gcc.exe: *** fatal error - couldn't allocate heap, Win32 error 0, ......

arm-elf-gcc 2192 child_copy: stack write copy failed, 0x28D450..0x290000, done 0, windows pid 2675588, Win32 error 5

i am running windows 7, matlab r2010b 64bit. Any help would be appreciated.

Nguyen Hieu

v goooooooooddd

eugenio marino

aditya jha

very good

Anas Obeidat

it's Excellent Simulation to NXT robot, but we need a good manual, to explain all circuit components, and how we can develop more demos

Ali Hamouda Ali

nural net and feature extraction

Ali Hamouda Ali

Nabhiraj Yalagoud

very good

Nabhiraj Yalagoud

D kiven

Shein-Yung Cheng

Yasuhiko Matoba

Fatih Can

pezeshki zahra

i want information about robot for my programming

Sina ferdowsi

thast very good
Kind Regards

Takashi Chikamasa

For more detailed info about Embedded Coder Robot NXT, check

Vicente Parra

Wonderful tool. This allows we researchers to devote the short spare time we have to support mindstrom based activities for children, which otherwise would rather imposible ro do.

ilan zohar

Excelnt job. Wait for the nxt version for bluetooth support and genric I2C.

Warden Wei

Kin Fung Chu


hamed nozari



Updated description since R2012a released.


Updated ecrobotnxtsetup.m to support GNU Make 3.82


Support Windows7 (32bit/64bit)
Added HiTechnic Prototype Sensor blocks
Added NXT 2.0 Color Sensor blocks
Added external C code integration interface


Updated copyright notifications.


Updated to support R2010a.
Removed NXTway demo
Support for the latest nxtOSEK v2.12


Updated Description.

CRobot NXT v3.12:
- Support for enhanced NXT standard firmware (so So ECRobot NXT can be used without replacing firmware.)
- Support for nxtOSEK v2.02

what's new in V3.10:
- ecrobotnxtsetup.m enables users to easily establish path settings via GUI.
- Support for LEJOS OSEK 2.0 application flash (over 200Kbytes Flash and ~50Kbytes SRAM are available for user application)

V3.06 New Features:
- Supports R2006 -> R2008a
- Uses LEGO standard USB driver (fantom.sys) instead of ATMEL SAM-BA
- New NXT Remocon demo, similar to Nintendo Wiimote remote control with sound
- Updated docs

What's new in V3.05:
- Supports NXT to NXT Bluetooth communication (nxt2nxt demo is available)
- Supports Sound Tone blocks
- Refactored ECRobot NXT customizations

- reposting v3.04 since didn't update.

- Added support for HiTechnic Acceleration and Gyro Sensors, which are useful for control engineers.

What's new in ECRobot NXT V3.03 is:
- Support MATLAB R2006a to R2007b, including model reference normal mode
- Support floating-point code generation (fixed-point is already supported)
- Added Bluetooth data logging feature

Fixed format issues with PDF document.

- Integrated LEJOS OSEK RTOS
- Support Bluetooth for target deployment
- Obsolete Keyboard Input block

## Rev.200 02/28/2007. Support for Real-Time Workshop Embedded Coder deployment to ATMEL AT91SAM7S256 in the NXT (no Bluetooth/USB support)
## Rev.202 26/03/2007 Updated LEJOS NXJ to 0.2alpha

MATLAB Release
MATLAB 7.2 (R2006a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video