Leika is an open-source quadruped robot built around the ESP32 microcontroller. The project combines embedded firmware, web-based control interfaces, and a physics-based simulation environment to create a complete robotics development platform. Using FreeRTOS for real-time task management, the robot handles inverse kinematics, gait generation, sensor fusion, and wireless communication simultaneously.
The project includes a PyBullet simulation environment for testing control algorithms and training reinforcement learning policies before deploying to hardware.
- ESP32-based control system with FreeRTOS
- Inverse kinematics with 3-DOF legs
- Multiple gait implementations (Bezier trot, 8-phase crawl)
- Real-time sensor integration
- Multiple hardware variants (standard, Yertle, and upcoming ✨Leika Mini✨)
- Self-hosted web interface embedded in firmware
- Dual joystick control with real-time robot visualization
- Complete configuration interface (calibration, network, settings)
- Built with Svelte and embedded using LittleFS
- PyBullet physics simulation with Gymnasium interface
- Reinforcement learning support (PPO, SAC)
- Parallel training infrastructure
- Model evaluation and comparison tools
- Interactive kinematics playground
The robot implements a sense-plan-act control architecture:
- Sense: Read IMU, magnetometer and gensture sensor
- Plan: Process sensor data, compute inverse kinematics, generate gait trajectories
- Act: Send servo commands, stream telemetry data
The kinematics system allows control through Cartesian coordinates rather than raw joint angles. This abstraction simplifies motion planning and enables intuitive control.
The robot's body pose in the world reference frame:
Where:
-
$x_b, y_b, z_b$ are Cartesian coordinates of the body center -
$\phi, \theta,\psi$ represent roll, pitch, and yaw angles
Foot positions in the world reference frame:
The inverse kinematics solver converts these high-level commands into joint angles for the 12 servos (3 per leg). The kinematics library is implemented in C++ for the ESP32 firmware and TypeScript for the web controller, enabling both real-time control and browser-based visualization.
The web interface is built with SvelteKit and compiled to static assets that are embedded directly in the ESP32 firmware. This approach eliminates the need for external servers and ensures the controller is always synchronized with the firmware version.
Features:
- Real-time 3D robot visualization
- Dual joystick control with configurable input mapping
- Network configuration and WiFi management
- Servo calibration tools
- System monitoring and diagnostics
- Firmware over-the-air updates
The motion system is implemented as a finite state machine supporting multiple locomotion modes:
Trot Gait (12-Point Bezier)
- Uses continuous phase time
$t\in[0,1]$ with configurable swing/stance ratios - Swing phase: 12-point Bezier curve for smooth foot trajectories
- Stance phase: Sinusoidal curve for body weight transfer
- Supports diagonal leg pairs moving in opposition
- Enables dynamic turning through trajectory modification
8-Phase Crawl Gait
- Static stability: three feet always on ground
- Sequential leg lifting with center-of-mass shifting
- Discrete phase transitions based on phase time accumulation
- Suitable for rough terrain and slow, stable locomotion
- Based on the implementation from mike4192's spotMicro
Static/Dynamic Posing
- Direct body pose control without locomotion
- Used for manual positioning, rest states, and transitions
| Input | Parameter | Range |
|---|---|---|
| Left joystick X | Step length (X) | -1 to 1 |
| Left joystick Y | Step length (Z) | -1 to 1 |
| Right joystick X | Turn angle | -1 to 1 |
| Right joystick Y | Body pitch | -1 to 1 |
| Height slider | Body height | 0 to 1 |
| Speed slider | Step velocity | 0 to 1 |
| S1 slider | Step height | 0 to 1 |
| Stop button | Emergency stop | 0 or 1 |
A PyBullet-based physics simulation is available for algorithm development and reinforcement learning training:
cd simulation
pip install -r requirements.txt
python play.pyFeatures:
- Real-time interactive control with GUI
- Multiple terrain types (flat, heightmap, maze)
- Gymnasium-compatible interface for RL
- PPO and SAC algorithm support
- Parallel training capabilities
- Training scripts with TensorBoard integration
The simulation environment allows testing control algorithms and training policies before deploying to hardware. See simulation/README.md for detailed documentation.
The original design supporting 12 servos with full 3-DOF leg control. Suitable for experimentation and learning about quadruped robotics.
A crossbreed between Kangal, SpotMicro and Open Quadruped
A smaller and more affordable variant currently under development. Leika Mini aims to lower the entry barrier while being fully compatible with the platform.
| Parameter | Leika (Standard) | Leika Mini | Yertle |
|---|---|---|---|
| Coxa Length | 60.5mm | 35.0mm | 35.0mm |
| Coxa Offset | 10.0mm | 0.0mm | 0.0mm |
| Femur Length | 111.2mm | 60.0mm | 130.0mm |
| Tibia Length | 118.5mm | 60.0mm | 130.0mm |
| Body Length (L) | 207.5mm | 160.0mm | 240.0mm |
| Body Width (W) | 78.0mm | 80.0mm | 78.0mm |
| Max Leg Reach | 219.7mm | 95.0mm | 255.0mm |
| Body Height Range | 98.9-197.7mm | 42.8-85.5mm | 114.8-229.5mm |
Motion Limits:
- Maximum roll/pitch: ±15°
- Maximum body shift: W/3 in X and Z directions
- Maximum step length: 80% of leg reach
- Maximum step height: 50% of leg reach
The kinematics system automatically adapts to the selected hardware variant through compile-time configuration flags (SPOTMICRO_ESP32, SPOTMICRO_ESP32_MINI, SPOTMICRO_YERTLE).
The robot body is constructed from 3D-printed parts based on various Spot Micro community designs:
| Component | Specification | Required | Notes |
|---|---|---|---|
| ESP32 | Microcontroller | Yes | ESP32-S3 (N8R8) recommended for better performance |
| PCA9685 | 16-channel PWM servo driver | Yes | Reinforce with thicker solder traces |
| 12x Servo motors | 20-36kg torque | Yes | Minimum MG996R, highly recommend the pricer CLS6336HV |
| LM2596/XL4015 | DC-DC buck converter | Yes | Set to 5V for ESP32 and peripherals |
| MPU6050 | IMU (accelerometer + gyroscope) | Recommended | GY-87 or MPU-9250 include magnetometer |
| HMC5883 | Magnetometer | Optional | Included in GY-87/MPU-9250 |
| PAJ7620U2 | Gesture sensor | Optional | For interaction capabilities |
| OV2640/OV5640 | Camera module | Optional | 120-160° FOV recommended |
| 2x HC-SR04 | Ultrasonic distance sensors | Optional | For obstacle detection |
| 0.96" SD1306 | OLED display | Optional | Status display |
| Battery | 7.6-8.4V | Yes | 4x 18650 in 2S2P or 2S LiPo |
| Power switch | Main power | Yes | Rated for battery current |
Complete build instructions are available in the documentation:
- Components and BOM
- Assembly Instructions
- Software Installation
- Initial Configuration
- Running the Robot
Prerequisites:
- PlatformIO IDE or CLI
- Node.js 18+ (for web controller development)
Build and flash:
git clone https://github.com/runeharlyk/SpotMicroESP32-Leika
cd SpotMicroESP32-Leika
cd app
pnpm install
cd ..
pio run -t upload
pio run -t uploadfsConfiguration is managed through factory_settings.ini and features.ini in the esp32/ directory.
To experiment with the simulation environments without hardware:
cd simulation
pip install -r requirements.txt
python play.pyFor development workflows and contribution guidelines, see docs/6_developing.md and docs/7_contributing.md.
├── app/ # SvelteKit web controller
├── docs/ # Build and software documentation
├── esp32/ # ESP32 firmware (PlatformIO)
│ ├── include/ # Firmware headers
│ ├── src/ # Firmware source
│ └── lib/ # Third-party libraries (TensorFlow Lite Micro)
├── simulation/ # PyBullet simulation environment
├── hardware/ # 3D printable parts and CAD files
├── scripts/ # Utility scripts
Track planned features and active development on the project board. Report bugs or request features through GitHub issues.
If you're interested in quadruped robotics, check out:
- mike4192's Spot Micro - ROS-based implementation with advanced features
- SpotMicroAI - Community hub for Spot Micro variants
- Stanford Pupper - Another affordable quadruped platform
- OpenQuadruped - Research-focused quadruped project
This project is licensed under the MIT License - see LICENSE.md for details.
Rune Harlyk - runeharlyk.dk
Project Repository: https://github.com/runeharlyk/SpotMicroESP32-Leika




