Jean-Pierre du Plessis
Newbie level 6
Hi,
I was wondering if anyone can help. I constructed an inverted pendulum for my final year project. Time is running out and I am struggling to get it properly balanced. The system consists of the following.
I use an POT to measure the angle and an optical encoder to measure the cart position. After the PID controller output I send the output to the PWM register to drive the dc motor. The value of my error is between 1 and about 15 for max error, larger than that the system can’t recover. Then my output to my motor PWM is between 300 and 1600. The motor only starts moving at values larger than 300. I am also able to output the results to MATLAB via serial communication.
I have it balancing a bit without position control, but its not good enough.
I tried using the system identification tool in MATLAB. My input to this tool was the measured ADC value, that can range anywhere between 0 and 1023, but the SP is around 500 so if it balance a bit the error is not too large. And for the output I send the PID controller output that is limited to 1600 and 300. These values were recorded by only applying Kp value large enough to balance the pendulum a bit. This tool then gives me a transfer function that I used to do auto PID tuning with the SISO tool. The values from the tool is very small and won’t be able to work.
Any advice or maybe suggestions where I went wrong with matlab. If more information is needed I will provide it. But please just ask and please help me?
I was wondering if anyone can help. I constructed an inverted pendulum for my final year project. Time is running out and I am struggling to get it properly balanced. The system consists of the following.
I use an POT to measure the angle and an optical encoder to measure the cart position. After the PID controller output I send the output to the PWM register to drive the dc motor. The value of my error is between 1 and about 15 for max error, larger than that the system can’t recover. Then my output to my motor PWM is between 300 and 1600. The motor only starts moving at values larger than 300. I am also able to output the results to MATLAB via serial communication.
I have it balancing a bit without position control, but its not good enough.
I tried using the system identification tool in MATLAB. My input to this tool was the measured ADC value, that can range anywhere between 0 and 1023, but the SP is around 500 so if it balance a bit the error is not too large. And for the output I send the PID controller output that is limited to 1600 and 300. These values were recorded by only applying Kp value large enough to balance the pendulum a bit. This tool then gives me a transfer function that I used to do auto PID tuning with the SISO tool. The values from the tool is very small and won’t be able to work.
Any advice or maybe suggestions where I went wrong with matlab. If more information is needed I will provide it. But please just ask and please help me?