Docsity

Team Project Report on Driving Range Buddy | ECE 445, Study Guides, Projects, Research of Electrical and Electronics Engineering

Partial preview of the text

Download Team Project Report on Driving Range Buddy | ECE 445 and more Study Guides, Projects, Research Electrical and Electronics Engineering in PDF only on Docsity!

Driving Range Buddy By Xi Luo Xuan Tang ECE 445, SENIOR DESIGN PROJECT Spring 2007 TA: Hyesun Park April 29th, 2007 Group 6

ABSTRACT

The goal of our project is to implement a device, termed the Driving Range Buddy (DRB), to be mounted on a golf driving club. This device will be used to detect the swing speed of the user using an accelerometer. Additional components of the device will include a PIC microcontroller to be the core processor of the device, a 16x2 character LCD for easy to read display, a strain gauge to act as a contact sensor, and an amplifier to boost signal. In addition to speed display, the Driving Range Buddy will also include a feature to estimate the traveling distance of the golf ball and a “sweet spot” detector to tell if the user is making contact between ball and club head at the optimal point. The Driving Range Buddy will be compared against a radar device for speed accuracy. Performance requirements for the Driving Range Buddy include speed accuracy within ±15% of the radar device, over 10 hours of battery life, and to be free from potentially unsafe parts. ii

iv

1. INTRODUCTION

We want to implement a device to measure the swing speed of a golf club. An accelerometer is used to measure acceleration in “g’s” in terms of voltage. The acceleration will be sampled, integrated, and converted into a velocity to be outputted on a LCD display to the user. For added features, a sensor will be used to detect contact between the club and ball to pinpoint whether or not the optimal point is being hit. 1.1 Purpose Currently on the golf market, the main way of measuring swing speed is by the use of radar technology. These radar devices range from $90 to over $1000 depending on the model, sensitivity, and features available. We wanted to create a similar device using an alternative technology while adding features more specific to the game of golf. Moreover, the device we create must be low cost in comparison to radar devices to be a viable substitute for real users. This product is intended for entertainment purposes only and may be used to substitute or supplement existing technologies. As an academic goal, we plan on integrating current technological components to build a product that is not on the current market. Not only will we be using our electrical engineering skills to tackle problems in the areas of analog-to-digital conversion, microcircuits, power, sensors, amplifiers, and programming, but we will also have an opportunity to come up with a marketable idea that will be beneficial to golf and possibly extended to other applications. 1.2 Specifications The Driving Range Buddy (DRB) should be able to fit onto a regulation sized golf club and only require one user to operate. It will display speed measurements within ±15% of the radar output and display distance within ±10% of the projected traveling distance vs. swing speed as specified by the U.S. Golf Association. The speed and distance units displayed will be consistent with the usual golf units – miles per hour [mph] and [yards], respectively. The sensor will be placed at the center of the clubface and will illuminate a LED for 5-second duration once the sensor has been contacted. The DRB will have a minimum battery life of 10 hours. Safety measures of the DRB include avoid having sharp, loose, or hot components during operation. 1.3 Subprojects Our system is divided into several modules which perform different tasks. 1.3.1 Power Supply The power supply consists of a 9V DC battery source feeding into a 5V regulator and outputting +5V with respect to the ground. A push-button ON/OFF switch will be included to control between operating and non-operating modes. 1.3.2 Microcontroller The microcontroller will manage all the inputted information from the accelerometer and strain gauge/amplifier. The input signals will be processed into usable information and formatted to be displayed by the LCD and LED.

2. DESIGN PROCEDURE

The decisions made during the design process of the DRB are based around the areas of cost, availability, performance, physical dimensions, and safety. 2.1 Power Supply Decision The power supply portion of our project was a fairly straightforward decision. All the components of our system either required or had the capability of operating with a +5V source. Since there are no 5V batteries widely available to us or to the consumer market, a 5V regulator (LM7805) was required. We had the option of using batteries with voltages either below or above 5V. A battery voltage less than 5V would have required us to build a circuit to boost the voltage above 5V so that the regulator could step it down to a consistent 5V output, therefore we decided on just using a voltage greater than 5V going directly into the regulator to eliminate the need for a voltage booster circuit. With battery voltages above 5V and widely available, we had the option of putting 4 AA batteries in series to form a 6V input into the regulator or a single 9V battery going into the regulator. For both cost and physical reasons, we decided on a single 9V battery to be going into the 5V regulator and outputting a constant 5V DC to the system. 2.2 Microcontroller Decision The microprocessor serves as the brains of the system. All inputs and outputs are going into and coming out of the microprocessor, and all calculations are performed here as well. The Microchip PIC16F877A was chosen because it was available upon request from the TA for no charge, it had many analog & digital inputs and outputs, the hardware and software required for programming this particular microcontroller was widely available in the lab computers, and simple C language was sufficient to code the algorithms. 2.3 Inputs Decision The two input components of the DRB include the contact sensor and the motion sensor. When researching different types of contact sensors, I heard about strain gauges and learned that a civil engineering professor on campus had lots of experience working with them. I set up a meeting with this particular professor and we tried testing a strain gauge sensor he had to see if it would output an adequate change in signal for the microcontroller to pick up. He showed that with amplification, it could be done. The contact sensor we decided on is a 120Ω strain gauge from Vishay Microelectronics. The main reason we chose a strain gauge as a contact sensor is due to its physical shape and dimensions. The strain gauge itself is paper thin so once it is mounted on the face of the club head and comes in contact with the golf ball; it will not affect the trajectory of the golf ball nor the impact energy transferred from club to ball. Originally, we had intended to order strain gauges with a lower resistance than 120Ω to allow for greater change in resistance sensitivity, but upon contacting the distributor, we learned that ordering custom gauges with custom resistance values would increase the cost and time for delivery. They did, however, have a deal going on for students. They were offering ten 120 Ω strain gauges for a fraction of the price of custom ones. We went with the student deal. For the accelerometer, we chose the ADXL320 5g dual-axis accelerometer from Analog Devices. We decided on using the evaluation model instead of simply the surface mount model since the evaluation model and all the small pins of the surface mount chip soldered on including signal conditioning

capacitors. It was reasonably priced, and as shown below in Equation 2.1, we calculated the 5g threshold to be sufficient for measuring a velocity range of 0 to 110mph. va   t v o (2.1) (Assume constant acceleration at maximum 5g or 49.05m/s^2 ) v = velocity a = acceleration t = time (a typical swing lasts roughly 1 second v 0 = initial velocity, which, in this case, is 0m/s. vmax = 49.05* vmax = 49.05m/s or 109.69mph 2.4 Outputs Decision The outputs of the DRB are a LCD and a LED. A 16x2 character display was chosen for the number of characters it could display at once. The Seiko M1630 LCD was chosen for its price ($6.00), low weight (25 grams), low power consumption (2.5mA), and great contrast without the need for a backlight to save on additional energy. The LED was simply taken from the parts shop and placed in series with a 1kΩ resistor to restrict current from burning out the LED. 2.5 Mechanical Decision The device will consist of two separate circuit boards. One board will hold the strain gauge and amplifier circuit, while the other will hold the PIC, oscillator, accelerometer, LED, and 2x7 LCD ribbon cable DIP slot. The purpose of having 2 separate circuit boards is to allow for 2 layers of small/narrow circuitry instead one big/wide circuit to allow for mounting on the golf club. The smaller amplifier circuit board was placed on standoffs and epoxy glued on the inside of the club. The larger circuit board was placed on the top of the golf club and held in place by 3 standoffs mounted to the top of the club head. The 9V battery was attached by Velcro inside the club head to take advantage of the space left over. The LCD was fastened to the shaft of the golf club and connected to the larger circuit board with a 14-wire ribbon cable. A printed circuit board (PCB) would have been preferable for our type of application, however, due to errors in our previous PCB board and the delay time in resubmitting and receiving a new PCB board, our time was limited so we settled for a circuit board from the ECE store that allowed us to do all the wiring ourselves and allowed for connection errors to be undone and fixed.

Since acceleration is available from the accelerometer, Equation 3. 3 is used to calculate speed. However, the PIC can only do addition and multiplication; thus numerical approximation is used. 3.1.3a Riemann Sum Riemann Sum (Figure 3.1) is the simplest approximation for calculating velocity. Riemann Sum approximates the function by a constant function and obtains the area under the constant area. (3. 5 ) Figure 3.1 Riemann Sum 3.1.3b Composite Trapezoid Rule Composite Trapezoid rule (Figure 3.2) approximates the function by a linear function (degree one polynomial) and obtains the area under the linear function. (3. 6 )

Figure 3.2 Trapezoid Rule 3.1.3c Composite Simpson’s rule Composite Simpson’s Rule (Figure 3.3) approximates the function by a quadratic function (degree two polynomial) and obtains the area under the quadratic function. (3.6) Figure 3.3 Simpson’s Rule 3.1.3d Comparison of Algorithms Error Term Order Algorithm Accuracy Riemann Sum O(n^2 ) Cheap and easy to implement Least accurate Trapezoid Rule O(n^2 ) Cheap but hard to implement Slightly better than Riemann Simpson’s Rule O(n^4 ) Expensive and hard to implement Most accurate when samples are large Table 3.1 Comparison of Approximation Algorithms Based on Table 3.1, we selected Riemann Sum as the approximation of choice.

3.2.1 Strain Gauge The strain gauge was selected as the contact sensor due to its physical shape. The thin-film property of the strain gauge has minimum to zero effect on the trajectory of the ball after contact with the golf club. Additionally, the inelastic thin-film property minimizes impulse time during contact to avoid any loss of energy and momentum during contact as well. We decided on the Vishay (CEA-06-240UZ-120) student strain gauge due to its price and quick availability. It is a 120Ω strain gauge that changes linearly in resistance based on strain applied on the sensor. With a variable resistance sensor, we need to implement a circuit to incorporate this variable resistance to output a voltage signal for the PIC to detect. The original design was to use a simple voltage divider rule circuit. We picked this design due to the minimal amount of parts required – 1 resistor. Additionally the mathematical computation is very simple for the output voltage signal as shown in Figure 3.5 and in Equation 3.9. Figure 3.5 Voltage divider rule circuit 1 ( 1 ) in out x

R

V V

R R

V V

V V

 V  0.3847633705 V  0.3846153846 V 0.1465 mV The Rx represents the strain gauge resistance and R 1 is the resistor that we choose. In our case, Rx is 120Ω and the change in resistance of the strain gauge when pressing down on it with a finger is 0.05Ω (∆Ω= 0.05Ω). Since the ∆Ω is so small compared to the base resistance of the strain gauge, we needed to pick a R 1 low enough to show the ∆Ω of the strain gauge well enough to be distinguishable from noise and also not too low to draw higher amounts of current which decreases battery life. The change in resistance of Rx will translate to a change in Vout as shown in Equation 3.9. We chose a R 1 resistance of 10Ω and using this value of R 1 , 5V input voltage, and the strain gauge resistance in Equation 3.9, we obtained the following theoretical output voltages for non-contact and contact conditions. The change in voltage is roughly 0.15mV which is adequate for amplification.

From Figure 3.2.1, the current passing through the strain gauge, Rx, can be determined using Ohm’s law as shown by Equation 3.10. It can be seen that roughly 38.5mA of current goes through the strain gauge. V I R

V

A 

The problem with this setup is the amount of current going through the strain gauge heats up the sensor significantly and thus increases the resistance of the strain gauge (and output voltage) even without any contact. Because of this issue, we decided to use a different sensor circuit to avoid hot parts as a safety precaution. The alternative circuit that we decided upon was the Wheatstone bridge as shows in Figure 3.6. The corresponding equations for the Wheatstone bridge as specified by Equations 3.11 and 3.12. Again, Rx represents the strain gauge and R 2 is a 120Ω potentiometer used in balancing out the left leg with the right leg of the bridge. R 1 and R 3 are both 120Ω resistors. The output voltage of this circuit is the potential difference between point D and point B (V 1 -V 2 ) on Figure 3.6. Figure 3.6 Wheatstone bridge circuit 1 2 3 1 2 3 ( ) ( (^) x ) equiv x

R R R R

R

R R R R

To get a general idea of the current going through the strain gauge, we use Equation 3.2.3 to find the equivalent resistance. (120 120) (120 120) R 120 (120 120 120 120) equiv

equiv^120

V V

I A

R

Figure 3.8 Instrumental amplifier circuit The gain for our instrumental amplifier remained at 330. When we connected the Wheatstone bridge output into the inputs of the instrumental amplifier, we got a 0.4V change in voltage between non- contact and contact states. This is enough of a change for the PIC to recognize.

4. DESIGN VERIFICATION

4.1 Velocity Testing The device is tested radar technology. We compare the data collected from the DRB and the data from the radar device. The first set of data is shown in Table 4.1. Table 4.1 Device vs. Radar Data Set 1 Number 1 2 3 4 5 6 7 8 9 Device 46 47.5 50 53.7 54.7 55 55.7 62.5 63 Radar 45 46 48 50 53 55 53 64 65 Number 10 11 12 13 14 15 16 17 18 Device 63.1 64.3 66 67.6 68 68.5 69 75. Radar 67 55 59 62 63 55 65 69 As Table 4.1 shows, there is a big difference between the DRB and the radar, due to approximations and sampling errors in the algorithm. Thus, a modification is needed. Data are entered in MS Excel and a linear approximation is used. Number 1 2 3 4 5 6 7 8 9 Device 70 71 72 73 81 83 87 89 94 Radar 43.5 44.1 44.7 45.3 50.3 51.6 54.1 55.3 58. Number 10 11 12 13 14 15 16 17 18 Device 95 96 96 100 103 115 116 117 131 Radar 59.0 59.6 59.6 62.1 64 71.5 72 72.7 81 Table 4.2 Device vs. Radar Data Set 2 Driving Buddy vs Radar y = 0.6289x + 15. 0 10 20 30 40 50 60 70 80 90 0 20 40 60 80 100 Driving Buddy - mph Radar - mph Series Linear (Series1) Figure 4.1 MS Excel graph for Data Set 1 After the linear approximation, we modified the velocity to be:

Piecewise function 30 35 40 45 50 55 60 65 70 75 30 40 50 60 70 80 90 Radar MPH DR Buddy MPH <=

Figure 4.3 Piece-wise function With these modifications, a piece-wise function that modifies the velocity is obtained as in Figure 4.3, 40 more data are taken after this, and it gives the average relative error of 9.15% with standard deviation of 6.7%. 4.2 Battery Life The device works under a 9V battery and the current draw is 11.4MA. We calculate the power: P = V I = 9V  11.4 10 A = 0.103 W (J/S) - (4.2) There are 19,278 J in a 9V battery. Thus the battery life is calculated as: 1 19278 52 0.103 3600 S h J h J S

This battery life meets the 10 hour battery life specifications.

5. COST

5.1 Parts Table 5.1 Parts

    1. INTRODUCTION....................................................................................................................
    • 1.1 Review and Update Material..............................................................................................
    • 1.2 Specifications......................................................................................................................
    • 1.3 Subprojects.........................................................................................................................
      • 1.3.1 Power Supply..............................................................................................................
      • 1.3.2 Microcontroller...........................................................................................................
      • 1.3.3 Inputs..........................................................................................................................
      • 1.3.4 Outputs........................................................................................................................
      • 1.3.5 Mechanical..................................................................................................................
    1. DESIGN PROCEDURE...........................................................................................................
    • 2.1 Power Supply Decision.......................................................................................................
    • 2.2 Microcontroller Decision....................................................................................................
    • 2.3 Inputs Decision...................................................................................................................
    • 2.4 Outputs Decision................................................................................................................
    • 2.5 Mechanical Decision..........................................................................................................
    1. DESIGN DETAILS..................................................................................................................
    • 3.1 Microcontroller...................................................................................................................
      • 3.1.1 A/D Conversion..........................................................................................................
      • 3.1.2 Acceleration Conversion............................................................................................
      • 3.1.3 Velocity Calculation...................................................................................................
        • 3.1.3a Riemann Sum.......................................................................................................
        • 3.1.3b Composite Trapezoid Rule..................................................................................
        • 3.1.3c Composite Simpson’s Rule..................................................................................
        • 3.1.3d Comparison of Algorithms..................................................................................
      • 3.1.4 Distance Approximation.............................................................................................
      • 3.1.5 Displaying Outputs to LCD....................................................................................
    • 3.2 Sensor.................................................................................................................................
      • 3.2.1 Strain Gauge...............................................................................................................
      • 3.2.2 Amplifier...................................................................................................................
    1. DESIGN VERIFICATION.....................................................................................................
    • 4.1 Velocity Testing................................................................................................................
    • 4.2 Battery Life.......................................................................................................................
    1. COST......................................................................................................................................
    • 5.1 Parts..................................................................................................................................
    • 5.2 Labor.................................................................................................................................
    1. CONCLUSIONS....................................................................................................................
  • Microchip PIC16F877A Microcontroller 1 $ 3.00 $ 3. Vender Part Number Description Qty Price Each Total Price
  • Analog Device ADXL320 Accelerometer 1 $ 29.95 $ 29.
  • NA NA Golf Club 1 $ 19.99 $ 19.
  • Sony 9V Battery 1 $ 3.00 $ 3.
  • NA NA LEDs 1 $ 0.27 $ 0.
  • Seiko M16320AA LCD 1 $ 13.60 $ 13.
  • Fox FOX F1100E Oscillator 1 $ 1.63 $ 1.
  • Radio Shack NA Board 2 $ 3.69 $ 7.
  • NA NA Glue 1 $ 3.00 $ 3.
  • NA NA Resistors 7 $ 0.30 $ 2.
  • NA NA Potentiometer 1 $ 0.50 $ 0. - $ 84.
    • Xi: $35/hour x 2.5 x 150 hours = $13, 5.2 Labor
    • Xuan: $35/hour x 2.5 x 150 hours = $13,
    • Total labor: $13,125 + $13,125 = $26,
  • Total cost = $84.42 + $26,250 = $26,334.