Latest posts

Building a SPIKE Prime 3 Sumo Robot with SPSumoeyes

Building a SPIKE Prime 3 Sumo Robot with SPSumoeyes

Introduction

Sumo robotics is one of the most exciting ways to learn engineering, programming, and robot strategy. In a sumo competition, two autonomous robots attempt to push each other out of a circular ring. Success depends on a combination of mechanical design, sensor integration, and intelligent software.

The LEGO® SPIKE™ Prime platform provides an excellent foundation for building educational sumo robots thanks to its powerful programmable hub, motors, and Python-based programming environment. The SPIKE Prime hub includes six input/output ports, a rechargeable battery, built-in gyroscope, Bluetooth connectivity, and a 5×5 LED display, making it ideal for competitive robotics projects.

One of the most useful add-on sensors for a SPIKE Prime sumo robot is the SPSumoeyes sensor from mindsensors. This infrared obstacle detector can identify opponents in three zones—left, center, and right—and supports both short-range and long-range detection modes. Objects can typically be detected up to approximately 12 inches (30 cm) away.

Why Use SPSumoeyes?

Traditional sumo robots often struggle to quickly determine where an opponent is located. The SPSumoeyes sensor solves this problem by providing directional obstacle detection.

Key Features

  • Detects opponents on the left, center, or right side.

  • Supports short-range and long-range detection.

  • Pre-calibrated and ready to use.

  • Designed specifically for SPIKE Prime and Robot Inventor systems.

  • Helps robots locate opponents faster and react more aggressively.

Recommended Sumo Robot Design

A competitive SPIKE Prime sumo robot should include:

Chassis

  • Wide, low-profile design

  • Strong front wedge for pushing

  • Low center of gravity

Drive System

  • Two large motors

  • High-traction wheels

  • Direct drive or geared torque setup

Sensor Placement

  • Mount SPSumoeyes at the front center.

  • Position the sensor low enough to detect opponents quickly.

  • Keep the field of view unobstructed.

Strategy

  1. Search for an opponent.

  2. Turn toward detected targets.

  3. Charge forward aggressively.

  4. Continue pushing until the opponent leaves the ring.

Programming Strategy

A simple sumo algorithm consists of three behaviors:

1. Search Mode

When no opponent is detected, slowly rotate to scan the arena.

2. Track Mode

When an opponent appears on the left or right, rotate toward the target.

3. Attack Mode

When the opponent is directly ahead, drive forward at maximum speed.

This simple strategy is surprisingly effective and serves as a great starting point for students and robotics teams.

Example SPIKE Prime 3 Python Program

The following example demonstrates a basic sumo robot using SPSumoeyes. The exact sensor API may vary depending on the mindsensors library version installed on your SPIKE Prime hub.

from hub import port

import time

import motor_pair

import device

from SPSumoeyes import SPSumoeyes

sumo = SPSumoeyes(port.B)

# Drive motors

motor_pair.pair(motor_pair.PAIR_1, port.E, port.F)

# Example sensor object



SEARCH_SPEED = 20

ATTACK_SPEED = 100

TURN_SPEED = 40

while True:

    # Example sensor reading

    zone = sumo.read(1)

    if zone == 0:

        # Attack

        motor_pair.move(motor_pair.PAIR_1, ATTACK_SPEED)

    elif zone == 33:

        # Turn left toward opponent

        motor_pair.move_tank(motor_pair.PAIR_1,-TURN_SPEED, TURN_SPEED)

    elif zone == 66:

        # Turn right toward opponent

        motor_pair.move_tank(motor_pair.PAIR_1,TURN_SPEED, -TURN_SPEED)

    else:

        # Search mode

    motor_pair.move_tank(motor_pair.PAIR_1,-SEARCH_SPEED,SEARCH_SPEED)

       time.sleep(0.05)                    

Possible Improvements

After the basic robot is working, students can add:

  • Ring-edge detection using SPIKE Prime color sensors.

  • Variable attack speed based on opponent distance.

  • Faster search patterns.

  • Gyroscope-assisted heading control.

  • Multiple attack strategies.

These enhancements can significantly improve competition performance.

Educational Benefits

Building a SPIKE Prime sumo robot teaches:

  • Mechanical engineering

  • Robot design

  • Sensor integration

  • Python programming

  • Problem solving

  • Testing and optimization

Students quickly discover that winning matches requires balancing hardware design with software intelligence.

Conclusion

Combining SPIKE Prime 3 with the SPSumoeyes sensor creates a powerful and educational sumo robotics platform. The directional obstacle detection provided by SPSumoeyes allows robots to locate opponents efficiently, while SPIKE Prime's Python programming environment makes it easy to develop increasingly sophisticated strategies. Whether used in a classroom, robotics club, or competition, a SPIKE Prime sumo robot is an engaging project that brings engineering and coding to life.



Posted in: How to, Spike Prime

Leave a comment