|Can I data log in the NXT software?
Data logging is not possible in the LEGO Mindstorms NXT Software (NXT-G) in the same way data logging works for the ROBOLAB 2.9 software. However, you can use "files" to datalog in NXT-G.
| (48 )
In NXT-G, files are both readable and writable from the on-board programs, so you can write a program that writes data to a named file, and then reads that data at a later point in time. An external computer is not needed for this function. A file on the NXT can hold text strings as well as numbers.
The attached NXT-G program will allow you to store one set of data at a time on your NXT. This program is adapted from a program written by Brian Davis. Here are screenshots from the program.
Further Instructions for Datalogging With LEGO™ Mindstorms NXT Educational Software (NXT-G)
- Download the file <Dlog_basic.rbt> onto your computer. It is attached to this question.
- Start NXT-G software, and go to File → Open → Dlog_basic.rbt
- Review the program and its comments to get a sense for how it works.
- The program is set to datalog from the ultrasonic (position) sensor. If you want to take data a different sensor, drag the appropriate sensor icon on top of the ultrasonic icon, and then delete the ultrasonic icon. The new icon should now be in its place. Check the settings for your new icon, which are found at the bottom of the screen, and make sure you take note of the selected port. The sensor icons are in the Complete palette (second tab at bottom left of screen), and they appear when you place the mouse over the yellow Sensor icon at the left of the screen.
- Connect the appropriate sensor to the appropriate port on the NXT.
- Connect the NXT to computer.
- Download the program to the NXT by clicking on the “Download and run” triangle button at the bottom right of the program screen.
- You may disconnect the NXT from the computer.
- To start logging data, press the orange button on the NXT.
- To stop logging data, press the orange button again.
- Reconnect the NXT to the computer, and click on the NXT image button at the bottom right of program screen.
- Once the dialog box is open, click the Communications tab if it is not already at the front.
- Click on the Scan button to scan the NXT’s memory.
- Click on the Memory tab to view the files in the NXT’s memory.
- Check the Show System Files box, and click on the underlined Other category at the left of the dialog box.
- Find and highlight Datalog.txt in the file list.
- Click on the Upload button, and note where the file is being saved.
- Close the dialog box.
- Open Excel or another spreadsheet/plotting application, import the datalog text file (it is comma-delimited), and plot the data.
Further Instructions for Datalogging With Robolab 2.9
- In Robolab 2.9, the simplest way to datalog is to use the Investigator module, which is chosen from the initial splash screen when you load Robolab. Please refer to the instructions for the “Scavenger Hunt” activity for further information about datalogging with Robolab Investigator.
- You may also use Inventor Level 4 to write a datalogging program in Robolab. You will find many of icons you need in the “Investigator” functions menu. In the default view of the Inventor 4 Functions Palette, the Investigator menu icon is located to the right of the Music menu icon (the piano).
- Icons for 3rd party sensors (HiTechnic or Mindsensor: e.g., acceleration, color, compass) are found in the “User Libraries” functions menu. In the Inventor 4 Functions Palette, the User Libraries menu icon looks like a yellow file folder with a tiny RCX on it.