- To build a rotary (furuta) inverted pendulum that self balances upon a disturbance.
- Understand BLDC motor control
- Implement close loop control for MSP 432 Lauchpad
- The main components of the inverted pendulum will be the main controller board, the motor, and the angle sensor. Texas Istrument Launchpad MSP 432 is the microcontroller per course requirement. Since the pendulum will rotate over 360 degree, an outrunner type of motor will enable us to have the wires hooked through the center of the motor that connect directly to the board and circuits under the motor. This allows for the motor to relatively freely rotate however many rotations it wants without the wires getting tangled up easily. Of course an outrunner looks more aesthetically appealing too. A hall-effect angle sensor with direct analog output was chosen for ease of use. Although I tried to argue against this idea of angle sensor and instead I wanted a motor with encoder, I submitted to my teammate Rohan to keep things simple. In addition, MSP 432 has been notorious for interfacing with I2C and SPI. Therefore an analog sensor is the best option for a 1.5 month project.
- Hollowing Motor Shaft
The first part of the mechanical design is to hollowing out the motor center for wire pathway. I separated the top case and the coil part and drilled a whole through the shaft on the top case. This is done on the lathe.
- Pendulum Shaft
As budget allowed.. a scraped hollow shaft that was left at the corner of machine shop was used as pendulum shaft. This was perfect because low inertia pendulum shaft happened to be advantageous for the whole system’s dynamics. Now…NEW PROBLEM! The shaft actually can’t be hollow for mounting to the angle sensor. Well I happened to have a tiny delrin stock on hand that was slightly bigger than the ID of the shaft so I turned off the excess material and press fitted the delrin into the tip of the shaft to create a solid shaft end. Problem solve.
- Pendulum Shaft Connector
The connector between the pendulum shaft and the angle sensor was originally designed and waterjetted out and bended on a sheet metal break as shown below:
however, when tested, the pendulum shaft ended up hanging too close to the whole motor mount (white PVC tube body) and impeded the motion. In addition, it was simply not a sustainable way to concentrate the strain from the weight of the pendulum shaft entirely on the angle sensor.
Alternatively, a bearing was incorporated as the load bearer. The whole assembly is shown as follows: A socket cap screw is pinned onto the pendulum shaft secured by a set screw on the side of the pendulum shaft. The connector(color in red) takes advantage of the socket cap and the angle sensor shaft and thus connects the motion of the two. A mounting base was designed so that this assembly is suspended and horizontal. Both connector and mounting base were 3D printed.
Below is a schematic of the circuitry.
I went with what was available: simple L2930 IC. However, the current is too much for a single IC that we ended up using two of these in parallel.
BLDC motors are driven by three phase signals as illustrated below:
In order to drive the motor, a preset sinusoidal wave was created and was used as Duty Cycle for three PWM to control the motor.
All together there were 4 timers:
While data on angle is constantly being taken, PWM’s Duty Cycle sequences through the present sinusoidal wave at a faster/slower frequency in response to the pendulum shaft position.
What a classical control problem for inverted pendulum! I was very excited to learn about LQR and model this system. Unfortunately, by the time I finished all the math while reading through various papers(1,2,3) and figuring out how to implement this continuous simulation to discrete digital control in C, I was running out of time! I made a decision to simplified the motion of equation by an approximation of cart-pole modeling in a fixed angle range of +/- 15 degree from upright position, and implemented a PID controlled instead.
One of many many failed ones:
Somewhat successful one:
Confession: there was crazy amount of friction that helps stabilize the system… PID controlled is definitely not the best fitted controller here.
- Mechanically speaking, a longer shaft with heavier end will make the whole system more ideal dynamically. The PVC motor mount body can be made with solid metal stock for stabilization.
- Smoother rotation can be achieved with a rotary encoder instead of an analog angle sensor. It will be interesting to explore I2C/ SPI interface and other common microcontroller options.
- There was a lot of cogging and re-skewing the motor coil will reduce it.
- LQR controller should be implemented to this system and all physical parameters of the system should be taken more accurately.
** This project is a collaboration of Rohan Pandya and Jing Yu**