Powered by Modern Robotics

0 $0.00

Cart

No products in the cart.
Shop

HiTechnic NXT Acceleration / Tilt Sensor

$54.95

Now you can make robots that know which way is up! The HiTechnic Accelerometer / Tilt Sensor measures acceleration in three axes. It also measures tilt along each axis. Using the sensor, you can measure the acceleration of your robot build robots in the range –2g to + 2g. Great for experimenting with acceleration forces in cars, on amusement rides, even on swing sets. This sensor will also tell you if your robot is level so you can build self-leveling robots and much more.

Out of stock

Join the waitlist to be emailed when this product becomes available

SKU: NAC1040 Category:

Description

HiTechnic NXT Acceleration Sensor for LEGO Mindstorms NXT

Introduction

The NXT Acceleration Sensor contains a three-axis accelerometer that measures acceleration in three axes, x, y and z. Acceleration is measured in the range of –2g to +2g with scaling of approximately 200 counts per g.

The Acceleration Sensor connects to an NXT sensor port using a standard NXT wire and uses the digital I2C communications protocol. The acceleration measurement for each axis is refreshed approximately 100 times per second.

The three axes of measurement are labeled x, y, and z as shown.

The Acceleration Sensor can also be used to measure tilt in three axes. This is possible because gravity is perceived as acceleration. When the sensor is stationary and in the normal horizontal position, the x and y-axis will be near zero, because they are horizontal, while the z-axis will be near 200, which represents one g. If you tilt the sensor then gravity will also be detected on the other axis and the value for the z-axis will go down. Since gravity is distributed among the three component vectors, the tilt of the sensor can be determined.

To test your new sensor, plug it into port 2 of your NXT, and select View > Ultrasonic cm > Port 2. Hold the sensor level in your hand and slowly tilt it forward and back. The value displayed on the NXT will represent the acceleration or tilt value for the x-axis and will be in the range of 0 – 254. (0 will display as ?????? while in View mode.) Note that only the x-axis can be displayed using the view function.

Programming

Mindstorms NXT-G

The Acceleration Sensor can be programmed using LEGO Mindstorms NXT Software using the Acceleration Sensor Block available as a download.

Acceleration Sensor Block

The Acceleration Block will return the value for the positive or negative acceleration for each axis, xy, and z as shown.

In addition, a trigger point may be set for the x-axis. The conditions for the trigger will be met whenever the x-axis value exceeds the trigger.

Configuring the Acceleration Sensor Block
  1. Choose the port where your Acceleration sensor is plugged in. By default, the block will be set to port 3 for an acceleration sensor. You can change this selection if you need to.
  2. If you choose the Compare function, the block will be triggered when the x-axis reading is above or below the selected value; select < “less than” to trigger the block when the reading is below the trigger value or > “greater than” to trigger the block when the reading is above the trigger value. Use the slider to set the trigger value or type it directly into the input box.
Sensor Register Layout
Address Type Contents
42H byte X-axis upper 8 bits
43H byte Y-axis upper 8 bits
44H byte Z-axis upper 8 bits
45H byte X-axis lower 2 bits
46H byte Y-axis lower 2 bits
47H byte Z-axis lower 2 bits

Notes:

  • NXT Firmware version 1.05 or later must be loaded in the NXT for the Acceleration Sensor and other digital I2C sensors to operate correctly. You can check the firmware version by displaying the NXT Window in the Mindstorms software.

Other Programming Environments

NXC Programming

The current version of NXC includes an API function for reading the HiTechnic Acceleration Sensor.

bool  ReadSensorHTAccel (const byte port, int &x, int &y, int &z) 

For a complete list of HiTechnic API supported by NXC, please refer to the HiTechnic API page of the online NXC Programmer’s Guide.

//====================================================================
// Sample Program to display the values from the
// HiTechnic Acceleration Sensor attached to Port 1
//
task main()
{
  int x,y,z;

  SetSensorLowspeed(S1);
  Wait(50);

  while(true) {
    ReadSensorHTAccel(S1, x, y, z);
    TextOut(0,  LCD_LINE1, "x:     ");
    NumOut(6*2, LCD_LINE1, x);
    TextOut(0,  LCD_LINE2, "y:     ");
    NumOut(6*2, LCD_LINE2, y);
    TextOut(0,  LCD_LINE3, "z:     ");
    NumOut(6*2, LCD_LINE3, z);
    
    Wait(100);
  }
}

Additional information

Weight .0540 lbs
Dimensions 2 × 3 × 1.25 in

Robot C

The RobotC driver suite supports HiTechnic products for RobotC 4.x and RobotC 3.x. Select the corresponding repository at the link below and download the zip file.

https://github.com/botbench

Downloads

No downloads found!