Scarab is a remote-controlled combat robot that our team, Pegasi, built for the Metal Monsters competition at the Alamein Robotics Championship in El Alamein, Egypt. In Metal Monsters, two robots fight inside a closed arena until one of them can no longer move or fight. We finished in 4th place among all competing teams.
- 4th place at Metal Monsters, 4th Edition (El Alamein)
- Full robot designed, built, wired and programmed by the team
- Welded 2 mm sheet-metal chassis that took hits through the whole competition
| Item | Detail |
|---|---|
| Robot name | Scarab |
| Team | Pegasi |
| Chassis | 2 mm sheet metal |
| Drivetrain | 4 wheels, 2 DC motors, chain and sprocket, bearings |
| Weapon | Spinner steel bar driven by a 350 W DC motor through a chain |
| Controller | ESP32 with a PS4 controller over Bluetooth |
| Control mode | Manual, arcade-style driving |
| Power | 3 x 12V batteries |
| Parameter | Value |
|---|---|
| Voltage | 24 V DC |
| Output power | 350 W |
| Rated speed (base motor) | 3200 RPM |
| Rated speed (after reduction) | 300 RPM |
| Rated current | 19.2 A |
| Sprocket | 9 tooth, 1/8" bicycle chain |
The reduction from 3200 RPM to 300 RPM gives a ratio of about 10.7:1. Three motors at rated current draw about 57.6 A in total, and stall current is higher, so the weapon is ramped up gradually in firmware.
| System | Parts |
|---|---|
| Chassis | 2 mm metal sheet |
| Drivetrain | 4 wheels, 2 x 350 W DC motors, gear coupling assembly, chains, bearings |
| Weapon | 1 x 350 W DC motor, spinner steel bar, gear coupling assembly, bearings, chain |
| Control | ESP32, 30 A motor driver, 5 V step-down, relay, PS4 controller |
| Power | 3 x 12V batteries |
flowchart LR
PS4[PS4 controller] -- Bluetooth --> ESP[ESP32]
BAT[3 x 12V batteries] --> ESTOP[Emergency stop]
ESTOP --> BUCK[5V step-down]
BUCK -- 5V --> ESP
ESTOP --> DRV1[Motor driver 30A: drive]
ESTOP --> RLY[Relay]
RLY --> DRV2[Motor driver 30A: weapon]
ESP -- 4 PWM --> DRV1
ESP -- 2 PWM --> DRV2
ESP -- GPIO --> RLY
DRV1 --> ML[Left motor]
DRV1 --> MR[Right motor]
DRV2 --> MW[Weapon motor]
| Input | Action |
|---|---|
| Left stick (up / down) | Throttle |
| Right stick (left / right) | Steering |
| OPTIONS | Arm weapon (relay closes, lightbar turns red) |
| SHARE | Disarm weapon (lightbar turns blue) |
| R2 | Weapon speed, only while armed |
| CIRCLE | Emergency stop for all motors |
Safety behavior in firmware:
- The weapon relay is open at boot and every time the controller connects.
- If the controller disconnects, all motors stop and the relay opens.
- Weapon speed ramps up in about 1.7 s and ramps down in about 0.3 s.
- Wheel output uses a slew limit to protect the chains and the drivers.
The firmware is an Arduino-framework project for the ESP32, built with PlatformIO. It uses the PS4-esp32 library.
include/config.h Pins, PWM settings, drive tuning
include/motor.h Motor class for two-input PWM drivers
src/main.cpp Control loop, mixing, arming, failsafe
- Install PlatformIO.
- Clone the repo and open it in VS Code with the PlatformIO extension.
- Edit
include/config.hto match your wiring. - Run
pio run -t upload, thenpio device monitorto read the ESP32 Bluetooth MAC.
- Open the serial monitor and note the line
ESP32 Bluetooth MAC. - Write that address into the controller with SixaxisPairTool.
- Put the same address in
PS4_MAC_ADDRESSininclude/config.hand flash again. - Power the robot and press the PS button. The lightbar turns blue when the link is up.
| Function | GPIO |
|---|---|
| Left motor RPWM / LPWM | 25 / 26 |
| Right motor RPWM / LPWM | 27 / 18 |
| Weapon motor RPWM / LPWM | 32 / 33 |
| Weapon relay | 23 |
![]() |
![]() |
Inside the chassis: three MY1016Z motors, chain drive, motor drivers, the step-down module and the battery tray.
scarab-combat-robot/
├── README.md
├── LICENSE
├── .gitignore
├── platformio.ini
├── include/
│ ├── config.h
│ └── motor.h
├── src/
│ └── main.cpp
└── docs/
├── system_diagram.svg
└── images/
├── 01-internals.png
├── 02-scarab-top.png
├── 03-scarab-front.png
└── 04-team-pegasi.png
Combat robots can injure people. Test on a stand with the wheels off the ground, keep the weapon disarmed while you work on the robot, and always use a physical emergency stop on the main power line.
MIT. See LICENSE.



