Introduction: ESP32 Small Robot Dog (closed)
Disclaimer
This project has been done mostly for fun about a year ago. Some libraries have been updated, so it basically does not work any more. Not every planned feature was released. No PCB is made and it creates a lot of trouble for most of you. I'm sorry to say, but I'm not going to provide any support for it any more. It's exhausting and sometimes just destroys any intentions to continue. This is not commercial project and I'm not going to do something like Donation. Maybe I'm disappointing someone. Sorry. Project closed.
ESP32 small robot dog is my attempt to make quadruped dog that become very popular after Boston Dynamics Spot. Work on the project still in progress and hardware and software can changed.
Features
- Only ESP32 required (you don't need additional PWM i2c, Bluetooth modules, etc)
- Arduino IDE
- Web based interface with telemetry, to control robot you will need just you smartphone or tablet
- CLI interface for calibration and debug
- True Inverse kinematics code
- Configurable Gait sequence and settings (just if you need it)
- Fun
Electronics
- 1 x ESP32 with 38pin
- 1 x 50x70 mm green prototyping board
- 12 x TowerPro MG90D or MD90S (cable should be out at the bottom of servo, thanks to triawan) servos (it can be tricky to use other servos, as size may vary, please have a look at this images of three different mg90-like servos: https://www.instagram.com/p/COoIyvzrLZt/)
- 1 x INA219 (optional)
- 1 x MPU9250 (optional, still has not been implemented, WIP)
- 3 x Mini360 (DC-DC Buck Converter Step Down Module) or similar, 2 for front/hind legs (or more), 1 for ESP32
- 1 x 18650 Battery Holder for 2 elements (try to find "18650 battery holder smt")
- 2 x 18650 Battery
- some capacitors
Other parts
- 8 x 8x12x2.5mm bearings
- 4 x small cable ties
- Super glue (cyanoacrylate) to glue all parts together
Step 1: Print Parts
All STLs to print can be downloaded from Thingiverse page: Robot dog, quadruped robot, 12DOF, 3DOF per leg
Some part should be mirrored to be able to print correctly. Please see attached images.
My printer have issue with first layer thickness, aka Elephant Foot. Gears should be printed as perfect as possible, so I add very tiny spacer to avoid issue, you will see that some part "flying" over surface, so please enable support for it.
I'm strongly recommend print parts with best possible quality, especially gears. As also use brim and ironing.
Full list of parts to print:
Printable parts:
- 1 x Body
- 2 x Leg top
- 2 x Leg top (mirrored)
- 2 x Leg bottom
- 2 x Leg bottom (mirrored)
- 4 x Shoulder part1
- 4 x Shoulder part2
- 2 x Legs holder part1
- 2 x Legs holder part2
- 4 x Servo gear
- 4 x Leg shoes, print with flexible filament (not required)
- 1 x Cover
- 2 x Cover clamps
Printable helping tools (see description on GitHub):
- 1 x CALIBRATION_LEG-Beta_and_Gamma
- 1 x CALIBRATION_LEG-Beta_and_Gamma (mirrored)
- 1 x CALIBRATION_LEG-Alpha
- 1 x CALIBRATION_SERVO-10deg
I'm using Ender 3 Pro, Cura, use Support and choose Dynamic quality. Plastic is PLA from OPY (AliExpress). For more details please visit Thingiverse page: https://www.thingiverse.com/thing:4822059
Step 2: Let's Make It Better and Glue Together
Preparation
Before we start, please check that bearings can be easy fit to body parts and over shoulder parts.
Also check that holes in Shoulder and body parts printed fine and servo cables (temporary disassemble servo connector) can be fit inside.
Do it
I tried to make body as light as possible, as small servos not very powerful. That is why you will need to glue some parts together. Promise it is not so hard =)
Make sure that gluing surfaces are flat, use some flat mini file and make sure parts can be connected to each other without space between. Then glue it together as shown on images.
Servo gears
Cut servo horn (see image) to fit it inside servo gear part and glue it together.
Step 3: Legs
Glue short servo horns into "leg top" parts.
Insert servo into "leg bottom part" and insert cable as shown on image.
Pull another servo cable through one of the hole on the "shoulder" part.
Repeat with other legs.
Step 4: Assemble Body and Legs Together
As was shown on previous pictures, pull all cables through legs and body holes.
Set all servos to middle using Arduino/ESP32 or servo tester.
Cut servo horn to make it fit inside "servo gear", glue it and install on the servo as usual. Insert servos into body. Screwing it can be challenging.
Squeeze "shoulder" part without servo (but with cable in place) and insert it between bearings.
Repeat with other servos and parts.
You don't need to fix legs with bolts at that moment, later you will need to calibrate legs following instruction in my GitHub repository: https://github.com/SovGVD/esp32-robot-dog-code
Step 5: PCB
PCB configuration is up to you. I can only show what I did.
Sensors connected to default I2C bus of ESP32 (GPIO 21 and 22).
Servos connected to:
- Left front: 25 (body servo, servo gear, alpha), 26 (body to leg servo, shoulder, beta), 27 (leg servo,gamma)
- Right front: 16, 18, 17
- Left hind (back): 13, 12, 14
- Right hind (back): 4, 2, 15
You can reconfigure it in the code, but make sure that ESP32 ISR Servo library support it.
Step 6: Code
Setup Arduino IDE to work with ESP32 but don't use esp32 version 2 and higher. There were some strange changes related to WiFi, so one of the core just freezing in v2.x.x
Install addition libraries (most of them could be installed in Arduino IDE "Sketch" menu -> "Include Library" -> "Manage Libraries...", please use only specified version):
- ESP Async Web Server with Async TCP
- ESP32 ISR Servo version 1.1.0
- MPU9250_WE version 1.1.3
- INA219_WE
Setup WiFi Access point credentials.
- Rename config_wifi.example.h to config_wifi.h
- Change APssid to any name of your robot, e.g. SmallRobotDog
- Change APpass to password (8 or more chars), e.g. MySup3rPassw0rd
- After code upload to ESP32 you should be able to find SmallRobotDog WiFi with your phone or tablet.
Open browser and input URL http://192.168.4.1/ and you will see two virtual joystick to control robot dog.
Step 7: Good Luck!
Hope you like that project. More code and instruction updates on the go and hopefully will be release soon.
94 Comments
3 months ago
Dear Mr Gleb Good afternoon.
May I ask you again. The code you give to me, first its Good to go, but when I uploaded to My EsP32 again around May it contain error again. Maybe the code is not work anymore with new upgrade from Espressif System anymore. Can you help me with that.
Best regards
Reply 3 months ago
Hi, this code mostly dead. I'm currently trying to move it to have proper builds with all libraries have correct versions. New code is here (https://github.com/SovGVD/esp32-legged-robots-core...), but without instructions that is probably hard to understand what to to, as well as that was tested in Linux only.
Make sure that libraries and esp32 itself have following versions:
- esp32 1.0.6
- ESP32_ISR_Servo 1.1.0
- MPU9250_WE 1.1.3
- INA219_WE 1.3.1
- "Adafruit PWM Servo Driver Library" 2.4.0
For the ESPAsyncWebServer and AsyncTCP, probably any versions should work, but I tested it using:
- ESPAsyncWebServer -> git checkout f71e3d427b5be9791a8a2c93cf8079792c3a9a26 to have expected version
- AsyncTCP -> git checkout ca8ac5f919d02bea07b474531981ddbfd64de97c
That is all could change later.
Reply 3 months ago
Dear Mr Gleb Good Morning,
I try to do above, but when do compile the code, config_model.h no such a file or directory is missing there's another library did you use?
Best Regars
Reply 3 months ago
Don't use https://github.com/SovGVD/esp32-legged-robots-core/tree/development if you are not in Linux. That is still Work In Progress. Just make sure you using correct library versions.
Under Linux you can use build.sh script that will create environment and everything else required to build and flash firmware.
I'm not going to provide any support for now for both versions of the code, sorry. That is extremely time consuming.
Reply 3 months ago
Dear Mr Gleb,
Thank you for explanation, i will try again.
Best regards
Question 7 months ago
Why does the robot not respond to the control app? Code uploaded without errors
Question 1 year ago
Hello, I repeated your project, but on the iPhone in browsers, the user-scalable=no parameter does not work. It turns out it is impossible to control the robot, the web page constantly scrolls and changes its scale. For an iPhone, you need to set the "body" parameter to "touch-action: none". I was trying to figure out how to compile index.html.gz.h and failed. I tried to change the sketch so that it would load an uncompiled page through a function in the SPIFFS library, and this also did not bring any result. Please, can you describe in more detail how to compile index.html.gz.h. Sorry for bad english, used google translate. Thank you!
https://youtube.com/shorts/vikkgRhvHfc
Answer 1 year ago
Oh. That looks so good, but feels like servos or legs was not calibrated precisely.
I will try to update existing code to include fix for iOS. You can also try to rebuilt it by yourself: install Node.JS, update https://github.com/SovGVD/esp32-robot-dog-code/blob/master/software/web/src/index.html and use commands from readme.md here https://github.com/SovGVD/esp32-robot-dog-code/tree/master/software/web
Reply 1 year ago
Thank you so much! Everything is working. I even managed to compile it myself. Now I'm trying to calibrate my legs, it turned out to be not so easy. It looks like he did everything right, but he doesn't walk well. I moved a little away from your instructions - I began to walk better (of course, far from yours). Perhaps this is due to the fact that the MG90S.
https://www.youtube.com/shorts/AY88G4RKitE
Reply 1 year ago
I also noticed that on my right web-joystick, the right and left are confused.
Answer 1 year ago
Try this one https://drive.google.com/drive/folders/18HXV45BE87...
also to be able to build front-end part, the package.json needs to be updated with:
--- a/software/web/package.json
+++ b/software/web/package.json
@@ -19,5 +19,8 @@
"gulp-htmlmin": "^2.0.0",
"gulp-inline": "^0.1.1",
"gulp-uglify": "^1.5.3"
+ },
+ "overrides": {
+ "graceful-fs": "^4.2.9"
}
}
Question 1 year ago
I was busy over the summer so I took a 2 month break on this project, and I saw the "project closed" message at the top, but figured it was still worth a try asking. When I have my esp32 plugged into my computer, the blue light on my device turns on and I can access the network created by the esp32. When I try to use just the battery, there's no blue light and I can't see the network, and the servos won't turn on either. If I plug in the esp32 first and put it into the PCB while the PCB switch is on, I can access the network and the servos initialize, but when I enter the website the robot won't respond to any controls. All of my libraries are on the versions specified, and my batteries are 3.7V and 20A, if it's a power issue. Where should I start with troubleshooting?
Answer 1 year ago
Hi Evan. I closed this project as too much things could goes wrong and I spent too much time trying to guess problems of other people, project is not ready for public. Sorry.
About your problem, I'm not sure how everything connect and if DC-DC thinking output enough power, but usually servo could drain a lot of power on start. My recommendation is to add extra capacitor close to the esp32 power lines and a little bit increase DC-DV voltage to around 5.2...5.5v (be careful here, as esp board could be damaged).
Good luck.
BTW, I'm working on another but similar open source project, it should be more user-friendly, but not sure if I will share it like this one.
Reply 1 year ago
I figured out the issue- my PCB wasn't wired properly, so I redesigned it and ordered a new one. Now the robot partially works, but 80% of the time it will turn on, the servos initialize, but the robot doesn't respond to controls. It also never detects the IMU or the current sensor.
Thanks for all the help!
Question 1 year ago
Hi,
I uploaded your code to my esp32, but when I use the button on the webpage, the robot doesn't respond. I tested the code and found that maybe it was because of a problem with initializing the robot. It seems to be a problem with the ISR library, but I have installed the specified version of the library. Below is the code that I think is problematic and the arduino terminal output result. ps: I can't even run commands like run/set help...
Arduino Terminal result (the last line):
- HAL ESP32_ISR v1.1.0
Thank you very much for help !
Answer 1 year ago
Where did you get Isr v1.0.6 libraries?
Reply 1 year ago
I think you're talking about the core version of esp32. You can change in tools -> boards manager -> search esp32 and choose v1.0.6, just like image.
And For Isr, i used v1.1.0. Do not use another version, it will most likely cause errors.
Reply 1 year ago
Nice to meet you, i will try it. did you have a problem when robot first on.?
Reply 1 year ago
No, i don't have any big problem. Just some small problème. You can fix it with the calibration tool provided by the author
Reply 1 year ago
Mmm. Where did you set-up for calibration tool on Code.? i dontvknow how to use it.
Sorry, need more explanation. Please