I’m trying to build a Self Balancing Robot as project for my university course. Right now i can’t reach balance and i think the problems are with my code. I’m not interested in moving back and forth, just a decent balance.
I’m trying to give as much information i can, feel free to ask more details if needed.
Materials and Geometry
3x Layers of Plastic Glass (16x10x0.5 cm)
4x Threaded Rod (M6)
Height from axes of rotation → 20cm
2x 280rpm Motors
2x 3.7V Li-Ion 18650 Batteries
I have read a lot of topics and did multiple researches on this subject and I think I have a good understand on how in theory every single component works. I have also understand principles of PID and his parameters, at least in theory.
In the first days I tried to implement a code that seems to be very popular online. It uses a library called “LMotorController” (Check Attachments) but didn’t work for me.
In this moment I’m trying to write my own way to tell motors how they have to move. Also trying to fix dead zone with map function.
I believe I’m still far away from the final part when you have to “only” adjust kp, ki, kd.
I try to explain me better. Right now my bot can’t stay on balance, I think the motors are not responding properly to the pid output. As I said i have understood how mpu read the data, how pid works and so on but i can’t figure how to properly control motors. In this moment I’m trying to implement map function to avoid dead zones of motors
Thank you for your attention,
LMotorController.cpp (3.77 KB)
LMotorController.h (594 Bytes)
OnlineCode.ino (4.37 KB)
SBR_nov24a.ino (4.74 KB)