Getting Started‎ > ‎

Mac - NXT communication

Make sure you have downloaded the latest version of the Matlab toolbox. 
 
Extract the files and put the toolbox folder in the correct location, by following these steps
  • A zip file called RWTHMindstormsNXTv4.02 (latest version as of 10/11/09) will be downloaded to your computer. 
  • Extract the files by clicking on the zip file
  • Double click on the zip file.  When the window opens, click on Extract all files
Move the toolbox into your Matlab folder, by following these steps:
  • Open a new Finder window
  • When the new window opens, click on Documents, and click on MATLAB.  
  • Then move the folder called RWTHMindstormsNXT into the MATLAB folder located in your Documents folder, by dragging it into the folder.
Create a folder for your programs, by following these steps:
  • In your Finder window, click on Documents, then click on MATLAB, then click on RWTHMindstormsNXT
  • From the Finder Menu at the top of the screen, select File and New Folder from the Finder menu
  • Make sure your new folder is in the RWTHMindstormsNXT folder.  If it isn't, move it there.
  • Give the folder the name MyPrograms.
Set the Path in Matlab so that it can find the toolbox files and your files
  • Open Matlab. 
  • Go to File and then click on Set Path...
  • A dialog box will open.  Click Add folder
  • Select Documents, then Matlab, then RWTHMindstormsNXT
  • Click Add folder again. 
  • Select Documents, then Matlab, then RWTHMindstormsNXT, then tools
  • Click Add folder again.
  • Select Documents, then Matlab, then RWTHMindstormsNXT, then MyPrograms
NXT Firmware
  • Obtain the firmware here.  
  • Unzip the files.
  • Install NXT-G software (or use a computer that has it loaded)
  • Select Update Firmware from one of the top menus of the program (tools, maybe?)
  • Don't pick the firmware that comes up.  Select Browse and look for the folder where version 1.28 is located.  You click on the folder.
  • Select Download and the new firmware will be downloaded to your NXT.
  • Note:  NeXT Tools (see below) should be able to do this, but it wouldn't work for me.  I used NXT-G software to download the firmware, then NeXTools worked.
Install software driver for your computer
  • Obtain the software here
    • For Mac OS 10.5- (tiger), select Mindstorms NXT Driver v1.02
      • On the right, click on 351 KB under MAC
    • For Mac OS 10.5+ (leopard), select Mac OS 10.5 (Leopard) Firmware Fix
      • On the right, click on 479 kB under Mac
  • Uzip the files
  • Open the folder LEGODriver
  • Click on LEGODriver.mpkg
Motor Control with the NXT
A special file has to be loaded onto your NXT for it to provide precise motor control of your robot.  To do this, follow these steps.
  • Download NeXT Tools - here http://bricxcc.sourceforge.net/NeXT_Tools.zip
  • When the dialog box pops up, Click Save
  • A file called NeXT_Tools will be downloaded to your Desktop (for MacOS 10.4) or to your Downloads folder (for MacOS 10.5 +).
  • Move the folder NeXT Tools to the Applications folder.  Do this from Finder by dragging the file to the Applications folder 
  • Connect your robot to the computer using the USB cable.  
  • Turn your robot on.
  • Double click on NeXT Tools
  • Select usb from the Select a port window
  • Select NXT Explorer (the icon is a picture of the world)
  • Select upload to NXT
  • Select the file MotorControl21.rxe from the folder Documents/MATLAB/RWTHMindstormsNXT/tools/MotorControl/

Pair the NXT with your Macintosh computer using Bluetooth
   
  • Turn on Bluetooth on the NXT
    • Power up the NXT
    • Push the grey arrow button on the NXT until you get to Settings.  Push the orange button.  Push the grey arrow again until you see Bluetooth.  Push the orange button.  Push the orange button again to turn bluetooth on.  You'll know bluetooth is turned on if a little symbol is displayed on the upper left corner of the NXT LCD screen.
  • Turn on bluetooth on the computer  - use system preferences of the bluetooth tab on the top menu of your screen
    • Select "Set up bluetooth device" from the computer window
    • Select "Any device" in the window Select Device Type
    • Select the name of your NXT
    • Enter the Passkey 1234
    • Push the orange button on the NXT (it shows the same passkey on the screen)
Create a Bluetooth Configuration file
  • Open Matlab
  • At the command prompt, type COM_MakeBTConfigFile
  • A window will open asking if you want to create a new Bluetooth configuration file.  Select yes.
  • A dialog box will prompt you to select a location, double click on the folder RWTHMindstormsNXT in the folder Documents/Matlab/
  • The only thing that you need to change is the serial port info.  To find this, follow these steps
    • Open System Preferences and selected Bluetooth and click on the name of your NXT
    • Next to the + - options, there's a gear. Select Edit Serial Ports
    • At the bottom, it shows a path (i.e./dev/tty.NXT-DevB-1)

    • Copy this path into the box for the Serial port in the Matlab dialog box window and click OK to make a bluetooth.ini file
    • To see if you're able to communicate using Matlab with your NXT, type the following:
      •  hNXT = COM_OpenNXT('bluetooth.ini');  this opens the connection - if things are working, you won't get any red errors
      • COM_SetDefaultNXT(hNXT);  this sets the communication port to hNXT
      • NXT_PlayTone(440, 500);  this plays a tone on your NXT - if it's working, you can't miss it!
      • COM_CloseNXT all;  this closes the connection - a very important step.  Always close your COM port when you're done or the NXT will hang and you'll get errors
Once your computer is communicating with your NXT, read the documentation that comes with the RWTHMindstormsNXT toolbox.  
  • From Matlab, select Help
  • Select RWTHMindstormsNXT
  • Select Tutorial: Programming Robots. 
  • Read ALL sections!
Have FUN!


 

 
 
 
Comments