Determining the Standard Acceleration of Gravity Using a PID Controlled Electromagnet
Elliott Imhoff and Colleen Sullivan
University of Minnesota - Twin Cities
Methods of Experimental Physics - Spring 2018
Introduction
Gravitational acceleration, g, is defined as the acceleration of a mass due to gravitational force, with the value of g varying across the surface of the Earth. This experiment attempted to determine g in Minneapolis, Minnesota by using a PID (proportional-integral-derivative) controlled electromagnet to levitate a magnetic cylinder. The magnetic force on a magnetic cylinder beneath a solenoid is approximately proportional to the current running through the solenoid. When an object is levitated, the magnetic force and gravitational force are balanced. Thus, by measuring the current required to levitate different masses, g was experimentally determined. A PID controller was used to stabilize the system and keep the cylinder levitated.
Theory
Dynamics of the System
The magnetic field along the axis of a solenoid is given by
where z is the distance from the center of the solenoid, and I is the current through the solenoid. The magnetic force beneath the solenoid is approximated by treating the magnet as a dipole. The force is found using
where
is the dipole moment of the magnet and B is the field given above. Solving this and assuming the magnet stays at a constant location yields
where is a constant that depends on the steady-state location of the magnet. When the magnet is levitating, gravitational and magnetic force are equal, allowing us to find
If the value of is known, the acceleration of gravity, g, can be determined by varying the mass of the magnet and measuring the current needed to keep the magnet levitated.
PID controller
A PID (proportional-integral-derivative) based controller was used to stabilize the system in this experiment. A PID algorithm works by repeatedly comparing the current state of the system to the desired setpoint, and then adjusting a control signal to keep the system stable. The formula for the PID algorithm is given by
where u(t) is the control output, e(t) is the instantaneous error from the desired setpoint, is the proportional gain constant, is the integral gain constant, and is the derivative gain constant. The proportional term is used to directly correct for the current error in the system. The derivative term is used to dampen large, quick changes in the state of the system, which is effective in reducing oscillations about the setpoint. Finally, the integral term is used to correct for long term errors by accumulating all the past error in the system. The integral term is especially useful in finding any long-term offset needed in the control output to maintain the system at the set point. For our experiment, the PID controller continually compared the measured position of the cylinder to its desired position, then adjusted the current through the solenoid to keep the cylinder levitated.
Figure 1
A block diagram detailing the flow of control in our experiment. The right-most equation is the transfer equation for the system, going from the change in current through the solenoid to a change in position of the solenoid.
In order for a controller to be effective, the three PID constants need to be optimized for a given system through tuning techniques. Our system was tuned as follows. The values of and were initially set to zero, and a constant offset was added to the output to counteract the force of gravity. The value of
was then increased until the cylinder began to oscillate about the setpoint.
was then increased until the oscillations were critically damped, stabilizing the system. A small value of was added in order to correct for the constant offset of the cylinder from the setpoint. This process resulted in the optimized PID constants of
Experimental Technique
Setup
A magnetic cylinder was levitated through the use of an electromagnet controlled by a microcontroller. The experimental set-up used to do this is shown in Figure 2.
Figure 2
The set up for our experiment. The current through the solenoid was adjusted by the microcontroller according to the position of the cylinder measured with the photodiode.
A KEPCO amplifier provided current through the coils of a solenoid, generating a magnetic field. A source shined light on the magnetic cylinder levitating in the field. The unblocked light from the source was picked up by a single Si S2281 photodiode. As the cylinder moved up and down, the amount of light incident on the photodiode, and subsequently the current output from the photodiode, changed. A 50
transformer converted the current output by the photodiode into a voltage that was measured by the microcontroller. By calibrating this measured voltage, a linear relationship between the position of the cylinder and photodiode output was established, allowing for an accurate conversion between the two. The microcontroller used this calibration to determine the error in the position of the cylinder, and used the PID algorithm to calculate the change in current through the solenoid needed to correct the error. The microcontroller controlled the current through the solenoid by sending a control voltage into the KEPCO amplifier.
Calibrating Position - Voltage Relationship
In order to measure the cylinder's position, the photodiode output voltage needed to be calibrated with the known cylinder positions. An optical post holder was used to precisely move the cylinder by 0.5 mm increments across the face of the photodiode, and the photodiode voltage for each position was measured. The position of the cylinder was plotted against the measured voltage, and the region around the middle of the photodiode was found to yield a linear relationship between the two. The linear region was a couple millimeters in height, capping the maximum displacement that the system could handle. The steady-state position that the cylinder would levitate at was chosen to be in the middle of this linear region.
Figure 3
The set up for the calibrating the photodiode output with the position of the cylinder. An optical post was used to vertically move the cylinder by small precise increments across the face of the photodiode.
Finding the Constant k
To determine the value of , a non-magnetic metal lever was built and placed with one end resting on a scale, and the other adjusted so to place the cylinder exactly at it's set point beneath the solenoid.
Figure 4
The set up used to calibrate the value of k(z). The lever pushed down on the scale as the cylinder was attracted to the solenoid, allowing us to measure the magnetic force as we changed the current through the solenoid
An Agilent E3630A DC power supply and KEPCO amplifier were used to precisely adjust the current running through the solenoid. The resulting magnetic force on the cylinder was measured by the scale. Balancing the torques on the lever yields
where is the desired constant, and and are the distances from the fulcrum to their respective objects. The current through the solenoid was increased incrementally and plotted against the adjusted force measured by the scale.
was taken from the slope of the fit line, with a measured value of 0.217 0.003 N/A. As can be seen from the graph, the relationship between current and magnetic force wasn't exactly linear. However, the deviations from the fit line were small enough for the approximation to be effective.
Figure 5
Our experimental data for determining k(z). The measured magnetic force on the cylinder was plotted against the current through the solenoid, with k(z) taken from the slope of the fit. The data is non-linear, but our approximation of a linear relationship still yielded a relatively accurate measurement of g
Results
Once the photodiode was calibrated and the PID algorithm was optimized, the electromagnet could stably levitate the magnetic cylinder. The mass of the cylinder was changed by hanging non-magnetic washers from a hook on the bottom of the cylinder. With each additional mass, the current needed to levitate the cylinder at the set point increased, which the PID algorithm automatically adjusted for. Plotting the steady state current against the mass of the cylinder and taking the slope of the linear fit yielded an experimental value for g.
Figure 6
A plot of the current needed to levitate the cylinder as a function of the added mass. The slope of the fit line is equal to g/k, from which an experimental value of g can be determined.
The linear fit line of the data is given by
where I is the current running through solenoid, and m is the mass added to the cylinder. The slope of the fit line, 45.08 A/kg, is equivalent to the value of . By multiplying by the value of found above, the experimental value of g was determined to be 9.78
0.15 N/kg.
The error present in the results of this experiment came from two primary sources. The first was from experimentally determining the constant . The second significant source of error came from being unable to keep the cylinder steady at the set point. Instead, it would continually oscillate around the set point, causing the current through the solenoid to continually oscillate. Thus, the measure of the steady state current through the solenoid had significant error.
Further Investigation
This experimental setup could be extended to measure air resistance. This could potentially be done by attaching an oppositely polarized magnet to the levitated cylinder, and then applying a perpendicular magnetic field to cause it to rotate with a set velocity. By measuring the time required for the cylinder to slow to zero velocity, the cylinder's air resistance could be determined.
Acknowledgments
We would like to thank Zach Anderson, Kevin Booth, Dan Dahlberg, and Kurt Wick for their insights and guidance throughout the course of this project.
References
E. Vinodh Kumar and Jovitha Jerome. Lqr based optimal tuning of pid controller for trajectory tracking of magnetic levitation system. Procedia Engineering, 64:254–264, 2013.
Kurt Wick. Physics 4052 Lab Manual. University of Minnesota School of Physics and Astronomy, spring 2018 edition, 2018. Equation 2.23.
Shekhar Yadav. Optimized pid controller for magnetic levitation system. IFACPapersOnLine, 49:778–782, 2016.
Katarina Zakovam and Mikulas Huba. Pd-controller tuning based on i2td and i2t1 models. In 4th Int. Conference on Computing Anticipatory Systems CASYS, Liege, Belgium, August 2000.
J. G. Ziegler and N. B. Nichols. Optimum settings for automatic controllers. Journal of Dynamic Systems, Measurement, and Control, 115:220, 1993.