Go Down

Topic: Self Balancing Code using raw MPU6050 values and PID library (Read 9772 times) previous topic - next topic


Might sound a little bit weird but I''m trying to make a self balancing robot as my first project on Arduino. I have already written a code which doesn't really works perfect. There might also be some mechanical problems but I think the main problem is caused by the program I use. I am using the PID library and the raw values coming from the MPU6050 sensor with a Complementary Filter.
Can someone please check the code I have written and make some suggestions for me?
I also want to use DMP for MPU6050 sensor, but I couldn't even understand the example code can someone explain it?

My own code on the attachment


can someone explain it?

Could you ask your question(s) again without using any acronyms?
The art of getting good answers lies in asking good questions.


Try outputting the input value. I don't think it is in angles. I am also making the same as we speak. Go to geekmomprojects. She has written a code which will give the angles after filtering. To use Jeff's DMP uncomment the Euler angle definitions at the start of the code, and there is a code to check if the serial port is available. Some 3 lines or so. Comment it. Jeff library needs you to connect INT of your 6050 module to INTERRUPT 0 of the arduino. Digital pin 2 on my UNO. Also DMP values need no filtering however set the setpoint value of the pid to the value which you get from holding the bot vertical and keep it vertical till DMP calibrates. Output the angle and pid values to serial. I have some problem with the pid values. Its showing crazy values. If you already made it you can help me too. What rpm motors are you using?


Thanks for help,
I tried finishing the project, but it did not work correctly after a long time.I started thinking that the problem was about the hardware so that I decided to restart doing the same project. I changed my motors with ones with higher torque and made the whole body out of plexiglas. Bought a motor shield with l298p(motor driver was l293p before). I am still searching for bigger tires. After that I can start programming once more. If you have made the same project before it would be really helpful if you could send me your own code and tell me how you have found the hardware for the project.

Go Up