This is an implementation of a 6-degrees of freedom hexapod — also called Stewart Platform — on the ESP32. The actuators are PWM rotary servo motors and the program is written in Arduino C for PlatformIO Core 4.0. This project is done in the frame of the P19 project at the Microclub.
Currently the platform can be operated:
- with a Nunchuck
- with Arduino C code (see
Hexapod_Demo.cpp) - with G-Code through serial (see
python/gcode2serial.py)
The kinematics calculation is done in Hexapod_Kinematics.cpp and can be also be compiled in a desktop C++ program to cross check calculations (i.e. without actuating the servos). I managed to compile it with g++ on macOS Mojave. See hexapod_desktop_app/hexapod_desktop_app.cpp.
The platformio.ini file is written for PlatformIO Core 4.0. If your PlatformIO version is older, you can upgrade with the command platformio upgrade. If you don’t want to upgrade, you can pick the old platformio.ini file here : https://github.com/NicHub/stewart-platform-esp32/blob/bc47243335e571190a0a5bb4c3ecf3de08c9b6ca/platformio.ini.
The home page is a work in progress, but the video shows what the platform can do. The original implementation used an analog joystick, but the current version uses a Wii Nunchuck.
https://ouilogique.com/plateforme-de-stewart-esp32/
Geometry settings are defined in Hexapod_Config_1.h. The meaning of the parameters is also explained in doc/hexapod-parameters.pdf.
WeMos ESP32 WROOM https://www.banggood.com/fr/WeMos-ESP32-WiFi-Bluetooth-Development-Board-Ultra-Low-Power-Consumption-Dual-Core-ESP-32-ESP-32S-p-1175488.html
https://www.mouser.ch/ProductDetail/adafruit/3416/?qs=F5EMLAvA7ICYzX4Av%252bhRHw==
I currently use a 5 V / 10 A power supply, but 5 V is not enough. I need to upgrade to 7 V. https://aliexpress.com/af/32810906485.html
M3x100mm (140mm total) https://aliexpress.com/af/32775630549.html
Tritanium color https://aliexpress.com/af/32843432977.html
- I currently use clones of the Tower Pro MG996R servos, but they are bad and I don’t recommend them. https://fr.aliexpress.com/item//32636102294.html
- I formerly used clones of the Tower Pro MG90s Servos, but they were also bad and too small for this application. https://www.banggood.com/6X-Towerpro-MG90S-Metal-Gear-RC-Micro-Servo-p-1072260.html
- In the future, I will probalbly use Parallax 900-00005 servos. It seems that these are the one used by fullmotiondynamics in their videos. https://www.parallax.com/product/900-00005
Pins are defined in
Hexapod_Config_1.h.
| servo | ESP32 pin |
|---|---|
| 0 | 13 |
| 1 | 15 |
| 2 | 27 |
| 3 | 14 |
| 4 | 33 |
| 5 | 25 |
- Nunchuck https://fr.aliexpress.com/item//32880983134.html
- Cable extension https://fr.aliexpress.com/item//32841281892.html
The Nunchuck library uses
Wire.hand standard I²C connections internaly.Pins are seen from left to right and top to bottom looking at the Nunchuck connector.
Cut the cable extension to connect to the ESP32.
| color | signal | ESP32 pin |
|---|---|---|
| white | SCL | IO22 |
| NC | ||
| red | GND | GND |
| green | VCC | VCC |
| black | ATT | IO4 (Not required, gives VCC if Nunchuck is connected) |
| yellow | SDA | IO21 |
The external libraries are installed automatically during the first build because they are declared under lib_deps in platformio.ini.
| Default address | New address | Device |
|---|---|---|
| 0x40 | 0x41 | PCA9685 |
| 0x70 | = | PCA9685 (broadcast) |
| 0x40 | = | Nunchuck (accel) |
| 0x52 | = | Nunchuck (joystick) |
| 0x68 | = | GY-91 (MPU9250) |
| 0x76 | = | GY-91 (BMP280) |
- San-José State University / Full Motion Dynamics:
- Hexapod kinematics of this project was originaly based on 6dof-stewduino, by Philippe Desrosiers, althought I reworked it in depth:
- He derived his implementation from the work of Daniel Waters:
- Kinematics calculation is also explained in this document by an unknown author from the Wokingham U3A Math Group:
- The project memememememememe was also an excellent source of inspiration. They share the code for RPi and a simulator in the Processing langage:
- Derived from MarginallyClever:
- PID Control System Analysis and Design, By YUN LI, KIAM HEONG ANG, and GREGORY C.Y. CHONG
- See Table 1, p.33 http://eprints.gla.ac.uk/3815/1/IEEE_CS_PID_01580152.pdf
- Understanding PID Control, Part 1: What is PID Control?
