The REV Robotics Touch Sensor (REV-31-1425) is a digital sensor that can be used as a button input or as a basic mechanical limit switch. The touch sensor is similar to a keyboard button, when the button is pressed the touch sensor notifies the Robot Controller and an action in the code is triggered. Sometimes this action may stop the motors or reset the encoder angle, depending on the use case.
Like all digital sensors, the Touch Sensor acts on a binary. When the button is not pressed, the LED light remains unlit and the value read by the Expansion Hub is 3.3V (high) and when the button is pressed the LED will light and the Expansion Hub will read 0V (Low)
The REV Touch Sensor features an off-center button. Because this sensor requires a contact interface; the sensor must be mounted with regards to the location of the button and the object, or mechanism, intended to trigger the sensor.
Configure the Touch Sensor as "REV Touch Sensor" as shown in the image below.
The code blocks below give a basic example of how to use the Touch Sensor to limit the motion range of a motor using if/else logic. If the button is pressed then the motor stops. Otherwise, the motor is allowed to move.
The code assumes the sensor has been named "Touch" and the motor has been named "Motor" in configuration.
The button is directly in-line with the LED and signal. So if the light is operating correctly, the button is working.
In the image below, is the key for the wired connection between the touch sensor and the robot controller. The touch sensor does not use or pick up a signal from the n (blue) wire. This is not a problem if there is one digital sensor per port. However, If you intend to connect more than one digital sensor to the same port using the sensor splitter cable, make sure that the n+1 (white) wire portion of the splitter cable is plugged into the touch sensor.
Common applications for the Touch Sensor, such as limit switches, require consideration for unconstrained, or twisting motion. Limit switches limit the range of motion for a mechanism. If the mechanism is not properly , there is a risk that the contact interface will not trigger the Touch Sensor.
In this example, the Touch Sensor is configured on port one. It is touched on briefly in the that the Touch Sensor only sends a signal to the Control Hub through the n+1 communication channel. Because of this limitation, the Touch Sensor will only work when configured on the odd-numbered digital ports.
Part Number
Description
Qty
REV Touch Sensor
1
JST PH 4-pin Sensor Cable - 30cm
1
Parameter | Value and Units |
Sensor Type | Digital, Active-low |
Signal | n+1 |
Parameter | Min | Typ | Max | Units |
Operating Voltage Range | - | - | 3.3 | V |
Button | n+1 Voltage | LED State | FTC SDK Logic |
Not Pressed | 3.3V | Off | TRUE |
Pressed | 0V | On | FALSE |