This is the first of a series of posts that examines each VEX sensor. The aim of this series is to help teams that are new to using sensors have an idea of what is available, and what they might like to use on their own robots. [See below for interesting note about the 3-wire cable used on these two switches!]

Bumper Switch

bumper switch or "bump sensor"$13 for a 2-pack

The bumper switch is a pretty basic; in addition to being reliable and durable, it is easy to install and use. It falls into the category of “digital sensors,” meaning that it returns only two possible values: 1 or 0 (and must be plugged into one of the cortex “digital” ports).

This item is screwed onto one part of the robot (often some part of the chassis) and when you hit something (like the field perimeter or a fixed field object) it says “Aha!”

Triggering it requires a reasonable amount of force, so don’t plan to use this for a movement that will lightly touch or graze its target object (see next for limit switches to do that).

Sensor Output: RobotC

When the button is pressed, the sensor returns a value of 1; when it’s not pressed, it gives a value of 0. To program a robot using a bump sensor, one usually has a conditional statement, followed by some instructions: If sensorValue == 1, do this. Or: While sensorValue == 0, do that. It’s pretty straightforward and great for programmers just starting to use sensors.

Sensor Output: easyC

EasyC users take note: EasyC programming with VEX digital switches requires a little bit of backward thinking. When the sensor is NOT pressed, it returns a value of 1; when it IS pressed, it returns a value of 0 (zero). My brain would love for this to work like RobotC, but in this case easyC users must train their minds to do a flip-flop.

It stems from the way input ports work (which operate the same way regardless of programming language). When the port is empty or has a switch that is not pressed, it returns a value of HIGH and when the sensor *is* pressed, it acts as a circuit break, returning a value of LOW. RobotC makes things more convenient and converts “pressed” into 1 and not-pressed into 0; easyC does not do this conversion for you.

So the easyC equivalents to the conditional statements above are: If SensorValue == 0, do this. Or: While sensorValue == 1, do that.

Limit Switch

VEX limit switch$13 for a 2-pack

The limit switch is also a digital sensor (returning 1 or 0) and acts very similarly to the bump switch. When the little metal lever is up, as in the photo at left, it returns a value of 1; when the little metal lever is depressed, it gives a value of 0.

Like the bumper switch, the limit switch is also easy to use and quite reliable, but fragile (otherwise known as “flimsy”). You don’t want to put this sensor in a place where it can get entangled with other robots or on a robot appendage that will hit things hard. If you did, you’d probably have to replace this sensor at the end of every match.

This sensor requires only a tiny amount of force to trigger it, as compared to the bump switch.


The limit switch is often used within a robot’s structure to prevent, say, a movable arm from coming down too low and smashing into the top of the cortex (it would be better to move the cortex, but sometimes these things cannot be helped).

My team used this sensor in Nothing But Net in a different way. We had a double-flywheel design for that game to shoot balls into a net (turned out to be a rather flawed design, but we were newbies). However, when a ball would go through the flywheel, it would slow down the spinning so much that it would take *4 seconds* to get back up to speed. Hard to launch a lot of balls quickly this way. We tried solving this with PID programming to match the RPMs of the flywheels to a fixed target, but the amount of inertia loss when the ball went through was so large, that there was just no combination of PID factors that would make this work reliably.

Renegade Robotics NBN Robot

Renegade Robotics Nothing But Net robot; limit switch can be seen above and to the right of the ball (small red box).

So, we installed a limit switch right where the ball exited the flywheel (photo). This switch is so lightweight that its position did not affect the ball’s trajectory in the slightest. When a ball would go through, we would automatically “juice” the flywheel motors with a high burst of power for a very short amount of time (like 400ms). This method could compensate for the drop in speed really well, and didn’t need to use complicated PID programming; an estimate of the extra power needed was enough. Using the limit switch was also faster than other options, because we didn’t need to take time to measure the slow-down in the flywheel; we just gave it a boost immediately after the ball went through (without measuring anything) and cut our response time from 4 seconds down to about 1 second to get back up to full speed and launch another ball.

So, you can be creative with this sensor—it’s not just for internal-robot movements. And the little metal lever can be (carefully) bent into a convex shape as shown in the product image at the top of this post, depending on your needs. Just make sure you put it in a place that will not hit by or get snagged on other robots, or bang into any field objects with lots o’ force. You will come back with a pretty red box screwed onto your robot and a nifty little piece of metal, never to be connected again.

Output Values

As with the bump sensor, your sensor output will vary depending on your programming language:

  • RobotC: HIGH = not pressed = 0 / LOW = pressed = 1
  • easyC: HIGH = not pressed = 1 / LOW = pressed = 0

Red Wire Placebo – Say What?

Collection of bump switches with broken red wires

A collection of bump switches with disconnected red wires. Photo credit: Griffin Tabor, VEX World Coaches Association Facebook group

In my introductory post on sensors, I explained that the red wire carries power, the black wire is ground, and the white wire carries the data/signal.

BUT…I learned something new today. On the bump and limit switches, the red wire is a placebo. Go figure. These 2 switches do not make use of the 5V power that normally travels down the red wire to the sensor. So if you have one of these sensors, and the red wire has broken off (photo), have no fear! Your sensor works the same way it always has!

In older versions of the sensor, the red wire was not even soldered onto anything inside its casing—just shoved in. Hence it became disconnected easily. Newer incarnations of both sensors apparently have the red wire more solidly connected on the inside, but they still do nothing.

And now that I know this is a thing, look what I found on the “Description” tab of the limit switch product page:

3-Wire Cable
Connect to a digital input
Black: Ground
Red: No Connect
White: Control signal

Learn something new every day. So if you have a “broken” limit or bump switch, test it; it probably still works.

Additional Posts on VEX Sensors