Electronic Bench Press Spotter by pengtt

VIEWS: 38 PAGES: 28

									  Electronic Bench Press Spotter


               By


          Jon Donenberg
          Barry Horwitz




ECE 345, SENIOR DESIGN PROJECT

           FALL 2004




        TA: Mark Wiegert



           May 1, 2004


          Project No. 6
                                               ABSTRACT



The Electronic Bench Press Spotter (EBPS) system is designed to alleviate the need for human

assistance when participating in weightlifting exercises, and in particular failure exercise. The ideal

instantiation of the EBPS system would handle on the order of 200-300lbs of applied bar weight. With

this ultimate design model in mind, a 1/5 scale model of the EBPS system was designed, constructed,

and tested. This report reviews that process in detail, addressing design alternatives, specific details of

implementation, underlying mathematical and algorithmic theory, and testing. All performance

requirements were met, and the device operates within desired specification ranges. The report

concludes that based on the success of the prototype, scaling to full size should present minimal

challenge.




                                                      ii
                                                         TABLE OF CONTENTS


1.   INTRODUCTION ....................................................................................................................1
     1.1 Overview of Design ............................................................................................................2
     1.2 Specifications ......................................................................................................................3
     1.3 Performance Benchmarks ...................................................................................................4
     1.4 Subprojects .........................................................................................................................5

2.   DESIGN PROCEDURE ...........................................................................................................6
     2.1 Input System .......................................................................................................................6
     2.2 Processing Circuitry............................................................................................................7
     2.3 Output System ....................................................................................................................8

3.   DESIGN DETAILS ................................................................................................................10
     3.1 Input System .....................................................................................................................10
     3.2 Processing Circuitry..........................................................................................................12
     3.4 Output System ..................................................................................................................19

4.   DESIGN VERIFICATION .....................................................................................................21
     4.1 Speed Analysis..................................................................................................................21
     4.2 Detection Accuracy ..........................................................................................................21
     4.3 Safety ................................................................................................................................22

5.   COST ......................................................................................................................................23
     5.1 Parts ..................................................................................................................................23
     5.2 Labor .................................................................................................................................23

6.   CONCLUSIONS ....................................................................................................................24

     REFERENCES .......................................................................................................................25




                                                                            iii
                                           1. INTRODUCTION




Weightlifting is one of the more common forms of anaerobic exercise. When practiced often,

weightlifting can play a transformative role in improving the health and muscle growth of the

weightlifter. In order to make the most of one‟s exercise time, weightlifters commonly practice a

weightlifting technique known as failure exercise. Based on physiological studies suggesting that

maximizing the tension on one‟s musculature is the best way to promote muscle growth, weightlifters

practicing failure exercise will lift very heavy weights for short sets of repetitions that last until such

time as they are no longer able to repeat the lifting action in question – in other words, working to

„failure‟. [1]



While clearly health-promoting, it should be readily apparent that both weightlifting in general and

failure exercise in particular carry with them the ever-present risk of serious injury. In the event that the

weightlifter reaches „failure‟ without some form of system in place to quickly relieve him or her of the

bulk of the force bearing down at that moment, injury may well occur. As a result, most weightlifters,

and in particular those engaging in failure exercise, tend to exercise with workout partners called

spotters whose job it is to keep a watchful eye on the weightlifter and step in to provide a relieving

counterforce should it become necessary. Unfortunately, human spotters are not always available;

creating an unfortunate dilemma for the weightlifter that must either skip his or her workout or risk

injury. As neither of these alternatives is particularly acceptable, there is an evident need for a self-

spotting system.




                                                       1
1.1 Overview of Design



The electronic bench press spotter (EBPS) is a concept designed to assist weightlifters in training to their

maximum potential without the aid of a human assistant. Designed and constructed at 1/5 scale of

normal, the prototype described in this report is able to perform all of the tasks that a human spotter

would perform in the context of barbell exercises (bench press, squats, dead lifts, straight-bar curls, etc.)

The block diagram corresponding to the initial project proposal is found in Figure 1.1. In the final

design, the clock was eliminated as unnecessary, and the hardware registers were replaced with software

variable storage within the microcontroller. In addition, a DC motor controller was added between the

microcontroller and the DC motor in order to minimize current spikes and drain on the microcontroller.




                                  Block Diagram


     DC Motor                  Microcontroller                       Digital Logic


                           Clock                Registers             IR Sensors

Figure 1.1. Original Block Diagram of Electronics



The block diagram for the final system can be found in Figure 1.2. Input signals from the mechanical

system are processed by the input IR sensor array and fed to the input encoder circuitry, which sends a

five-bit string to the BasicX-24 microcontroller. Based on constant checking of the input state, the motor

controller is able to generate PWM signals corresponding to different conditions requiring the activation

of the variable-voltage DC motor. These PWM signals trigger the activation of the 4Z144 12/24V DC

Motor by way of the MD03 microcontroller. Included in the block diagram is a connecting option to a


                                                      2
local Windows XP computer, which can display debug output that provides explicit information on

sensor tracking of the bar position, motor execution state, etc.



                                 BasicX-24 Microcontroller



  MD03 Motor Controller             Input Encoder Circuit          Debug Output to WinXP
                                                                         Computer


  Variable-Voltage 4z144           Input IR Sensor Array
     12/24VDC Motor



Figure 1.2. Final Block Diagram for EBPS Electronic System.



The three major tasks of a spotter are defined herein as reversal compensation, stuck compensation, and

velocity compensation. All three are implemented in the context of the scale model, and it will be

apparent from the context of this report that these three functions can be scaled to full size with a

minimum of effort.



1.2 Specifications



The constituent weights of the mechanical system are provided in Table 1.1.

The scale model design is designed to operate effectively at two           Component                    Weight

weight levels - a “no-weight-added” weight level of 1.09kg and a           Bar                          632.0g

                                                                           Sliders (X2)                 457.4g
“weight-added” level of 2.37kg. Maximum current levels under this
                                                                           Supplemental „weight         1281.6g
implementation suggest the device may be able to handle roughly
                                                                           added‟ mass (X2)
four times the “weight-added” level without causing electrical or
                                                                           Table 1.1. Mechanical System Weights
mechanical failure.


                                                      3
The EBPS can resolve velocities of up to 7.7 m/s. In reality, it is likely impossible for any weightlifter to

operate at this speed. The typical maximum velocity of the system is estimated to be 1 m/s. Testing to

verify these parameters was performed up to 1.2 m/s. Test results suggest an optimum typical operating

velocity of 0.3 m/s.



1.3 Performance Benchmarks



There are three primary performance benchmarks associated with the EBPS system, roughly defined in

the categories of speed, accuracy, and safety.



With respect to speed, typical weightlifters are observed to lift in the speed range of 1 cm/s to 4 cm/s,

and falling weight is observed to approach a velocity of 1 m/s. As a result, it is necessary for the device

to be able to resolve speeds of up to 1 m/s.




Accuracy in position detection is another critical area upon which the quality of performance may

depend. Without proper input detection, higher-level functions like velocity compensation and stuck

compensation, along with more basic safety features like reversal compensation, may not execute

correctly. As a result, all input signal errors must be eliminated to whatever extent is possible.



Safety is the final critical benchmark area. Electrical failsafes like reversal compensation must be

present to prevent injury, and mechanical backup failsafes to catch the bar must also be present in the

event the electrical system shuts down for some reason.




                                                      4
1.4 Subprojects



The three major subproject areas are defined as the input circuitry, the processing circuitry, and the

output circuitry. A flow diagram of the interactions between these three areas can be found in Figure 1.3.




                           In
  Input Circuitry                  Processing                   Out    Output
   • 32X IR Sen so r
                                   Circuitry
                                   • BasicX-24                         • Mech an ical
   Ar r ay                                                             Ap p ar at u s
                                   Micr o co n t r o ller
   • In p u t En co d er                                               • Var iab le
   Cir cu it
                                                                       Vo lt ag e Mo t o r




Figure 1.3. Subproject Flow Diagram



The input circuitry subproject includes the input sensor array and the input encoder circuit. The

operational requirements for the input circuitry are to correctly sense the bar position and correctly

encode the position into a five-bit binary string at all times. The processing circuitry subproject consists

of the BasicX-24 microcontroller. The operational requirements for the processing circuitry are to

operate essentially as a large state machine, using current and previous state information to predict what

type of compensation (if any) should be executed. The processing circuitry must also output the correct

PWM signal corresponding to such compensation as required. The final subproject – the output –

includes the mechanical apparatus, the motor controller, and the 4z144 12/24V DC motor. This portion

of the project must correctly process the PWM signal from the BasicX-24 and power the DC motor as

needed. The mechanical apparatus must be robust, including a mechanical failsafe, and must be

sufficiently responsive so as to allow for total device performance within desired specifications.




                                                            5
The separation of the overall project into three relatively autonomous electromechanical components

represents a major design advantage. Due to the relative compartmentalization of the three subprojects

and the ability to synthesize test input signals to each allowed for the development of these three

systems roughly in parallel with each other. This methodology served to significantly cut down the total

time from conceptualization to operational execution of the EBPS system.



                                       2. DESIGN PROCEDURE



2.1 Input System



The original design for the sensor inputs changed dramatically over the course of the semester. Initially,

reflective infrared sensors appeared to be an effective method of tracking the location of the bar. To

achieve this, the bar would have to be painted black with a small white area to reflect the IR signal. In

this particular implementation, each sensor would read logic LO unless the bar was in front of it. To

process this input, a 32-bit Priority Encoder circuit shown in Figure 2.1 (attached) was designed using

four 8-3 bit encoders whose outputs were fed to two 4-bit full adders, the second level of this circuit.

The output of the second level was two 4-bit numbers, which were fed to a single full adder, constituting

the third level of the circuit, which completed the computation. In all, the 4-bit output plus a carry bit

would denote a 5 bit number corresponding to the sensor being tripped within the range of 0-31.



This circuit was built and functioning before it became apparent that this particular design setup was not

optimal for the project. The reflective sensors initially considered turned out to be prohibitively

expensive at ~$5 apiece, and the technique of IR reflection remained of questionable utility since it was

not 100% accurate. Fluorescent light, used in most classrooms, contains more wavelengths beyond the

visible spectrum, which can intrude on the sensor operating regions to create malfunctions in the input


                                                      6
readings. Furthermore, the input circuit was prone to glitches, primarily as a result of the original

encoder chips‟ (MC10165) „low‟ outputs reading as high as 3.6 V.



As a result, line-of-sight infrared sensors replaced the reflective sensors, and the input circuit was

redesigned. Detailed specifications on these two components can be found in the next section. Under the

new implementation, both the input sensors and the input encoding circuit performed to specifications.



2.2 Processing Circuitry



Processing of input signals and generation of output signals for the EBPS is done within the processing

circuitry subproject of the system. In our particular instantiation, processing of input signals is handled

by a BasicX-24 microcontroller. The microcontroller was chosen due to ease of programming and in an

attempt to minimize the processing hardware needed to complete the tasks required of this subsystem. It

would also be possible to build processing circuitry without the use of a microcontroller, using a flip-

flop configuration to create a state machine to track the input and output states, and to store data and run

simple calculations in a system of registers with some basic mathematical computation circuitry. Such

an implementation would probably speed up the execution of the EBPS and increase the theoretical

speed resolution of the system, but is probably unnecessary.



There are six major software functions within the BasicX that are associated with the correct operation

and functioning of the EBPS system. These six functions fall into two broadly defined categories – state

functions and PWM functions.



State functions, which are involved in sensing the current input state of the system and setting the

current output state of the system, include InputValue() which checks input values, CheckInput() which


                                                      7
processes sensor input and determines the correct output state, Initialize() which sets the initial values of

the system, and Main(), the primary executable function that runs in a constant loop from startup.



PWM functions are involved in controlling the operation of the PWM output. They are called by the

state functions and set the duty cycle on the output of the PWM., and include InitializePWM() which

turns on the PWM signal at a frequency of 14.1kHz, and PutPinPWM, which toggles the output of the

PWM signal from high to low according to an input duty cycle.



A psuedocode outline of the operation of the PWM functions in tandem can be found in Figure 2.2.

Here, the duty cycle is set to a given operational value and applied to the output through the

PutPinPWM function as long as a given execution condition remains true. When the execution condition

becomes false, the duty cycle is reset to a minimal, „non-operational‟ value and applied to the output

signal via the PutPinPWM function.

 Do While (Execution Condition == True)
        DutyCycle = Operational Value
        Call PutPinPWM(PinOC1A, DutyCycle)
        Update Execution Condition
 Loop

 DutyCycle = non-operational Value
 Call PutPinPWM(PinOC1A, DutyCycle)

Figure 2.2. Psuedocode for PWM Execution.



2.3 Output System

The output system is designed to process the PWM signals from the BasicX-24 and apply them to the

4z144 DC motor as required in order to provide the necessary forces to the bar as they are required. The

original design of the output circuit was centered on a particular motor driver chip, the LMD18200.

Most motor driver chips consist primarily of an H-bridge device which allows the motor to be driven in

either direction based on the inputs to the chip. [2] A generic H-bridge configuration is shown in Figure

2.3. One of the inputs to the device can be a PWM with a variable duty cycle, where the duty cycle is a
                                                  8
percentage which signifies the percentage of the motor‟s full load capability and/or full voltage rating.

The LMD18200 would have sufficed for these purposes if it were not necessary for the motor to carry

more than 3 A.




Figure 2.3. Generic H-Bridge configuration. [3]


After testing the motor with the attached full load of 2.37kg, the original output circuit did not prove

powerful enough to handle the job. The motor attempted to pull upwards of five to six amps of current

as required by the specifications of the mechanical system, but the LMD18200 was limited to 3A. As

the semester was winding down, the decision was made to go with a more capable chip, the MD03 by

Devantech. Substantially similar in design and virtually identical in function, the new chip was able to

carry up to 20A of continuous current.




                                                     9
                                           DESIGN DETAILS



3.1 Input System



The input circuit consists of two major components – an input IR sensor array, and an input processing

32-5 bit encoder circuit. Operating specifications and characteristics of the IR sensors can be found in

Table 3.1.



After initial experimentation with reflective IR
                                                           DETECTOR CHARACTERISTICS
sensors, it became clear that a direct IR beam sent        Emitter-Collector Voltage:   5V
                                                           Ic Collector Current:        50mA
from an emitter to a detector across the vertical axis     Power Dissipation:           150mW
                                                           Peak Sensitivity Wavelength: 850nm
of the bar would be most favorable. Here, each             Bandwidth Range:             620-890nm
                                                           Angle of half-sensitivity:   +/-20o
sensor output would read logic HI unless the bar
                                                           EMITTER CHARACTERISTICS
physically blocked the IR signal from the emitter.         Continuous Forward Current: 150mA

                                                           Radiant Power Output:          15mW
                                                           Peak Emission Wavelength:      950nm
The new sensors required a new implementation of           Table 3.1. Detector & Emitter Specs.
the input circuit, effectively solving the problem of the original, faulty one. An IR emitter-detector pair

bought in bulk from Radio Shack sold for $2.70, halving the cost of sensor arrays themselves. A circuit

diagram of the complete emitter and detector pair of sensor arrays can be found in Figure 3.1.




                                                      10
The new encoder circuit was designed using different encoder chips (74LS148‟s), NAND gates, and

inverters. The new input circuit is shown in Figure 3.2. This design proved to be somewhat less

intricate, both due to its initial configuration as well as the use of Boolean algebra to simplify the

internal output signals significantly. The new implementation proved to be more effective, since it

matched perfectly with the sensor array.




Figure 3.2. Input Encoder Circuit.



Typical propagation delays for the input circuit were
                                                                           Typical (ns) Maximum (ns)
calculated by summing propagation delays reported          Encoder:        10             15
                                                           Hex Inverter: 20               33
at each level of the circuit. These values can be          Nand Gate:      125            250
                                                           Total:          155            298
found in Table 3.2. [4], [5] Total typical propagation     Table 3.2. Propagation Delays for Input Circuit.

delays for the input circuit were found to be 155ns, with a maximum total delay of 298ns. These

numbers fall below the time resolution of the overall system, and thus do not have a noticeable effect on

the operation of the system.

                                                     11
3.2 Processing Circuitry



The processing circuitry, represented by the BasicX-24 microcontroller, houses six major functions as

well as four output state sub-functions. The general workings of each of these functions and

subfunctions is explained in this section.



Major Functions – Main(), initialize(), inputValue(), checkInput(), InitializePWM(), PutPinPWM()



The basic framework of the Main() function can be found in Figure 3.3. The Main() function is called at

  Public Sub Main()                               startup (i.e., when the chip is powered up) and is the default
  lastValue = 0

  Call initialize()
                                                  executable function for the BasicX-24. Because the system
  'Turn on motor
  Call InitializePWM(1) ‘Turn on PWM at 14.1kHz   must constantly sense the current state and constantly be
  DutyCycle = minimum operational cycle
  Call PutPinPWM(PinOC1A, DutyCycle)
                                                  ready to change the output state, the architecture of the
  Do
            'check input
            A = inputValue()                      Main() function is set up such that after calling an
            'if a sensor is tripped
            If (getpin(7) = 1) then
                   'process input A               initialization function to set all variables to their initial
                   Call checkInput()
            End If
                                                  values, an infinite loop is called, within which all state-
  Loop

  End Sub
                                                  checking code is implemented.

 Figure 3.3. Main() psuedocode.



The initialize() function is a relatively straightforward function which sets all internal variables to their

initial values. No code is provided here as the function consists primarily of simple assignment

statements.

The basic framework of the inputValue() function can be found in Figure 3.4. The inputValue() function

is called from within the infinite loop of the Main() code, ensuring that the system is constantly checking

the input sensor value. This function is charged with translating the five-bit input string into a decimal


                                                         12
sensor number for processing by the checkInput() function. This function is also responsible for initial

preprocessing and error-checking of the input signal.


                                             Public Function inputValue() as Byte
The checkInput() function is                        inputValue = 0

                                                    'binary conversion of input value to decimal value
responsible for the bulk of the error               If(getpin(7) = 1) then
                                                           If (getpin(12)=1) then
                                                                   inputValue= inputValue+ 1
checking and output state processing                       End If
                                                           If (getpin(11)=1) then
                                                                   inputValue= inputValue+ 2
that occurs within the BasicX-24                           End If
                                                           If (getpin(10)=1) then
                                                                   inputValue= inputValue+ 4
microcontroller. This function                             End If
                                                           If (getpin(9)=1) then
                                                                   inputValue= inputValue+ 8
determines whether or not the bar is                       End If
                                                           If (getpin(8)=1) then
                                                                   inputValue= inputValue+ 16
                                                           End If
moving upward or downward, and                             ‘error checking
                                                           If (inputValue = 0) then
                                                                   inputValue = lastValue
based on previous state information                        End If
                                                    End If

decides whether or not to move into          End Function


one of the three main task areas of          Figure 3.4. InputValue() code.

reversal compensation, stuck compensation, or velocity compensation. The execution of tasks is

discussed in the section on subfunctions. Here, error-checking – one of the main functions of the

checkInput function – is discussed.



A psuedocode outline of error-checking within the checkInput() function for upward movement can be

found in Figure 3.5. Error checking is based on a number of vacuously true principles of the machine‟s

operation as well as the error-buffer concept. The vacuously true principles are principles that will

always be true if the device is in the state that it purports itself to be in. For instance, if the EBPS

believes it is moving upward, the current sensor should be greater than the previous sensor. If the EBPS

believes itself to be moving downward, the current sensor should be less than the previous sensor. If no

sensor is being tripped, then input signals should be disregarded. Finally, if the current sensor is located

at a distance greater than two or three sensors from the previous sensor, the „current‟ sensor is likely

incorrect, as experimental results show that skipping more than three sensors even at peak speeds is
                                                    13
 exceedingly unlikely. By preventing checkInput() from executing its code unless these conditions are

 met, the system is forced into double and triple-checking its purported input state against all other

 available data. While this means the response time may be slightly slower than optimal, it has a great

 positive effect on ensuring that the correct state is indeed identified.



 The second form of error-checking implemented within the Basic-X involves the concept of error-

                                                                                    buffers. Error buffers come
If (moving upward) then ' error check
         If (current sensor greater than last sensor) then
         If (difference between current sensor and read sensor < 2) then            into play when the bar
                  If (previously moving downward) then
                           upErrorBuffer = 1 'turn on error buffer
                  End If                                                            reverses direction; the
                  If (previously moving upward) then
                           If (error buffer is active) then
                                    increment error buffer                          upErrorBuffer is associated
                           End If
                           If (upErrorBuffer = 2) then
                           Debug.Print "UP "; cstr(Alast); "->"; cstr(A)            with reversing from
                                    upErrorBuffer = 0
                                    Call upCode()
                           ElseIf (upErrorBuffer = 0) then                          downward to upward,
                                    Debug.Print "UP "; cstr(Alast); "->"; cstr(A)
                                    Call upCode()
                           End If                                                   while the downErrorBuffer
                  End If
                  prevState = 1
         downErrorBuffer = 0                                                        is associated with reversing
         End If
         End If
End If                                                                              from upward to downward.

 Figure 3.5. upward checkInput() pseudocode with error-checking                     Because of input signal

                                                                                     glitches, it is possible for

 the device to erroneously posit that it has switched direction when in actuality all that has been detected

 is a glitch. The error-buffers simply treat each reported reversal as merely a candidate for reversal, and

 check the next few sensors to ensure that the bar is, in fact, moving in the direction denoted by the

 reversal. If the bar continues to move in the reversal direction for two more sensors, the system

 determines that an actual reversal has, in fact, occurred, and implements reversal compensation if

 necessary. Using this error-buffer technique provides a minimal sluggishness in response time (3 sensors

 or ~4.5cm) but this small loss is far outweighed by the near-flawless execution of proper reversal

 detection observed in the actual implementation.


                                                        14
                                                    Public Sub InitializePWM( _
                                                        ByVal RateSetting As Byte)
The basic framework for initializePWM() can
                                                         Const   PWMmode8bit    As   Byte   =   bx0000_0001
                                                         Const   PWMmode9bit    As   Byte   =   bx0000_0010
be found in Figure 3.6. This function, based on          Const   PWMmode10bit   As   Byte   =   bx0000_0011
                                                         Const   PWMmodeOff     As   Byte   =   bx0000_0000

PWM initialization information provided by the           Const MaskOC1A As Byte = bx1000_0000
                                                         Const MaskOC1B As Byte = bx0010_0000


manufacturers of the BasicX, allows the user to          ' Turn off Timer1.
                                                         Register.TCCR1B = 0

                                                         ' Set Timer1 to 8-bit PWM mode.
set the operating frequency of the BasicX to one         Register.TCCR1A = PWMmode8bit

                                                         ' Initialize pin directions.
of five preset values within the microcontroller.        Call PutPin(PinOC1A, bxOutputLow)
                                                         Call PutPin(PinOC1B, bxOutputLow)

These values can be found in Table 3.3.                  ' Clear duty cycles on both OCR1A and OCR1B pins.
                                                         Register.OCR1AH = 0
                                                         Register.OCR1AL = 0

             Tick       8-bit PWM                        Register.OCR1BH = 0
                                                         Register.OCR1BL = 0
TCCR1B       Frequency Pulse Rate
Value        (Hz)       (Hz)                             ' Start Timer1 according to the specified rate setting.
                                                         Register.TCCR1B = RateSetting
         1 7,372,800            14,456
         2      921,600          1,807                   ' Enable PWM for both pins.
                                                         Register.TCCR1A = Register.TCCR1A Or MaskOC1A
         3      115,200          225.9                   Register.TCCR1A = Register.TCCR1A Or MaskOC1B
         4       28,800          56.47
                                                    End Sub
         5        7,200          14.12
 Table 3.3. PWM Operating Frequencies.     -        Figure 3.6. InitializePWM() code.



Finally, the code framework for the PutPinPWM() function can be found in Figure 3.7. This function is

also based on code provided by the BasicX manufacturers. The function, as written, can set PWM

outputs on either of two pins; only one pin is actually used, however, in the implementation of the EBPS

system. [6] The function reads in a duty cycle percentage, and then converts that number to a discrete

value from 0 to 255, corresponding to the resolution of the 8-bit register which actually stores its value

onboard the BasicX-24.



Output State Subfunctions – Up-Coiling, Reversal, Velocity & Stuck Compensation



Four critical subfunctions contained within the major functions and two secondary functions – upCode(),

downCode() – are involved in actually setting the output duty cycles on the PWM line for given states.

Descriptions of these four subfunctions are provided below.


                                                    15
          Public Sub PutPinPWM( _
              ByVal PinNumber As Byte, _
              ByVal DutyCycle As Single)

          ' This procedure starts a PWM pulse train on the specified pin number. The
          ' nondimensional DutyCycle should be in range 0.0 to 1.0.

              Dim iDutyCycle As Byte

              ' Scale and enforce range constraints.
              If (DutyCycle < 0.0) Then
                   iDutyCycle = 0
              ElseIf (DutyCycle > 1.0) Then
                   iDutyCycle = 255
              Else
                   iDutyCycle = FixB((DutyCycle * 255.0) + 0.5) ' Round off.
              End If

              ' Set the proper pin.
              If (PinNumber = PinOC1A) Then
                  Register.OCR1AH = 0
                  Register.OCR1AL = iDutyCycle
              ElseIf (PinNumber = PinOC1B) Then
                  Register.OCR1BH = 0
                  Register.OCR1BL = iDutyCycle
              End If

          End Sub


       Figure 3.7. PutPinPWM Code.



The first important subfunction is called up-coiling, and is contained within the function upCoil(). Up-

coiling, while not explicitly used in a compensatory fashion, is nonetheless a critical underlying

operation for the machine. The purpose of the up-coiling function is to ensure that the line connecting

the bar to the motor remains near-taut at all times. Without the presence of this function, the line would

never move except on motor activation calls, creating a significant lag time associated with the coiling

of the line up to the location of the bar at a given moment. The practical impact of this phenomenon

would be readily apparent. For instance, upon a reversal compensation call, the bar might drop several

sensors (picking up speed along the way) before the line reaches the bar and becomes taut. Also,

velocity compensation would be virtually useless as it is designed to execute for a short, set period of

time to provide an immediate counterforce to the bar which cannot be executed if the line is not taut.



The upCoil() function is called every time a new sensor is tripped while moving upwards. The function

turns on the motor for a set period of time at a predetermined speed sufficient to coil the line around the
                                                     16
motor enough to make the line taut again. Because of the slow startup of the motor from a resting state, a

minimum PWM cycle is left on the motor when the bar is moving upward at all times in order to allow

for the quick jolts of speed required of the motor shaft when the upCoil() function is utilized.



The first of the three compensatory functions is reversal compensation. Reversal compensation is

primarily an emergency failsafe, and is the most basic and important function of the device. Reversal

compensation is designed to provide assistance to the weightlifter when he or she reverses direction

suddenly and unexpectedly during the execution of a particular repetition. Such a movement is almost

always associated with early failure, and indicates that the weight is in near-free fall, posing a safety risk

to the weightlifter. In the event that the user reverses direction from upward movement to downward

movement before tripping the top sensor, the system assumes that the bar is dropping and reversal

compensation is executed from within the checkInput() code. When called, reversal compensation pulls

bar to top of system and holds it in place until the user is ready to begin lifting again. The initial pulling

is done with a high percentage PWM cycle, while the „holding‟ function is performed by a much lower

PWM cycle, which the user can physically override by pulling the bar down below a high trigger sensor

and switching off reversal compensation entirely. [7], [8]



The second major operational function of the system is stuck compensation. Stuck compensation is

designed to provide assistance to the weightlifter when he or she cannot lift the weight past a certain

height that is lower than the top sensor. After four seconds, the EBPS assumes that the weightlifter is

„stuck‟ and cannot lift the bar any further without assistance. Once this has been determined to be the

case, stuck compensation applies a slight upward bump to the bar by triggering a high percentage PWM

cycle for a short interval of time. If the user is still stuck after another four seconds, stuck compensation

will again bump the bar. This process will continue until the user starts moving again or until the user

fails, at which point reversal compensation would be called.


                                                      17
The final major operational function of the system is known as velocity compensation. Velocity

compensation is based on the principle that the weightlifter should be able to exceed a certain minimum

velocity on his or her exercises. In the event that this velocity is not exceeded during the actual muscle

contraction, the system will provide a compensatory force to the bar that is sufficient to bring the total

velocity of the system back up to the minimum velocity.



In order to calculate the torque required for velocity compensation, it is necessary to compute the

acceleration of the system. A basic physics equation allows us to solve for the acceleration over a

chosen distance given an original velocity and final velocity:

       vf2 = vo2 +2*a*d                                                                                (3.1)

This equation can be re-arranged in the following manner:

       a = (vminimum2 – vactual2)/(2*.015)                                                             (3.2)




This is the equation that is used to find the acceleration between the minimum velocity and the actual

velocity over a distance of one sensor length. Note that it is necessary to add this acceleration value to

9.81 in order to counteract the force of gravity, so the total acceleration of the system is identified as:

       a = (vminimum2 – vactual2)/(2*.015) +9.81                                                       (3.3)

Plugging in this acceleration and available mass and pulley radius information into the standard torque

equation, one can calculate the required compensatory torque as:

       Tr = (mass)*(acceleration)*(pulley radius) = 2.37 kg*.01cm*(a)                                  (3.4)

The voltage and the torque of a motor are roughly approximated in the following manner:

       Tr / Tfull load = Vr / Vfull load = Duty Cycle                                                  (3.5)

Therefore, the required duty cycle to apply dynamically to the PWM can be found by dividing this

calculated torque by the full load torque of the system, which is a characteristic of the motor itself.




                                                         18
3.3 Output System



The output system consists of a Devantech MD03 motor controller and a 4Z144 12/24V DC Motor. The

MD03 was laid out in a straightforward manner with a logic side and a motor side. The logic side

required 5 V and contained a direction input (tied to logic HI) and a PWM input which designated the

amount of voltage to be placed across the leads of the motor. The motor side required a motor voltage

supply, and carried two leads to the motor itself.



The 4z144 12/24V DC motor was chosen because it met calculated specifications determined using

standard motor sizing techniques. First, the maximum power necessary to lift the load was computed

using the following equation:

       Pmax = (mass)*(gravity acceleration)*(min. sensor resolution)/(min. time resolution)      (3.6)

This equation can be simplified to:



       Pmax = m*g*(max system velocity)                                                          (3.7)

In this particular case, we found a maximum power value of 94.3463W which is based on a maximum

theoretical operating speed of ~7.8m/s (see testing and verification section).



In addition to power calculations, it is necessary to determine the maximum current that will be drawn

by the system. This calculation is performed using the simple circuitry equation:

       Imax = Pmax/(Operative Voltage)                                                           (3.8)

In this case, the maximum current is found to be 7.86A, based on an operating voltage of 12V.



The third critical requirement of the system is to calculate the maximum torque on the motor shaft that

will be required to lift the mechanical load of the EBPS system. In order to find the maximum torque,

one must first calculate the maximum required upward acceleration:

                                                          19
       Amax = 9.81 m/s2 + (Vminimum2)/(2*min. sensor resolution)                                     (3.9)

In this case, the maximum required upward acceleration was found to be 9.84m/s2. This number can be

substituted into the standard torque equation to yield the maximum torque of the system:

       Tmax = (mass)*(max acceleration)*(pulley radius) = 0.2317 N-m                                 (3.10)

Finally, pull-up speed requirement is set to 1 m/s according to the presumed maximum operating speed

of 1 m/s:

       Vup = 1 m/s = 954.9 rpm                                                                       (3.11)

The specifications for the 4z144 12/24V DC motor can be found in Table 3.4. [9] As can be seen, all

critical motor specs exceed these calculated
                                                        Model Type:                      4z144
minimum required values.                                Operating Voltage:               12V
                                                        Full Load Torque:                02892N-m
                                                        Maximum Speed:                   1750 rpm
                                                        Rated Current:                   6.9A-8.1A
                                                        Peak Current:                    17.5A
                                                        Rated Power:                     53.29 W
                                                        Peak Power:                      124.3 W
                                                      Table 3.4. Motor specifications.




                                                          20
                                                                                    4. DESIGN VERIFICATION



4.1 Speed Analysis



Tests were performed on the operational apparatus to measure the frequency of sensor trips for each

sensor at different velocities. Ideally, one would expect the relationship between sensor trip frequency

and speed to be a linear one – as the bar moves faster, each sensor is tripped less times, etc.

Experimental data in fact showed an exponential relationship between trip frequency and bar speed, as

displayed in Figure 4.1. This data suggests an optimal operating speed of 0.3m/s. This is well within

specifications. It should also be noted that while the optimal sensing speed is in the range of 0.3 m/s, the

device maintained correct operation throughout the entire range of testing – up to 1.2 m/s.

                                                                                                                                                                                                     4
                                            Frequency (Trips) Vs. Velocity                                                                           Log(Frequency (Trips)) Vs. Velocity
                                                (Tolerance Analysis)                                                                                                                                 5
                                                                                              4                                                             Tolerance Analysis                       6
                                                                                              5
                              80                                                              6
                                                                                                                                                                                                     7
                                                                                                                                           2
                                                                                              7                                                                                                      8
                              70                                                              8                                                                                                      9
                                                                                              9
                              60                                                                                                         1.5                                                         10
                                                                                              10
  Frequency of Sensor Trips




                                                                                                                                                                                                     11
                                                                                                        Log(Frequency of Sensor Trips)




                                                                                              11
                              50                                                              12                                                                                                     12
                                                                                              13                                           1                                                         13
                              40                                                              14
                                                                                              15                                                                                                     14
                              30                                                              16                                         0.5                                                         15
                                                                                              17                                                                                                     16
                              20                                                              18
                                                                                                                                                                                                     17
                                                                                              19
                                                                                              20
                                                                                                                                           0                                                         18
                              10
                                                                                              21                                                0   0.2   0.4      0.6     0.8       1   1.2   1.4   19
                              0                                                               22
                                                                                                                                                                                                     20
                               0.15   0.3    0.45       0.6     0.75       0.9   1.05   1.2   23                                         -0.5
                                                                                                                                                                                                     21
                                                    Bar Velocity (m /s )                                                                                        Bar Velocity (m/s)
                                                                                                                                                                                                     22
                                                                                                                                                                                                     23
Figure 4.1. Linear and logarithmic plots of trip frequency vs. average bar velocity for multiple trials.



4.2 Detection Accuracy

Tests were run to determine operational detection accuracy both before and after implementing

vacuously true error checking and error-buffering. Figure 4.2 shows the frequency of „error‟ reads at

different speeds before implementing error correction, and Figure 4.3. shows the frequency of „error‟

reads after implementing error correction. Prior to implementing error correction, glitch frequency


                                                                                                   21
increases as speed decreases. This is most likely due to input errors when the bar is between sensors,

causing the erroneous signaling of low-valued sensors to the processing circuitry. As is readily apparent,

the use of error correction in the manner outlined previously served to virtually eliminate all glitch read

errors in the system, guaranteeing a robust system with maximal detection accuracy.

                                             Fre quency (G litches ) V s. V elocity                                           Frequency (Glitches) Vs. Velocity
                                     9
                                                                                                                     9
                                     8
                                                                                                                     8
 F re q u e n c y o f G litc h e s




                                     7
                                                                                                                     7




                                                                                             Frequency of Glitches
                                     6                                                                               6

                                     5                                                                               5

                                     4                                                                               4

                                                                                                                     3
                                     3
                                                                                                                     2
                                     2
                                                                                                                     1
                                     1
                                                                                                                     0
                                     0                                                                                   0           0.5                           1                   1.5
                                         0          0 .5                         1    1 .5                                                        Velocity (m/s)
                                                           Ve lo c ity (m /s )


Figure 4.2. Without error correction.                                                        Figure 4.3. With error correction.



4.3. Safety

A mechanical stop was included with the apparatus in the event of electrical failure to safeguard the user

against injury from falling weight. In addition, tests were run to determine the maximum operational

currents associated with the four different operational PWM
                                                                                                                                                                   Maximum Operational Currents

states. The results of these trials can be found in Figure 4.4.                                                                                    6




The maximum current draw, fund during reversal
                                                                                                                                                   5


                                                                                                                                                   4

compensation, is ~5A, which is well below the operational
                                                                                                                                           Amps




                                                                                                                                                   3



limits of the 20A motor controller. As a result, it can be                                                                                         2


                                                                                                                                                   1
confidently concluded that the device will not experience
                                                                                                                                                   0
                                                                                                                                                           Uncoiling      Velocity           Bump Current   Reversal Current
electrical failure under normal operating circumstances.                                                                                                  Resistance
                                                                                                                                                            Current
                                                                                                                                                                        Compensation
                                                                                                                                                                          Current



                                                                                                                                       Figure 4.4. Electrical failure tests.




                                                                                                                         22
                                              5. COST

       (Prototype Costs Only)

5.1. Parts Needed:
              Sensor Arrays: (27 Emitter-Detector Pairs and 54 Resistors)
                     27*$2.70 + 54*$0.05 = $75.60

              25 lb. Aluminum Frame = 25*$0.789 = $19.73 [10]

              4Z144 Motor @ KingSolar.com = $134.29 [11]

              4 74LS148 Encoder Chips @ $0.93 = $3.72 [12]

              3 CD4072 Chips @ $0.50 = $1.50 [12]

              2 74LS14 Chips @ $0.87 = $1.74 [12

              1 Devantech MD03 Motor Driver @ $107.00 [13]

              Total Cost:    $343.58

5.2. Labor
              Labor to build machine: 8 hrs @ $50/hour = $400.00

              Design Labor over semester: 2 men @ 10 hrs/week, 14 weeks @ $20/hr
                     2*10*14*20 = $5,600
                     5600*2.5 = $14,000

              Total Cost:    $14,400.00



              GRAND TOTAL: $14,743.58




                                                 23
               6. CONCLUSIONS


The purpose of the electronic bench press spotter (EBPS) system is to allow weightlifters to work safely

without the assistance of others, even when engaging in failure exercise. Toward this end, the device

was designed to handle all of the typical and emergency situations for which a human spotter might be

asked to compensate. The three standard situations, defined herein as velocity compensation, reversal

compensation, and stuck compensation, were all constructed within the framework of the EBPS system

and functionality tests have shown that they perform reliably and within required specifications. Design

of the circuit was at times a problematic endeavor. Early input circuit designs proved to be ill-suited for

this particular implementation, and problems with original output circuit designs created a set of

electromechanical issues which threatened to scrap the project. The eventual prototype incorporated

multiple iterations on those initial designs into a working product.



The key question for the EBPS prototype is to what extent it can be scaled to full size for home or gym

use. Motor sizing estimates suggest that a much higher voltage motor in the 48V-90V range would

likely be required. Even with a 90V motor, a 300lb load would pull about 4kW, requiring almost 50A of

current. As such, any full-scale implementation should incorporate a gear box in tandem with the motor

in order to draw down torque and thus current requirements. Two possible home implementations are

readily apparent. The first would utilize a gear box and run a 48V motor driving system off of a 48V car

battery. Such a battery would likely last for months due to the relatively short periods of actual motor

operation. A second option would be to run a 90V motor from a wall source. Current requirements

would be drawn down again with a gear box. In addition, a large stiffening capacitor (roughly 4F) could

be connected in parallel with the motor to stabilize voltage level at the motor and dump excess current

into the motor when peak exceeds power source ratings. Both of these options appear to be plausible

solutions to the increased electromechanical requirements of a full-scale system. All other components

of the EBPS prototype would remain identical, ensuring an operative system.

                                                    24
REFERENCES

[1]   The Biofitness Institute, “Organizing the Workout Plan” 1994,

http://www.biofitness.com/strengt2.html

[2]   University of Arizona, “Mosfet H-Bridge Schematic and Theory of Operation” Dec. 1995,

http://www-isl.ece.arizona.edu/~soccer/team4a/data/motors/Hbridge_Theory.pdf

[3]   Bellevue International School, “H-Bridge Demystified” 1998,

http://www.barello.net/Papers/H-Bridge.pdf

[4]   Texas Instruments Technical Staff, Hardware Datasheets, Texas Instruments, 1988 (74LS148)

[5]   Texas Instruments Technical Staff, Hardware Datasheets, Texas Instruments, 1999 (CD4072B)

[6]   Netmedia, “BasicX Support”, 2004, www.basicx.com

[7]   4QDTEC Circuits Archive, “PWM speed control” 2004, http://www.4qdtec.com/pwm-01.html

[8]   J. Santana, J. L. Naredo, F. Sandoval, I. Grout and O. J. Argueta “Simulation and Construction of

a Speed Control for a DC Series Motor” Mechatronics, vol. 12, pp 1145-1156, Nov-Dec 2002.

[9]   Actuator Company of America, “Motor Constants 24V” 1999, http://www.actuator.net/24volt.htm

[10] MetalPrices Archive, “Price of Aluminum,” 2004, www.metalprices.com

[11] Motor Prices Archive, “4Z144 Motor Specs” 2004, www.kingsolar.com

[12] FindChips Archive, “Pricing” 2004, www.findchips.com

[13] Acroname Robotics, “MD03 by Devantech” 2004, www.acroname.com




                                                   25

								
To top