Stewart Platform IK Simulator & Serial Control
This project implements the inverse kinematics (IK) of a 6-DOF Stewart platform, including real-time visualization and serial communication with an ESP32 for controlling servos via a PCA9685 driver.
π§© Overview
The system is divided into two main parts:
Simulation (Python) Inverse kinematics calculation Visualization of simplified platform position Hardware Control (ESP32 + PCA9685) Receives servo commands via serial communication Controls 6 servos (MG996) using PWM driver
βοΈ Hardware Setup Microcontroller: ESP32 Servo Driver: PCA9685 (I2C) Servos: MG996 (or similar high-torque servos)
The PCA9685 allows precise PWM control of multiple servos using I2C, reducing load on the ESP32.

π System Architecture
Python (IK + Control) β Serial Communication (USB) β ESP32 β I2C β PCA9685 β Servos β Stewart Platform
π§ Inverse Kinematics (Python)
π ik_visualizer.py

This script simulates the Stewart platform and visualizes its motion.
The user inputs: Roll Pitch The system computes: The required position of each actuator (6 servos) Output: Individual servo values corresponding to platform orientation Graphical visualization of position
π ik_serial.py
This script connects directly to the ESP32 via serial communication.
π Workflow: User inputs: Roll Pitch Python: Computes inverse kinematics Normalizes the output values Sends data via serial in the format: a,b,c,d,e,f#
π§ ESP32 Firmware (Arduino Framework) π controlSerial.ino
This code runs on the ESP32 and handles servo control.
π Workflow: Waits for a complete serial message ending in # Parses the received string Splits values into 6 independent variables Updates each servo position ποΈ Servo Control Logic
Each servo is controlled using:
servo.write(90 + m);
Where:
90 β neutral (center) position m β normalized offset value from IK
π¦ Requirements (Python) pip install numpy matplotlib pyserial
πΈ Model & References
Images and screenshots available in /images
3D model available on GrabCAD https://grabcad.com/library/stewart-plataform-1

π Notes This repository focuses on inverse kinematics and low-level control Advanced control strategies (PID, LQR, BC+DeepRL) are implemented in a separate project Designed for modular integration with computer vision systems
π¨βπ» Author Cristian Guerrero