Team Doki Doki: Paintball Gun IR Sensing and Tracking Team Members: Matt Freeman James Kirby Juan Rivera Capstone CDR Fall 2005 Presentation Outline • Project Overview • System Diagram – Input subsystem – Processing subsystem – Output subsystem • • • • Schedule Milestones Division of Labor Budget/Parts List Capstone CDR Fall 2005 Project Overview • Design a paintball gun auto-detection and tracking system • Implement both manual control and automatic control based on IR sensing • Stepper motors control gun movement • Linear actuator pulls trigger • Spartan-3 provides system control Capstone CDR Fall 2005 System Diagram IR Sensors Data ADC Data Spartan-3 /MUX Stepper Motors Actuator User Interface Control IR Transmitter Capstone CDR Fall 2005 LCD Gun System Input IR Sensors Data ADC Data Spartan-3 /MUX Stepper Motors Actuator User Interface Control IR Transmitter Capstone CDR Fall 2005 LCD Gun IR Sensing • IR λ emitted by humans is ~10μm – Requires exotic and expensive detectors • Use matched IR detector/emitter pairs – Readily available, inexpensive Capstone CDR Fall 2005 HgCdTe IR Transmitters • Transportable independent target • House in self-contained multiple LED flasher – Has different modes of operation • Two IR LEDs for transmission and one visible LED for alignment and power confirmation Capstone CDR Fall 2005 IR Sensors • • • • Mount in an array on gun barrel Both fine-tuning and coarse adjustment Shield from light for best results More precise final design Capstone CDR Fall 2005 MUX • One ADC, 8 analog inputs • MC74HC4051: 8 to 1 analog switch • Will require 8 cycles to refresh all IR readings Capstone CDR Fall 2005 ADC • IR sensors are analog, board input is digital • AD7821: 8 bit parallel analog to digital converter • VREF+/- allows for finetuning of voltage of one LSB Capstone CDR Fall 2005 IR/MUX/ADC Schematic +5 V +3 .3 .V GPIO 1 74 HCT 405 1 AD782 1 74 LVC424 5/SO 2 11 10 9 6 16 7 A B C EN VDD VE E X X0 X1 X2 X3 X4 X5 X6 X7 3 1 13 14 15 12 1 5 2 4 12 11 7 8 13 20 19 VIN +V REF -VRE F MODE RD CS VDD VS S DB 0 DB 1 DB 2 DB 3 DB 4 DB 5 DB 6 DB 7 INT OFL WR/RDY IR D1 IR D2 2 3 4 5 14 15 16 17 3 4 5 6 7 8 9 10 9 18 2 22 6 23 24 A1 A2 A3 A4 A5 A6 A7 A8 B1 B2 B3 B4 B5 B6 B7 B8 21 20 19 18 17 16 15 14 3 4 5 6 7 DIR 8 ... OE VCCB VCCB 74 LVC424 5/SO IR D3 IR D4 IR D5 IR D6 3 4 5 6 7 8 9 10 2 22 IR D7 23 24 IR D8 Capstone CDR Fall 2005 A1 A2 A3 A4 A5 A6 A7 A8 DIR OE VCCB VCCB B1 B2 B3 B4 B5 B6 B7 B8 21 20 19 18 17 16 15 14 IR LSB ... ... MUX L SB ... MUX ... MUX MS B ... ... IR MSB ... 9 10 11 Manual Control Interface • Modified 8-bit NES controller • Controls switching between operation modes • Controls manual and calibration functioning Capstone CDR Fall 2005 Manual Control Interface E1 +5 V 1 J3 2 4 J4 J1 1 1 J2 1 A1 1 1 3 U2 B2 S B2 S 2 BT N BT N 15 3 4 5 6 7 8 9 10 14 2 B5 S U1 1 2 3 4 5 6 7 8 P8 Q6 Q8 P4 P3 VCC P7 P6 P5 Q7 P2 DS P1 C VS S P/S 16 13 +3 V 12 22 23 24 11 10 A1 A2 A3 A4 A5 A6 A7 A8 B1 B2 B3 B4 B5 B6 B7 B8 DIR OE VCCB VCCB 21 20 19 18 17 16 15 14 3 4 5 6 7 8 ... B A Up Do wn Le ft Ri gh t Se l Start ... GPIO 74 LVC424 5/SO 9 • Parallel control hard-wired to MC14021B controller chip 14 021 • Input into board via 40-pin GPIO expansion port Capstone CDR Fall 2005 System Processing IR Sensors Data ADC Data Spartan-3 /MUX Stepper Motors Actuator User Interface Control IR Transmitter Capstone CDR Fall 2005 LCD Gun Spartan-3 Breakdown SPARTAN-3 FPGA IR Data NES Control State Machine 40-pin GPIO MUX/ADC MicroBlaze Serial LCD RS-232 Motor Drivers Capstone CDR Fall 2005 State Machine Reset=1 Calibration NESRight=1 NESUp=1 MoveUp NESSel=1 NESLeft=1 Transfer out of all move states and fire state controlled via variable PrevState Automatic mode ignores all inputs except Reset and NESSel NESUp=1 NESRight=1 MoveLeft NESLeft=1 NESSel=1 Manual MoveRight NESB=1 NESDown=1 MoveDown Automatic NESDown=1 Capstone CDR Fall 2005 Fire State Machine Implementation • Big switch statement – Registers keep track of both next state and previous state • Digital lock prevents unwanted toggling • Separate modules for clock division and display Capstone CDR Fall 2005 Initial Software Testing • First used Spartan-3 on-board I/O, then GPIO • Successful behavior of state machine observed – Simulated and actual NES inputs all had correct effects – L/R and U/D position each visible on two 7-segment displays – Manual control working in software, yet to send pulses to motors Capstone CDR Fall 2005 MicroBlaze • MicroBlaze is a soft processor core from Xilinx for use in FPGAs • Create an RS-232 interface for serial character LCD output • Encapsulate Verilog state machine – Cannot directly interface with GPIO ports Capstone CDR Fall 2005 System Output IR Sensors Data ADC Data Spartan-3 /MUX Stepper Motors Actuator User Interface Control IR Transmitter Capstone CDR Fall 2005 LCD Gun Stepper Motors • Provide gun left/right and up/down movement • Chosen stepper motors have lots of torque • Allow the system to know the position of sensor Capstone CDR Fall 2005 Motor Driver Circuit • Bipolar Stepper Motor Driver • “H-bridge” design • Interface between Spartan-3 and motors Capstone CDR Fall 2005 Motor Driver Schematic Capstone CDR Fall 2005 Actuator • Linear actuator physically pulls trigger • Chosen over servo motor for faster reaction – Can fire multiple times per second • Mount directly on gun behind trigger – Spring-loaded trigger pulls actuator back out automatically after firing Capstone CDR Fall 2005 LCD • Character LCD chosen for ease of use • Serial RS-232 LCD to interface with MicroBlaze • Could display lots of different information – – – – Initially: Debugging info Gun position Shots remaining IR signal strength • Not system-crucial Capstone CDR Fall 2005 Paintball Gun • Mounted on a Lazy Susan for left/right rotation • Will fire “safe” ammunition for indoor testing Capstone CDR Fall 2005 Updated Project Schedule Capstone CDR Fall 2005 Milestone 1 • Date: October 27th • Goal: Manual operation fully functional – NES Controller properly interfaced – Proper state machine operation – Working motor driver circuits (wire wrap) – Motors control gun movement Capstone CDR Fall 2005 Milestone 2 • Date: November 17th • Goal: Automatic operation functional – IR detector array finalized – Control logic (MUX, ADC) configured – Automatic state on FPGA taking data from IR sensors and sending out appropriate signals to motor drivers Capstone CDR Fall 2005 Add-Ons for Expo • Get serial character LCD configured via RS-232 using MicroBlaze • Complete acrylic housing – Ability to see all “guts” of system • Mount CMOS video camera on gun barrel Capstone CDR Fall 2005 Division of Labor • Matt – Circuit Design and System Integration • James – Data Processing and Software Design • Juan – Structure and Circuit Design and Implementation Capstone CDR Fall 2005 Project Budget/Parts List Item Stepper Motors (2) Linear Actuator IR Sensors & Mounts Color CMOS Camera Mounting Hardware Fiberglass Casing FPGA/Embedded Controller PCB Serial LCD Digikey Purchases E-Store Purchases Aprilog Adapters Printing/Binding Costs Miscellaneous Electronics Description Vexta 2-Phase 1.1A motors Ledex heavy-duty tubular solenoid RadioShack matched IR emitter detectors CM-2 from ElectronicKits.com For gun, motors, actuator Stationary housing Xilinx Spartan-3 2-layer, allows for at least one revision ILM-216 from seetron.com PFETS: IRFZ44 and MTP2955 (20 each) BJTS: BC547B (20) MUX: 74HC4051N ADC: AD7821 Level shifters: LVC4245A (3) Perfboard, caps, etc. 24SOD3SMTS (3, SOIC to DIP) User and technical manual Unforeseen parts and repairs TOTAL: Capstone CDR Fall 2005 Estimated Price $25 $15 $40 $86 $100 $50 $125 $150 $60 $80 $40 $40 $150 $150 $1,111 Questions? Capstone CDR Fall 2005