Group #2 Jorge Avilla Luis Bonilla Redwood Diego Nunez Project Purpose: Project Overview Create a robot that is able to collect tennis balls either autonomously or manually. Goals and Objectives To autonomously or manually pick up tennis balls. Recognize objects using a vision system. Able to keep track of number of balls collected. Wireless control from a remote control if it’s not on autonomous mode. Specifications & Requirements Robot cost around $700.00. Weight less than 7 lbs. Ability to carry 3-5 tennis balls. Range of 120 ft. Battery life of around 1 hour. Project Components Vision System: To identify objects DC Motors: For movements of the robot Batteries: To provide power to all components of the robot to function properly Ball Collecting Mechanism: To collect the tennis balls Wireless Device: To manually operate the robot Chassis Design Custom Chassis Modeled in SolidWorks Built the actual chassis using clear acrylic sheets Connect the robot’s platform using L-brackets Ball Collecting Mechanism Paddle Wheel design. Built with PVC and clear acrylic sheet. The system uses a DC motor to rotate the paddle in order to collect the balls. Chassis Design Ball Counter ABC uses 2 Sharp IR Range Sensors. Each sensor eliminates the 10 cm minimum distance of the other. The sensors are located inside the chassis, behind the wheel paddle. Drive Train Motors 2 DC motors for movement Operating Voltage = 12 volt Operating Current = 90 mA Stall Current = 1.5 A Stall Torque = 123.20 oz.-in RPM = 120 Weight = 5.36 oz. Price = 21.95 each Wheels Rear Wheels ◦ 2 All Terrain Wheels Front Wheels ◦ 2 Caster Wheel to provide balance Visual System Blackfin Camera: • • • • Color Detection Motion Detection Compatible with WebBot Library It communicates via UART Specifications Processor Processor’s Speed Input Voltage Current Draw (max) UART Number of Timers Frames per Second I/O pins Resolution Blackfin Camera Blackfin BF537 500 MHz 3.3 V 145 mA 2 4 30 16 640x480 Microcontroller Atmega328 Specs Pins I/O pins EEProm Program Memory SPI USART Timers 8/16 bit PWM pins ADC channels Programming Language Max Clock Rate Voltage Price Atmega328 32 23 1K 32K Yes 1 2/1 6 8 C 20 MHz 1.8-5.5V $5 Microcontroller Why atmega328: • More Programmable Memory • Previous experience with atmega8 and atmega168 • Already had programmer available. • WebBot Library: Functions library compatible with the 328 and with the Blackfin Camera • Simplifies programming process. Microcontroller Design 3 Microcontrollers: • Simplifies testing of the different parts separately • Allows for the coding to be divided among the group Main Controller: Brain of the robot, receiving and transmitting information between the other two microcontrollers and the camera Motor Controller: Receives input from the main controller or the laptop(RC mode). Controls the input of the h-bridges. XBee Blackfin Camera Main Controller Motor Controller L298N Counter Counter: Keeps count of the number of balls the have been loaded on the vehicle and instructs the Main to return to the base once the goal has been reached. Main Controller and Counter Schematic Motor Controller modes: • Autonomous mode: Receives its input from the main controller Controlling Truth Table: Pins Main Controller/Motor Controller C3/C3 C4/C4 C5/C5 Action 0 0 0 Stop 0 0 1 Forward 0 1 0 Reverse 0 1 1 Turn Right 1 0 0 Turn Left 1 0 1 Roller on Forward 1 1 0 Roller on Reverse 1 1 1 Roller OFF Motor Controller Modes: • Remote Control Mode: Receives its inputs from a Laptop via XBee. Xbee Receiver Laptop Motor Controller Xbee Emitter H-Bridge: • Receives the input from the motor controller and provides the power to the DC motors. • Protects the microcontroller from any shorts from the motors. L298 from STMicroelectronics Characteristics: Specs L298 Logic Supply Voltage 5V Voltage Supply (motors) Up to 45V DC Current Supply per Channel 2A # Channels 2 PWM Capable Pins Yes Logical 0 Input Voltage Up to 1.5 V L298 Configuration Schematic: • Diodes are fast response Schottky diodes. Motor Controller with L298s Schematic: Wireless Adapters vs. Specs Range Voltage Current TX Current RX Idle current Frequency Interface Price Xbee 300ft 3.3V 45mA 50mA <10uA 2.4GHz TTL $19 BlueSmirf 350ft 4.5-5.5V Up to 120mA 40mA 2mA 2.4GHz TTL $64 NiMH Rechargeable Batteries 12V Battery ◦ To power all the DC motors such as the drive train and the ball collecting mechanism 9.6V Battery ◦ To power all the electronic components such as the camera, the sensors, and the wireless devices for the remote control Power Management Power Distribution Component Quantity Voltage Max Current Drive Train motors 2 12 V 1.5 A Ball Collecting Mechanism motor 1 12 V 1A Camera 1 3.3 V 150 mA Sensors 3 5V 5 mA Wireless devices for Remote Control 1 3.3 V 50 mA Microcontrollers: ATMEGA 328 3 5V 80mA H-Bridge: L298 2 5V 50mA Collision Avoidance • The Maxbotix LV-EZ1 ultrasonic rangefinder provides accurate readings from a minimum tested distance of 6 in. to a maximum of 255 in., according to Sparkfun Electronics. • The robot is designed such that it registers any object sensed 1 ft. away as a possible collision, and performs a evasive procedure. • The single rangefinder mounted on the chassis is not enough to provide full collision detection. Software Design Programming Environment: • AVR Studio 4 • AVR Pocket Programmer Pros: Provides power to the microcontroller. • Pololu USB AVR Programmer Pros: Integrates directly to AVR Studio 4, allowing direct programming. • WebBot Library o http://webbot.org.uk/iPoint/ipoint “This site contains useful software utilities for both the amateur and professional robot builder. Whilst this software is Open Source I would hope, if it has been useful, that you will visit the download page and click on the Donate button on the top right of the page and give what you can.” abcr_core.h Includes sys/atmega328P.h switch.h Definitions Enumerations operation_mode Structures none Global Variables opSwitch Functions appControl appRCControl appAUTOControl retrieveOperationMode • sys/atmega328P.h Systems file from the WebBot Library which configures the targets the functionalities of the Atmel Atmega 328. • operation_mode RC – Remote Control. AUTO – Autonomous. • Enable the program to be easily switched between the two different types of operation modes we want to handle. event.h Includes none Definitions none Enumerations event_mode Structures event_type event_map Global Variables none Functions twoPowerOf appConfigureEvents transmitEventCode transmitEventRef transmitEventName receiveEventCode receiveEventName receiveEventRef • event_type Represents an event that can be sent or received between microprocessors. • event_map Structure that represents an interaction that will occur between microprocessors. • Intended for structuring the interactions that will be performed between microcontrollers. Acquisition.( h | c ) Includes abcr_core.h a2d.h event.h Sleep.h Sensors/Distance/Maxbotix/EZ1.h Definitions IR_LEFT IR_RIGHT PERCENT_ERROR_DETECTION_THRESHOLD COUNTTHRESHOLD HOMEBASETHRESHOLD FREQUENCY Enumerations Structures Global Variables _IREventMap __prevIRLeftDistance __prevIRRightDistance _totalCount _irSensing mDistanceSensor _ballAcquiredDelay Functions isBallAcquired appConfigureEvents appRCControl appInitHardware appInitSoftware appAUTOControl CollisionDetected • Implements the sensing and counting of tennis balls as well as informing the autonomous code of a full tennis ball storage compartment. • At each iteration of the main loop, we call the isBallAcquired function and determine the message to send to the autonomous controller from the result. Command vbc Response ##vbc dd\r\n ssss x1 x2 y1 y2\r\n .... ###vcc\r\n ##vmean yy uu vv\r\n Description The 'vb' command searches for blobs matching the colors in color bin #c, indicates the number of blobs found as dd, and returns a count of matching pixels in the blob, along with coordinates of an x1, x2, y1, y2 rectangular region containing the matching pixels. up to 16 blobs can be returned, and the blobs are sent in order of pixel count, though blobs smaller than MIN_BLOB_SIZE (currently set to 5 pixels) aren't shown. The 'vc' command directly sets the contents of color bin #c. this command will return string with 'vc' followed by the color bin number. For example, we could save a set of colors to color bin #3 corresponding to measurements taken at another time, such as the above mentioned orange golf ball color measurement, using 'vc3127176086111154200'. We could then confirm that the colors were properly stored by issuing the command 'vr3' to retrieve the contents of color bin #3. Computes mean values for Y, U, and V over the entire image. vccy1y2u1u2v1v2 vm Autonomous.( h | c ) Includes buffer.h abcr_core.h Cameras/Surveyor/blackfin.h event.h Sleep.h Definitions UART_RX_BUFFER_SIZE UART_TX_BUFFER_SIZE BLACKFIN_RESOLUTION_DEFAULT BLACKFIN_TENNIS_BALL_BIN_RANGE BLACKFIN_HOME_BASE_BINS_RANGE BLACKFIN_RESOLUTION_CENTER_WIDTH BLACKFIN_RESOLUTION_CENTER_HEIGHT OBJECT_CENTERED_WIDTH_RANGE_ERROR_NEAR OBJECT_CENTERED_WIDTH_RANGE_ERROR_FAR OBJECT_CENTERED_HEIGHT_RANGE_ERROR BLOB_LOST_DEFAULT_WAIT BLOB_LOST_DEFAULT_SPRINT ROLLER_CHECK_DEFAULT ROLLER_CHECK_BLOB_NEAR DEFAULT_SERVO_SPEED SERVO_SPEED_MAX SERVO_SPEED_MID SERVO_SPEED_MIN SERVO_STEP AUTO_ROLLER_ON AUTO_ORTH_TURN_DELAY 18 AUTO_LONG_DELAY 70 AUTO_MED_DELAY 30 AUTO_SHORT_DELAY 12 FREQUENCY 20000; • Responsible for capturing of commands from the Blackfin camera and transmitting the right movement instructions to the drive train. • setColorBins Dynamically change the color bin range that the camera searches for depending on the mean color of the image. • detectBlobs Process the action that needs to be performed from the data gathered from the camera. PCB Design •Eagle Cad Software: •Extensive Library Parts and Good tutorials on the web •Manufactured by 4PCB: Student discounts PCB Design • Traces have different widths depending on the amount of current flowing on them. • Signal traces are thinner that power traces • Ground Plane • Combines surface mount parts with through hole. PCB Design PCB with the surface components mounted. Project Management Power Drive Train Remote Control Luis Jorge Diego Camera PCB Sensors Programming 0% 50% 100% Project Management Expected Final Project Budget Project Budget Item Amount Item Amount Camera $ 230.00 Camera $ 171.56 Battery/Charger $ 80.00 Battery/Charger $ 60.35 GPS $ 100.00 XBee $ 91.45 RC Unit $ 65.00 Ball Collecting Mechanism $ 45.08 Chassis $ 30.00 Chassis $ 120.00 Sensors $ 60.00 Sensors $ 30.00 Motor/Wheels $ 50.00 Motor/Wheels $ 75.80 Electronics $ 30.00 Electronics $ 60.00 PCB $ 55.00 PCB $ 60.00 TOTAL $ 700.00 TOTAL $ 714.24 Project Challenges Caster wheels affecting motion ◦ Solution: Compensate as much as possible in code Missing connection on the board ◦ Solution: Soldered cables directly to the board Project Challenges Color Specification: • The Blackfin camera takes a range of colors to define a blob. • A color blob is not a accurate method for searching for a specific object. Possible improvements: • Machine learning: http://research.microsoft.com/en-us/um/people/viola/Pubs/Detect/violaJones_IJCV.pdf • Edge finding More Information • All project information is available at: http://eecs.ucf.edu/seniordesign/su2010fa2010/g02/ Questions?