All pages
Powered by GitBook
1 of 3

Loading...

Loading...

Loading...

Magnetic Limit Switch

The REV Robotics Magnetic Limit Switch (REV-31-1462) is a three-sided digital hall effect switch. The three internal hall effect elements (one on top, two on the sides) are connected in parallel so if any one of them is triggered the sensor will report as triggered.

Hall effect sensors detect the presence of a magnetic fields. The REV Magnetic Limit Switch is an omnipolar momentary switch; it will trigger when there is sufficient field strength of either magnetic pole detected.

Kit Contents

Part Number

Description

Qty

REV-31-1462

REV Magnetic Limit Switch

1

-

Magnet with mounting tabs

2

REV-31-1407

JST PH 4-pin Sensor Cable - 30cm

1

Specifications

Specifications

General Specifications

Parameter

Value and Units

Sensor Type

Digital, Active-low

Sensor Configuration

Normally Open (N.O.)

Signal

n & n+1

Magnetic Polarity

Omnipolar (both north & south)

Electrical Specifications

Parameter

Min

Typ

Max

Units

Operating Voltage Range ( )

3.3

-

†

Using the included magnet

Mechanical Drawings

Magnetic Limit Switch

All dimensions are in millimeters

Mountable Magnet

All dimensions are in millimeters

Pinout and Schematic

The Magnetic Limit Switch can send signal from either the n+1 or n ports.

This schematic illustrates that the Magnetic Limit Switch is NO "Normally Open".

Application Examples

Application Information

The REV Magnetic Limit Switch comes with two mountable magnets. Because this sensor does not require a contact interface, the magnet can also be soft-mounted almost anywhere with just tape or glue.

The strength of the magnetic field determines the maximum distance the magnet can be from the sensor and still be detected. Alternate (stronger or weaker) magnets can easily be used to change the trigger range of this sensor.

Hysteresis

When designing a system using the REV Magnetic Limit Switch, it is important to consider the impact of hysteresis. When the magnetic field approaches the Magnetic Limit Switch, the sensor triggers after the field strength increases enough to cross the rising trigger point (Bop). As the magnet is then moved away from the sensor, the magnetic field strength falls, but the sensor remains in the triggered state until the field falls below the falling trigger level (BRP). The difference between these two points is the hysteresis.

For a simple system like stopping an arm at the end of range of motion, the hysteresis might not play much of a role, but for creating one or more stop points on a linear elevator, this may factor into the software design.

FTC Applications

Configuring in the Control System

It is recommended that the Magnetic Limit Switch be configured as a "REV Touch Sensor" as shown below:

In this example, the Magnetic Limit Switch is configured on port 3 as a "REV Touch Sensor". It is touched on briefly in the Pinout Section that the Magnetic Limit Switch is capable of sending a signal to the Control Hub through the n+1 and n communication channels. The channel the sensor communicates through is decided by which port it is configured on. In this case, the Magnetic Limit Switch communicates through the n channel.

Programming Applications

The code blocks below gives a basic example of how to use the Magnetic Limit Switch to limit the motion range of a motor using if/else logic. If the magnet is within range of the sensor, then the motor stops. Otherwise, the motor is allowed to move. When triggered by proximity to a magnet, the sensor is considered pressed.

To learn more about programming Touch and Limit Sensors check out Hello Robot for and !

Certain blocks will not appear if the Magnetic Limit Switch is configured as just a "Digital Device"

The code assumes the sensor has been named "test_magnetic" and the motor has been named "test_motor" in configuration.

package org.firstinspires.ftc.teamcode;
 
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.TouchSensor;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
 
@TeleOp
public class LimitSwitchTest extends LinearOpMode {
    // Define variables for our touch sensor and motor
    TouchSensor test_magnetic;
    DcMotor test_motor;
 
    @Override
    public void runOpMode() {
        // Get the touch sensor and motor from hardwareMap
        test_magnetic = hardwareMap.get(TouchSensor.class, "test_magnetic");
        test_motor = hardwareMap.get(DcMotor.class, "test_motor");
        
        // Wait for the play button to be pressed
        waitForStart();
 
        // Loop while the Op Mode is running
        while (opModeIsActive()) {
            // If the Magnetic Limit Swtch is pressed, stop the motor
            if (test_magnetic.isPressed()) {
                test_motor.setPower(0);
            } else { // Otherwise, run the motor
               test_motor.setPower(0.3);
            }
            
        telemetry.addData("Arm Motor Power:", test_motor.getPower());
        telemetry.update();
            }
    }
}

5.0

V

Top Trigger Distance †

-

10

-

mm

Side Trigger Distance †

-

5

-

mm

Hysteresis

-

5

-

mm

Included Magnet Strength

-

4300

-

G

VINV_{IN}VIN​
Blocks
OnBot Java