Balancing Omni-directional, Multi Surface Skateboard (BOMSS) Final Report April 28, 2010 Casey Christensen Harrison Cobb Misael Marriaga Table of Contents Requirements Specification ………………………………………………………………………….……………………. 3 Implementation Considerations .……………………………………………………………………….….………………….. 6 Updated Project Test Procedures ....................................................................................... 7 Project Overview and Summary …….………….…………………………………………………………………..………… 8 Operation and System Analysis …………………………………………………………….………….………….…………. 9 Frame ……………………………………………………………......………………………………………………….………..…… 10 Sprocket-to-Wheel Assembly Axles ………………………………………...……………………………………………........ 14 .....……………………………………………………………………………………………………………………………… 16 Chain Alignment and Tensioning ………….……………………………………………………………………… 17 Controls System and Simulation …………………………………………………………………………………. 20 Voltage Indicator Circuit …….…………………………………………………………………..…………………… 26 Power Supply Circuit ….………………………………………………………………………………………………………. 27 Microprocessor ………………………………………………………………………………………………………….. 28 Motors and Motor Driver ……………………………………………………………………………………………… 30 Software ………………………………………………………………………………………………………………………. 33 Sensors …………………………………………………………………………………………………………………..….. 36 Power Requirements .……………………………………………………………………………………………………..….. 38 Project Completion Analysis Project Summary ……………………………………………………………………………………… 39 ………………………………………………………………………………………………………….. 40 Budget Analysis ….………………………………………………………………………..……………………………………….… 41 Test Results ………………………………………………………………………………………………………….. 42 Appendices ………………………………………………………………………………………………………………………………..…. 44 2 Requirements Specification Balancing Omni-directional, Multi Surface Skateboard (BOMSS) Harrison Cobb, Misael Marriaga, Casey Christensen Overview Riding a skateboard can be difficult and discouraging to learn. We will create a device that will allow beginners to quickly enjoy being able to ride a skateboard. It will also have a compact design that allows it to be easily maneuvered in an urban environment. The BOMSS will be a skateboard-style, self-balancing vehicle. Basic design consists of a platform for the rider to stand on, with two independently operated wheels fastened centrally to the underside. The BOMSS will be an enjoyable recreation vehicle for users of nearly any age that are looking for a unique and inventive new way to spend their time. Its maneuverability and ability to operate efficiently in many different environments will make it stand apart from other similar recreational and transportation vehicles. Operational Description The design is a two wheeled, self balancing vehicle that provides a dynamic turning radius, meaning that the turning radius is proportional to the velocity of the vehicle, with a near zero turning radius at no forward motion. If the vehicle, for example, is traveling at a rate of 4 m/s, the turning radius will be much greater and therefore more stable than if the vehicle were traveling at a rate of 0.5 m/s, where the radius would be significantly decreased. This will make the vehicle useful and easy to maneuver in an urban environment. The Balancing, Omnidirectional, Multi Surface Skateboard (BOMSS) will utilize accelerometers and gyroscopes to sense the angular position of the skateboard with respect to the horizontal plane. This information will then be used as an input in its controls algorithm. The vehicle will be maneuverable in the forward and aft direction, as well as steering left and right. Safety features will include a minimum rider weight and an anti-theft key. Before power is delivered to the system, the rider must insert a removable anti-theft key and then fully depress a mechanical weight sensor. Power is provided by a rechargeable, on-board battery. 3 Technical Requirements: 1. The BOMSS will achieve a maximum speed of no less than 4 m/s (13 ft/s) and no more than 10 m/s (33 ft/s) for safety concerns. 2. The BOMSS will be powered for a runtime of no less than 60 minutes at an average of 30% maximum speed. 3. A turning radius of no greater than 1 m x 1 m (3 ft x 3 ft) at zero forward motion. 4. The BOMSS will have a low battery indicator light (cutoff voltage to be determined). 5. The BOMSS will be capable of carrying a 91 kg (200 lbs) adult over dense materials such as pavement and concrete, on both a flat and inclined plane. 6. The BOMSS will weigh no more than 23 kg (51 lbs). Deliverables: 1. 2. 3. 4. 5. 6. User’s manual Self balancing skateboard with anti-theft key CAD drawings, electronic schematics, 3D views and analyses Code and flowcharts Report of testing Final report Testing Plan: To ensure proper operation, the following tests will be conducted: Run Time Test: To test run time, the BOMSS will be required to maintain operation for a total time of approximately sixty (60) minutes. The rider will weigh between 91 and 100 kg (200-220lbs) and will be required to maneuver a predetermined course (refer to Figure 1) around the Harding University campus containing level planes, inclines, and declines over a multitude of surfaces. Riding times can be discontinuous, but a total time of sixty (60) minutes must be summed at an average of 30% of the maximum speed before the battery is recharged. 4 Figure 1: The course the BOMSS will be required to navigate during the test period is indicated in red. The starting and ending place is the Pryor-England Science Center highlighted in yellow. The BOMSS will complete the course at least once to demonstrate its ability to operate on varying surfaces. Care was taken in determining the course as to not encounter any dangerous traffic or intersections that would place the tester in harm’s way. Maximum Speed Test: To test the maximum speed, the BOMSS will be mounted and proven to travel a measured distance in a given amount of time. A stopwatch will provide an adequate amount of accuracy. The distance will be forty (40) meters on a flat, asphalt or concrete surface. Time to travel this distance must be between four (4) and ten (10) seconds. Turning Radius Test: To test turning radius, only a minimum turning radius will be required. The skateboard will be placed inside a taped-off square of one (1) meter by one (1) meter, and then mounted. A satisfactory test will be if the skateboard can be maneuvered a full 360° without leaving the taped square. 5 Implementation Considerations The operational components will be contained in water and vibration resistant compartments where they will be protected from collisions with foreign objects. These compartments and the components they contain will be easily accessible to the user, while remaining “hidden” within the structure as to not interfere with the user’s ability to effectively operate the vehicle. 6 Updated Project Test Procedures Initially, a single test was designed to demonstrate workability of multiple components of the system. This method was determined to have a high risk factor for failure based upon the large number of dependent pieces; therefore, we are proposing testing that comprises a greater breakdown of each individual component being tested. The original tests are not being eliminated, but will be implemented in a different format. We propose the following testing procedures: Runtime Test The BOMSS will operate at 30% of full motor capacity for a total duration of no less than sixty (60) minutes. This test will be conducted on a treadmill with a rider. Maximum Speed Test The BOMSS will operate at a maximum speed of no less than 4 m/s and a maximum speed of no greater than 10 m/s. This test will be conducted on a flat open surface where the maximum speed can be reached, maintained, and then allow for deceleration without turning. Turning Radius Test The BOMSS will complete a full 360° turn while remaining in a radius of no greater than 0.5m. This test will be conducted with a rider. Incline Test The BOMSS will operate both uphill and downhill at an incline of angle 3°, while safely controlled by a rider weighing approximately 80 kg (176 lbs). The incline will be provided by a treadmill operating at 30% maximum speed. Multi-variable Test The BOMSS will be required to maintain operation for a total time of no less than sixty (60) minutes. The rider will weigh between 91 and 100 kg (200-220 lbs) and will be required to maneuver a predetermined course (refer to Figure 1) around the Harding University campus containing level planes, inclines, and declines over a multitude of surfaces. Riding times can be discontinuous, but a total time of sixty (60) minutes must be summed at an average of 30% of the maximum speed before the battery is recharged. 7 Project Overview and Summary The goal of the Balancing Omni-directional Multi-Surface Skateboard (BOMSS) is to design a two wheeled, self balancing vehicle that provides a dynamic turning radius. A dynamic turning radius is such that the turning radius is proportional to the velocity of the vehicle, with a near zero turning radius at no forward motion. If this vehicle, for example, is traveling at a rate of 4 m/s, the turning radius will be much greater and therefore more stable than if the vehicle were traveling at a rate of 0.5 m/s, where the radius would be significantly decreased. This will make the vehicle useful and easy to maneuver in an urban environment. The Balancing, Omnidirectional, Multi Surface Skateboard will utilize accelerometers and gyroscopes to sense the angular position of the skateboard with respect to the horizontal plane. This information will then be used as an input in its controls algorithm. The vehicle will be maneuverable in the forward and aft direction in this manner. Turning radius will be calculated by measuring a variable voltage through force sensors located underneath one of the foot pads. 8 Operation and System Analysis 9 Frame Before construction could begin, an accurate representation of the structure’s resilience was important. Without knowing if the frame would support typical operational conditions, the project required a detailed and complete analysis to ensure proper function. Therefore, an accurate model of the frame was constructed in SolidWorks and simulations were run to determine failure points, deflection amounts, and stress concentrations. Figure 2 shows the results from the virtual testing of the frame/axle assembly. Figure 2: The figure shows a perspective of the frame and shaft assembly after stress analysis using SolidWorks. A load was applied to both foot platforms to simulate a rider. The frame was designed to allow ease of portability when not in operation and to require few storage requirements, so weight and overall size were heavily considered when designing the frame. The final frame dimensions can be seen below in Figure 3. 10 Figure 3: Completed dimensions of metal frame. The frame was designed for structural integrity while remaining within the stipulated weight restriction. Smaller tubing, 0.75” square, was used in areas where bracing was needed and 1” square tubing was unnecessary. The strength of both tubing sizes is virtually the same, so in these areas, using the smaller size does not weaken the frame structure, it only lightens the overall mass. During construction of the metal frame, the sides, as they were being welded, began to warp due to an uneven welding surface, and the excessive heat traveling through the thin metal tubing. After one side was completely welded and the issue was found, it was straightened by placing force on the bowed out surface. This allowed for a perfectly straight side. With this knowledge, the other side was constructed in a different manner to eliminate this issue. The long rails at the top of the sides making up the standing platform were spot welded to the welding table to eliminate movement. Next, each individual piece was spot welded to these main rails, as well as the table. Only spot welding these pieces eliminated the high concentrations of heat, and ultimately resulted in a straighter completed side. Once the entire side was spot welded, it was cut off the table and then, over a longer period of time, was welded completely. After the sides were finished and checked for straightness, the two could be connected. The frame is the same width throughout, so the connecting tubes were all cut to be the same length. This also ensured that the sides were straight in that as the final connecting pieces were being welded, they met up with the other side exactly where they were designed to. The completed frame can be seen in Figure 4. 11 Figure 4: Completed frame ready to have motors and all other components implemented. The frame, as specified in the fall semester, must withstand a rider weighing at least 91 kg (200 lbs). After construction was complete, an individual was asked to stand on the frame under no power and try to balance. The rider weighed 125 kg (275 lbs), exceeding the maximum amount. The frame, axles, and wheel assembly withstood the forces of mounting, dismounting, and rocking back and forth for over ten minutes, ensuring that the frame was rigid enough to carry a rider of the specified maximum mass. The frame was tested in the fall semester with a load of 227.3 kg (500 lbs). This excessive load was applied to ensure that a rider of the maximum weight could be held by the frame. Placing a rider of this mass on the completed frame was not possible, but the mass that was applied confirmed our original design and analysis. The physical dimensions match the original design exactly, as the frame pieces were cut and ground to fit exactly on the plans. The completion of the frame allowed for the individual placement and alignment of each individual piece into the frame, i.e. motors, chains, wheels, microprocessor, gyro, accelerometer, etc. The frame was designed and built so that each component can be moved a small amount about its mount to allow for exact alignment. Without proper positioning of each component, the devices, as a whole, will not operate smoothly and may experience unexpected failure or fatigue due to binding or misalignment. Also, there will be room provided to work on these individual components that are incorporated into the frame. If an item needs to be removed for any reason, access to that component will not be hindered in any way by the frame design and structure. 12 If this project were ever to be redone, there are a few aspects for the frame construction that I would suggest be altered. First, the frame, as a whole, is excessively heavy. It was designed to withstand any forces applied to it, but with a factor of safety of 14, significant amounts of material can be removed while maintaining rigidity and integrity. The frame weighs an approximate 10.43 kg (23 lbs), and this mass can possibly be reduced by almost half, and still have a factor of safety larger than necessary. Second, the design of the bracing needs to be altered to allow ease of mounting components into the frame. The motors are now between two braces and any movement available for final alignment is minimal. 13 Sprocket-to-Wheel Assembly To ensure proper alignment of the wheel sprocket, there are threaded U-bolts used to tighten the sprocket against bracing on the wheel. This compresses the sprocket and wheel together, providing a tight and rigid connection while not allowing slipping. If further adjustments need to be made to the sprocket-to-wheel assembly for any reason, it will simply require the loosening of the necessary bolt, adding or removing material where necessary, and re-tightening. By using this method, minute differences in alignment can be remedied with simple alterations and minimal effort. Figures 5 and 6 are visual representations of the above description. Figure 5: Front view of wheel and sprocket assembled. 14 Sprocket U-Bolts Figure 6: Completed assembly ready for implementation. The assembly process went mainly as planned, but some complications arose that were unexpected. The most noteworthy issue is that of the plastic wheel deforming under the pressure of the tightened bolts. The bolts needed to have a sufficient amount of tension on them to not allow for loosening or movement while under power. To remedy this issue, more bracing between the sprocket and wheel was created. This allowed for more contact between the two surfaces and when the bolts were tightened, the pressure was more evenly distributed over the entire wheel. The alignment was more difficult than expected as well. The sprocket and wheel were not made to be assembled. The large diameter hole in the center of the sprocket did not allow for a tight fit around the center hub of the wheel, as seen in Figure 6. Therefore, the sprocket had to be mounted as close as possible, tightened, and then properly aligned. This was done by spinning the wheel while off of the skateboard, finding the side of the sprocket that is bulged out, and applying force to that spot on the sprocket, causing he sprocket to gently slide over and become properly aligned. Ever though this method allowed for a precise alignment, the sprocket is still off of center a minimal amount (< 1 mm). Finally, a wheel constructed of a more durable material, such as metal, is suggested. After testing, the wheels showed extensive wear and fatigue around the spokes. The plastic spokes of the wheel can withstand large vertical, downward, forces, but with the bolts slightly deforming the wheel with a horizontal force, the vertical force becomes off of center and too large for the wheel to carry, creating weakness and unavoidable failure. A different mounting system for the sprocket, or a different wheel would remedy this issue. The mounting of the wheel and sprocket assembly to the frame did not pose any issues. The wheels have built in bearings on the center hub that allow for nearly frictionless rotation. 15 Axles The axles were ordered larger than needed for both the main drive wheels and the safety wheels. The main drive wheels have a diameter of 0.435” (1.105 cm), while the safety wheels have a diameter of 0.313” (0.795 cm). Axles were ordered at a diameter of 0.5” (1.27 cm) and were lathed down to the desired diameters. This was done because, to order the exact sizing needed, the cost would have more than quadrupled. Having access to a lathe in the engineering labs allowed for expediency and precision in the lathing process. Figures 7 and 8 below show the pictures of the axles before and after the lathing process. Figure 7: Axle before lathing process. Diameter is 0.5” (1.27 cm) Figure 8: Axles being lathed Not having a working knowledge of the lathe in the engineering department caused a time delay in completing this portion of the build, but after a short training period, both axles were cut and polished with precision and accuracy. 16 Chain Alignment and Tensioning In order to efficiently transfer power from the motors to the wheels, all of the drive train components must be aligned with each other. If there is even a slight misalignment between any two sprockets, binding and undue stress will be placed upon the system, possibly causing a premature failure of one or more components. The motor is mounted in a fashion that will also allow slight changes to be made with ease. The motor has a four-bolt plate affixed to the bottom side allowing a sturdy platform for mounting. Four holes can be drilled into the mounting platform of the frame, but if the holes are slightly off from the mounting hole on the motor plate, the alignment will be off. Therefore, a method was developed that will allow the motors to have the ability to be adjusted while attached to the motor mounts. Each motor has the ability to rotate approximately 10° in either direction, ensuring exact alignment of the chain, drive sprocket, and the motor sprocket. Figure 9 depicts the mounting method that is employed for this device. Holes/slats cut into frame mounting plate Mounting plate affixed to motor (Blue) Motor (Red) Figure 9: The motor and mounting holes on the motor plate (red dashed) shown with the mounting plate (blue dashed). Adjusting slats will be cut into the frame mounting plate (black lines) so the motor can be adjusted by a small amount, as indicated by the arrows, to ensure proper alignment. When the precise position is found, the motor will be bolted down using thread locking fluid. 17 Once the motors were fit to the frame and the holes were drilled, an issue arose that was not expected. The design of the frame has each motor sitting between two upright supports with little room for movement. This was done to ensure that the motors fit snugly into the frame and there would be no flex when under power. However, since these supports are located so close to the motors, the movement/rotation of each motor is drastically reduced. The motor, in reality, cannot rotate 10° in each direction. The most movement that can be achieved is limited to approximately 2° in either direction. This does not pose an issue though, because the motor, when inserted into the frame, is already aligned as desired. Determining that the alignment was correct was done by attaching the wheel and chain to the motor and, during slow rotations, the teeth of the motor sprocket were observed to ensure proper gear mesh and attack angle. If this alignment were not correct, the chain would come off of the sprocket, or would not seat properly into the sprocket. Once it was seen that the alignment was satisfactory and smooth rotation was achieved, it was clear that the mounting method mentioned above was not required for the final alignment. The tension of the chain was not satisfactory once the motors and wheels were mounted, so a tensioning device was created and attached to the frame to get the proper tensioning. Figure 10 shows the device that was created to remedy the tension issue. Figure 10: Tensioning device A simple motor was mounted to the frame and an 11 tooth sprocket was affixed to that small motor’s shaft. The small motor does not serve any other purpose other than tensioning, 18 and does not have any measurable resistance opposing free rotation. This method was created after it was discovered that the chains that were ordered in the fall did not come with a master link, although the description indicated they would. Not having the ability to take links out and make a master link, this method was developed. The small motor can be rotated in its mount and tightened at any position to get precisely the tension desired. Having this tension correct was mandatory as to not allow for any “slop” in the chain. If this were the case, either the chain could come off the sprockets, creating an unsafe situation, or the motors would not be able to balance the board, as the small movements/corrections made by each motor would have been “soaked-up” in the amount of slack. Figure 11 shows the properly aligned and tensioned chain. Figure 11: properly aligned and tensioned chain. As the motor and wheels were attached to the frame and the chain tensioning was not acceptable, altering the distance from the motor shaft to the wheel shaft was not possible, creating too much slack. The only remedy was to alter the length of the chain or, in our case, create a tensioning device. If the design of the frame were different, as mentioned in the frame section, the motor could have been moved over the necessary amount and shortening the chain would not have been necessary. This issue was not a factor that held the project back, but if it were to be redone, a different mounting system would make the final alignment less time consuming and labor intensive. 19 Controls System and Simulation The controls algorithm is based on solving a classical inverted pendulum problem. Proportionalintegral (PI), proportional-derivative (PD), and proportional-integral- derivative (PID) controllers are widely used in controlling the behavior of such unstable systems. Nevertheless, most inverted pendulum systems are single-input, single-out systems. BOMSS is a multiple-input, multiple-out unstable system, hence the controls system is based on feedback gain and an integral gain to stabilize its response to disturbances introduced by the rider and the environment (vibrations, ground irregularities, etc.). BOMSS was modeled as a two-wheeled inverted pendulum as seen in Fig. 12. Figure 12: Side view (left) and plane view (right) of the inverted pendulum. In Fig. 12, represents the tilting angle of the skateboard, represents the average angle of rotation of the right and left wheels, and represents the turning angle of the skateboard. The rest of the physical parameters are listed below. g 9.81 m s 2 : gravitational acceleration m 0.34 kg : mass of each wheel R 0.1 m : radius of each wheel JW mR 2 2 kg m 2 : mass moment of inertia of each wheel M 23 kg : body mass of the skateboard W 0.305 m : width of the skateboard 20 D 0.79 m :depth of the skateboard H 0.2 m : height of the skateboard L 2H 5 m : distance of the center of mass from the wheels axle J M ( D2 H 2 ) 12 kg m 2 : body pitch moment of inertia J M ( D2 W 2 ) 12 kg m 2 : body yaw moment of inertia J m 0.0154 kg m 2 : DC motors inertia moment Rm 1 :DC motors internal resistance Kb 0.0075 Vs rad : DC motors back EMF constant Kt 0.065 Nm A : DC motors torque constant n 65 11 : pinion-to-sprocket gear ratio f m 0.2 : friction coefficient between body and DC motors f w 0.5 : friction coefficient between wheel and floor The values for f m and f w where estimated since they are difficult to measure. The mass of the wheels were measured with a bathroom scale, and the radius of the wheels was measured with a metric ruler. The mass moment of inertia of each wheel was estimated as the moment of inertia of a uniform disk with same radius and mass as the wheels. The mass of the skateboard was measured with a bathroom scale. The width, depth and height of the skateboard were determined directly from the dimensions shown in the design diagram, Fig. 3. The distance of the center of mass from the wheels’ axle was estimated by taking into account that most of the components in the skateboard were placed below half the height of the skateboard. The body yaw and pitch moments of inertia were estimated as the moments of inertia of a rectangular box with the same depth, height, and width as the skateboard. The values for Rm , Kb , Kt , and J W were determined experimentally. The internal resistance Rm was determined by connecting a multimeter to the motors and the terminal to terminal resistance was measured. The back EMF constant Kb was measured by connecting the shaft of the motors to a drill with known angular velocity, Fig. 13. The voltage produced by the motors when the shaft was forced to rotate by the drill was measured. The value of Kb is the produced voltage divided by the angular velocity of the drill. The value for K t was determined by dividing the average torque delivered by the motor specified in the data sheet by the maximum current drawn by the motor, also specified in the data sheet. The moment of inertia of the motor was measured by connecting the shaft to a tachometer 21 while providing power to the motors, Fig. 14. The final velocity of the shaft was measured with the tachometer. An estimate of the angular acceleration of the motor shaft was calculated by dividing the final velocity of the shaft by the time it took the shaft to reach it. The torque provided by the motor was estimated by multiplying the voltage provided to the motor by the previously determined torque constant. If follows that the moment of inertia is equal to the torque divided by the acceleration of the shaft. The validity of these parameters will be tested by observing how well the skateboard balances when the microprocessor, motor controller, and sensors are installed on the skateboard. Pitch and yaw moment of inertia, and the distance of the center of mass from the axle will be altered in order to make the skateboard balance. Figure 13: Motor shaft connected to drill with known angular velocity. Figure 14: Motor connected to tachometer. 22 BOMSS is expected to function with two inputs (the voltage provided to each motor) and four outputs (angular position and velocity of the wheels, and the tilt and tilt rate of the skateboard). Therefore, the state vector is x And the input vector is v u l vr where vl and vr are the voltage provided to the left and right motors, respectively. The resulting state-space representation of the system, once the physical parameters were measured, is the following. 0 1 0 0 0 0 0 0 0 1 0 0 x x u 0 3.8307 0.8771 0.2347 0.2221 0.2221 0 13.4561 0.0013 0.0653 0.0618 0.0618 We know from modern controls theory that the system is unstable if the four-by-four matrix in the state-space representation has eigenvalues whose real parts are positive. The system’s eigenvalues are [0, 3.6359, -3.7009, -0.8775]. This verifies that one of the states is unstable; namely the angle of tilt . The necessary feedback gains and the integral gain were determined by the linear-quadratic regulator method, which determines the system’s optimal eigenvalue placement. The resulting feedback gains are [-0.1452, -6.1292, -0.0812, -0.4205](108) and the resulting integral gain is -5(105). When the gains are introduced, the closed-loop eigenvalues are [-1.9424+1.8820i, -1.9424-1.8820i, -.0042+0.0052i, -0.0042-0.0052i, -0.0097](102). Note that all the closed-loop eigenvalues have negative real parts, which indicates that the system is now stable. Figure 15 shows the simulated response of the skateboard to different disturbances. 23 Tilt Angle (degrees) Time (s) Tilt Angle (degrees) (a) Time (s) Tilt Angle (degrees) (b) Time (s) (c) Figure 15: Response of the skateboard (a) during stationary balance, (b) when balancing during back and forth motion, and (c) forward movement while turning. At the time when the rotary encoders were ready to be mounted on the skateboard, we realized we did not have enough input pins on the microprocessor in order to have an input signal from both rotary encoders. To solve this problem, a summing amplifier with a gain of 0.5 was suggested to calculate the average of the signals coming from both encoders and just use one input port. Nevertheless, the battery could not provide 15 V and -15V the op-amp needed to function properly. This idea was dismissed. 24 An observer was designed to estimate the angular velocity and position of the wheels to compensate for the lack of sensing devices. The angular velocity of the wheels was observable, but the angular position of the wheels had to be estimated by integrating angular velocity with respect to time. The first design of the observer yielded unsatisfactory results since the initial error in the estimation of the velocity of the wheels was also integrated and the estimated position did not converge to the actual position. The observer was redesigned so that the estimated velocity would have a smaller initial and error. Additionally, the initial conditions enforced in the estimates of the states in the observer in order to account for discrepancies between the mathematical model and reality were eliminated since the position of the wheels could be reset every time the skateboard stops. The robustness of the observer was tested by changing the open-loop eigenvalues of the observer slightly away from the open-loop eigenvalues of the model. The estimations converged successfully. The improved estimates of the states are shown in Figure 16. wheels position (radians) States x and their Estimates xhat 0.2 State theta Estimate thetahat 0 -0.2 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 time (sec) body tilt (radians) 10 State psi Estimate psihat 5 0 -5 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 wheels velocity (rad/sec) time (sec) 10 State thetadot Estimate thetadothat 5 0 -5 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 body tilt rate (rad/sec) time (sec) 2 State psidot Estimate psidothat 0 -2 -4 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 time (sec) Figure 16: States response estimated by observer during stationary balance. 25 0.45 0.5 Voltage Indicator Circuit It was decided that it was necessary to provide an indicator of the supply battery’s voltage, be it a digital display, LED display, or low battery indicator light. After attempting to design a three LED indicator, several unsuccessful attempts led to a simplified circuit utilizing a transistor to control the brightness of an LED. A circuit was designed to fully illuminate an LED at 24 V and be “off” at 21 V. The lower voltage was selected after studying the battery drain characteristics to prevent the battery from being damaged by excessive low voltage. A potentiometer is built into the circuit to provide “tuning” of the voltage cutoff. The Multisim schematic, as well as the PCB of this circuit, is shown below in Figure 17. (a) (b) Figure 17: Multisim Schematic (a) and Etched (b) Low Battery Voltage Indicator Circuit 26 Power Supply Circuit Power must be supplied to the microprocessor, gyroscope and accelerometer; to do this a power supply circuit was designed to provide 12V and 3V according to the appropriate requirement. A measured voltage of 12.25V is provided via the Powerstream model MW292 DC-DC converter, which minimizes power loss while also smoothing supply voltage peaks from the battery. The accelerometer and gyroscope are powered at a steady 3.11V, even when motors are being run, by a 5V voltage regulator in series with an equivalent resistance of 357Ω. Even though voltage regulators cause greater power loss than some alternatives, the actual amount of losses over the regulator and resistors is only .05335W. The PCB Artist diagram and a photograph of the professional circuit board are shown in Figure 18 below. (a) (b) Figure 18: PCB Artist Diagram (a) and Photograph (b) of Power Supply Circuit 27 Microprocessor The main component of this project is Futurlec’s development board with a Microchip brand PIC18F458 PID microprocessor. With 32kb onboard flash memory, 10MHz crystal, 4 Pulse Width Modulated (PWM) outputs, 8 A/D converters and 34 I/O bits this microprocessor was capable of meeting our demands. Two independently controlled PWM signals are produced, one for the voltage control to each motor via the motor driver, and altered through software to maintain balance of the skateboard. The development board purchased is shown in Figure 19 below. Figure 19: Futurlec’s PIC18F458 Development Board To compile code, MPLAB IDE and MPLAB C18 software from Microchip were downloaded and installed so that C code could be written and compiled into hex code. Code has been written and successfully loaded onto the microprocessor to demonstrate the main components of each individual component: accelerometer function, gyroscope function, force resistor reading for both weight and turning, and independent control of two PWM signals. The main program collects data from several sensors before processing that data through a number of mathematical algorithms, including a mathematical state observer to estimate the velocity of 28 the skateboard and the control algorithm equations, to produce the proper PWM duty cycle to output to the motor driver. The PWM signals control the speed of the motors and, therefore, the skateboard. The screen capture of an oscilloscope showing a waveform produced by the microprocessor is shown in Figure 20. The software written in MPLAB C18 can be found in the appendices. Figure 20: Pulse Width Modulated (PWM) signal produced by software run on the PIC18F458 microprocessor. 29 Motors and Motor Driver Using calculations made in the design phase, we determined that a motor power of 300W/motor would be adequate to maintain nearly 3m/s up a 10° incline. After searching online we purchased two 300W motors from Unite Motors through the website electricscooterparts.com. Model MY1016 motor’s rated voltage is 24V DC, rated current is 16.4A and rated speed is 2750 RPM. We decided to use a 24 volt power supply because it requires lower current flow, which will prevent the ‘burning out’ of sensitive components. The drawbacks to these motors are the weight (2.54 kg) and dimensions (0.101m x 0.101m x 0.137m). The project remained within predetermined size limits, but due to the mass of the frame and motors the skateboard went overweight by 9.6 kg (21.2 lbs). The motors are pictured below in Figure 21. Figure 21: Unite Motor Co. 24V DC, 300W Model MY1016 Motors The original intent was to purchase 350W motors; however, we were unable to obtain any motors of this power rating for a reasonable price. The decision to use 300W motors was made after it was determined that the supplied power would be adequate for meeting our requirements specification. These 300W motors proved to be no less capable of controlling the skateboard and we were still able to meet the maximum velocity requirement specifying a maximum velocity of no less than 4m/s. Also, the lower current draw of the motors provided 30 for a longer runtime for the battery, allowing us to satisfy the determined minimum runtime of sixty (60) minutes. It was a good decision to downsize our motor wattage and allowed our requirements to be more easily met. The hardware required to control this device was more difficult to obtain. Originally, we thought we would be forced to design a motor driver that would sustain current flow of 7.25A continuously. We eventually found a motor driver from Dimension Engineering that meets our requirements, the Sabertooth 2X10. Unfortunately, this controller was destroyed during a test and was replaced with the Sabertooth 2X25, pictured in Figure 22 below. Figure 22: Sabertooth 2X25 (Dual 25A) Motor Driver The Sabertooth 2X25 can handle a larger continuous current and is configurable for individually and simultaneously controlling two wheels at a sustained 25A each, with bursts to 50A. This motor driver will be controlled by a signal from the microprocessor ranging from 0 to 5V, with 0V being full reverse, 2.5V being full stop, and 5V being full forward. The motor driver has been tested and is shown to be fully capable of controlling both of the 300W motors. This 31 was proven in the motors being run for a total of sixty (60) minutes, as well as being run at full velocity for the maximum speed test, without any catastrophic failure in the motor driver. In retrospect, the larger motor controller should have been purchased first, preventing the extra expense of replacing the damaged controller. 32 Software The software flows in a redundant cycle. The initial state is to wait for the rider to mount the board and bring it level for the first time. Once this has occurred, as long as the person remains mounted, the board will measure the accelerometer and gyroscope inputs before running those values through the controls algorithm. This algorithm calculates the needed response by the motors and the necessary voltage output to cause such a response. If turning is desired by the rider, their shift of weight will be measured by a voltage change in the force resistors and implemented in software to cause a turning radius dependent upon forward velocity. A high level flow chart can be found in Figure 23 on the next page, with a breakdown of the software following in Figure 24. Fully commented code is located in the appendices. 33 Figure 23: High level system flowchart 34 Figure 24: Software flowchart for calculating PWM signal 35 Sensors The sensors that are found on the BOMSS are: a one-axis accelerometer, one-axis gyroscope, and two force resistors. The accelerometer and gyroscope measure the forward and backward angular position and motion of the skateboard; these are the means for the balancing of the skateboard. The force resistors change resistance as with the weight applied to them, so these are used for the weight safety mechanism as well as the turning mechanism. The accelerometer and gyroscope were initially selected as surface-mount chips; a surface mount gyroscope was even purchased early in the project. However, the main problems encountered by choosing this type of component mounting were, one, finding a prototype board that fit the specific chip, and two, soldering the chip to the board. The recommended method for mounting a surface mount sensor is through the use of a reflow oven, which requires programming in itself. Eventually, a prototyped accelerometer and gyroscope were purchased from sparkfun.com for a total of was $55.31 so the project could progress. The accelerometer is an MMA7260Q, shown in Figure 25, and the gyroscope is an LISY300AL, shown in Figure 26. Datasheets for both of these sensors can be found in the appendices. Figure 25: MMA7260Q one-axis accelerometer Figure 26: LISY300AL 300°/s one-axis gyroscope 36 The FlexiForce force resistors were purchased from tekscan.com. These are resistors that exponentially lower resistance when a force is applied to the pressure point. These sensors are used first to measure the rider weight. By measuring the voltage dropped across the resistors in parallel, an average weight can be measured and a limit applied through software. By altering the sensors to be in series, the voltage measured at the point between the resistors can be used to calculate the ratio of force to each resistor. This ratio is changed by the rider to produce a turn from the skateboard. By altering the input side of one resistor between 0V and +5V, the resistors switch between parallel and series, providing both weight sensing and turning ratio through the same two resistors. This method for capturing both the weight and turning ratio was successful and turned out to be very efficient. However, one downside to using this method was that a separate resistor was required to draw the voltage at the A/D converter to ground, this skewed the turning ratio by a small amount. A picture of a force resistor is shown in Figure 27 and a datasheet can be found in the appendices. Figure 27: FlexiForce force resistor circuit 37 Power Requirements After construction of the actual circuits, voltage and current were measured through each to calculate power usage. The completed power budget can be found below in Figure 28. Figure 28: Power Requirements 38 Project Completion Analysis 39 Project Summary The final prototype consists of a metal frame with dimensions of 0.78 m x 0.30 m x 0.20 m (31” x 12” x 8”) covered in Lexan material. The total weight, including all components mounted into the frame, is 32.6 kg (71.9 lbs). Throughout the year, project progress followed the expected schedule until the middle of the second semester. At this point, several setbacks in understanding the microprocessor and controls algorithm implementation created a delay in the schedule. The completion of the BOMSS project required seamless mounting of the mechanical components into the constructed frame, a robust controls algorithm properly manifested in software, and integration of all circuitry components into the system. Prior to this final assembly, each piece was tested independently of others to ensure smooth operation and to minimize damage in the event of a single component’s failure. Unfortunately, the project was not completed as expected, but each individual component has been shown to operate independently of the others. The issue that caused the project to be incomplete was the electrical failure of two major components: the gyroscope and the accelerometer. All software was shown to function properly with the sensors before they were integrated into the system. Unfortunately, both sensors shorted out before testing, preventing any control of the balancing function of the skateboard. 40 Budget Analysis When the original budget was made, several aspects of the build process were not included as the team did not realize everything that would be involved. After initial budgeting, force sensors were added, along with replacement gyroscope and accelerometers and a second motor controller. Although several items on the final budget were more expensive than estimated, but many items were able to be purchased at a lower rate than previously budgeted. The finalized budget breakdown can be seen in Table 1 on the following page. Table 1 Item Cost Vendor 300W Motors $74.12 monsterscooterparts.com Lead Acid Battery $112.90 advancedbattery.com DC-DC Converter $26.45 powerstream.com Accelerometer $16.15 sparkfun.com Gyroscope $39.16 sparkfun.com 2 Gyroscope $11.49 digikey.com Force Sensors $41.52 trossenrobotics.com Microprocessor $43.90 futurlec.com Motor Controller $82.49 dimensionengineering.com Motor Controller2 $127.99 dimensionengineering.com Pro-Etched Circuit Board 49.58 4pcb.com Metal for Frame Construction Free Donations HU Metal Shop Lexan Sheeting $62.72 estreetplastics.com Wheel Shafts $19.05 mcmastercar.com Drive Wheels , Front Wheels $36.72 Bike City, Searcy, AR #25 Chains with Master Link $23.72 monsterscooterparts.com 65 Tooth Sprockets For #25 Chain $32.12 monsterscooterparts.com Attachment Hardware $15.55 fastener-express.com 11 Tooth Sprockets for #25 Chain $13.50 ebay.com Professional Binding of Reports $20.00 Harding Resource Center Contingencies & Misc. $0.87 Total Cost $850.00 Table 1: Updated Budget as of April 11, 2010. 41 Date Updated 11/4/2009 11/4/2009 11/14/2009 4/11/2010 4/11/2010 11/4/2009 2/14/2010 11/14/2009 11/14/2009 4/11/2010 4/11/2010 10/13/2009 10/9/2009 11/4/2009 10/3/2009 11/4/2009 11/4/2009 10/28/2009 4/11/2010 4/11/2010 Ordered Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Test Results Turning Radius Test Objective: The BOMSS will complete a full 360° turn while remaining in a radius of no greater than 0.5 m. This test will be conducted with a rider. Result: The BOMSS successfully exhibited the ability to rotate 360° within a radius of no greater than 0.5 m. A 1 m x 1 m square was taped off on the floor, and the skateboard rotated three (3) turns without the frame leaving the area. Runtime Test Objective: The BOMSS will operate at 30% of full motor capacity for a total duration of no less than sixty (60) minutes. This test will be conducted with no rider. Result: The runtime test was unable to be conducted due to frame warping that occurred during a prior test run. According to the power budget, after sixty (60) minutes of runtime over 75W of reserve power, equivalent to 3 Ah of reserve capacity, are available from the battery before it is dead. Considering that these values were also conservatively measured, we are confident that the battery would have successfully powered the skateboard throughout the runtime test. Maximum Speed Test Objective: The BOMSS will operate at a maximum speed of no less than 4 m/s and a maximum speed of no greater than 10 m/s. This test will be conducted on a treadmill capable of said speeds with no rider. Result: Due to instability at high speed caused by slight warping of the wheels, the maximum speed test was unsafe to conduct with a live rider. Attempts were made with and without a rider, both resulting in potentially hazardous situations. It was during this test that the axles were bent, rendering the skateboard unrideable. An unexpected collision between the fast moving skateboard and a sidewalk curb caused an instantaneous force exceeding the design parameters, warping the frame, axles, and wheels. This impact was outside of the normal operating conditions and caused unpredictable stresses that exceeded the yield strength of the metal components. Because of this, along with safety reasons, the maximum speed test was unsuccessful. 42 Incline Test Objective: The BOMSS will operate both uphill and downhill at an incline of angle 3°, while safely controlled by a rider weighing approximately 80 kg (176 lbs). The incline will be provided by a treadmill operating at 30% maximum speed. Result: The incline test was unable to be conducted due to frame warping that occurred during a prior test run. Due to conservative calculations for motor power, we believe a rider would have the ability to safely control the skateboard both uphill and downhill at an incline of angle 3°. The presence of the two safety wheels prevent the skateboard from tilting to angles beyond 21°. However, due to inability to conduct this test, the results are inconclusive. Multi-variable Test Objective: The BOMSS will be required to maintain operation for a total time of no less than sixty (60) minutes. The rider will weigh between 91 and 100 kg (200-220 lbs) and will be required to maneuver a predetermined course (refer to Figure 1) around the Harding University campus containing level planes, inclines, and declines over a multitude of surfaces. Riding times can be discontinuous, but a total time of sixty (60) minutes must be summed at an average of 30% of the maximum speed before the battery is recharged. Result: The multi-variable test was unable to be conducted due to frame warping that occurred during a prior test run. Due to sensor failure and frame warping, the all-encompassing nature of this test made it impossible to complete. We believe the runtime provided by the battery would have been adequate, as well as the frame construction and rigidity; however, we are unsure whether the wheels and axles would have withstood the forces experienced during this test. 43 Appendices Technical Drawings MatLab Code ……………………...…………………………………………………………………………….. Appendix A …………………………………................................................................................. Appendix B MPLAB C18 Code ……………………………………………………………………………………………………… Appendix C Shaft Data Sheets ……………………………………………………………………………………………..……… Appendix D Battery Data Sheet ....………………………………………………..……..……………………………………….. Appendix E DC-DC Converter Data Sheets …………….……………………………………………………………………...…… Appendix F Motor Controller Data Sheets ………………………………………………………………………………………… Appendix G Development Board Data Sheets …………………………………………………………………….……… Appendix H Angular Rate Sensor Data Sheets ……………………………………………………………….…………… Appendix I Accelerometer Data Sheets ……………………………………………………………...…………………….…… Appendix J Resistive Force Sensor Data Sheet Motor Data Sheet ………………….…………………………………………………………. Appendix K ……………………………………………………………………………………………………… Appendix L 44