- 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
| From | To | Purpose |
|---|---|---|
| Battery motor supply | H-bridge VM and GND | Power motors within driver rating |
| Controller GND | H-bridge and battery GND | Create common reference |
| Controller pins 5-8 | H-bridge direction inputs | Command both motor directions |
| Left switch | Pin 2 and GND | Active-low left collision input |
| Right switch | Pin 3 and GND | Active-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
Step 1
Build and roll the chassis
Assemble the rover and turn each wheel by hand.
Correct rubbing before wiring.
Step 2
Mount the bumpers
Hinge broad left and right paddles so each presses one switch.
Add stops to protect switch levers.
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.
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.
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.
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.
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.
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
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); }
}
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
- 250 ms
- 350 ms
- 450 ms
| Symptom | Likely cause | Confirm it | Fix |
|---|---|---|---|
| The rover turns toward the obstacle | Motor polarity or switch mapping is reversed | Press one bumper with wheels raised | Swap mapping in code |
| A switch stays pressed | Bumper hinge or stop binds | Release by hand and listen for click | Loosen hinge and add return band |
| Controller resets | Motor noise or voltage sag affects logic | Watch power LED at reversal | Use decoupling and separate regulated logic supply |
| The driver warms | Motor current exceeds rating or wheels stall | Measure wheel-free current | Use 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
Single bumper
Reverse and turn one fixed direction.
Maze box
Measure escapes from three start orientations.
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
- How did turn duration change the measured result?
- Where did wheel slip affect the build most strongly?
- What evidence shows that reactive control explains the motion?
- 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 guidesSources 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.
