View License

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

» Watch video

Highlights from
Embedded Coder Robot NXT Demo

4.6 | 22 ratings Rate this file 115 Downloads (last 30 days) File Size: 5.99 MB File ID: #13399 Version: 1.18
image thumbnail

Embedded Coder Robot NXT Demo



15 Dec 2006 (Updated )

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

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information

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.


Nx Tway Gs (Self Balancing Two Wheeled Robot) Controller Design inspired this file.

This file inspired Nxt Scara (Two Link Planar Robot Arm) Controller Design, Nxt Ballbot (Self Balancing Robot On A Ball) Controller Design, Nx Tway Gs (Self Balancing Two Wheeled Robot) Controller Design, Nxt Scanner With Lego Mindstorms Nxt, and Vu Lego Real Time Target.

Required Products Simulink Coder
Embedded Coder
MATLAB release MATLAB 7.2 (R2006a)
Other requirements Works with R2006a - R2012a (32bit/64bit)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (32)
19 Mar 2016 Edgar Andres Parra Rucaurte

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.

13 Nov 2014 Nguyen

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

18 Jun 2014 Christian

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

Comment only
06 Dec 2013 Chanthery Elodie

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!

Comment only
19 Jan 2013 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'

Comment only
23 Apr 2012 edris farah


Comment only
13 Oct 2011 VV

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!

Comment only
07 Jun 2011 Didem

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?

08 May 2011 ehs

ehs (view profile)

06 Apr 2011 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

Comment only
29 Nov 2010 Paul

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.

Comment only
04 May 2010 Nguyen Hieu

05 Mar 2009 Syed Noman Hussain

v goooooooooddd

01 Oct 2008 eugenio marino

29 Jul 2008 aditya jha

very good

Comment only
17 Mar 2008 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

10 Mar 2008 Ali Hamouda Ali

nural net and feature extraction

Comment only
10 Mar 2008 Ali Hamouda Ali

27 Feb 2008 Nabhiraj Yalagoud

very good

27 Feb 2008 Nabhiraj Yalagoud

17 Feb 2008 D kiven

11 Feb 2008 Shein-Yung Cheng

05 Feb 2008 Yasuhiko Matoba

04 Jan 2008 Fatih Can

30 Oct 2007 pezeshki zahra

i want information about robot for my programming

27 Oct 2007 Sina ferdowsi

thast very good
Kind Regards

22 Oct 2007 Takashi Chikamasa

For more detailed info about Embedded Coder Robot NXT, check

Comment only
20 Oct 2007 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.

31 Mar 2007 ilan zohar

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

25 Mar 2007 Warden Wei

21 Mar 2007 Kin Fung Chu


16 Mar 2007 hamed nozari

27 Mar 2007

## 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

29 May 2007

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

30 May 2007

Fixed format issues with PDF document.

10 Sep 2007

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

21 Nov 2007

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

26 Nov 2007

- reposting v3.04 since didn't update.

04 Feb 2008

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

10 Mar 2008

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

09 Apr 2008

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)

11 Jun 2008

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

14 Oct 2009 1.12

Updated Description.

06 Apr 2010 1.13

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

06 Apr 2010 1.14

Updated copyright notifications.

22 Mar 2011 1.15

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

12 Dec 2011 1.17

Updated ecrobotnxtsetup.m to support GNU Make 3.82

01 Mar 2012 1.18

Updated description since R2012a released.

Contact us