What is the FIRST Tech Challenge Sensor Guide?
We have included sensors from both modern robotics and LEGO. We will start with information about the modern robotics sensors since they are the newest but at the bottom of this page we have the explanation of the LEGO sensors.
The first sensor we will cover is the Modern Robotics Color Sensor. The information comes directly from Modern Robotics, Inc. It has information on the two modes that it can work which are passive and active. Refer to the chart included in the link for the table of values depending on the color.
Here is an excellent video from modern robotics about the color sensor in both active and passive modes.
Modern Robotics Color Sensor by Modern Robotics, Inc.
For a more detail explanation modern robotics has a pdf file that includes all the sensors. The color sensor starts on page 23, just click on the link below
Now lets go over the Range sensor which measures distances from 1cm to 255cm. It combines an ultrasonic sensor to detect objects from approximately 5cm to 255 cm and an optical sensor to detect objects closer than 5cm.
Again for more detailed information about the range sensor click on the link above called sensor documentation.
The purpose of the FIRST Tech Challenge Sensor Guide is to:
Provide new Teams with a basic overview or what Sensors are and how they operate.
Familiarize new Teams with the various Sensors allowed on an FTC Robot.
Provide a review of materials for returning FTC Teams as an ongoing reference.
The guide focuses on the skills and concepts needed for the development of the following general goals:
Enabling Teams to make educated decisions about the parts they put on their Robot.
Providing a clear understanding of the
way Sensors and other technical elements work.
This guide would not be possible without the contributions of time, ideas, and resources provided by the following people:
Phil Malone – primary author – FTC Teams
2818 and 4240, McHenry, MD
Hunter Smith, National Instruments, K-12 Engineering Specialist
Timothy Friez, ROBOTC, Senior Software Engineer
Xander Soldaat, Robotics hobbyist and ROBOTC contributor, www.botbench.com
Introduction to FTC Sensors
What are Sensors?
The essence of what a Robot does can often be described as:
Sense – Think – Act.
In other words, a classic “machine” is able to produce a repetitive sequence of operations, but a “Robot” is able to sense a changing environment and adapt its behavior accordingly to achieve its overall goal.
In most cases this involves the Robot getting feedback from its environment, to determine if it has successfully achieved its current goal. The type of device used to obtain this feedback is called a Sensor, since it senses (measures) the value some specific property. There are thousands of different types of Sensors that can measure properties as mundane as temperature or pressure, or as esoteric as Quantum Flux or Gravity waves. With the right information, choosing the best Sensor for the job can be fun.
Why use Sensors?
A Sensor should be used if it enables the Robot to reach its goal faster, more accurately, more reliably, more safely, or more efficiently with respect to some scarce resource (like power or weight). So, to create the best possible Robot for a task, it’s important to fully understand all the available Sensor options, and evaluate how each Sensor type can aid the Robot in achieving its goal. FTC permits a limited set of standard Sensors which conform to the LEGO interface. Additional custom Sensors can be utilized, but these must be wired to a prototyping board and require some advanced electronic skills.
This document describes the function and usage of the most common Sensors used in FTC.
Since the Autonomous period of the FTC game does not permit human Drivers to redirect the Robot if it goes off-course, it’s much more important for the Robot to be able to make its own determination of how it’s doing. It is possible to program an Autonomous routine to score points without using Sensors, but to obtain the maximum points, the Robot typically needs to adapt to changing conditions such as random Beacon placement, opposing Robot actions, degraded performance due to wear and tear, or dropping battery voltage.
Every FTC game offers several ways to use Sensors during the Autonomous period. The IR Beacon, for example, is frequently used and extra points are often awarded for elements scored in goals marked by a Beacon. Many games also include white or colored tape lines on the playing field that can be used to aid in navigation. Sensors can also be used to determine when the Robot is on a sloped surface, when it’s balanced, or how far away it is from the perimeter wall or another Robot.
One other Sensor that isn’t described in detail here is the motor encoder. This Sensor is an extension of the DC Motor controller and it enables the Robot to determine and control how fast and how far the motors turn. This Sensor is very helpful when planning complex driving sequences.
One might assume that once the Drivers take over, there is no more need for Sensors, but this is far from the truth. Sensors may be needed to detect things that can’t be seen by the Driver, such as the weight difference between two rings or a magnet inside a racquet ball. Sensors could also be used to detect and count the number of operation the Robot has performed (like collecting no more than five batons or four cubes).
Sensors should be used to make an operation more efficient and safer. An example might be a touch Sensor on an arm that detects when the arm is up against an end-stop. The program can then shut down the motor instantly to prevent damage.
Generally, there is no limit to what you can do with Sensors. However, there usually is a limit to the number of Sensors you can use, either because of available input ports, limited power, or simply the cost. Having a thorough understanding of the available Sensors for FTC will help you make good decisions about which ones to use.
FIRST Tech Challenge Sensors
Before discussing the different types of Sensors, it’s worth touching on Input Ports and Sensor Multiplexers. The LEGO NXT has 4 Input Ports (labeled 1-4) and each is designed to accept a cable from a single Sensor. Since at least one of these ports will probably be attached to DC motor and/or Servo Controllers for FTC, there are three inputs remaining for Sensors.
In order to expand the capabilities of the NXT, HiTechnic offers two devices called “Multiplexers” which plug into a single Input Port, and expand it into four new Input Ports. It’s like a USB hub for LEGO Sensors. One of these multiplexers can only be used with touch Sensors, while the other type can be used with any LEGO compatible Sensor. Using several Multiplexers, it’s easy to connect up to 12 LEGO Sensors to an FTC Robot.
One other ultra-clever use for a Multiplexer is to extend the length of an NXT cable by locating the multiplexer away from the NXT. So, for a long arm that has a 30″ reach and needs a Light Sensor at the end, placing a Multiplexer midway down the arm and using two full–length NXT cables allows you to effectively double your reach.
If you’re using a Multiplexer, your software needs to use a HiTechnic subroutine or Sub-VI to access the attached Sensors. You need to be able to specify both the Input Port and the “Mux” port.
The simpler of the two multiplexers is the Touch Multiplexer. This device lets you read up to 4 LEGO Touch Sensors with just a single NXT input port. The advantages of the Touch Multiplexer over a full Sensor Multiplexer are that it’s cheaper and it does not require an external battery pack. It would be great for adding multiple bumpers around the perimeter of your Robot.
HiTechnic Sensor Multiplexer
The Sensor Multiplexer allows you to connect up to four LEGO or HiTechnic Sensors to a single NXT Input Port. However, since the current demands of an active Sensor can be significant, it is necessary to provide additional power to the Multiplexer. So, the Sensor Multiplexer comes with an external 9V battery pack attached. The battery pack only has a short cable so it needs to be mounted nearby. This is one of the few instances where the FTC Robot Rules permit an additional battery to be used on a competition Robot.
With the great advantage that the Sensor Multiplexer provides, there is the inevitable compromise. Managing the 9V battery does take some vigilance. If the 9V battery is allowed to die, then the attached Sensors will not read correctly. There are two LEDs (Light Emitting Diode) and a power switch on the Multiplexer to help out here. The red LED indicates when the NXT is attached and switched ON. The Green LED indicates when the NXT is attached and both the NXT and the 9V Battery pack is turned ON.
So, if the green LED is lit, then it means that the 9V Battery is being used to power the attached Sensors. So this MUST be ON when your Robots is running (something to add to your pre-match checklist).
In order to preserve the life of the 9V Battery, it should be turned off when the Robot is not in use for a prolonged period. Luckily, if the NXT is off, then the Green LED goes off, and it does not appear to drain the 9V battery as much, so as long as the NXT is off, the 9V power switch can remain on for short periods of non-use.
Bottom line, if you are not using the Robot, and the green LED is on, then you should turn off either the NXT or 9V Battery (something to add to your post-match checklist).
LabVIEW for LEGO MINDSTORMS: Sample LVLM Robot projects for each Sensor can be downloaded as a .zip file from the following NI Community page:
ROBOTC: All ROBOTC directory references are relative to the ROBOTC installation directory, which is typically at: C:\Program Files (x86)\Robomatter Inc\ROBOTC Development Environment\ or C:\Program Files (x86)\Robomatter Inc\ROBOTC Development Environment 4.X\
LEGO Touch Sensor
This is the simplest of all Sensors used in FTC. A momentary-action on/off switch is mounted inside a standard LEGO Sensor housing. A spring-loaded plunger is located at the front of the Sensor, with a hole suitable for inserting a LEGO axle. When the plunger is pressed the NXT senses the condition and can use it to respond to the contact.
Only a small amount of force is required to activate the touch Sensor. Once the plunger hits the end-stop, it is important to limit any additional force to prevent damage to the Sensor or its mounting bracket.
LEGO Touch Sensor Usage
Touch Sensors can be used to sense conditions both inside and outside the Robot. For example, sensing when the Robot encounters an obstacle. For FTC, flexible whiskers can be added to the Sensor to extend its sphere of influence. Sensing that the Robot has reached a wall or goal can be very helpful when navigating in Autonomous.
Touch Sensors are also useful for automating the motion of mechanisms inside the Robot. One classic example is sensing the end-of-motion for an arm or turntable. When the moving part reaches the end of its motion, it depresses a touch Sensor, which can then indicate it’s time to turn off the drive motor so it does not get stalled and draw excessive power. Another use might be to detect an error condition. For example, a ball feeder may jam and push a ball into an incorrect location. A touch Sensor could be used to detect the jammed ball, and then reverse the ball feed automatically.
The Touch Sensor can discriminate three different conditions: pressed, released, and bumped. Pressed and released simply report the current state of the internal switch, but bumped requires both a press and release in sequence. This condition is great for counting actions where each action may take a small amount of time to occur. Using the bumped state prevents the software from counting one sustained press as a series of events.
Tech Note: Normally only four Sensors can be used with an NXT, but it is possible to use a touch Sensor multiplexer to attach four touch Sensors to a single NXT input port without requiring any additional power.
LEGO Touch Sensor Parameters
Senses: Mechanical contact with minimal force
Inputs: Port Number (1-4)
Outputs: Button State: Pressed, Released, or Bumped.
LabVIEW for LEGO MINDSTORMS Sample: click here.
ROBOTC 3.x – Sample Programs\NXT\Touch Sensors\Wait For Push.c
ROBOTC 4.x – Sample Programs\NXT\Touch Sensors\Wait For Push.c
LEGO Light Sensor
This Sensor combines a red LED and a photo-diode into a single NXT Sensor housing. This Sensor can be used in two distinct ways:
1. Passive Mode: The LED is turned off and the Sensor measures
the amount of ambient light entering the photo-diode. This may be
direct light, or light that has reflected off another surface. The
Sensor will react to a wide range of light intensity and color
variations, but only intensity is measured. The Sensor will return
an integer in the range of 0-100 where 0 means dark and 100
2. Reflective Mode: The LED is turned on and the Sensor measures
the combined ambient and reflected LED light entering the photo-
diode. When a reflective surface is brought near the Sensor (0.1″
to 1″), the reflected LED light dominates. The closer the surface is, or the greater the reflectivity, the higher the measured light intensity will be. Once again, the range of values is 0 for dark to 100 for bright.
To adapt to different Sensors and reflective surfaces, it is possible to calibrate the light Sensor to produce a consistent result. The NXT has a means (programmatically) to take the minimum and maximum available light levels and translate these into the full 0-100 range. This calibration can only be performed on one light Sensor input and is remembered until the next time the NXT is calibrated.
LEGO Light Sensor Usage
In their simplest form, light Sensors can often be used as a non-contact version of a touch Sensor. That is, they can be used to sense the approach of a reflective object like a wall or mechanism The advantage of a light Sensor over a touch Sensor is that they can be positioned to give.
advanced warning. For example a light Sensor can detect the early approach of a wall so the Robot can slow down before it actually makes contact. This saves wear and tear on both the Robot and the Sensor.
In reflective mode, the light Sensor can use white tape lines on the playing field to aid in navigation. This enables the Robot to drive until its Sensor crosses the path of a white line, or to follow the edge of the white line to approach a ramp or goal.
One caveat when using the light Sensors is that you must consider the color of the illuminating LED. Since the LED is red, red gaffers tape looks a lot like white gaffers tape and blue gaffers tape looks a lot like the grey tile. Because of this, special consideration should be given to the application of this Sensor. For example, it can help choose between a red or blue scoring piece, but would not be useful for following a red line on the field if that same line is blue on the opposite side.
One other novel uses for a light Sensor is as a simple indicator light. Imagine mounting the Light Sensor pointing up. By turning the LED on or off, the Robot can signal to the Driver that something is happening. This could be an “I found one” signal for a special game piece or simply that the Robot is acting in a new mode.
LEGO Light Sensor Parameters
Senses: Ambient or reflected light
o Port Number (1-4)
o Illumination on/off
o Light Intensity: 0-100. 0 = dark, 100 = light.
o Raw analogue value: 0-1023
LabVIEW for LEGO MINDSTORMS Sample: click here.
ROBOTC 3.x – Sample Programs\NXT\Light Sensor\Line Tracking.c
ROBOTC 4.x – Sample Programs\NXT\Light Sensor\Line Tracking.c
LEGO Color Sensor
This Sensor is similar to the LEGO light Sensor, but it extends the capabilities by adding the ability to detect different colors. It’s easily recognized by its unique three bumps at the sensing end. Like the light Sensor, this Sensor also has an illuminating light source, but in this case it can be one of three different colors – red, green, or blue.
The output of the Sensor can be either a reflected-light level (0 = dark, 100 = bright), or it can be a color code. Codes are Black = 1, Blue = 2, Green = 3, Yellow = 4, Red = 5, White = 6, No-Color=0
LEGO Color Sensor Usage
One way to use this Sensor is to detect the color of a target or game piece. The typical FIRST red and blue colors are extremely easy to detect. A Sensor could be used to check the color of a game piece as it passes through the Robot and discard any color that is not desired.
The color Sensor can use both color detection and light level modes for a two-step tracking procedure. First, the color Sensor can look for a non-black tape line and record the color that it finds (red or blue). Then, it illuminates the corresponding color and uses the reflected light energy to tightly track the line. This process eliminates the problems a plain light Sensor would have tracking a blue line.
By placing a multi-colored strip on a linear slide or turntable, a color Sensor can also be used as a position Sensor. The program could use the color to determine if the turntable was left or right of center, or if the slide was near the end of its motion in either direction.
LEGO Color Sensor Parameters
Senses: Color or light level.
o Port Number
o Detection/Illumination Mode
o Color Code: Blk=1, Blu=2, Grn=3, Yel=4, Red=5, Wht=6, No-Color=0
o Light Intensity: 0 = dark, 100 = bright
LabVIEW for LEGO MINDSTORMS Sample: click here.
ROBOTC 3.x – Sample Programs\NXT\LEGO Color Sensor\ColorSensor.c
ROBOTC 4.x – Sample Programs\NXT\LEGO Color Sensor\ColorSensor.c
HiTechnic Color Sensor
This Sensor is similar to the LEGO color Sensor, but it operates in a different way. Instead of having three illuminating sources (LEDs) paired with a single generic sensing element, this Sensor incorporates a white illuminating LED and a color-sensitive sensing element. It can be used in either active or passive mode like a regular light Sensor (with the illumination turned on or off) and, because of its white LED, it is much better at coping with unexpected colors.
The sensing element outputs three different color strengths simultaneously (for red, green and blue). The Sensor’s processor then analyses these three color levels to determine a white level and a color code. The color codes are not as distinct as the LEGO color Sensor’s, but they provide more variations. Codes 0 and 17 represent black and white, respectively. Codes 1-10 span the typical color spectrum and codes 11-16 represent different white colors.
Note: Using LabVIEW or ROBOTC, you can gain access to the raw internal data of the Sensor for the more experienced programmer. The HiTechnic color Sensor is slower, compared to the LEGO Sensor, but is more accurate.
HiTechnic Color Sensor Usage
This Sensor might be used to detect the color of a target or game piece. The FIRST red and blue colors are easy to detect, especially when a range of color codes are used for both red and blue. This Sensor can be used to check the color of a game piece as it passes through the Robot and discard any color that is not desired.
Additionally, because of the illuminating white LED, this Sensor is great for line detection and tracking because it is less dependent on a specific color.
HiTechnic Color Sensor Parameters
Senses: Ambient or reflected light color/intensity.
o NXT Port
o Mode Active, Passive, Raw
o Color Number (0-17)
o Red level (0-255)
o Green Level (0-255)
o Blue Level (0-255)
o White Level (0-255)
LabVIEW for LEGO MINDSTORMS Sample: https://decibel.ni.com/content/docs/DOC-37282
ROBOTC 3.x – Sample Programs\NXT\3rd Party Sensor Drivers\HiTechnic-colour-v2-test1.c
ROBOTC 4.x – TBD
HiTechnic IR Seeker v.2 This Sensor is used to seek the Infra-Red (IR) light emitted by devices such as the IR Beacon used in FTC competitions. This Sensor can determine a rough direction and signal strength, which Robots will typically use to navigate towards, or around, the Beacon. Once the IR Seeker is configured to match the modulation mode of the Beacon (see HiTechnic IR Beacon section for more information), it senses IR signals on five unique, overlapping, internal Sensors. The software within the Seeker then maps the strength of these five signals onto one of nine non-overlapping beams (numbered clockwise 1-9) which span about 300 degrees. The Seeker is essentially saying “This is my best guess as to where the Beacon light is coming from.” A value of 0 means the Seeker cannot detect the Beacon.
However, all things are not equal across these nine beams. Due to the internal Sensor geometry, the odd-numbered beams have a detecting width of approximately fifty-five degrees and the evennumbered beams have a width of five degrees. Therefore, the odd beams are great for roughly locating the Beacon and the even beams are best for fine steering control. HiTechnic IR Seeker v.2 Usage Teams that make extensive use of the IR Seeker often mount the Sensor rotated 30 degrees offcenter, to place one of the narrow beams (4 or 6) on the center-line of the Robot. This enables the Autonomous code to steer directly towards the Beacon within a five degree window. In addition to outputting the best beam number, the Seeker also outputs the signal strengths from the five internal Sensors (numbered clockwise, 0-4). Programmers can make use of this raw data for even more precise target tracking. Since the narrow (even) beams occur because the five internal Sensors have slightly overlapping sensing ranges, then if the Beacon is located in one of the even beams, you can use the relative signal strength of the two adjacent Sensors to determine which half of the beam the Beacon is in. This enables an extremely accurate left/right steering mode. One other way to use the IR Seeker is to use it to tell when the Robot is at a certain position relative to the Beacon. By knowing the angle at which the Beacon moves from one beam to the next, the Robot can gauge its progress across the field by waiting for the best beam number to change. HiTechnic IR Seeker v.2 Parameters Senses: Direction to IR Beacon, and 5 signal strength values Inputs: o Port Number (1-4) o Beacon Type (AC/DC) (600Hz/1200Hz) Outputs: o Best Beam. Integer: values:0= Not Found, 1-9 clockwise beams o Signal Strength. Integer array : values 0-255 LabVIEW for LEGO MINDSTORMS Sample: click here.
ROBOTC Sample: ROBOTC 3.x – Sample Programs\NXT\3rd Party Sensor Drivers\HiTechnic-irSeeker-v2- test1.c ROBOTC 4.x – TBD HiTechnic Infrared Beacon The HiTechnic Infrared Beacon is not a Sensor, but it is the device that emits the IR light that can be detected by the IR Seeker v.2 Sensor. There are two versions of the HiTechnic IR Beacon, an older model and a newer, 360 degree model.
Newer 360 Degree IR Beacon The second version of the HiTechnic IR Beacon was introduced for the 2013-2014 FTC season and has a HiTechnic part number of HBK2100. This new-style of Beacon is a 360° Beacon that can run in either 1.2 kHz or 0.6 kHz mode. This new Beacon has six (6) IR LEDs that are mounted in a circle to provide 360 degrees of coverage for the emitted IR light.
The Beacon is powered by a 9V alkaline battery. On the front of the Beacon there are two switches (see image above). The switch on the left is an on/off switch, with the off position being the rightmost position. The switch on the right is a four-position switch that is used to control the Beacon mode:
The leftmost position puts the Beacon in 180° mode (only half of the IR LEDs are active) and in 1.2 KHz mode (the IR LEDs flash at this frequency). The second position from the left puts the Beacon in 360° mode (all of the IR LEDs are active) and in 1.2 KHz mode. The third position from the left puts the Beacon in 180° mode and in 0.6 KHz mode. The rightmost position puts the Beacon in 360° mode and in 0.6 KHz mode. When running in 180°mode, a lit, red LED indicates which side of the Beacon is active. In 180° mode only one of the LEDs will be lit. In 360° mode both red LEDs will be lit. Note that if the battery voltage is low, the red LEDs will flash, indicating that the battery should be replaced.
HiTechnic Angle Sensor This Sensor is quite unique in the world of angle/rotation measurement devices because it can measure absolute position and rotational speed. The Sensor has a standard LEGO axle hole at one end so it can be adapted to connect to a range of devices. Unlike many rotation Sensors that use some form of pulse-based encoder, this Sensor uses a magnet attached to the end of the shaft and two magnetometers to sense the rotation of the magnetic field. This has two distinct advantages over other rotational Sensors: 1. There is no contact between the rotating shaft and the sensing element. 2. The two magnetometers can actually determine the angle of the shaft with respect to the housing, so the Sensor always knows the actual shaft angle, rather than just how much it has turned since it was powered up, thus eliminating the need to home an actuator. And, just in case the Sensor needs to be mounted at an odd angle, the programming software can zero out the angle so that its current position will be considered zero degrees from then onwards (even after movement when the power is off). While the Sensor is powered up, it also accumulates changes in angle to determine a total accumulated angle. This is similar to a typical encoder and it can be used to measure multiple rotations of the shaft in either direction. In addition, the Sensor can measure the shaft’s speed and direction of rotation. HiTechnic recommends keeping the speed below 1000 RPM (> 16 revolutions per second). HiTechnic Angle Sensor Usage This Sensor has many uses in the areas of Navigation and Manipulator control. By adding the Sensor to a drive motor output, or a passive follower wheel, the software can determine how far and fast the Robot is moving. Another useful application is using this Sensor to monitor the position (angle) of a rotating manipulator joint (arm, platform, roller etc.). By resetting the Sensor to read 0 degrees at the actuator’s home position (once, at the start of the season) the software can gain full control of the manipulator’s position. This information can be used to monitor the position or in a control loop to actively set the manipulator’s position. The angle Sensor could also be used to help record and return to one or more preset positions. Finally, the rotation speed measurement aspect of the Sensor could be used to control a spinner or other high speed actuator. Being able to measure/adjust the speed of a shooter wheel can provide greater accuracy. Note: Care must be taken when using the angle Sensor and the compass Sensor on the same Robot. Just like the magnets in a motor, the magnet in the angle Sensor can pull a compass off the correct heading. Make sure that the angle Sensor is mounted away from magnetic-field measuring devices.
HiTechnic Angle Sensor Parameters Senses: Angle, speed and direction of shaft rotation. Inputs: o NXT Port Number Outputs: o Shaft Angle Degrees (0-365) o Accumulated Angle Degrees (integer) o Shaft Speed RPM (integer) LabVIEW for LEGO MINDSTORMS Sample: click here.
LEGO Ultrasonic Sensor This Sensor emulates the technique that a bat uses to sense the distance to a nearby object. It sends out ultrasonic (high frequency) sound pulses and measures the time it takes them to bounce off a surface and return to the Sensor. This time is then converted into a distance (in cm) which is sent to the NXT. This Sensor is effectively a range-finder. Because sound reflections are strongly affected by the size, shape, and texture of a surface, the ability of the Ultrasonic Sensor to get an accurate measurement is unpredictable. If the Sensor is pointed head-on to a large flat and smooth surface, it will be very reliable and provide an accurate reading. However, if the Sensor is expected to measure the range to a curved pipe or small padded surface, it may be much less dependable. In addition the Sensor is only capable of working within a narrow range of distances. It will not pick up any targets that are less than 8 cm or more than 255 cm from the Sensor head. Objects further than 100 cm are difficult for the Sensor to detect. The distance from which the Sensor first detects an approaching object depends on: 1. The ultrasonic reflectance of the object, which is a function of the object’s size and composition. The Sensor detects large, hard objects from a greater distance than small, soft ones. For example, the Sensor might detect a pane of glass at 200 cm and a Robot at 100 cm. 2. The angle of incidence of the object relative to the Sensor. The Sensor detects objects directly in front of it at greater distances than objects off to the sides. LEGO Ultrasonic Sensor Usage The primary use for the ultrasonic Sensor is navigation, which includes obstacle avoidance. The simplest form of ultrasonic navigation is measuring the distance to the field perimeter. Since the perimeter is typically 12” high, flat, and smooth, it presents the perfect target for the ultrasonic Sensor if you are approaching it head on. If you are approaching at an angle, the smoothness of the surface may work against you. If you intend to touch the perimeter, you will need to recess the Sensor inside the Robot to ensure that the range is always greater than 5 cm.
HiTechnic Electro Optical Proximity Detector (EOPD) Sensor Externally, this senor looks similar to a light Sensor, but it is designed to be immune to ambient light and only respond to its own illumination. Since the Sensor only responds to its own generated light, it’s able to judge the distance to a reflective object within about 6 inches (20 cm). This Sensor takes rapid, alternating readings with the illuminating LED turned on and then off and measures the difference between the two sensed light levels. In this way the ambient light can be subtracted from the illuminated reading. The EOPD Sensor has a high and low gain setting. The high (4x) gain can be used for longer range, or low reflectivity objects (like the LEGO ball). The low (1x) gain works well with close, shiny objects. The maximum value returned by this Sensor is 1000, and this occurs when the Sensor is within about 1 cm of a white paper target. As the target object is moved away from the Sensor, the reflected light level will drop and this can be used to determine distance. The actual Sensor output values will depend on the surface of the object being detected, so in most cases the Sensor will need to be calibrated in order to determine actual ranges (unlike the ultrasonic Sensor which can generate actual ranges without calibration). Due to the nature of light propagation, the reflected light level will vary based on the square of the distance to the target object. To determine an actual target range, the following calculation needs to be performed by the software: Range = cal_factor / sqrt(raw_reading) cal_factor needs to be determined ahead of time, by taking the Sensor value at an intermediate range (half the distance between the minimum and maximum distance you plan to measure)and performing the reverse calculation: cal_factor = Range * sqrt(raw_reading)
HiTechnic EOPD Sensor Usage The EOPD Sensor provides yet another way to make short range position measurements. This feature can be used to locate objects both inside and outside of a Robot. Externally, the EOPD Sensor could be used to closely track a wall. As a wall follower, if the Sensor was angled forward at 45 degrees, it could determine if the Robot was heading away from, or towards, the wall by seeing how the sensed distance changed. Internally, the EOPD Sensor could be used to position a mechanism by adding a small reflector to the piece being positioned. The reflected light energy could be used to reliably return the mechanism to the same position without requiring any physical contact.
HiTechnic EOPD Sensor Parameters Senses: Reflected Light Energy Inputs: o NXT Port o Gain (1x or 4x) Outputs: o Light Level: Integer: (0-1000) 1000 = max reflected light. HiTechnic Magnetic Sensor This Sensor is able to measure magnetic field strength. Magnetic field lines extend out from the North Pole of a magnet and curve around back to the South Pole. Depending on the orientation of the magnet to the Sensors, the field strength reading can vary greatly and if there are no magnets near the Sensor, it will read zero. One issue with sensing magnetic fields is that they exist in three dimensions. However, mounting this Sensor horizontally will make it most sensitive to a magnet that is oriented vertically in front of the Sensor. If the North Pole of the magnet is up, the field strength will be greatest. If the magnet is oriented sideways, it may not be detected at all. It’s always a good idea to test the values that the Sensor generates for different magnet orientations. HiTechnic Magnet Sensor Usage So far the only use of the Magnetic Sensor was to detect the special magnet balls in the 2011- 2012 FTC Game – Bowled Over. HiTechnic Magnet Sensor Parameters Senses: Magnetic Field Strength Inputs: o NXT Port
HiTechnic Acceleration Sensor This Sensor is able to measure acceleration in three (orthogonal) axes. The orientation of the x, y and z axes are shown in the image. The range of measurements for this Sensor is approximately +/- 2G (where a G is the acceleration due to gravity.) The scale factor of the measurement is approximately 200 counts per G, so a full scale measurement will be +/- 400 counts. The interesting thing about measuring acceleration is that it can be caused by two different factors. The first factor that can cause the Sensor to register acceleration is actually speeding up or slowing down the velocity at which the Sensor is moving. This is linear, motion-based acceleration. The other factor that can cause the Sensor to read acceleration is gravity. The effect of gravity is identical to motion-based acceleration, except that the Sensor only sees it if it is tilted off the horizontal plain. As a sensed axis is tilted off horizontal, the effect of gravity is seen based on the sine of the tilt angle. When the angle reaches 90 degrees, one full G will register (about 200 counts). Since the z axis is already vertical, it shows gravity as the cosine of the tilt angle. HiTechnic Acceleration Sensor Usage Both types of acceleration (motion or gravity) can be used to detect information about the motion of the Robot. For example, if the Sensor is facing forward, a sudden negative X acceleration would indicate that the Robot has stopped suddenly, perhaps from hitting an obstacle. However, the combined X and Z values could be used to detect when the Robot is tilting up or down. This measurement could be used to help balance the Robot on a tilt bridge, like in the “Get Over It” game. It is important to realize that trying to measure tilt angle while moving horizontally is difficult since the acceleration of the vehicle will affect the “apparent” tilt angle, because the two forms of acceleration will be combined. HiTechnic Acceleration Sensor Parameters
Senses: Acceleration in three axes
Inputs: NXT Port
Outputs: o X Axis Acceleration: integer (+/- 200)
o Y Axis Acceleration: integer (+/- 200)
o Z Axis Acceleration: integer (+/- 200)
HiTechnic Gyro Sensor This Sensor contains a single axis gyroscopic element that detects rotation and returns a value representing the number of degrees per second of rotation (turn rate). The gyro Sensor can measure up to +/- 360° per second of rotation. The axis of measurement is in the vertical plane with the gyro Sensor positioned with the black end cap facing upwards as shown. Unlike the acceleration Sensor, the gyro Sensor does not read zero when there is no rotation. Instead it has an output value that corresponds to a zero turn (Null) rate, and this value may vary based on the specific Sensor and ambient temperature. So, before taking actual rate measurements, it’s necessary to determine the null output value. This is done by holding the Sensor still and taking the average of a number of readings. This average null offset is then subtracted from future values to determine the actual turn rate. Unfortunately this form of calibration is never perfect, so quite often angle calculations based on turn rate will tend to “drift” over time. HiTechnic Gyro Sensor Usage If mounted horizontally, the Gyro Sensor can also be used to measure the turn rate of a Robot or other vehicle. Once again, integrating the readings can provide a heading angle. By combining the reading from a Compass Sensor and a Gyro Sensor a high-speed but drift-free Robot heading could be calculated. This method of using two Sensors to perform a single task is called Sensor Fusion. The gyro Sensor is the perfect Sensor for building a selfbalancing Robot (like a Segway). By pointing the Sensor up, and integrating (adding up) the Gyro reading over time, you can determine the angle that the Sensor is tilted. This angle can then be used to ensure that your Segway Robot stays upright. For detailed instructions on how to build and program an HTWay, check out www.HiTechnic.com.
HiTechnic Gyro Sensor Parameters
Senses: Angular Rotation
Inputs: NXT Port
Outputs: o Angular
Velocity: Null Offset + Degrees per second
IR Sensor and Color Sensor in FTC Robotics
IR sensor, Color Sensor used in FTC 2014-2015 Cascade Effect and sample code in RobotC