Using HiTechnic sensors with the LEGO Mindstorms software

This post will show you how to download and install the HiTechnic Sensor Blocks for use with the LEGO Mindstorms software. It will also give you a brief tutorial on using the sensor blocks as well as how to access the online help from within the LEGO Mindstorms software.

Before you can use a HiTechnic sensor with the LEGO software, you will need to download and install the sensor block that goes along with the sensor that you are using. To do that, first go to the HiTechnic Downloads page and then click on the category Mindstorms NXT-G Programming Blocks.

Here you will find all the Sensor Blocks that are available for NXT-G, which is the LEGO Mindstorms Software programming language. You will typically find one sensor block per sensor but a few sensors have multiple blocks. You will also find the sensor blocks for the LEGO Light, Sound, Touch and Ultrasonic sensors for use with the HiTechnic Sensor Multiplexer.

If you have the LEGO Mindstorms 1.0 software, then you will need to install a patch called Dynamic Block Update in order to import blocks into the LEGO software, this is not needed with 1.1 or 2.0. You can find Dynamic Block Update on this LEGO Education Downloads page.

Block Download and Installation Instructions

These instructions are for Microsoft Windows operating systems. If you have a Mac, the basic process will be the same.

  1. To make it easy to install the blocks into the LEGO software, I recommend that you start of by creating a new folder on the Desktop and call it “NXT-G Blocks”. So start of by right-clicking on the Desktop and then select New > Folder. Enter the name “NXT-G Blocks”.
  2. Now go back to the HiTechnic downloads page and find the file that you want to download. For this example I will download the block for the Acceleration Sensor. Click on Download Now for the sensor block that you are downloading.
  3. The next page you will see will look like this:

    On this page you can enter your name and email address so that we can contact you if necessary. This is optional. When you are ready to proceed, click on Proceed to Download.
  4. On the next page, click on the filename of the download. For example, for the Acceleration sensor the filename will be: In Windows this will open a dialog asking if you want to Open or Save the file, Select Open.
  5. Now you will want to copy the folder from inside the zip file to the “NXT-G Blocks” folder that you created on the Desktop. Arrange the windows on your screen so that you drag from one file folder window to the other and then drag the folder, in my case “Acceleration Sensor”, from inside the zip file to the “NXT-G Blocks folder”.
    Note: You only need to copy the folder, you don’t need to copy the License and ReadMe files. If you want to look at these files then this is a good time to do so. When you have finished this step, you can close the temporary zip file folder.
  6. Now you are ready to import the block into the LEGO Mindstorms Software. Start the software then find the Block Import/Export Wizard on the Tools menu. On the Block Import/Export Window, there are several steps you will see below.
  7. Click on Browse and select the “NXT-G Blocks” folder on the Desktop. It should be easy to find.
  8. In the list box you will see all the NXT-G blocks available in the folder, select the ones you are ready to import.
  9. Click on the Import button. Note, at this point there may be some warnings that some files already exist. Just click OK on these warnings.

You are done! The new HiTechnic Sensor block is ready to use.

Using the Sensor Blocks

Now that you have the sensor block installed, how do you use it? Of course, that depends a lot on the sensor and what your robot is supposed to do. Here I will show you how to make a really simple program to view the sensor value. Something like this will work for nearly all the sensors and is a very useful way to start using a new sensor since it makes it easy to tell what kind of sensor data your robot is getting.

Start of by creating a new program and name it “ViewSensorName“. In my case I will name it “ViewAccel” since I will be making an Acceleration Sensor View program.

  1. Your program will consist on a Loop, so start by placing a Loop in your program.
  2. Inside the loop, put the sensor block for the sensor that you want to view, in my case I will put the Acceleration Sensor block. You will find the HiTechnic sensor blocks on the Advanced Palette.
  3. Next, add Number To Text block right after the sensor block inside the loop.
  4. Add Text block right after that still inside the loop. This block will serve a couple of purposes that I will explain later.
  5. Add a Display block to the loop.
  6. Finally, add a Wait block to be the last block in your loop. Right now your program should look like this:

    Now we need to configure all the blocks as well as add wires. I like to work from right to left when I do this so that is what I will do in this tutorial.
  7. Start of by clicking on the Wait block. This block will control how fast our loop is; we want it fast but not too fast. If it is too fast then the number may change so rapidly that it is hard to read. In the configuration panel, change the Control: to Time and then change the Seconds to 0.1. This will make the loop repeat about 10 times per second. The configuration panel should look like this:
  8. Next go to the Display block. Change the Action: to Text. Clear the check-box to Clear the screen (this will make it easier to extend the program to display more stuff). In the Position, change the Line to 1. It should look like this:
  9. Now click on the Text block. This block allows you to concatenate three pieces of text together. We will use it to put a caption together with the number from the sensor as well as to add some spaces to the end. So set the A field to the name of the value. I will use “x:” to represent the X axis of the Acceleration Sensor. Then set the C field to a few blank spaces (I used 5 spaces). The spaces are used to clear the screen after the number in case the number gets shorted. If you don’t do this you may see some number that look much larger than they really are. You can skip the B field because that is where the number will go. Your configuration panel should look something like this:

  10. Now it is time to add the data wires. Click on the tab at the lower edge of the Text block and the Display block to fully open their data hub.
    Add the following wires by dragging the mouse from one data plug to another.

    From: To:
    Sensor value of the sensor block. Number input on Number to Text block.
    The Text output from the Number to Text block. B input of Text block.
    The Text output from the Text block. Text input on Display block.

    Your program should now look something like this.

Wiring Tips:

  • If you make a mistake, you can Edit>Undo (Ctrl-Z) to undo your last change.
  • If you need to remove or replace a wire, you can carefully select the wire by clicking on it and then deleting it with the Delete button. When you do this make sure that no block is also selected.
  • Sometimes it is easier to wire from right to left, so if you have difficulties making the wire connect in one direction, try to wire it from the other direction.
  • You can adjust wires by dragging on the edge of a wire and moving it.
  • Another way to fix wires that don’t look right is to click on the data hub tab on the lower edge of some of the blocks. This will make the LEGO software attempt to automatically adjust the wires that are affected by the data hub opening and closing.
  • Take your time! The LEGO Software seems to work better if you don’t rush it.

You are done! Now download it to your NXT and give it a try.

This program is easy to extend if you want to display more things on the screen. For example, if you want to display the y and z axis of the Acceleration Sensor as well, just copy-paste the Number to Text, Text, and Display blocks and have two more copies of these blocks in your program. Make sure that the new Display blocks output is on different lines on the screen and update the labels for the other two axis. Then wire the y and z values from the sensor blocks to the new Number to Text blocks.

Getting more help on the HiTechnic Sensor Blocks

Did you know that there is a help file available for all the LEGO and HiTechnic blocks? To see the help file for a block, hover the mouse over the block in the program until the context help information shows up in the lower right corner of the LEGO Mindstorms screen. Then click on “More Help >” to see the full help file. The help file will not only give you more information on the sensor, explain all the inputs and outputs, as well as give additional wiring information.


Tags: , ,

10 Responses to “Using HiTechnic sensors with the LEGO Mindstorms software”

  1. [...] You will find the new blocks on the HiTechnic downloads page. You can also find the blocks with the SMUX support on the bottom of the SMUX product page. If you need help downloading and installing sensor blocks, please look at Using HiTechnic sensors with the LEGO Mindstorms software. [...]

  2. Jason says:

    I downloaded your “Train IR Link” NXT-G blog, and I found an error. The Train logo, when the block is dragged around the programming page, is backwards. You need to fix the PNG File and re-import the block into the program software. But its an easy fix.

  3. Gus says:

    This is was not a bug. It was just the block designer being creative!

  4. Brandon says:

    When I download the gyro sensor block, I try importing it. When the importer comes up, I navigate to the file but the “gyro sensor” letters are gray and it won’t let me click it to import. The letters are unclickable. I deleted my file and remade it but it doesn’t work.

  5. Gus says:

    Brandon, Double check the block import instructions. The LEGO software is very particular about the all the files being present and that the folder name matches the name of the block. If any file or sub folder or if the folder holding the block files is misnamed, then the entry in the list will be gray.

  6. Farjad says:


  7. Gus says:

    What is not working? The best way to get help is to use the online support form.

  8. Sohan says:

    I tried to download the pf irlink block but the letters are gray in the import export wizard they are unclickable is it because i am using nxt 2.0

  9. Gus says:

    The LEGO software is very finicky and requires that there are a bunch of required files and that the name of the block matches the name of the folder containing the files. Make sure that when you expand the zip file that you extract the entire file tree contained within including the folder itself. If any files are missing, are invalid, or if the folder name does not match the name of the block, then the LEGO software will show the block in gray and not let you import it.

  10. Maryanne says:

    Thank you for the help I have a class using this and needed to download the move motors blocks.

Leave a Reply