Micromelon Robotics
Platform
Resources
NewsAbout UsDownload
Support
Build Your Kit

Stay in the loop

New activities, teaching guides, and product updates delivered to your inbox.

Micromelon Robotics

Australian-made educational robotics for the next generation of innovators.

contact@micromelon.com.au

Company

  • About Us
  • Privacy Policy
  • Terms and Conditions

Products

  • Micromelon Rover
  • Code Editor
  • Robot Simulator
  • Junior
  • Python Library

Support

  • Resources
  • News
  • Rover Repairs
  • Contact
  • Build Your Kit

© 2026 Micromelon Robotics Pty Ltd. All rights reserved.

ABN 56 623 302 296

← Back to Resources
ActivitiesSimulator ActivitiesIntermediate

Activity: Sumo II

Coding Skills

BranchingIterationAlgorithm Design

Rover Concepts

ColourUltrasonicIRMotors
Activity: Sumo II

Level up your sumo Rover. In this intermediate challenge you’ll add the IR distance sensors to detect opponents from multiple directions and create a smarter search pattern to find and engage opponents faster.

Two Rovers facing off in a sumo arena

Two Rovers facing off in a sumo arena

Setup

Use the same sumo arena as Sumo I, a circular arena with clear edge markings, 60–100 cm in diameter.

Building On Sumo I

In Sumo I we used the colour sensor to avoid the edge and the ultrasonic sensor to detect opponents ahead. This works, but the Rover can only find opponents directly in front of it. By adding the IR sensors we can detect opponents to the left and right as well.

Stage 1: Add IR Sensor Detection

After checking for the arena edge with the colour sensor, add ELSE IF conditions to check the left and right IR sensors. If an opponent is detected to the left, turn left and charge. If detected to the right, turn right and charge. This gives the Rover a much wider detection range.

EDGE_BRIGHTNESS = 200
OPPONENT_RANGE = 40  # cm
 
while True:
    brightness = Colour.readSensor(option=Colour.CS.BRIGHT, sensor=1)
    front = Ultrasonic.read()
    left = IR.readLeft()
    right = IR.readRight()
 
    if brightness > EDGE_BRIGHTNESS:
        # At the edge, back away and turn
        Motors.write(-30)
        delay(0.5)
        Motors.turnDegrees(180)
    elif front < OPPONENT_RANGE:
        Motors.write(60)              # Charge!
    elif left < OPPONENT_RANGE:
        Motors.turnDegrees(-45)       # Opponent on the left
        Motors.write(60)
    elif right < OPPONENT_RANGE:
        Motors.turnDegrees(45)        # Opponent on the right
        Motors.write(60)
    else:
        Motors.turn(15)               # Search by spinning

Stage 2: Smarter Search Pattern

Instead of just driving forward when no opponent is detected, implement a search pattern: spin slowly on the spot while checking all three distance sensors. Once an opponent is detected in any direction, turn to face them and charge at full speed.

Stage 3: Edge Recovery

Improve the edge-avoidance behaviour. Instead of reversing and turning a fixed amount, reverse and then spin to scan for the opponent before moving forward again. This prevents the Rover from wasting time after hitting the edge.

Continue Learning

Activity: Sumo IIIRelated resourceActivity: Sumo IIIMaster sumo with advanced strategies using the gyroscope for precise movement, the accelerometer for defensive tactics, and functions for clean code.

How to Design a Sumo AttachmentRelated resourceHow to Design a Sumo AttachmentDesign and 3D-print custom sumo attachments for the Rover, a great introduction to CAD and 3D printing.

← Return to Resources