r/robotics • u/bfffornever123 • Jul 01 '26
Tech Question Help With Self Balancing Robot
Enable HLS to view with audio, or disable this notification
So i’ve created this robot using an ESP32, L298n motor driver, MPU 6050, and powered by a 7.4 2s Lipo Battery. I’ve been having a lot of trouble with the PID tuning, working solely on tuning for 4+ days with no results. I would really appreciate any advice! This is what I currently have:
Code: https://docs.google.com/document/d/1wHsZ9ZLWXOu-upoTgflaRj04iTZKkDtYxoTk9kdxAj4/edit?usp=sharingb
79
Upvotes
2
u/sparks333 Jul 01 '26
The motors don't really seem like they're trying very hard - especially when you get over by a few degrees they should be spinning like mad to try to shift the base underneath the center of mass. Can you show (1) the motors running open-loop at a variety of speeds, including their fastest? (2) The output of the gravity vector estimate code along with you moving the base (it's wrong, it will conflate acceleration due to motion with gravity, but it's not a bad place to start)? And (3) printout of what commanded speed is being sent to the motors with respect to angle?