21
Date: 12/07/10 Student Name: Mary Richeson TA’s :Mike Pridgen Tim Martin Ryan Stevens Devin Hughes Thomas Vermeer Instructors: Dr. A. Antonio Arroyo Dr. Eric M. Schwartz University of Florida Department of Electrical and Computer Engineering EEL 4665/5666 Intelligent Machines Design Laboratory Written Report Rico the Recycler 1

 · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

Embed Size (px)

Citation preview

Page 1:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

Date: 12/07/10

Student Name: Mary Richeson

TA’s :Mike PridgenTim Martin

Ryan StevensDevin Hughes

Thomas Vermeer

Instructors: Dr. A. Antonio ArroyoDr. Eric M. Schwartz

University of FloridaDepartment of Electrical and Computer Engineering

EEL 4665/5666Intelligent Machines Design Laboratory

 Written Report

Rico the Recycler

 

1

Page 2:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

Table of Contents

Introduction p. 3

Integrated System p.4

Mobile Platform p.5

Actuation p.6

Sensors p. 7

Experimental Layout, Results, and Interpretation p.10

Appendices p.11

2

Page 3:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

ABSTRACT

Rico the Recycler will locate and sort recyclables found on the ground. Rico will be able to determine the difference between aluminum cans and glass bottles. The robot will find the recyclables left on the ground. Once it locates a recyclable it will drive toward it until it rolls on to a main arm platform. The arm will then rise to a ninety degree angle where Rico will decide whether the object is a can or a bottle. Rico will then place the bottle or can in the appropriate recycling container.

EXECUTIVE SUMMARY

Rico will locate recyclables by moving in a lawn mower type fashion up and down each row of a room using infrared sensors to locate object low to the ground. Once it locates the recyclable it will drive toward it and then directly at it. The bottles will roll on to a main arm platform that is flush with the ground. An infrared sensor will detect it on the metal platform and the arm will then rise to a ninety degree angle where Rico will decide whether its heavy or light based on a weight sensor on the platform. If Rico determines it is heavy and a glass bottle it will lift a storage container lid and then continue to lift the arm platform so the bottle will roll into the first storage container. Otherwise it will not lift the lid to the first bottle storage container and as the arm is lifted the aluminum can will roll over the first container and into the second aluminum container that does not have a lid. It will continue to do this until it reaches the maximum of 4 recyclables.

INTRODUCTION

Many times after sporting events, such as swimming tons of trash is left on the ground including items that can be recycled. Often many of these recyclables are just thrown into the trash and taken to a landfill. A robot that could help pick up and sort recyclables would be ideal in this situation.

Rico is just the robot to help with recycling. Rico works indoors to cleaning up arena hallways or swimming patios littered with recyclables. Rico will have an integrated system to help it navigate pathways in a lawn mowing type fashing, by driving up a pathway one row at a time. Rico’s mobile platform is customized to picking up, sorting and storing aluminum and glass recyclables. The different actuation systems will allow the robot to easily drive the platform and lift recyclables. Four infrared sensors, two for obstacle avoidance, and two for recyclable recognition will be in place. A pressure sensor will also be implemented to help with sorting.

3

Page 4:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

INTEGRATED SYSTEM

Rico will survey an area by moving in a lawn mower type fashion, moving up one row at a time. It will use infrared sensors for obstacle avoidance. Once it locates a recyclable it will drive toward it until it rolls on to a main arm platform. On the platform a weight sensor will determine whether the object is an aluminum can or a glass bottle. Depending which object is detected a specific flap will be lifted and the recyclable will be placed into the appropriate container. Rico will stop looking for cans once a maximum number of cans or bottles have been found. In this manner Rico will successfully meet the objectives by locating, sorting and storing the recyclables.

4

Page 5:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

MOBILE PLATFORM

The platform is a two feet in length by one foot in width. It is made of wood a quarter inch thick. There are three wheels attached in a triangular position. The two side wheels will be motorized with the third front wheel just being a castor. On the middle of the platform rests the storage container. The storage area is divided with one side for cans and one side for bottles. An arm ramp is mounted with one side attached to the storage containers and the other side resting on the ground. The plastic arm ramp is 12.5 inches wide, 24 inches long and 1/12 of an inch thick. The micro processor board and batteries will be located at the back of the platform.

LessonsWhile trying to find a light weight platform plastic was used for the arm ramp. While this was a good intention, it had unintended negative consequences as the ramp was unstable and had half and inch of unanticipated side to side movement. To further complicate this the storage container it was mounted to was also plastic and contributed to more movement.

Platform Specifications

Main Platform Wood 2’ x 1’ x ¼”

Wheels Black foam 2.5” x 2.5”

Storage Container Plastic 8” x 12” x 6”

Arm Ramp Plastic 12.5” x 24” x 1/12”

ACTUATION

5

Page 6:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

The types of actuation are the wheels, arm platform, and storage container lid flap.

Motor and WheelsThere is a motor for two foam tires. The foam wheels are 2.5 inches by 1.5 inches. This will allow Rico to a medium speed and carry the weight of the robot adequately. Each wheel motor has 3.6 kg-cm torque to drive around the arena and pick up recyclables. The motors are 12 V with 200 RPM. The torque will be well above the calculated into the max torque of the motor which includes the weight of the platform, wheels, battery, motors, servos, platform arm ramp, and filled storage containers. The wheels are mounted with an aluminum mount. A duel motor driver with a built in opto-isolator will allow the wheels to interact and easily allow it to move forward, reverse, and turn either left or right. The opto-isolator will prevent the motors from accidentally dropping too much current onto the ground line and destroying the microprocessor.

*I used Mark Milks code for the motor and wheels because we had the same wheel kit and dual motor driver

Arm Ramp PlatformThe first servo will be connected to the arm ramp with a pulley system. A hacked servo willwill be attached to a stainless steel frame mounted over the storage containers. Fishing wire will be strung through an extended metal structure which exits and ties at each end of the metal platform that is flush with the ground. This servo moves in forward 360 ° motion for 12 seconds forward to lift a glass bottle and 10 seconds for a can. This 4.8 V servo has a stall torque of 42 oz/in and a max operating speed of 1.14 seconds per 360° of rotation.

Storage Container Lid The storage container lid will operate on the second servo. This hacked servo can rotate 360°. It is also mounted on the metal frame located over the storage containers. It is attached to fishing wire that runs over the metal frame and down to one courner of the storage lid. To lift the lid the servo will move in a counter clockwise motion to wind up the string for 1500 ms, and then in reverse to close the lid again. This 4.8 V servo has a stall torque of 42 oz/in and a max operating speed of 0.29 seconds per 90 ° of rotation.

SENSORS

6

Page 7:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

Infrared Proximity SensorAn infrared sensor was used for obstacle avoidance so Rico stays in the boundaries of the 10 x 10’ arena. The 3.1 V analog output infrared sensors can detect distances from 4 inches to 30 inches. Once Rico gets within 5 inches of a wall it will turn at a 180 degrees. In this driving pattern Rico will run into the different pieces of recyclables placed in the arena.

Infrared Proximity Sensor

Current Range 0 - 3.1 V

Resistance Range 4 – 30 inches

Output range 2200-500

Distance (inches)

IR 1Output Value

IR 2Output Value

IR 3Output Value

IR 4Output Value

20 900 1960 2200 1940

15 890 1900 1900 1950

12 938 3000 2200 2100

10 938 3200 3000 3000

8 1700 3500 3100 3100

6 2179 3188 3500 3400

4 3500 3100 3100 3500

2 3100 3100 3500 3600

Reference:SEN-00242 Infrared Proximity Sensor - Sharp GP2Y0A21YK, SparkFun Electronics, 1-303-284-0979

Weight Sensor A weight sensor will be used to determine the type of recyclable on the scale part of the platform. Once a recyclable is on the metal platform a servo will move the arm ramp to a horizontal position where sufficient weight of the recyclable will be on the weight sensor. The 8.5 inch weight sensor is a small flexi-force pressure sensor. Adding weight to the sensor reduces the resistance of the sensor which it translates into a weight. The resistance changes from infinity to 300k ohms. It is sensitive from 0 to 1 pound. When it detects an object weighing 0.031 pound

7

Page 8:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

it will determine it is an empty 12 oz aluminum can (below the 3000 output value threshold). If it detects an object weighing 0.41 pounds it will decide it is an empty 12 oz glass bottle (above the 3000 output value threshold). After determining the type of recyclable Rico will lift up the arm ramp further until the recyclable rolls into the correct container. An 100k ohm resistor was used in this circuitry. At a value of above 3000 the sensor will consistently detect a bottle and not detect a can

Flexiforce Pressure Sensor

Piezoresistive force sensor- as you increase the pressure the lower the sensor’s resistance

Pressure range 0 -1 lbs

Resistance range Infinite – 300k

Dimensions 8.5 x 0.55 x 0.008 inches

Sensing diameter 0.375”

Response Time Less than 5 microseconds

Can < 3000 (LCD output value)

Bottle >3000 (LCD output value)

For the reference resistance RF an 100k ohm resistor was used to make the output values more sensitive to added weight.

Reference:Flexiforce Pressure Sensor - 1lb., SparkFun Electronics, 1-303-284-0979Code in Appendix C

8

Page 9:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

EXPERIMENTAL LAYOUT

The wheels and lawn mower, row by row, movement was tested. The infrared sensors were tested. The servos were tested next to see if they could lift the appropriate weight.

Once individual sensors were confirmed working integrated wheels with infrared was performed for obstacle avoidance. Then the infrared integrated with the servos was performed.

RESULTS

The servos performed appropriately and could pick up a bottle or can. Due to the servos only being activated for a specific amount of time, they did not lift the arm lever or storage lid to the same location each time, leading to cans not being lifted enough to fall into their container. Thus subsequent uses of the arm ramp caused inaccuracies. Only once did Rico drive into a bottle and can and it rolled onto the platform.

9

Page 10:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

INTERPRETATION

A week after lengthening the cables for the infrared sensors, they stopped performing consistently which created much difficulty for Rico to detect whether there was an object on the platform.

Rico did not consistently execute 90° turn angles when the motors were sent a 2 second signal. This was probably due to 90 percent of the weight being over the front castor wheel which could lead to it not performing the same each time. The testing was also quite difficult because most places indoor places to perform this testing had tile and could not execute turns due to getting caught in the grout.

The infrared sensor also performed on a time delay. This led to inaccuracies in subsequent lifting and lowing of the arm ramp and bottle storage lid.

APPENDIX

Appendix A. Literature references

1.Drive Train “How to build your first robot tutorial.” Society of Robots. 2010.

http://www.societyofrobots.com/robot_tutorial.shtml

Appendix B. Parts

1.LCD Screen. 1 x 20X4 Backlit LCD White on Blue (DE-LM005).Wright Hobbies Robotics. Phone:630-214-9534

10

Page 11:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

2. Wheel Motor Kit. Solutions Cubed Easy Roller Robot Wheel Kit EZR1 (Black) Product code :RB-Sol-27 2 0. Solutions Cubed. Phone: 530.891.8045

3. Infrared Sensors. SEN-00242 Infrared Proximity Sensor - Sharp GP2Y0A21YK, SparkFun Electronics, 1-303-284-0979

4. Weight Sensor.Flexiforce Pressure Sensor - 1lb., SparkFun Electronics, Phone:1-303-284-0979

5. Servos.   (31311S00) HS-311 Servo. ServoCity. Phone: 620-221-0123 

6. Motor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969

Appendix C. Code

#include "usart_driver.h"#include "PVR.h"

#define USART USARTF0

void M0_ForwardSlow(int a);void M0_ForwardFast(int a);void M0_ReverseSlow(int a);void M0_ReverseFast(int a);void M1_ForwardSlow(int a);void M1_ForwardFast(int a);void M1_ReverseSlow(int a);void M1_ReverseFast(int a);

uint8_t sendData [4];uint8_t receivedData;

int main(void){

xmegaInit();delayInit();ADCAInit();ServoCInit(); //setup PORTC ServosServoDInit(); //setup PORTD Servos//lcdInit();delay_ms(3000);

PORTF.DIRSET = PIN3_bm;

PORTF.DIRCLR = PIN2_bm;

USART_Format_Set(&USART, USART_CHSIZE_8BIT_gc, USART_PMODE_DISABLED_gc, false);

USART_Baudrate_Set(&USART, 3317,-4);

USART_Rx_Enable(&USART);USART_Tx_Enable(&USART);

bool stop = true;

int infrared1; //high left infraredint infrared0; //high right ir

11

Page 12:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

int infrared2; //low right irint i=1;M0_ForwardSlow(70); //for straight slowM1_ForwardSlow(70); //for straight slow

PORTJ_DIR = 0b11111100;

PORTQ_DIR |= 0x01; //led as output

while(stop){

infrared0 = ADCA0(); //ADCA1 Robots rt IR,,,,,,infrared1 = ADCA1(); //ADCA0 Robot's left IRinfrared2 = ADCA2();M0_ForwardSlow(70); //for straight slowM1_ForwardSlow(70); //for straight slow

/* if(ADCA1() > 2500){ //too close to left hight IR2 do right turnPORTQ_OUT = 1;//delay_ms(1000);

// PORTQ_OUT =0;delay_ms(1000);

M0_ForwardSlow(0);M1_ForwardSlow(0);delay_ms(3000);M0_ReverseSlow(40);M1_ForwardSlow(40);delay_ms(2500);M0_ForwardSlow(40);M1_ForwardSlow(40);

}

*/// if((ADCA1() > 3300) || (ADCA0() > 2100)) { //too close to right hight IR2 do left turn

if (ADCA0()>2100){ if(i %2 ==0){ //even number of turns// PORTQ_OUT =1;

M0_ForwardSlow(0); //do right turnM1_ForwardSlow(0);delay_ms(3000);

M0_ReverseSlow(50); //RIGHT TURN!!M1_ForwardSlow(50);delay_ms(2000);

M0_ForwardSlow(0);M1_ForwardSlow(0);delay_ms(1000);

M0_ForwardSlow(50); //straight almost 1 secM1_ForwardSlow(50);delay_ms(700);

M0_ForwardSlow(0);M1_ForwardSlow(0);delay_ms(1000);

M0_ReverseSlow(50); //90 deg. right turn (aka U-turn)

M1_ForwardSlow(50);delay_ms(2000);

12

Page 13:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

M0_ForwardSlow(70); //continue straight M1_ForwardSlow(70);

}

else {//is odd number //odd number of hit

PORTQ_OUT =0;M0_ForwardSlow(0); //do left turnM1_ForwardSlow(0);delay_ms(3000);

M1_ReverseSlow(50); //LEFT TURN!!M0_ForwardSlow(50);delay_ms(2000);

M0_ForwardSlow(0);M1_ForwardSlow(0);delay_ms(1000);

M0_ForwardSlow(50); //straight almost 1 secM1_ForwardSlow(50);delay_ms(700);

M0_ForwardSlow(0);M1_ForwardSlow(0);delay_ms(1000);

M1_ReverseSlow(50); //90 deg. right turn (aka U-turn)

M0_ForwardSlow(50);delay_ms(2000);

M0_ForwardSlow(70); //continue straight M1_ForwardSlow(70);

}i=i+1;}

//else if(ADCA2() >500){ //lower right infrared

// PORTQ_OUT=0;

// }// else if((ADCA2()>2100)||(ADCA5()>1900)){ //ADCA2 -lower

infrared left that see cans

else if (ADCA5()>1900){M0_ForwardSlow(0);M1_ForwardSlow(0);//jgdelay_ms(20000);/*M0_ForwardSlow(0);M1_ForwardSlow(0);*/

//Robot's Right lower IR value, for on platform ADCA0()>1600

PORTQ_OUT = 1; //starts moving automatically

ServoC0(100);delay_ms(10700);ServoC0(0);delay_ms(2000);

13

Page 14:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

if(ADCA7()>3000){//ADCA7() is weight sensor sees if can

delay_ms(1000); //descends drop down door

ServoD0(-100);delay_ms(1500); //100

descend drop down door, -100 lifts drop down doorServoD0(0);delay_ms(1500);

ServoC0(100); ///lifts arm all way up

delay_ms(14000);ServoC0(0);delay_ms(4000);

ServoD0(100); //closes drop-down door

delay_ms(1500);ServoD0(0);delay_ms(1500);

ServoC0(-100);///descends arm all way down

delay_ms(20000);ServoC0(0);delay_ms(5000);

M0_ForwardSlow(70);M1_ForwardSlow(70);}

else{ ///if light then is canServoC0(100);delay_ms(13000);ServoC0(0);delay_ms(3000);ServoC0(-100);delay_ms(14000);

M0_ForwardSlow(70);M1_ForwardSlow(70);}

M0_ForwardSlow(70);M1_ForwardSlow(70);

}

}

}

void M0_ReverseSlow(int a){

sendData[0] = 170;sendData[1] = 9;sendData[2] = 8;sendData[3] = a;

for(int i = 0; i<4;i++){

do{

14

Page 15:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

}while(!USART_IsTXDataRegisterEmpty(&USART));USART_PutChar(&USART, sendData[i]);

}

}

void M0_ReverseFast(int a){

sendData[0] = 170;sendData[1] = 9;sendData[2] = 9;sendData[3] = a;

for(int i = 0; i<4;i++){

do{

}while(!USART_IsTXDataRegisterEmpty(&USART));USART_PutChar(&USART, sendData[i]);

}

}

void M0_ForwardSlow(int a){

sendData[0] = 170;sendData[1] = 9;sendData[2] = 10;sendData[3] = a;

for(int i = 0; i<4;i++){

do{

}while(!USART_IsTXDataRegisterEmpty(&USART));USART_PutChar(&USART, sendData[i]);

}

}

void M0_ForwardFast(int a){

sendData[0] = 170;sendData[1] = 9;sendData[2] = 11;sendData[3] = a;

for(int i = 0; i<4;i++){

do{

}while(!USART_IsTXDataRegisterEmpty(&USART));USART_PutChar(&USART, sendData[i]);

}

}

void M1_ForwardSlow(int a){

sendData[0] = 170;sendData[1] = 9;sendData[2] = 12;

15

Page 16:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

sendData[3] = a;

for(int i = 0; i<4;i++){

do{

}while(!USART_IsTXDataRegisterEmpty(&USART));USART_PutChar(&USART, sendData[i]);

}

}

void M1_ForwardFast(int a){

sendData[0] = 170;sendData[1] = 9;sendData[2] = 13;sendData[3] = a;

for(int i = 0; i<4;i++){

do{

}while(!USART_IsTXDataRegisterEmpty(&USART));USART_PutChar(&USART, sendData[i]);

}

}

void M1_ReverseSlow(int a){

sendData[0] = 170;sendData[1] = 9;sendData[2] = 14;sendData[3] = a;

for(int i = 0; i<4;i++){

do{

}while(!USART_IsTXDataRegisterEmpty(&USART));USART_PutChar(&USART, sendData[i]);

}

}

void M1_ReverseFast(int a){

sendData[0] = 170;sendData[1] = 9;sendData[2] = 15;sendData[3] = a;

for(int i = 0; i<4;i++){

do{

}while(!USART_IsTXDataRegisterEmpty(&USART));USART_PutChar(&USART, sendData[i]);

}

}

16

Page 17:  · Web viewMotor Battery. 12V 2000mAh Flat NiMH Battery Pack for Airsoft Gun. All-Battery. Phone:(510) 979-9969 Appendix C. Code #include "usart_driver.h " #include "PVR.h " #define

17