Safety and scope
Use a guarded test ring and keep hands clear of the robot. Check event-specific weight, dimensions and battery rules.
Plan, predict and test
Suggested virtual study time: about 20 minutes. This is a planning estimate, not a validated construction time.
Preparation: Foundation electricity and basic programming logic. Adult supervision for children. Review a foundation lesson ↗
Use paper, a spreadsheet or a simulator. This is not a verified physical assembly guide.
- Scenario: Model boundary and opponent Boolean inputs for all four combinations. Use indicators instead of motors.
- Expected result: Boundary avoidance overrides the attack command.
- Checkpoint: Write your prediction, test it in the virtual model and explain any difference.
A correct answer does not certify the physical system.
Record your validation
Use only virtual inputs and indicators until the actual components, pinouts and electrical limits have been verified.
| Case | What to record |
|---|---|
| Normal input | No edge, opponent detected → attack indicator |
| Boundary | Edge detected with opponent present → edge indicator only |
| Missing or invalid input | An open pull-up input is ambiguous. No physical collision, boundary or braking behavior is validated. |
| Repeat test | Repeat the virtual test, record the actual output and compare with the expected result. |
These are test-planning requirements, not recorded hardware results.
Before building: understand the listed components and the relevant low-voltage safety rules. This is a concept brief, not a tested assembly manual.
What it does
Combine edge detection and opponent detection in a priority-based autonomous strategy.
Engineering principle
Two sensing tasks compete for control. Downward-facing IR sensors detect the ring boundary; a forward ultrasonic or IR sensor detects the opponent. The safety priority is explicit: first avoid leaving the ring, then attack when the edge sensors report a safe position.
Hardware and components
- Arduino Nano or UnoRuns the priority-based strategy.
- 2 × downward IR line sensorsDetect the boundary or contrast between the ring and its edge.
- Forward ultrasonic or long-range IR sensorDetects the opponent in the attack direction.
- L298N or L9110S motor driverControls the drive motors.
- 2 × high-torque geared motors, reinforced chassis and batteryProvide traction and pushing force; competition rules constrain size and mass.
Suggested build sequence
- Check the exact arena colours and calibrate edge sensors on the ring and border surfaces.
- Implement edge detection as the highest-priority condition.
- When an edge is detected, reverse or pivot away immediately.
- When edge sensors are safe and the opponent is detected, drive forward to attack.
- When no opponent is seen, rotate to scan; test side approaches and recovery behaviour.
Learning outcomes
- Priority logic and state machines
- Contrast sensing
- Motor torque and traction
- Competition testing and repeatability
Possible upgrades
Add side-facing opponent sensors, a controlled search pattern, wheel encoders or a more efficient motor driver.
Practice the core principle
Use a virtual Arduino Uno circuit with the following substitute inputs and indicators. The exercise deliberately does not drive motors, powered mechanisms or real industrial equipment. Physical experimentation requires adult supervision for children, a suitable current-limited supply and checked wiring.
Reference components
- Arduino Uno (5 V)
- 2 pushbuttons
- 2 LEDs, each with 330 Ω resistor
Connection plan
- D2 → boundary pushbutton → GND
- D3 → opponent pushbutton → GND
- D8 → 330 Ω → retreat LED → GND
- D9 → 330 Ω → attack LED → GND
Reference sketch
void setup(){
pinMode(2,INPUT_PULLUP); pinMode(3,INPUT_PULLUP);
pinMode(8,OUTPUT); pinMode(9,OUTPUT);
}
void loop(){
bool edge=digitalRead(2)==LOW;
bool opponent=digitalRead(3)==LOW;
digitalWrite(8,edge);
digitalWrite(9,!edge && opponent);
delay(20);
}How the code works
The buttons represent sensor conditions. Internal pull-ups produce HIGH when released. The attack output is enabled only when there is no detected edge and the opponent is detected.
Practice sequence
- Set up the virtual components with power disconnected in the simulator.
- Verify pin numbers and LED polarity before running the sketch.
- Run and record the expected inputs and outputs.
- Test the boundary cases described below.
Expected result and testing
Test all four button combinations. When both buttons are pressed, only the retreat LED may be lit. A released boundary switch is not a verified safe state on real hardware.
Troubleshooting
Check the specified pin assignments, supply and common ground, indicator polarity and serial monitor baud rate where applicable. If an input seems fixed, isolate that input and observe its value before changing the control logic.
Independent challenge
Change one model threshold or timing value, predict the resulting behaviour, and repeat the test. Explain the difference without adding physical actuators.