NXT Sensor Guide
Some sensors
This is a list of some available sensors for the LEGO NXT
Sensor | Function | Possible Use | Where to buy? |
Compass | read direction | HT/MS | |
Acceleration | read acceleration in three axis | HT/MS | |
Gyro | read rotation speed in one axis | HT | |
Color | Detect one of several preset colors, or return the color range for Red, Green & Blue | HT | |
RFID | RFID cards have a small radio in them that transmits a single, unique, and in this case, unchangable number. The sensor can detect those cards and return a value that represents that number. | ||
EOPD | More advanced Light Sensor | HT | |
Touch | LEGO | ||
Ultra sonic | Detect range to object using sound | LEGO | |
Light | LEGO | ||
Sound | detect sound level | none | LEGO |
Rotation Sensor | detect movement distance & direction of motor | LEGO | |
Infrared Seeker | Find direction to IR ball | HT | |
Infrared Link | Connect NXT to RCX, Power Functions system, or IR Trains | HT | |
Sensor prototyping kits | Allow users to make their own sensors | HT | |
Acceleration Sensor, Gyro and Compass
One very common question about LEGO MINDSTORMS NXTs is: "What's the difference between a Gyro sensor, an Acceleration (or tilt) sensor, and a Compass sensor. This page will attempt to explain how each is different, and how they can be used.
Feature | Acceleration | Gyro | Compass |
Function | read acceleration in three axis | read rotation speed in one axis | read direction |
Data Axis | |||
Where to buy? Several companies sell sensors. This is one source. |
Acceleration | Gyro | Compass |
Notes
(1) standard note
Common Questions:
Here are some answers to questions posted on nxtasy forums by our friend and NXTpert Brian Davis and also myself
Q: If I'm correct, the acceleration sensor only measures when the sensor is, well, accelerating! Right?
A: More exactly, it determines when the
internal sensor is experiencing an acceleration relative to the outer
casing.
Q: Can I use an acceleration sensor to balance my robot?
A:
No. Actually, surprisingly, this doesn't work as
well as you might like. The problem is when the robot is falling over, the acceleration sensor is not
returning the angle the robot is at, but the acceleration it is under, which
depends on the angle, as well as the angular velocity, as well as the angular acceleration. Building a LEGway
style robot using both ground-sensing elements (and no, there is no
"super-resolution" mode for the US sensor that I'm aware of) as well as a tilt
sensor might allow hill climbing (something significantly more difficult), but I
suspect the biggest limitation is going to be the speed of the software
response. To get LEGway to balance well takes a "tight control loop" (i.e., very
rapid and accurate correction).
Q: Is a Gyro the same as
a one axis acceleration sensor?
A: Well... no. Not at all . The gyro sensor measures how fast
it is rotating (or turning) in around one axis, but that's it. That's not
an acceleration like the accelerometer
measures. How to explain it...
Put yourself in an elevator with a compass
sensor, a gyro sensor, and a 3-axis accelerometer. With the elevator at rest on
the 13th floor, one axis of the accelerometer reads '200' (about 1 G), while the
other two are very close to zero. the compass sensor reads something like '90'
(it just happens, in this example, to be pointed just about due east), while the
gyro reads '0' (it isn't turning).
Now spin the robot rapidly (but
smoothly, not speeding up or slowing down) in place. The accelerometer will
still read about '200' (down), as none of the linear accelerations on it have
changed. But the compass sensor will start changing rapidly as the direction it
points changes... '90' becomes '110' which becomes '130' etc, until at '359' it
suddenly "drops" to '0' again and starts counting up. The gyro sensor on the
other hand will show some constant value, like '15', as the unit rotates at 15
degrees per second. But it's not linearly accelerating.
OK, now cut the
elevator cable. The accelerometer now reads '0' in all directions. Why? I mean,
you are certainly accelerating (towards the bottom of the shaft in this rather
touchy case). But the sensor within the accelerometer is now accelerating
exactly the same as the casing to which it's attached, so it can't detect this,
and reads zero. The compass still works, giving you which way you are facing
relative to magnetic north. And the gyro still works, because it's measuring the
rotation rate about one axis. Neither of these depend on an external acceleration.
I do suggest you step out of the plummeting elevator just
before it hits the bottom
Q: Can I use an acceleration sensor on a bot going a steady speed to tell whether or not I was flipped over or on a hill?
Actually, yes. If the robot
is moving at a steady speed, then there is no acceleration on it, and the
only thing the accelerometer will report is the gravitational acceleration on the internal sensor itself.
If that's all "down", then the robot is moving flat. If it's "half down and half
forward" (i.e., two of the readings are about 140), then the robot is at a 45°
angle, or if the reading is "about 200, in the opposite sense that it normally
is", you know the robot is flipped over like a turtle on its back.
Q: Will a pendulum always point down, as long as you
let it be (not touch it or anything) and if the "counterweight" (the thing that
is at the bottom of the pendulum ) is heavy enough?
A: Well... no. Although if it's any help, I have
to re-teach this to college students as well.
In a *static* situation,
where things are not accelerating, then a pendulum at rest hangs straight down,
and the mass it has makes absolutely no difference (in fact, the mass makes no
difference to *gravitational* accelerations of the pendulum, either - the result
is the period of a pendulum is independant of the mass, something you can verify
to yourself the next time you swing on a swing with your parent or child). But
in the case in question there are certainly accelerations (other than gravity)
to consider.
Think about it this
way: I seal you in a little room on the
top of a long pole that is hinged on the lower end, and you have a little plumb
bob that is hanging straight down. Now, I let the pole tip to the side, toppling
over. Does the plumb bob always remain pointed at the ground, or at the floor of
the little room, or somewhere else? Well, I know that the instant before the
little room hits the ground it is moving straight down, in "free fall", so at
least at that moment, the plmb bob would not be "pointing" down - it would be
floating, or drifting, in the little room.
When the pole had only tipped 45°, for instance, my hand
that is holding the plumb bob would be moving diagonally towards the ground - in
fact, it would be *accelerating* diagonally towards the ground, while the
pendulum bob would be accelerating downward (due to gravity) as well as to the
side (becasue of the string connecting the bob to my hand). The situation
actually gets quite complicated.
This gets back
to why an acceleration sensor is not the best way to
balance a LEGway-style platform. After all, what is a pendulum but a different
kind of acceleration sensor, but a very complex one
to deal with.
Q:What if the acceleration sensor was mounted very close to the ground? (for a balancing robot) Wouldn't that negate some of the additional accelerations that you mentioned? I guess my theory is that if you mount the acceleration sensor at the pivot point of the "inverted pendulum", it should only tell you the angle it is currently at, right? Of course the pivot point is where the tires are touching the ground, and you can't mount it there, but you could mount it very close, no?
A: Many of the above examples hold true when the sensor is placed near the "center of mass" of the robot. If the sensor is in a different location, many other (confusing) forces may come into play, making it even more complex.
Q: What can you measure with an acceleration sensor:
A: Things Brian has done with an accelerometer...
The HiTechnic accelerometer is still one of my all-time favorite sensors, because it can do so much... but you have to understand how it works in order to take advantage of that. And the sad fact is (speaking as a physics teacher here) people, even intelligent, well-educated, "aged" people like myself, usually haven't spent enough time thinking about the differences between things like position, location, velocity, speed, linear acceleration, angular acceleration, and angular position (or the difference between rotation and revolution, or... dang, I think I need to go back to teaching again, the summer's been too long ).
Other Sensors (incomplete list)
Mindsensors Sensors
"LEGO Certified sensors"
Some sensors are listed as "LEGO Certified". That means they pass LEGO's strict quality control standards. These include current limits and safety standards.
Converter cables (this needs more information)