A fully autonomous robotic arm that plays Connect 4 against a human opponent — Python AI decides the move, MATLAB kinematics computes the position, Arduino executes the motion.
Connect 4 is a two-player game where players drop colored pieces into a vertical grid, aiming to form a line of four in any direction. This project builds a robotic arm capable of playing the game autonomously — thinking strategically, choosing the best column, and physically placing a piece in the correct position.
The game environment was built in Python using Pygame. The AI evaluates board states using a minimax-style scoring function to select the optimal column for each move. Once a move is selected, the column number is sent over serial to the Arduino.
The robotic arm was modeled mathematically in MATLAB using Denavit-Hartenberg (DH) parameters to define the workspace and joint configurations. Each column of the board corresponds to a known set of joint angles, calculated through inverse kinematics and stored as target positions in the Arduino firmware.
When the Arduino receives a column command via serial, it calculates the required motor steps and drives the arm to the correct position to drop the piece.
The electrical system was fully designed and documented — power distribution, Arduino Mega, stepper motor drivers, sensors, and actuators. The schematic covers all connections from supply to actuators.