written report 1 - university of floridaplaza.ufl.edu/dmlad/written report 2.doc · web viewc. bump...

22
Written Report 2 David Ladolcetta RoBeDeS EEL5666: Intelligent Machine Design Laboratory Instructors: Dr. A. Antonio Arroyo Dr. Eric M. Schwartz TA: Kevin Claycomb Adam Barnett

Upload: others

Post on 23-Mar-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

Written Report 2

David LadolcettaRoBeDeS

EEL5666: Intelligent Machine Design Laboratory

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

TA: Kevin ClaycombAdam Barnett

Page 2: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

Table of Contents

3. Abstract............................................................................................................................34. Executive Summary.........................................................................................................35. Introduction......................................................................................................................36. Integrated System............................................................................................................37. Mobile Platform...............................................................................................................48. Actuation..........................................................................................................................69. Sensors............................................................................................................................6

A. Pyro-Electric Infrared (PIR) Sensor..........................................................................7B. Sonar Range Sensor...................................................................................................8C. Bump Sensor..............................................................................................................8D. CdS Photo Cells.........................................................................................................9

10. Behaviors......................................................................................................................911. Experimental Layout and Results...............................................................................1012. Conclusion..................................................................................................................1013. Documentation............................................................................................................1114. Appendices.................................................................................................................11

A. Program Code...........................................................................................................11LCD Code..................................................................................................................11Sonar Code.................................................................................................................13Bump Sensor Code....................................................................................................15PIR Code....................................................................................................................16

2

Page 3: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

3. Abstract

The purpose of this report is to display the current progress of my robot design, RoBeDeS. RoBeDeS stands for Robotic Beverage Delivery System and does as named. After being loaded, it will traverse a room seeking the nearest human. Once it finds a person, it will roll to him/her, await beverage removal and then move on to the next person. The robot will use a pyro-electric sensor for person-seeking ability, sonar and bump sensors for object avoidance, and CdS photo cells for beverage recognition. The robot will also contain 2 wheels, castor, LCD screen, motor driver boards, daughterboard for easy cable arrangement and other various components.

4. Executive Summary

Not included at this time.

5. Introduction

Autonomous Robotics is the science of designing an electro-mechanical being that completely controls itself within the scope of its functionality. There are so many applications of this concept and it is a great way to learn a lot about computer, electrical, and mechanical engineering concepts. This is the purpose behind the IMDL class, and our Autonomous Robot Design project.

The robot that I have designed and will be creating is named RoBeDeS (Robotic Beverage Delivery Service) and will be a beverage delivery robot. It uses a multitude of sensors, motors, and other electronic components to fulfill its function as will be described in this report.

The semester is halfway over and my robot is about half way completed as well. So far I have implemented many aspects of the robot onto the MCU as small snippets of microcode. These aspects are bump sensing, sonar object avoidance, person-sensing via the PIR sensor and LCD display. Also I have fully designed the robots platform and body in Autodesk Inventor, cut and assembled the first stage of the platform, and began working on the motor control system.

6. Integrated System

The robot is based on an Atmel ATMega128 processor on the BDMicro MAVRIC IIB board. The board is interfaced to 2 sonar sensors, 4 push buttons, the motor driver boards, and an LCD via the digital ports. Also the PIR and soon 4 photo resistors and the motor driver temperature sensor will be interfaced to the board via the

3

Page 4: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

ADC port. For now the wires are all connected in a spaghetti bowl around the board, but one of the next steps for me is to design a daughter board for my MAVRIC board that will help to organize the clutter of wires into a much nicer design. The motor drivers will also plug into this board to again minimalize the wire trail.

7. Mobile Platform

The platform is almost entirely planned out, and was designed in Autodesk inventor. However since the robot design is a work in progress, dimensions and other specifics are likely to change.

The platform will consist of 3 levels, each made of model airplane wood, cut from the T-Tech machine in the lab. The three layers will be connected by ½” diameter dowels. The bottom and middle layers will be approximately 4” apart, or more depending on how the boards fit. The middle and top layers will be 3.25” apart in order to hold a soda can in place without falling off.

4

Page 5: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

The first (bottom) level of the design is a 1-foot diameter circle with indentations on each side for the wheels. It will hold the majority of the electrical components. The motors are mounted on each side underneath the robot with the wheels lined up with the indentations. On the top of this the microcontroller board is mounted, as well as the sonar and bump sensors and the two battery packs. The daughterboard and motor drivers are attached on top of the MCU board.

The second level will be the base where the beverages will be placed. It will also be a 1’ diameter circle connected to the other layers with dowels. This layer must be protected in plastic in order to protect the electrical components below from any condensation or dripping of the drinks. Since the robot will be made to hold 4 drinks, there must be 4 small holes cut where each will be placed, and the CdS cells will be mounted underneath these holes, covered in clear plastic so that light can shine through, but moisture will not destroy the electronics. Finally, the pyro-electric sensor and servo will be mounted here at the front of the robot with enough room to stick out and sweep.

The final and top level of the robot will again be a 1’ diameter circle and will be used to keep the beverages from toppling over. Since the shortest beverage it is designed to hold is a 5” tall soda can, the third level will be mounted on dowels 3.25” from the second level. Also there must be holes cut in it wide enough to have a 3” diameter soda can fit in it. Also on this level, the LCD screen will be mounted for easy visibility.

5

Page 6: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

8. Actuation

There will be 2 types of actuation included in RoBeDeS. The main actuation involves the movement of the robot. Since the weight of RoBeDeS is on the heavy side (4 cans of coke weigh 48 oz, plus the components and materials of the robot ends up being on the order of 4-5 pounds) hacked servo motors were ruled out. The motors needed to have enough torque to move the weight of the robot at approximately 1 f/s on 2.5” diameter wheels. The torque needed to run this is determined by the following formula:τ = .5* r*m*g*μwhere r = wheel radius in meters, m = mass in kg, g = gravitational constant (9.8m/s2) and μ = constant of friction (estimated to be about 0.3). The RPM can be calculated by:RPM = (60 * v)/(d*π)Where v = velocity in in/s and d = diameter in inches. These calculations led me to know that I will need a motor that can handle 15.34 oz-in of torque and 91.67 RPM.

Based on these calculations I purchased 2 motors from LynxMotion that were rated for 120 RPM and 123 oz-in or torque.

The other actuation in RoBeDeS is the servo motor required to sweep the pyro-electric sensor 180 degrees for human sensing. This is a HiTEC standard servo motor which will be mounted onto the front of the robot with the PIR sensor mounted onto its wheel.

9. Sensors

The most important aspect of robotics is the idea of sensors so the robot can react to its surroundings. RoBeDeS incorporates multiple different sensors to fulfill its purpose as a beverage delivery robot.

6

Page 7: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

A. Pyro-Electric Infrared (PIR) Sensor

The major functionality of RoBeDeS is the human-seeking behavior. The sensor that makes this possible is the pyro-electric infrared (PIR) sensor. It senses heat in the temperature range of human skin, however only when in motion. This is because it actually senses a change of heat. The sensor has a normal output of about 2.5V and with no movement stays at 2.5V. If motion is in the positive direction of the sensor, a voltage higher than 2.5 volts is output (depending on speed). When the motion is in the negative direction, obviously the output voltage goes below 2.5V.

The one problem with this PIR is that there has to be motion, but at a party people aren’t always moving. To handle this, I plan on mounting the PIR on a servo motor. The servo will sweep the room 180 degrees back and forth until the PIR picks up motion. When this happens, RoBeDeS will determine where the person is and walk toward them.

The actual PIR sensor is a hacked LED motion detector device from Wal-Mart that cost $6.50. The product is made by MLMeridian electric and the part number is PHMO01. Anywhere online, a PIR sensor costs more than $50 for just the PIR component. This motion detector device included the sensor mounted onto a controller board with several other components including an LED and a photo resistor. I removed the photo resistor so the sensor could be used in the light. Also I covered up the LED since it serves no purpose to me and was annoying. Also the output of the PIR sensor itself only has a range of about 1V peak to peak. This was of very little use to me because I would need a much more precise ADC. However I checked over the entire PCB of the motion detector and found one pin on one of the controller chips that was an amplified and much more useful signal. This one had the 0V-5V range that was useful to me, so I connected a wire to it and interfaced this to one of the ADC channels.

The method described above is the theoretical way that the PIR is supposed to work. In practice I discovered a slightly different output. When a person walks by from right to left, the voltage spikes to 5V for a short time, then spikes down to 0V for a short time, then slowly settles back to 2.5V after the person is gone. When a person walks from the left to right, it goes 0V then 5V. This is still useful as I can still see when a person is there and determine which way the person comes from. In the image below, the left spike is the right to left and the right waveform is left to right.

7

Page 8: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

B. Sonar Range Sensor

For obstacle avoidance, one of the sensors that I am using is dual sonar range sensor, and more specifically the Devantech SRF05 Ultrasonic Ranger. This product is a sonar transmitter and receiver and microcontroller combined on an easy-to-use PCB. These two sensors will be mounted on the front of the robot on opposite sides and cross paths in front of the robot. When the SRF05 input receives a pulse, an ultra-sonic “ping” is sent from the transmitter. The device then waits for an echo and the distance from an object can be determined by measuring the time it takes to receive a response. The robot can be programmed to determine if an object is in its way, and then act accordingly. Two units are used because the sensor range is a bubble which can miss objects within certain blind spots. The detection “bubble” is shown below:

C. Bump Sensor

8

Page 9: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

As a backup safety measure to the Sonar Range sensor, Bump sensors are also installed. These are simply 3 push buttons glued to the front of the robot’s platform. To make a bumper, I at first tried using a piece of a metal coat hanger. This was too stiff and would not press the buttons correctly. My next attempt was to use rubber weather molding but this was in fact too soft and bumping the bumper in between the buttons would not affect either button. Then I inserted the metal hanger into the rubber molding, and this gave the exact movement needed. It used the flexibility of the rubber, but the overall firmness of the coat hanger to push the button from anywhere.

D. CdS Photo Cells

CdS photo cells (Cadmium Sulfide) are used to detect the amount light. They actually are photo-sensitive resistors meaning that depending on the amount of light, the resistance changes. Depending on the resistance of the photo-resistor, the output voltage will change, and the amount of light can be determined. They will be installed underneath where the beverages will sit and depending on the ambient light it detects, it will know if a beverage is on the platform or not. Experiment pending, I may have to add an LED near the photo cells, but outside of the beverages if the light that comes into the 2nd level of the robot is not bright enough.

10. Behaviors

RoBeDeS is fully autonomous so it must have a set behavior to act on its own. It will start out in a waiting position until it is loaded with drinks, and the start button is pressed. Once started, it will traverse the room in a random pattern moving forward, turning left and turning right based on a randomized algorithm. When an object is encountered through either the sonar or bump sensors, it will stop moving, turn around, and turn randomly left or right.

All throughout this random movement, the servo motor will be turning and the PIR will be capturing data. When a person is detected by the PIR, RoBeDeS will turn itself towards the person, and walk toward them until the sonar determines that it is close enough. It will then wait for either one of it’s CdS cells to trigger or a to-be-determined time-out period to end, then turn around 180 degrees (to ensure that the same person is completely out of its sight) and continue its random walk around the room.

When all four drinks are taken, the robot will then signal to the room that it is empty via beeping the speaker. It will then walk straight towards the nearest wall to be out of people’s way, and then stop and return to its original wait state.

Each of these behaviors will be individually programmed and tested on their own as mini functions. Then they will be used together to get the overall behavior. As of now I have programmed behavior for the LCD display, Sonar pinging, bump sensing and PIR reading and AD conversion. The functions are included in the Appendix.

9

Page 10: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

11. Experimental Layout and Results

As of this time full experiments have only been completed for some of the sensors. Code was written for the sonar sensor that pings the sonar and waits for the return ping. For the time being, I am waiting for the return ping while in a loop which counts a counter each loop. This number is then returned from the function to be used in the robots thought process. I tested from 1 to 10 inches because as of now this is the range I will need it in. Following is a table illustrating the number of counts for each distance:

Inches 1 2 3 4 5 6 7 8 9 10Counts 216 367 395 558 667 798 945 1070 1179 1157

Sonar Conversiony = 124.64x + 58.551

0

200400

600800

1000

1200

1400

0 5 10 15

Inches

Coun

ts Series1Linear (Series1)

Note that in the graph 2 inches and 10 inches are removed because they were outliers and obviously false readings. With this graph a function is acquired to convert counts to inches, so the robot can determine how far something is. Unfortunately the sonar readings are not linear as they exceed about a foot and a half, so more testing is needed if readings further than this distance are needed in the future.

Testing was also done on the PIR sensor. These results were discussed in the sensor section above.

12. Conclusion

It is halfway through the semester and the project has been lots of fun and a big learning experience. It has been a lot of work so far and there still is a lot more to go before the semester ends. However I believe I am in a very good place with the project and as soon as I get my Motor drivers working it will be a smooth ride from there. Any suggestions or recommendations are welcome.

10

Page 11: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

13. Documentation

No documentation at this time.

14. Appendices

A. Program Code

LCD Code#include <avr/io.h>

void delay(){int i;PORTB = 0x01;

for (i = 0; i <= 500; i++){}

PORTB = 0x00;}void LCDcomnib(unsigned char c){

c = c & 0x0F; //keep low four as datac = c | 0x40; //set E hiPORTC = c; //write to LCDdelay(); //wait 10 msc = c ^ 0x40; //set E lowPORTC = c; //write to LCDdelay(); //wait 10 msc = c | 0x40; //set E hiPORTC = c; //write to LCDdelay(); //wait 10 ms

}void LCDcommand(unsigned char c){

unsigned char cH = c & 0xF0; //give cH hi 4 bits of dataunsigned char cL = c & 0x0F; //give cL low 4 bits of datacH = cH / 0x10; //shift c1 right by 4LCDcomnib(cH);LCDcomnib(cL);

}void LCDcharnib(unsigned char c){

c = c & 0x0F; //keep low four as datac = c | 0x50; //set E hi

11

Page 12: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

PORTC = c; //write to LCDdelay(); //wait 10 msc = c ^ 0x40; //set E lowPORTC = c; //write to LCDdelay(); //wait 10 msc = c | 0x40; //set E hiPORTC = c; //write to LCDdelay(); //wait 10 ms

}void LCDchar(unsigned char c){

unsigned char cH = c & 0xF0; //give cH hi 4 bits of dataunsigned char cL = c & 0x0F; //give cL low 4 bits of datacH = cH / 0x10; //shift c1 right by 4LCDcharnib(cH);LCDcharnib(cL);

}void LCDstring(unsigned char ca[]){

int i = 0;while (ca[i] != '\0'){

LCDchar(ca[i++]);}

}void LCDinit(){

DDRC = 0xFF;DDRB = 0x01;LCDcommand(0x33);LCDcommand(0x32);LCDcommand(0x28);LCDcommand(0x0F);LCDcommand(0x01);

}void LCDint(int value) { int temp_val; int x = 10000;

int leftZeros=5;

if (value<0){LCDchar('-');}

while (value / x == 0){ x/=10;

leftZeros--; } while ((value > 0) || (leftZeros>0)){ temp_val = value / x;

12

Page 13: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

value -= temp_val * x; LCDchar(temp_val+ 0x30); x /= 10;

leftZeros--; } while (leftZeros>0){

LCDchar(0+ 0x30);leftZeros--;

} return; }void LCDgoto(int row, int col){

unsigned char xval = col;unsigned char yval;xval = xval & 0x1F;if (row == 1)

yval = 0xC0;else

yval = 0x80;LCDcommand(yval + xval);

}void LCDclear(void){

LCDcommand(0x01);}int main(){

LCDinit();LCDstring("Hello World!!");LCDgoto(1,3);LCDint(12345);while(1){ };

}

Sonar Code#include <avr/io.h>#include "..\LCD\LCD.c"#define SONARTRIG PORTD#define SONARECHO PIND#define SONARDDR DDRD

//dont forget to add:// TCCR0 = 0x02;//to your initialize function

void delay2(){int i;

13

Page 14: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

for (i = 0; i <= 32000; i++){}

}

int sonarPingCounts(int leftright){int n;SONARDDR = 0x0A;if (leftright == 0){

SONARTRIG = 0x08;}else{SONARTRIG = 0x02;}//SONARTRIG = 0x0A; //sets trigger pins high for 10usdelay2();SONARTRIG = 0x00; //sets trigger pins lowwhile (!(SONARECHO & 0x05)){

// do nothing as long as echo line is low}

n = 0;

while (SONARECHO & 0x05){

n += 1; // add 1 to n as long as PortA pin 0 is high}

//when we get here, the falling edge has occured

return n;}

/*int sonarPingInches(){int n = sonarPingCounts();float inches;inches = ((float)n - 19)/131;return (float)(inches +.5);

}*/

int main(){int n,left,right;SONARDDR = 0xFF;LCDinit();while(1){

left = sonarPingCounts(0);for(n = 0; n <= 5; n++){

delay2();

14

Page 15: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

}right = sonarPingCounts(1);for(n = 0; n <= 5; n++){

delay2();}

LCDclear();LCDstring("left = ");LCDint(left);LCDgoto(1,0);LCDstring("right = ");LCDint(right);

}}

Bump Sensor Code

#include <avr/io.h>#include "..\LCD\LCD.c"

#define BUMP PINB#define DDRBUMP DDRB

//BIT 7 6 5 4// Br Or Gr Pu

int main(){LCDinit();DDRBUMP = 0b00000000;PORTB = 0b11110000;while(1){

if ((BUMP & 0b10000000) == 0b000000000){//brown/redLCDint(1);

}if ((BUMP & 0b01000000) == 0b00000000){//orange/yellow

LCDint(2);}if ((BUMP & 0b00100000) == 0b00000000){//gree/blue

LCDint(3);}if ((BUMP & 0b00010000) == 0b00000000){//purple/grey

LCDint(4);}

}

15

Page 16: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

}

PIR Code

#include <avr/io.h>#include "../LCD/LCD.c"#define ANALOG PORTF

void PIRdelay(){int i;

for (i = 0; i <= 32000; i++){}

}void PIRinit(){

DDRF = 0b00000000; // set port F to all input // Note: when JTAGEN fuse is set, F4 - F7 don't work PORTF = 0x00; // make sure pull up resistor is not enabled

ADMUX = 0b01100000; // 5V reference, leftadjust, select channel0 (pin F0)ADCSRA |= 0b10000111; // turn on ADC, don't start conversions

// single conversion // divide clock by 128}

void PIRstart(){ADCSRA |= 0b01000000;

}

int main(){LCDinit();LCDclear();PIRinit();int n,topcount=0,bottomcount=0;while(1){

PIRstart();while((ADCSRA & 0b00010000) == 0b00000000){}if(ADCH > 250){

topcount = 0;LCDgoto(0,0);LCDstring(" ");while(ADCH > 250){

topcount++;PIRstart();while((ADCSRA & 0b00010000) == 0b00000000){

16

Page 17: Written Report 1 - University of Floridaplaza.ufl.edu/dmlad/Written Report 2.doc · Web viewC. Bump Sensor As a backup safety measure to the Sonar Range sensor, Bump sensors are also

}}LCDgoto(0,0);LCDint(topcount);

}if(ADCH < 5){

bottomcount = 0;LCDgoto(1,0);LCDstring(" ");while(ADCH < 250){

bottomcount++;PIRstart();while((ADCSRA & 0b00010000) == 0b00000000){}

}LCDgoto(1,0);LCDint(bottomcount);

}PIRdelay();

}

}

17