HIGHLY ACCURATE PENDULUM INSTRUMENT ECE-492/3 Senior Design Project Spring 213 Electrical and Computer Engineering Department Volgenau School of Engineering George Mason University Fairfax, VA Team members: Faculty Supervisor: Alice V. Hatfield, Andrew Ottaviano, Danielle Sova and Joshua Weitz Dr. Peter W. Pachowicz Abstract: The purpose of this project was to create a highly accurate pendulum device, where deficiencies of mechanical design and negative environmental influences are corrected via electronically controlled electromagnetic energy transfer. The goal for this control is to stabilize a pendulum s frequency and amplitude using low-cost and low-power means. A designed close-loop control utilizes: a Hall-Effect sensor for pendulum-state sensing; a microcontroller for error calculation, formulation of a control strategy and timing of energy transfer; and a custom solenoid for energy transfer. System behavior has been mathematically modeled and simulated to determine parameter ranges for control, electronics, solenoid, and an energy transfer module. A separate highly accurate optical measurement unit was built to evaluate the success of the project. 1. Introduction Real world clocks governed by pendulums require constant adjustment and maintenance to keep accurate time. As the clock ages, the spring weakens or deforms. Moving components encounter higher friction issues as the oil s viscosity increases. An increase in temperature causes the metal of the rod to lengthen, effectively moving the center of mass farther away from the pivot point and forcing the pendulum to swing at a slower rate. Just the opposite occurs for a decrease in temperature. A rise in humidity creates higher friction in the air as the pendulum swings from one side to the next. Altitude and even phases of the moon are just a few of the other factors influencing pendulum frequency [1,2]. Even when environmental effects are minimized, energy is removed from the pendulum through constant collisions with a specific part of the time piece called the escapement. These small but significant changes cause even the most carefully designed mechanical pendulum to lose energy over time and eventually stop. With the above in mind, using a pendulum run time piece would mean keeping constant time at the expense of constant maintenance. One solution to lowering maintenance would be to use electronic clocks. Unfortunately, these clocks do not have the aesthetic appeal that mechanical clocks provide for observers in the current 1
mechanical design renaissance. Therefore, a second solution of merging both mechanical and electronic designs is proposed, in particular where deficiencies of one type of clock can be substituted by advantages of the second one and the entire system greatly simplified. The developed device will attempt to replenish constant loss of energy, as well as account for the frequency changes due to variable influencing factors. This project is a part of a series of projects where mechanical clock design is greatly simplified and much higher accuracy is supported by electronically controlled electromagnetic energy transfer. 2. Requirements The device shall operate on a pendulum with a period of two seconds, it shall be low powered, and use a microcontroller both for comparing the pendulum against its own enclosed timer as well as performing the necessary correction calculations. The electronic regulator shall account for a combination of conditions and external influences such that at least 1 seconds can be gained or lost per day if instructed. The electronic device shall be powered by no more than 6 volts. The microcontroller shall sleep in between measuring and adjusting to conserve power. Mathematical modeling and MATLAB-based simulations shall be developed to determine design parameters. 3. System architecture The pendulum system has several crucial top-level functions (Figure 1). The system must sense the frequency and energy of the pendulum, calculate the amount of adjustment needed, and apply energy to the pendulum at specific moments to adjust the frequency and energy. Figure 1: System top-level function The frequency of the pendulum is measured in two ways. One method is through the use of a low-power Hall- Effect switch and a magnet mounted on the pendulum. This Hall-Effect switch provides the feedback for adjustment calculations. The second method involves an optical interrupt sensor with a light-blocking bar mounted on the pendulum. This device requires significantly more power than the Hall-Effect switch, but is more accurate. The optical sensor is used by an external measurement unit for testing and experimentation. The system architecture is shown in Figure 2. The sensor input is fed into a microcontroller unit (MCU). This unit performs the unit conversions, adjustment calculations, and outputs control signals for adjusting the pendulum. The output pulses it provides to the energy transfer system are minimized based on how much correction is necessary. It also filters the incoming Hall-Effect switch data to prevent erroneous correction factors. The microcontroller operates in low-power mode as often as possible. The energy transfer module provides energy to the pendulum. This is accomplished with a solenoid that pushes a magnet attached to the pendulum when told by the microcontroller unit. The energy transfer system provides high-current pulses to the solenoid and protects the microcontroller from these pulses with back-emf. The solenoid was designed based on mathematical modeling and simulations of the energy balance in the system. The system (with the exception of the external measurement unit) is powered by a rechargeable 6-Volt battery that is regulated to produce the appropriate amounts of voltage and current for each sub-system. 2
Figure 2: System architecture and functional decomposition 3. System implementation The heart of the energy transfer system is the 5-cm long, 25-turn solenoid. This solenoid is made with 38 gauge insulated wire with a plastic housing, and has an inner diameter of 1.4-cm to allow the magnetic rod on the bottom of the pendulum to pass through it uninhibited. Current to the solenoid is provided directly from the power supply while being switched on and off by the microcontroller unit (MCU). This is accomplished with a highcurrent-safe bipolar junction transistor. The transistor is used as an amplifier in a common-emitter configuration. Back-EMF protection for the MCU is implemented with a high-current Schottkey diode in series with the solenoid on the emitter of the transistor. The diode will only allow current to flow in the desired direction. An additional.1 microfarad capacitor is added in parallel with the solenoid to smooth the discharge curve. A 1 Ohm resistor is also in parallel with the solenoid which allows it to discharge when the transistor is in its cutoff region. For the control unit (MCU) portion of this project, the MSP43FG4616 microcontroller was selected. The microcontroller's function is to determine at what amplitude the pendulum is swinging, and correct that 3
amplitude by varying the pulse length being outputted to the energy transfer circuit. It also maintains the frequency of the pendulum by sending the control pulses every period at the desired frequency. By transferring energy to the pulses and ensuring each pulse is spaced correctly, the controller forces the pendulum to swing at the desired frequency. In order for the microcontroller to be able to make very small adjustments and to calculate timings precisely, a 2MHz external crystal is used as the main clock. The code for the microcontroller is interrupt based, and the device goes into low-power mode between interrupts. Timer A is used to read the input pulse length from the Hall-Effect switch. In the initial, non-triggered state, the input line is held high. As the pendulum swings left, the magnet triggers a pulse in the Hall-Effect switch. The falling edge of this pulse is the first trigger, and the rising edge is the second trigger for the Timer A to capture peripheral. The time between these edges is the pulse time. This pulse time is inversely proportional to the velocity of the pendulum, which is directly proportional to the angle of the pendulum. There are two pulses in each swing. These swings are both captured and the average is saved in a circular array. The controller is then brought out of the low-power state. The pulse time array is median filtered and averaged before being used as an input to a proportional integral (PI) controller. The PI controller compares this input to a set point and computes the output pulse time. Once this is accomplished, the device returns to sleep. As the pendulum increases in angle, the velocity of the pendulum through the center point of the swing increases, causing the Hall-Effect switch pulse period to decrease. This inherent condition is corrected by manipulating the input of the PI controller. As stated earlier, the input to the PI controller is the median filtered and averaged array of the Hall-Effect switch pulse widths. This array is subtracted from the maximum length a single pulse period could be in order to make the input to the PI controller directly proportional to the output pulse period. This value in turn is subtracted from the set point to get an error signal. The error signal is used in two ways. It is added to all the previous errors, the sum being the integral term, which is then multiplied by the integral coefficient in the PI controller. As the input moves above and below the set point this term goes to zero. There is also a proportional term in which the error is multiplied by a proportional constant. These two terms are added together, the result being the output of our PI controller, the pulse period. Timer B is used to time the energy transfer pulses. A counter counts up to half of the pendulum period (the inverse of the pendulum frequency). Then the output pulse is turned on. Another timer is used to count to the value previously computed by the PI controller. Once the timer reaches this value, the output pulse is turned off. A counter finishes counting out the rest of the period and the cycle is started again. 4. Mathematical modeling At the most basic level, the motion of the pendulum can be simulated with a sinusoid with the following relationship: where: T is the period, l is the length from the fulcrum to the center of mass, and g is the gravitational constant 9.8 m/s^2. Given a period requirement of two seconds, the length of the pendulum must be approximately 1m. Forces are constantly acting upon the pendulum and removing energy. Fortunately, because the system swings conservatively, the angles of motion are small, and the period is assumed to be independent of the angle. Thus the equation of motion (the linear model) is modified to: where: θ is the angular position of the pendulum relative to the equilibrium point (where the potential energy of the system is ), and γ is the damping factor. Because γ is less than 1, the system is underdamped. The damping factor is also dependent on the Q factor, or quality factor of the physical components of the system; the higher 4
the Q value, the less damping the system experiences. Note in Figure 3 that the maximum amplitude of the angle/position is decreasing, which corresponds to energy loss, but the period remains constant. Figure 3: Energy of pendulum over time Although the period remains constant, energy must be provided into the system to maintain a proper range of motion. In order to control/manipulate the frequency, as well as add energy, the following method is implemented. Energy is transferred into the system with a period equal to that of the desired period, and the duration of the pulsing dictates how much energy is transferred into the system (the longer the duration, the more energy). This method relies on pulsing the system at its resonant frequency. That being said, if the system must change frequency, resonance will not occur, and the system will lose energy faster. In transferring energy to the system, a solenoid is pulsed with I=1mA of current. Given that the magnetic field generated by the pulsing of the solenoid (N = turns divided by length) is and the force acting on the pendulum is dependent on the cross-sectional area of the magnet (A m ), as well as the magnetic field: It is concluded that energy transferred into the pendulum, our current I, is dependent on the number of turns in the solenoid. Through mathematical modeling and simulation the desired solenoid parameters were found as illustrated in Figure 4. Figure 4: Energy transfer to the pendulum under different solenoid paramters 5
5. Experimental Evaluation and Validation Six experiments were designed to test the system s ability to keep the pendulum swinging at the desired frequency of Hz, while also testing the pendulum s response to an abrupt change in driving frequency. In these tests, the pendulum started with a driving frequency of Hz from standstill, and was left to stabilize for 12 hours. At this point, the driving frequency was switched to a value that corresponded to added (or subtracted) +1, +2, and +3 seconds per day, and -1, -2, and -3 seconds per day. During these tests the resulting frequency of the pendulum and the control unit s output pulse duration were recorded. These experiments were considered successful if the system could keep the average resultant frequency to within 1 mhz of the driving value, and if the resulting amplitude never dropped to the point where the system would not function. Average data collection for each test lasted about 11 hours. In the first test, the driving frequency was adjusted to +1, +2 and +3 seconds per day (.49994,.49988, and.49982 Hz). The average resulting frequency after the switch was.49977,.49978 and.49972 Hz, with some fluctuation. The control output was stable and remained below 5 ms after the initial startup. Large spikes in frequency, however, were observed and attributed to external disturbances such as door opening/closing and other mechanical vibrations. 6 Test 1: +1 seconds/day 3 Test 3: +3 seconds/day 4 2 2.498 1.499.496.498.494 1 1.5 2 2.5 3 3.5 4.497.2.15.1.2.15.1 Figure 5: System performance for driving frequency change from Hz to.49994hz and.49982hz In the second test, the driving frequency was adjusted to -1, -2 and -3 seconds per day (6, 12, and 18 Hz). The average resulting frequency after the switch was.49997, 4 and 9 Hz, with some fluctuation. The control output was not stable. Larger changes in frequency and pulse duration compared to the first test were observed and caused by unknown reasons. Figure 7 shows a summary of results. Overall, the electronic control of the system was able to bring the pendulum to the desired frequency. For lower frequencies the pulse width was slightly shorter while for the higher frequencies it was a bit longer. It seems that slowing the pendulum down takes more energy than speeding it up. It was also observed that occasional large spikes in frequency were unpersuasive, and were promptly corrected by the controller. There were periods of time when the pulse duration was significantly different from the mean. 6
Test 4: -1 seconds/day 8 6 4 2.498.496 Test 6: -3 seconds/day 8 6 4 2.498.496 1 1.5 2 2.5 3 3.5 4.2.15.1.2.15.1 1 1.5 2 2.5 3 3.5 Figure 6: System performance for driving frequency change from Hz to 6Hz and 18Hz 1 Resulting frequency and pulse width vs. frequency pulsed.4999.4998.4997.4998.4999 1 2.6 pulse width (sec).4.3.2.4998.4999 1 2 Figure 7: Results summary 7. Conclusions Results from this experiment provide important conclusions for future developments. First, the mechanical design of the pendulum (mainly the increase in bob weight and supporting structure) must be improved to mitigate external negative influences. Second, the PI controller was selected properly due to the large temporary spikes in frequency the derivative D part of the PID controller would cause large instabilities. Third, the optical sensor in the external measuring unit was adequate to measure pendulum frequency during tests. And forth, increasing the sensing and energy transfer s accuracy and precision would require a higher frequency crystal to be used by the system s microcontroller. References [1] Baker, Gergory L. Blackburn, James A. The Pendulum: a case study in physics. Oxford nnnuniversity Press, 25. [2] Fedchenko, F.M. Astronomical Clock AChF-1 with Isochronous Pendulum. Soviet Astronomy Vol. 1. (1957) p. 637. 7