Stabilization Table for Accurately Balancing a Loose Element Critical Design Review December 13th, 2012 William Brown Phillip Chen Eric Huckenpahler Laura Hughes Brian Ibeling Chris Johnson 1 Develop a robust control system that is capable of balancing a ball at a plate’s origin. Allow users to control the plate and ball’s position with various devices. Integrate interactive games. Capable of fully autonomous operation. Operate from AC wall power. 2 3 Constructed physical model to demonstrate plate and motor interaction. Communicated and translated touchscreen data to motor rotation. 4 5 From PDR: 6 7 The motor: •Sparkfun •4.8 to 6.0V •Analog actuation •Torque around 6kg*cm •Small Footprint •$12 •180 degrees of movement The motor: •Hitech •4.8 to 6.0V •Small Footprint •Digital actuation •Torque around 343 oz-in •$70 •90 degrees of movement We could have used: Ball bearing Shaved down hinges Fiberglass rod Rotating pivot Or, this nail. Fiberglass is finally appropriate Rigidity issues may force us into aluminum arms Binding posts were chosen over shoulder bolts Cheaper and easier to find Works for both arm-to-arm and arm-to-plate connections Bolted it down with the included screws Acrylic base needed to secure screws Motor arm was imperfect We could have used: Ball bearings Gears Pneumatics Magnets 15 Or, a small hinge: There are still questions to answer How will the second motor affect rotational stability? The motion is software limited, but should we physically limit this as well? 18 We are strongly considering the use of a computer PSU to supply the power to our project 19 Why? Integrated/compact design Efficiency Safety Very high quality control ▪ No fried controllers! 20 PSU supplies 12V, 5V, and 3.3V lines We will need to create a converter circuit on PCB to supply 6V to motors PCB will be used for power distribution 21 22 The current control system is fairly theoretical Testing will determine whether or not a different approach to controlling the ball will be necessary 23 Control based off of second-order physical system Forces on the ball were linearized with respect to angle to simplify system Using a line of best fit of sin 𝜃 to 30° gave a good approximation with 𝑅 2 = 0.9994. Max difference between real and estimated 𝑚 accelerations is 0.01 2 𝑠 24 25 Factoring in rotational inertia, the position of the ball can be modeled as 𝑋 0.119 = 𝜃 𝑠2 Sanity check: A constant angle input does cause a constant acceleration 26 For the first design, a simple case was chosen. 4 𝐻 𝑠 = 2 𝑠 + 4𝑠 + 4 A function that can control this was found to be 𝑠 4𝑠 2 + 16𝑠 + 16 𝐶 𝑠 = 0.119𝑠 3 + 0.952𝑠 2 + 2.38𝑠 + 1.904 27 28 29 Possible issues: This model is highly theoretical. It remains to be seen if all forms of disturbances can be rejected ▪ If problems arise, a more robust approach will be needed Microcontrollers don’t work in the Laplace domain! 30 31 Large touchscreen wasn’t accurate enough 32 Smaller touchscreen showed smoother results 33 We need a more accurate large touchscreen that will still react to the ball’s weight when the touchscreen is at an angle 34 35 Simple main file Initialize peripherals Main loop ▪ Check state and act accordingly Header file for each peripheral More modular Keeps code readable 36 Primarily soft interrupts Best for an embedded environment Easy to set flags which will determine states Some hard interrupts Good for emergency shutoff and other time- critical tasks 37 38 Hardware interaction with software, requires careful planning 39 Computer Cell Phone User Input & ball feedback Hardware Wifi/Eth. UART Bluetooth UART Joystick USB ADC DI/O UART Debugging Hardware PMP LCD screen & 7segment debug display PWM Motor Control PIC32 Micro HW Action Local Interface DI/O UART Touch Screen DI/O ADC Important PIC32 built in peripherals 5 UART channels 1x Parallel Buss 16 Channel ADC 5x 16 bit Digital Timers 8x DMA channels 41 Wireless chip: 1x UART and 2x DMA channels to prevent the processor from having to wait for data. Computer Wifi/Eth. User Input & ball feedback UART PIC32 Micro Cell Phone 42 1x UART and 2x DMA channels to keep the processor from having to wait for data to arrive. PIC32 Micro UART Debugging Hardware 43 1x UART and 2x DMA channels to prevent the processor from having to wait to acquire data. Cell Phone Bluetooth UART PIC32 Micro User Input & ball feedback 44 Flexibility in choice On-board USB 2.0 On-The-Go host support with dedicated DMA channels Extra DI/O and ADC pins for a game port Joystick. 45 Digital push buttons. Should be triggered by interrupts to provide highest response rate to user & button functionality User Input & ball feedback Local Interface DI/O UART PIC32 Micro 46 Fastest operation uses PMP bus to control parallel port enabled devices. PIC32 Micro PMP LCD screen & 7segment debug display 47 PIC32 Micro PWM Table Control 2x PWM outputs, one for each motor, each require a 32bit timer to output slow enough. Requires 4 of the 5 16bit timers. Needs to be updated at 50Hz to maximize control systems abilities. 48 User Input & ball feedback Touch Screen DI/O ADC PIC32 Micro 2x ADC pins Need to be triggered to sample at a steady frequency in order to calculate velocity. Will likely involve the use of the 5th timer. 2x DI/O pins Needs to update at highest rate TBD. Hopefully 100-200Hz 49 Hardware Number Available Number Used UART 5 3 Parallel Buss 1 1 ADC’s 16 2-4 16 bit digital timers 5 5 General Purpose DMA channels 8 6 General DI/O Lots +-12 Knowing this information, need to carefully program our processor otherwise system will fail to meet hard deadlines. 50 Hardware Number Pins/Feature Number Used UART 2 6 Parallel Buss 11 11 ADC’s 1 2-4 16 bit digital timers 1 2 required PWM signals General DI/O Plenty +-12 Total: +-35 pins Using a good number of the available I/O pins as well. 51 52 Need some scheduler to deal with multiple demands made on processor at a time: Various demands should only be ignored so long before being addressed 53 If only one demand is made at a time, scheduling is simple: Deal with the demand and wait for another one Problems arise when multiple demands arrive at the same time or arrive during another demand: How should we pick which demand to address first? 54 Simple Priority Based Scheduling: Easy to code and debug Provides minimal control over scheduling and ignores deadlines completely—can lead to starvation Why am I always last? 55 Variable Priority Based Scheduling: Some difficulty debugging Provides extensive but unintuitive control over scheduling and can indirectly address soft deadlines Sometimes the world appreciates me as I deserve 56 Time Slice Based Scheduling: Provides extensive and intuitive control over scheduling and predictable deadlines Difficult to code and debug Increased context switching inevitably leads to poorer performance Poor design could lead to insufficient processor time being given to demands 57 More complex systems yield better results but are more difficult to implement Use simpler systems to begin with and then upgrade to more complex system if simpler system is insufficient for our purposes 58 59 User Interaction User Interface Desired Position Control System Parse Input (joystick) User Input Parse Input (tablet/phone) Desired Position Control System Standard Mode Interface Physical State Game Mode Art Mode 61 Multiple methods of manipulating and viewing the same control system: Model View Controller 62 63 Ball’s speed and weight too great Non-steel ball with higher frictional coefficient Dual motor interaction and locking Ball joints rather than door hinges Redesign motor arms 64 Parallel processing for touchscreen, UI devices, and motor actuation Optimize code Split responsibilities over 2 processors Noisy PWM signal for motors Filter signal output Split responsibilities over 2 processors 65 Unable to meet deadlines for data analysis and plate actuation Adjust control code to predict ball behavior Optimize code for faster runtime operation Faster processor Split responsibilities over 2 processors 66 Task Brian Ibeling Laura Hughes William Brown Motor Control S P S Mechanical/ Structure P S S Power Board S S P ADC Board S S P Command and Data Handling TouchScreen Control User Interface Control User Interface Device Comm Documentation Phillip Chen Eric Huckenpahler Chris Johnson S P S S S S P S S S P S S P S S S P S P = Primary S S = Secondary 67 Item Unit Price Quantity Unit Total Mechanical Servomotor $77 4 $308 Aluminum (0.5” x 0.5” x 6”) $20 4 $80 Plexi-glass Plate $40 1 $40 External Case $50 1 $50 Steel Ball $10 1 $10 Electrical Microchip PIC32 Development Board $70 2 Sampled Power PCB Creation $45 3 $135 AC AC Transformer $20 3 $60 6V Regulator $15 3 $45 3.3V Regulator $15 3 $45 Touchscreen Sensor $50 1 $50 Joystick $20 1 $20 LEDs $0.15 100 $15 Breakout ADC Board Creation $45 3 $135 Touchscreen Driver $7 2 $14 Misc. Dev Components (Resistors, Caps, headers) $50 1 $50 Net Estimated Budget $1057 68 69 Structure fully developed Basic control algorithm implemented Rev 1 Power PCB developed and tested Testing plans implemented 70 System integration complete Fine control algorithm actuating Rev 2 (3 if needed) Power PCB complete Aesthetics fully developed Documentation complete 71 Capcakes = capstone + cupcakes Fully functional system Games implemented and available to guests Aesthetically pleasing system and presentation 72 73 74 75 Yes Ball Centered? No Ball resting at origin Touchscreen senses ball movement Ball’s offset and speed calculated Motors and plate actuated 76 Ball resting at initial position UI device sends data No Ball at final position? Yes Plate tilt or ball offset calculated Complete Motors and plate actuated 77