Project Report by liwenting

VIEWS: 183 PAGES: 28

									             Final Project Report

Auto-Leveling Platform on Unstable


          Course Title: Mechatronics

        Instructor: Dr. Robert Landers

             Report prepared by:

 Geongsik Lee (12119235)

 Jason Searcy (10145451)

 Aravind Kumar (12340425)

              Date: 05/04/2011

                 The objective of this project is to maintain a platform parallel to the
        Earth’s surface even when placed on an unstable surface; such as a table that
        remains level on a boat that is being tossed on the waves. The problem is solved
        using an accelerometer fixed to the platform to record any movement in the mobile
        surface. The data are then processed to calculate a control input to a linear actuator,
        which corrects the error and levels the platform (or sends the platform to any
        reference angle that is desired). This report describes the development of the
        dynamic model and controller used for the auto-leveling experiment. The platform
        is controlled directly by calculating the disturbance angle and using the control
        input to offset the error. Because of noise in the accelerometer measurement, a
        Kalman filter is used to increase the accuracy of the angular position estimate. The
        results of the filtered and non-filtered experiments are included. Finally, any
        improvements to the design and future work that could be accomplished is
        discussed in the conclusion.

        The motivation for selecting this project comes from the fact that having a level deck as

the ship rolls at sea would be a large selling point; especially on a cruise ship, as it would allow

passengers who suffer from seasickness to have an enjoyable journey. Some work on this idea

had been previously noted by Popular Mechanics in 1947. Second, medical evacuation vehicles

would benefit from having a steady platform, making it easier for the EMT to do emergency first

aid on route to the hospital. Finally, armed vehicles such as the Humvee, would improve their

accuracy by providing a steady platform for the roof gunner. There already has been previous

work in this field as shown by stabilized deck for the Israeli Mini-Typhoon Weapon System and

the M1A1 Abram Tank.

        The approach discussed in this report provides a proof of concept for the auto-leveling

surface. The project consists of a movable surface that supports a raised cantilever beam. The

beam is hinged at the connection point and has an accelerometer attached to it. This

accelerometer detects any change in angular position of the surface and sends that information to

a controller. The accelerometer will read the acceleration as voltages in a Cartesian vector. If the

platform is level, the accelerometer should read 1 g in the down direction. If the platform is not

level, it will read a component in the down direction, and a component in the lengthwise direction

of the beam. The inverse sine function is used on the components to yield the angle. The

controller will then process the data and will provide an output (in the form of a voltage) to a

linear actuator connected to the free end of the beam and directs the linear actuator to correct the

displacement. Then the accelerometer sends the current position to the controller, which

continually checks if the current position is within tolerance of the initial position. If the current

position checks as the initial position, then the controller does not move the linear actuator.

        The project is divided into three systems: the surface, the beam and the electronics.

‘Lego’ bricks are used to construct the surface and the beam. The choice of ‘Legos’ for

construction came from the ease of assembly it provides as well as the ability to easily take an old

design apart and build a new design. The thin, green plate will serve as the movable surface,

while a stand would be made from the other blocks. The stand provides a place for a hinge, which

would be attached to the beam. The beam is constructed of the remaining Lego pieces, whose

specifications are: 40.95g, 3.5cm wide, 0.8cm tall and 32.3 cm long. Once the beam was

completed, a system of axis was chosen as shown below.

                                            Figure 1: Beam axis diagram

        The moment of inertia about the x-axis was found to be 3.5624e3 g*cm2, using the

equation below.

                                         ���������������� * (��������������������h2 + h������������h����2)
                                �������� =                      12                             (1)

        As the linear actuator was taller than the LEGOs stand, a stand made of wood was added

in order for the beam to lower below the level position. The wood/LEGOs stand is shown below.

The figures shows the actual test setup on the left, and the diagram on the right.

                             Figure 2: LEGO brick-platform picture/schematic

        To allow some rotation of the beam while the actuator was moving, a compression spring

was added between the actuator and the beam using the setup below. The spring constant was

experimental found to be 21.4 lb/in. This spring was super-glued to a metal piece, which was

glued to a bolt with a nut. The free end of the beam is attached to the actuator with a spring..

                              Figure 3: Spring before being glued to the beam

        Attached to the beam are the electronics. The electronics can be divided into two sub-

systems, the sensor and the actuator. The sensor proposed is a Freescale MMA7361L XYZ-axis

(see appendix for data sheet) accelerometer which can detect ±1.5 in three axes. The sensor is

attached to the LEGO bridge via the mounting holes. Power is supplied to the sensor and a

voltage is outputted that describes the acceleration out the end of the beam. The accelerometer

outputs -1.5 g to 1.5 g accelerations, linearly distributed between 0 and Vref. The Vref is user

selectable and will be set to 6 V (same as voltage for linear actuator) for simplicity. A reading of

0 V will correspond to an acceleration of -1.5 g, a reading of Vref/2 will be 0 g, and an output of

Vref corresponds to 1.5 g. The output voltages are converted into a digital signal via a NI 6040E

DAQ (see appendix for data sheet). The angular displacement is calculated by using assuming the

translational acceleration is always 9.81 m/s2 perpendicular to the Earth’s surface. The angle is

then the inverse sine of the acceleration in the direction of the beam. The angle is fed into the

controller. The output of the controller is converted into an analog form by the D/A converter in

the multifunction board and conveyed as an analog voltage to the linear actuator connected to the

platform. A Firgelli L12-I Linear Actuator (100mm) (see appendix for data sheet) is used in

our project. It is capable of moving at only 12mm/sec, which means the disturbance much be at

very low frequencies. It moves with respect to the voltage supplied; supplying 0 V will cause the

arm to retract completely and supplying 5 V will cause the arm to fully extend. Between zero and

five volts, the position of the arm changes linearly with voltage.

Initial Approach:
        The system was modeled and simulated with a controller to keep the platform level,

assuming that the dynamic analysis could work on this small scale. The beam was hinged at one

side. The force on the board is determined from displacement of the linear actuator by using a

spring in between the board and the actuator. The damping that will be caused by the spring has

been modeled into the system.
        The following figure shows a diagram of the setup and the components.

                           Figure 4: Diagram of the Experimental Setup

        The system dynamics can be described by Equation (2) and (3).

                                                                                               (2)

                                        LK (u  L sin( ))  B
                                                                                                  (3)

        In the above equations, θ represents the angular displacement of the platform, ω is the

angular velocity, L is the length of the platform, K is the spring constant, B is the damping

coefficient of the hinge, u is the displacement, and J is the moment of inertia of the platform.

        The system is nonlinear due to the sin (θ) in the calculation of the angular acceleration.

The controller chosen is the State Dependent Riccati Equation technique, or SDRE.1 The SDRE

controller solves the Riccati equation at each time step to calculate the control gain. The Riccati

equation finds the gain that minimized the cost function

                                         1 T
                                      J   x Qx  u T Rudt                                      (4)
                                         2 t0

        In Equation (3), Q and R are weights on the states and the control, respectively. A high

Q matrix will correspond to lower controller error and faster convergence to the desired state,

while a higher R matrix will try to reduce the control input needed. The ratio of the Q to the R

matrix is the important factor in optimal control.

        The Riccati equation is

                                  AT S  SA  SBR 1 BT S  Q  0                                (5)

        The solution to the Riccati equation provides the matrix S, which is directly related to the

control through the equation

                                          u   R 1 BT Sx                                       (6)

        The Riccati equation is solved using the linear quadratic regulator function, or LQR, in

MATLAB. The SDRE technique requires the system to be in linear-like form. This means the

dynamics must be written of the form

                                            x  Ax  Bu
                                                                                                (7)

        The dynamic equations can be rewritten in this form by factoring out state variables were

possible. It should be noted that the term with sin(θ) could not have a θ factored out of it. Using

a method shown by Cloutier in Reference 2, one can multiply and divide by θ to get the correct

form. When the method is applied, the equations become

                                         0             1           0 
                           d    2                             
                                    L K sin( )       B     LK  u                        (8)
                           dt   
                                                          
                                        J             J          J 

          This method causes problems when the state is zero, because a term in the A matrix is

                                      sin( )
divided by the state.       Because              1 for small angles of θ, the equations can be

approximated to be linear and have the form

                                       0            1           0 
                              d    2                       
                                      L K          B     LK  u                           (9)
                              dt   
                                                        
                                       J            J    J 

          It turns out that the simplification causes the system to be approximated as a linear

system.     The small angle approximation is usually considered accurate to 15 degrees.

Simulations of this system show that the controller will work with angles as high as 25 degrees

and the test setup will not be able to move more than a few degrees. So the control gains will be

calculated only once and the SDRE controller will not technically be used.

          For the simulation results in this report, the following initial conditions and constants

were assumed. The initial angular displacement and velocity was set to two degrees and zero

degrees per second, respectively. The spring constant was assumed to be 3747 N/m. The

damping coefficient was assumed to be 0.1 kg/s. The length of the platform was selected is 0.323

meters, and the moment of inertia of the beam was calculated to be 3.5624E-4 kg m2. The

controller weights, Q and R, were set to 1E-7 and one times the identity matrix, of appropriate

size, respectively. The simulation was run for 0.1 seconds with a time step of 0.0001 seconds.

          The results of the simulation show the uncontrolled system oscillates from the initial

conditions, and the oscillation dampens out over time due to the damping in the hinge. The

length of the beam, the spring constant, and the damping coefficient determines the dynamics.

The addition of the control has a large impact on the system response. Using the actual moment

of inertia of the Lego beam, and the actual spring constant, the system responds much faster.

Even the uncontrolled system returns to zero angle within a tenth of a second. The controller

levels the platform faster still. Figure 5 shows the angle of the table with respect to horizontal,

and Figure 6 shows the angular velocity.         Each plot has the uncontrolled and controlled

responses. The speed at which the controller corrects the angular displacement can be adjusted

by changing the Q and R weights on the system states and control input. By increasing Q, the

controller will put more weight on making the system states go to the desired states, causing a

faster response. By increasing R, the controller will put more emphasis on lowering the required

control input, increasing the response time. Although it seems that a faster response will always

be desired, the R matrix may not be completely user selectable. If the R matrix is selected to be

too high, the controller may ask for more control than is available. If it is too low, the controller

capability is not fully utilized. The controller has been fitted with saturation and velocity limits

that make sure that the control signal never asks for more than the actuator can handle. The

control signal voltage is shown in Figure 7.

                   0.8                                                           Controlled


     theta, deg    0.4






                         0   0.01   0.02   0.03   0.04      0.05 0.06   0.07   0.08   0.09      0.1
                                                         time, sec

                  Figure 5: Simulated Angular Displacement with and without Control

                  400                                                            Controlled


w, deg/s





                         0   0.01   0.02   0.03   0.04      0.05 0.06   0.07   0.08   0.09      0.1
                                                         time, sec

                    Figure 6: Simulated Angular Velocity with and without Control



               Control Signal Voltage





                                               0   0.01   0.02   0.03   0.04      0.05 0.06   0.07   0.08   0.09   0.1
                                                                               time, sec

                                                      Figure 7: Simulated Control Signal Voltage

        The control signal is generated for the Firgelli L12 linear actuator by sending a voltage

between zero and five volts. The displacement has a linear relationship with the input voltage.

An input voltage of zero would be fully retracted and an input of five volts would result in the

linear actuator being fully extended. The control code is set to saturate if the control signal goes

outside of that range. The velocity is limited by using the previous control signal, and only

allowing a maximum velocity of 12 mm/s. This controller has been determined unacceptable,

because of the inability to determine the deflection of the spring from the available

measurements, and on this small scale, it is difficult to make a spring deflect at all. This

controller could be used if the position of the bottom of the linear actuator was known. However,

with this test setup, that quantity is unobservable. The controller below calculates the control

based on the error in angle, and drives the linear actuator without the need for knowledge of the


Final Approach
        The controller used for the experiment became a disturbance rejection controller rather

than a dynamic controller. The systems dynamic response is not needed. The reason for this

change is that the purchased linear actuator has a built-in controller that could not be overridden

unless it was dismantled and “hacked.” The controller takes a desired position (in the form of a

voltage between 0 and 5 V) and moves the actuator to the correct position. The controller moves

with whatever force or speed it deems necessary to achieve the desired position. Without the

flexibility to control the force that the linear actuator exerts on the bridge, the dynamics do not

work without the addition of a spring. This was noticed early in the planning stages, but what

was not realized was the problems faced in two areas. The first problem is determining the exact

deflection of the spring. The model and controller developed above can assume that the bottom

of the linear actuator does not move. Movement of the linear actuator causes the model to

assume the spring is deflected much farther than reality. The model believes, especially with a

low moment of inertia bridge and a high spring constant, that the bridge has a very large force

acting on it and will rotate very quickly. The actual system does not have any force on it and will

not move.

        The second problem was hinted at before. The bridge has a very low mass and will rotate

very freely. When the bridge pushes the spring, the spring does not deflect. Experimentation was

done with different springs and materials, as well as adding weight to the bridge, however, no

deflection would happen due to the linear actuator. The linear actuator can only push at 25 N

maximum, and staying under that weight, a spring with a low enough constant could not be

found. The solution would be to purchase a new linear actuator with a much higher force, and

use a larger bridge, something that was realized too late to make a difference for this experiment.

However, the problem that was initially proposed has been solved. The system created senses

changes in the orientation of the bridge in real time, then moves the bridge to cancel error

between the reference angle and the actual angle of the bridge.

        The first step to “auto-level” or “auto-any-desired-angle” is to receive input from the

accelerometer. The accelerometer inputs a voltage that ranges between 0 and whatever input is

given to the 3v3 pin on the accelerometer. The 0 should correspond to the lowest acceleration

that can be read by the accelerometer, and Vref should indicate the maximum.              For this

accelerometer, the min/max is plus or minus 1.5 g. Three axis are measured, but the only two

giving useful information are the one pointing down, and the one pointing length-wise of the

bridge. The equations that can be used to calculate the angle of the bridge are shown below.

                                           sin( )  a y
                                                       ay                                      (10)
                                           tan( ) 

        Where ay and az are the accelerometer readings after the conversion from voltage to g’s

has been completed. The pre-processing is completed by taking the inverse sine or tangent of the

above equations (one or the other depending on the data being collected, both should yield the

same result).

        The other input needed for the system to work is the current position of the linear

actuator. This is again needed because of the built-in controller on the actuator. The controller

build here cannot tell the actuator to move a certain amount from the current position, but only

where to go next. The linear actuator has a built in potentiometer that gives 3.3 V output if the

actuator is at the fully retracted position and 0 V if the actuator is fully extended. This voltage

needs to be converted to meters. This conversion is easier than finding θ, it can be found by

subtracting 3.3 V from the measurement and then multiplying the result by negative 0.1 m

divided by 3.3 V. Now, the angle of the board, and the current displacement of the linear actuator

are known.

        On the controls side, the current angular position is subtracted from the reference position

to form an angular error. By examining the angle made by the board, a Δd can be calculated that

represents a change in the length of the linear actuator. The control voltage sent to the linear

actuator then becomes the current position plus the desired change in position. This controller

can be used to cancel any unknown disturbance and can be used to track any reference angle.

The diagram below shows the geometry used to find the input to the linear actuator.

                              Figure 8: Diagram of desired displacement Δd

        The angle can be calculated from the picture as

                                          d  L sin( )                                       (11)

                The desired position of the linear actuator becomes

                                         d desired  d  d                                    (12)

               Converting the equation to an input voltage, the control input to the
linear actuator is

                                           u        d                                         (13)

        The controller was built in Simulink, with the input and output through the National

Instruments multifunction board as an analog to digital and digital to analog controller. Figure 9

displays the pre-processing of the measurements to prepare for the calculation of the control

input. The voltage from the accelerometer and the potentiometer inside the linear actuator are

converted to an angle and a displacement, respectively. Figure 10 shows the control calculation

using the processed measurements.

                        Figure 9: Simulink model of measurement pre-processing

                                   Figure 10: Simulink controller model

       After the implementation of the controller on the actual system, the results showed that

the controller was able to track low frequency responses. Tests were conducted with an unknown

disturbance, and a sinusoidal reference angle.     The unknown disturbance tracked well, but

because the disturbance was unknown, there could be no comparison good comparison to show

how well the accelerometer was measurement the angle of the platform. The sinusoidal reference

though, showed a desired angle and a measured angle. The fluctuations in the measured data

showed noise in the measurement.


            Angle of Table, degrees    5




                                            0     10        20         30        40       50      60          70
                                                                        time, sec

                                                Figure 11: Reference and Measured Angle of Beam

       The noise in the measurement can be removed through the use of a Kalman filter. The

Kalman filter uses measurements to correct uncertainty in the dynamic model.                           The EKF

calculates the estimate covariance, propagates it, and then uses it to update the states.3

       Consider the system

                                                                 x  f x   w
                                                                                                          (14)

                                                             y  h( x )  v                                (15)

       where y is the measurement, w is the process noise and v is the measurement or

sensor noise with a mean of zero, and a variance of Q and R, respectively. A set of

partial derivative matrices is next defined as

                                          F    f ( x)
                                          H  h( x )

       The F and H matrices in Equation (16) are the Jacobian matrices of the plant and

measurement, respectively. The system is numerically integrated including the states and

the estimate covariance.

       The system dynamics in Equation (14) are used to propagate the states forward in

time. The f(x) function describes the system itself. The model can be very accurate or

inaccurate, with the process noise, w, used to account for any inaccuracies. The

covariance     propagation      equation         for       the       EKF   takes   the   form

                                     P  PF  F T P  Q                                  (17)

       where P is the estimate covariance, F is the Jacobian of the system dynamics, and

Q is the process noise covariance. The results of the integration are known as the a priori

state estimate and the covariance, and they are designated by a “bar” above the variable.

Posteriori estimates are designated with a “caret” above them. The estimate and

covariance are then updated using the equations

                               K k  Pk H k T ( H k Pk H k T  Rk ) 1
                               xk  xk  K k ( yk  hk ( xk , tk ))
                               ˆ                                                         (18)
                               Pk  ( I  K k H k ) Pk

       The results for the velocity estimate from the Kalman filter are shown below.

        Because the filter will correct for model uncertainty, the model used will be simply a

third-order Markov model. The process noise will take care of the changes due to the changing

reference angle, and the acceleration of the beam will be modeled to be zero.

        The system will be

                                        0 1 0   
                                                 
                                        0 0 1   
                                                                                             (19)
                                       0 0 0   
                                                

        The filter matrices are

                                             0 1 0
                                         F  0 0 1 
                                                   
                                             0 0 0
                                                   
                                         H  1 0 0

        The measurement will be simply theta. A simulation of the Kalman filter has been

performed with a simulated measurement with a Gaussian noise distribution with zero mean and a

variance of one degree.

                The Kalman filter was not implemented on the actual system because the

accelerometer malfunctioned before thee filter was attempted. The simulation results for the

filter, though, filtering the data as sort of a post processing attempt to reduce measurement noise

was conducted. The filter reduced the error and smoothed the estimate of the beam angle.

                            4                                                       Estimate


              Theta, deg





                                 0    10       20       30        40      50       60          70
                                                         time, sec

                                     Figure 12: Reference and Measured Angle of Beam

        There is a definite offset, or phase shift, between the measured and the reference angles,

it is difficult to determine the full cause of the problem. The offset could be due to the filter, or it

could be due to a lag in the measurement from the accelerometer, or a little of both. It is also

difficult to tell if the noise in the measurement could have been delaying the controller response.

If the filter could have been implemented, the controller could have been tested to see if the noisy

measurement was the cause of the offset.

        Experiments were conducted on the setup and they proved to be successful. The linear

actuator moved the beam to the desired location based on the controller and reference inputs. As

the results showed, the measured value followed the reference. The harmonics were removed

using a Kalman filter.

        Generally in such systems, the controller is based off of a dynamic model of the system.

The motive for this project was to build a system with an adequate dynamic model to design a

controller. The initial idea of using a spring to be able to determine a force did not work. What

should have been done instead was to order a linear actuator without a built-in controller.

Firstly, the mass of the beam was very less relative to the high spring constant of the spring. This

caused almost no oscillations in the spring ruling out any dynamics to be accounted for while

designing the controller. Next, the Firgelli L-12I linear actuator had a built in microcontroller that

controlled the speed of the strokes and also output the position of the linear actuator. Such

features resulted in the design of a simple feedback control scheme.

        Though the experimental runs were problem free, the linear actuator placed some

constraints on the system. With a maximum power of 23N at 6mm/s, the actuator could not move

objects with higher mass. An actuator with a higher power would have facilitated efforts to add

dynamics to the system by placing a heavier beam on the spring. The operational speed was also a

hindrance. With a maximum speed of 12mm/s, the linear actuator had a very low bandwidth.

Summary and Conclusion
        The objective of the project was to design and maintain a platform parallel to the surface

of the earth even on unstable surface. Motion sickness faced by people on a ship, a soldier trying

to take aim on a moving vehicle on a hilly terrain while the vehicle is in motion, and other such

problems were the main reasons behind choosing the project. The basic idea was to stabilize a

beam connected to a movable surface which, when moved, made the beam unstable.

        For the experiment, the beam was hinged on one end to a raised platform and the other

end was connected to a linear actuator that controlled its movement. An accelerometer fixed to

the beam provided outputs in the form of the angular position. The accelerometer outputs were

used as the main input to the controller. Calculations were made on the angular position and the

desired position was output as a voltage to the linear actuator connected to the beam.
Based on the voltage supplied, the actuator moved the beam higher or lower. Data conversion

devices were used to converted signals from digital to analog and vice-versa.

        As mentioned in the previous section, the components selected prevented modeling and

testing the setup realistically. The plan to input different references and observe the outputs could

not be completed because of the damage to the accelerometer. However, with a heavier beam and

a more powerful linear actuator, the results can be simulated more realistically. A linear actuator

without inbuilt controls can help us develop efficient control schemes and obtain better outputs.

Auto-leveling platforms find a lot of real world applications. Such a system can then be

implemented on a larger scale successfully.

                               Figure 13: Final Constructed Project


[1] Cloutier, J.R., “State-Dependent Riccati Equation Techniques: An Overview,” Proceedings of
        the American Control Conference, Albuquerque, NM, June, 1997.

[2] Cloutier, J.R., Stansbery, D.T., “The Capabilities and Art of State-Dependent Riccat
       Equation-Based Design,” Proceedings of the American Control Conference, Anchorage,
       AK, May 2002.

[3] Simon, Dan, Optimal State Estimation, John Wiley and Sons Publications, Hoboken, NJ,

[4] MMA7361L 3-Axis Accelerometer with Voltage Regulator, Pololu Robotics,

[5]    Firgelli   L12      Linear     Actuator     –    100(mm),     Trossen    Robotics,

[6] Mini – Typhoon weapons system

[7] M1 Abram Tank

[8] Popular Mechanics – Ship’s Stabilizing Fins May Prevent Seasickness

[10] Dr. Landers Mechatronics Course Website


            Figure 14: Data sheet – MMA7361 accelerometer

Figure 15: Data sheet – MMA7361 maximum rating and operating characteristics

Figure 16: Data sheet – Firgelli Linear Actuator

Figure 17: NI 6040E Multifunction DAQ10


To top