Robotics/electronics

Bumper-Switch Rover

Build a two-motor rover whose front bumpers trigger a timed reverse-and-turn escape behavior.

The rover cannot see an obstacle, but it can feel one. Two bump switches act as binary sensors, and state logic turns a collision into a controlled recovery.

Difficulty
Intermediate
Build time
90-140 min
Estimated cost
$0-$30
Age range
12-17
Workspace
A clear table about 90 cm wide

The finish line

What you will build

The rover detects left and right bumper presses and escapes a three-sided test area without motor stalls in four of five trials.

Learning goals

  • Identify how left or right bumper switch closure produces motor reverse and turn sequence.
  • Construct and explain a electrical state-to-differential wheel motion system.
  • Measure how turn duration changes performance.
  • Diagnose losses caused by wheel slip and gearbox friction.

Before you build

Materials, tools, and safety

Reuse-material cost: Usually under $5 with an existing kit. Supervision: Adult guidance recommended for wiring and cutting.

Tools

  • Small screwdriver
  • Wire stripper
  • Multimeter
  • Low-temperature glue gun or tape

Low-cost swaps

  • Use alligator-clip leads for a no-solder version.
  • Build and test the mechanism manually before adding electronics.
  • Use a commercial two-motor classroom rover chassis and clip-on switches while keeping the control logic original.

Wiring table

FromToPurpose
Battery motor supplyH-bridge VM and GNDPower motors within driver rating
Controller GNDH-bridge and battery GNDCreate common reference
Controller pins 5-8H-bridge direction inputsCommand both motor directions
Left switchPin 2 and GNDActive-low left collision input
Right switchPin 3 and GNDActive-low right collision input

Project-specific safety

  • Use only the listed low-voltage battery supply; never use mains electricity.
  • Disconnect power before changing wires and stop if a motor, wire, or battery becomes warm.
  • Use low voltage only, test wheels raised first, fuse or limit motor current, disconnect before wiring, and stop immediately if a motor or driver warms.

Orient the build

Place the build so left or right bumper switch closure is on your left and motor reverse and turn sequence is on your right. Call the side facing you the front, the far side the back, the tabletop the bottom, and the opposite face the top.

Build it

Step-by-step instructions

  1. Step 1

    Build and roll the chassis

    Assemble the rover and turn each wheel by hand.

    Correct rubbing before wiring.

  2. Step 2

    Mount the bumpers

    Hinge broad left and right paddles so each presses one switch.

    Add stops to protect switch levers.

  3. Step 3

    Wire the driver

    Connect motors to H-bridge outputs and the rated battery to motor supply.

    Join all grounds.

    Builder checkpoint: After wire the driver, the first subassembly should stay aligned when handled gently.

  4. Step 4

    Connect control pins

    Wire four direction inputs and two switches using internal pull-ups.

    Label every lead.

    Watch for: If this stage binds or drifts, inspect timing variation before adding more parts.

  5. Step 5

    Test wheels raised

    Run forward, reverse, left turn, and right turn for one second each.

    Correct polarity in code rather than crossing random wires.

  6. Step 6

    Test bumper states

    Press left and right switches while watching serial output or indicator LED.

    Confirm each input is distinct.

    Builder checkpoint: After test bumper states, operate the build slowly and confirm that motor reverse and turn sequence begins without binding.

  7. Step 7

    Tune escape timing

    On the floor, begin with 300 ms reverse and 350 ms turn.

    Use soft box walls in a clear area.

  8. Step 8

    Run five enclosure trials

    Start from the same center mark and record successful escapes.

    Stop after any stall or warm component.

    Builder checkpoint: At the final checkpoint, The rover detects left and right bumper presses and escapes a three-sided test area without motor stalls in four of five trials.

See the engineering

Why it works

Input
left or right bumper switch closure
Output
motor reverse and turn sequence
Motion
electrical state-to-differential wheel motion
Energy losses
wheel slip, gearbox friction, bumper flex, timing variation
Bumper-Switch Rover concept diagram with labeled input, output, and motion arrows.
The electrical state-to-differential wheel motion motion path, with the main efficiency losses called out.

Why this works

Reactive control

A normally open switch changes a digital input when the bumper touches an obstacle. The controller enters a brief reverse state, then turns away before returning to forward motion.

Look for: Press each bumper by hand with wheels raised and confirm the turn direction before floor testing.

Where the energy goes

Efficiency and losses

The ideal model leaves out wheel slip, gearbox friction, bumper flex, timing variation. These effects turn some input energy into heat, sound, vibration, or unwanted motion, so measured performance will be lower than an ideal calculation.

Look for: Run the build slowly and locate the first place where wheel slip becomes visible or audible.

Math bite

Estimate pivot turn

Formula: turn angle ≈ wheel travel difference / track width

  • Wheel travel difference = 0.16 m
  • Track width = 0.12 m

Substitute: angle ≈ 0.16 / 0.12 = 1.33 rad ≈ 76°

Result: The timed wheel difference produces roughly a 76-degree ideal turn.

Wheel slip makes real angle smaller and variable.

This uses a simplified differential-drive model.

bumper_rover.ino

Complete active-low bumper logic for a dual H-bridge with conservative timed recovery.

const int leftBumper=2, rightBumper=3;
const int leftA=5, leftB=6, rightA=7, rightB=8;
void motors(int l, int r){
  digitalWrite(leftA,l>0); digitalWrite(leftB,l<0);
  digitalWrite(rightA,r>0); digitalWrite(rightB,r<0);
}
void setup(){
  pinMode(leftBumper,INPUT_PULLUP); pinMode(rightBumper,INPUT_PULLUP);
  pinMode(leftA,OUTPUT); pinMode(leftB,OUTPUT); pinMode(rightA,OUTPUT); pinMode(rightB,OUTPUT);
}
void loop(){
  bool leftHit=!digitalRead(leftBumper), rightHit=!digitalRead(rightBumper);
  if(leftHit || rightHit){
    motors(-1,-1); delay(300); motors(0,0); delay(80);
    if(leftHit){ motors(-1,1); } else { motors(1,-1); }
    delay(350); motors(0,0); delay(80);
  } else { motors(1,1); }
}
Brick-building meme reading: Chuck Norris does not build LEGO; he roundhouses the bricks into sculptures.
The rover met the wall, processed the feedback, and chose a different career path.Image supplied by the site owner.

Make it behave

Test, troubleshoot, and tune

Controlled test

Start here: Raise the rover so wheels spin freely and test each direction for one second.

Success looks like: The rover reacts to both bumpers and escapes four of five soft-wall trials without stalling.

Measure: Detection side, reverse distance, turn angle, escape success, and current.

Change: turn duration

Keep constant: rover, battery, motor speed, floor, walls, and start point

  1. 250 ms
  2. 350 ms
  3. 450 ms
Troubleshooting guide
SymptomLikely causeConfirm itFix
The rover turns toward the obstacleMotor polarity or switch mapping is reversedPress one bumper with wheels raisedSwap mapping in code
A switch stays pressedBumper hinge or stop bindsRelease by hand and listen for clickLoosen hinge and add return band
Controller resetsMotor noise or voltage sag affects logicWatch power LED at reversalUse decoupling and separate regulated logic supply
The driver warmsMotor current exceeds rating or wheels stallMeasure wheel-free currentUse rated driver and remove mechanical load

Choose your tradeoff

Reliable sensing comes before speed. Longer reverse and turn times improve clearance but increase cycle time and may create new collisions in tight spaces.

Keep experimenting

Try another version

Easier

Single bumper

Reverse and turn one fixed direction.

Performance

Maze box

Measure escapes from three start orientations.

Advanced

Nonblocking states

Replace delays with timed state transitions so sensors stay responsive.

Build together

Classroom and access options

Classroom version

Teams can compare turn duration while keeping rover, battery, motor speed, floor, walls, and start point. Assign builder, tester, recorder, and explainer roles; have each team predict the result before collecting three trials.

Access adaptations

  • Color-code and label every wire at both ends.
  • Use clip leads, larger controls, and pre-crimped connectors when fine motor work is difficult.
  • Use large switch paddles, color-coded wires, and a tabletop button that runs one test cycle.

Reflect on the design

  1. How did turn duration change the measured result?
  2. Where did wheel slip affect the build most strongly?
  3. What evidence shows that reactive control explains the motion?
  4. Which change would improve motor reverse and turn sequence without creating a new problem?
Glossary
Reactive control
A normally open switch changes a digital input when the bumper touches an obstacle.
Input
The action or energy supplied to a system; here it is left or right bumper switch closure.
Output
The useful response produced by a system; here it is motor reverse and turn sequence.
Efficiency
The fraction of input energy that becomes useful output instead of friction, sound, heat, or unwanted motion.

Build your dreams

One build can start the next.

Share what you learned, change one variable, and help another builder understand what worked.

Explore more guides

Sources and build notes

A platform-agnostic low-voltage robotics or electronics project with original assembly guidance.

  • Low-voltage design review: Battery voltage, polarity, component roles, current paths, and motor or LED protection were editorially checked.

Written and edited by BrickLabClips. Published 2026-07-22; updated 2026-07-22.

Next builds

Related guides