Need help for inverted pendulum project

Hello I have some questions about a inverted pendulum balancing project that I am doing and its my first time here is this the right channel btw? Im trying to make an inverted pendulum project and I am using an arduino uno, Nema 17 stepper motor, rotary encoder with 600pulses/rev on a 2020 profile. The hardware is kinda done and the pendulum is a simple pvc pipe i found lying around and the angle is read by a rotary encoder attached at the pivot. My lacking is mainly code/logic wise I watched a video about deriving the equations of motion for a classic inverted pendulum (https://www.youtube.com/watch?v=5qJY-ZaKSic) and I want to ask, With the data read/given to the arduino (ANGULAR DISPLACEMENT, ANGULAR VELOCITY, ANGULAR ACCELERATION, LENGTH OF PENDULUM, MASS OF PENDULUM) it should be using those values and calculating for the acceleration needed for the cart to move to try and balance the pendulum right? I am quite stuck because in equation 6 there is a variable F which to my knowledge is Mass*Acceleration so then do I just use the equation 5 to find the acceleration or does both equations 5 & 6 need to be used together to make such a thing? Attached is a picture of my current setup and my own writings of the equation shown in the video if anyone wants to sound out if I did anything wrong PLEASE let me know I am willing to learn
Brianno Coller
YouTube
Classic Inverted Pendulum - Equations of Motion
In this video, we derive the full nonlinear equations of motion for the classic inverted pendulum problem. Although the Lagrange formulation is more elegant, this video uses a simpler Newtonian approach that anyone with sophomore-level engineering dynamics should be able to understand.
No description
6 Replies
arvincible
arvincibleOP4mo ago
In the video he mentioned that F is the force that the controller outputs to balance the pendulum but by force does he mean Force = Mass * Acceleration or something else? Can anyone help?
robherc
robherc4mo ago
do you have anything with a bit of mass to stick to the top of the pendulum? It may not be "strictly necessary", but an inverted-pendulum is usually much easier to balance if it has a "heavy head" on it.
arvincible
arvincibleOP4mo ago
Now no its just a plain pipe, I can add some quick weight tomorrow since a higehr weight can increase intertia and make it easier to balance
robherc
robherc4mo ago
...as for digging into the equations, I am about to make my 5th attempt at going to sleep (first 4 failed because of allergy-based reasons u don't want to hear), so I'm afraid I'm not in a very good state-of-mind to be trying to give any accurate advice on something that technical right now. 😕 yes, I would add weight specifically at the top-end of the pipe, having the mass concentrated there tends to make everything "happen slower" & thus be easier to compensate for.
arvincible
arvincibleOP4mo ago
its alright man I understand literally cracking my head the past 3 weeks for this and my sleep has been filled with fear because Im just scared this doesnt work out I will add sort of 3d print to add nuts and bolts there as weight👍 🫡
robherc
robherc4mo ago
yeah, it doesn't need to be 5lbs (2.3kg); just needs to have a fair bit more mass-per-length than the rest of the pipe, mainly

Did you find this page helpful?