19
Cleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023 Chandra Kiran Reddy Evuru - CS15BTECH11012 Anushrut Mishra - CH15BTECH11005 Introduction Our objective was to build a basic cleaning robot which can autonomously clean a room and can also be controlled remotely through a bluetooth module. It should be able to meet basic cleaning necessities like sweeping and mopping without involving significant human interruption. The bot had a pair of brooms in the front for sweeping, a container underneath to collect the dirt, a water dispenser to release water, and mops in the rear to mop up the area to be cleaned. The first aspect we looked at was to build a simple obstacle avoiding robot. An Arduino was coded so that motors could move based on the obstacle distance values provided by sensors. The sensors were used to detect the obstacles and guide the bot’s motion. Motor drivers were used control the direction of rotation of the motors based on the commands given by the arduino. Servo motors were used to fix the angle for rotation of the brooms. One servo was also used to rotate the bottle containing water so that water could be periodically sprayed and the mops could subsequently clean. A bluetooth module was used to guide the robot and its cleaning in the non-autonomous mode. The Electronics Components: The following electronic components were used: Arduino Mega 2560 - 2 12V DC Motors - 4 L293D motor drivers - 2 SG90 Servo motors - 3 A bluetooth module [HC-05] - 1 9V Batteries - 3 Breadboards - 5 HC-SR04 Ultrasound sensors - 6 Connecting Wires - as required Resistors-[3.3k and 10k]

ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

  • Upload
    doanque

  • View
    214

  • Download
    2

Embed Size (px)

Citation preview

Page 1: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

Cleaner BotSukrut Rao - CS15BTECH11036

Tejas P - EP15BTECH11010M S A Siva Satvik - CS15BTECH11023

Chandra Kiran Reddy Evuru - CS15BTECH11012Anushrut Mishra - CH15BTECH11005

IntroductionOur objective was to build a basic cleaning robot which can autonomously clean a room and can also be controlled remotely through a bluetooth module. It should be able to meet basic cleaning necessities like sweeping and mopping without involving significant human interruption.

The bot had a pair of brooms in the front for sweeping, a container underneath to collect the dirt, a water dispenser to release water, and mops in the rear to mop up the area to be cleaned.

The first aspect we looked at was to build a simple obstacle avoiding robot. An Arduino was coded so that motors could move based on the obstacle distance values provided by sensors. The sensors were used to detect the obstacles and guide the bot’s motion. Motor drivers were used control the direction of rotation of the motors based on the commands given by the arduino. Servo motors were used to fix the angle for rotation of the brooms. One servo was also used to rotate the bottle containing water so that water could be periodically sprayed and the mops could subsequently clean.A bluetooth module was used to guide the robot and its cleaning in the non-autonomous mode.

The ElectronicsComponents:The following electronic components were used:

Arduino Mega 2560 - 2 12V DC Motors - 4 L293D motor drivers - 2 SG90 Servo motors - 3 A bluetooth module [HC-05] - 1 9V Batteries - 3 Breadboards - 5 HC-SR04 Ultrasound sensors - 6 Connecting Wires - as required Resistors-[3.3k and 10k]

The connections are as follows: Connecting ultrasound sensor to the Arduino: The ultrasound sensors are simple

devices which give out a pulse and calculate the time required for the pulse to return back after reflection from any obstacle. An ultrasound sensor basically has four pins namely-trig, echo, Vcc and ground. Vcc pin is to be connected to the 5V pin found on the Arduino and ground pin is to be connected to either of two ground pins. The trig and echo pins are to be connected to any available digital pin. (Make sure to write these pin numbers in the arduino code). This way all the six sensors are to be connected. The ground pins can be made common on the breadboard since there

Page 2: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

are only two ground pins available and many more components that follow need to be grounded.

Connecting servo motors to the Arduino: A servo motor has three pins namely signal , ground and Vcc pins. The ground pin is connected in the same way as previously described.The signal pin is again connected to any of the available digital pins on arduino and the corresponding number is noted. If the Vcc pin is connected to the 5V of the Arduino, the interference from the servos causes the ultrasonic sensors to misbehave. An external power source is recommended, but what we used was the 5V pin from another Arduino. Similarly the other two servo motors are connected.

Connecting the DC motors to the Arduino: A motor driver can power two motors. Since this bot has four motors, two drivers need to be used. The driver has Vcc and ground pins which need to be powered using an external source (say a 9V transistor battery). The voltage must not exceed 9V. First the motor terminals are calibrated based on the direction in which the wheels rotate. Let’s call forward rotation as positive. The motor terminals are connected to the pins named M-Out on the motor driver. The four pins which are named M-In are connected to the digital pins on the arduino and the pin numbers are noted accordingly.

The following is a representative circuit diagram, depicting the connection of one DC motor

Connecting the bluetooth module to the Arduino: Four of the pins present on the HC-05 bluetooth module were used, namely TX, RX, Vcc, and ground pins. The TX pin is connected to the Arduino’s RX pin, the ground pin is connected to the Arduino’s ground pin and the Vcc pin is connected to the 3.3V pin on the Arduino. The Arduino TX pin gives a 5V signal, while the bluetooth module cannot take more than 3.3 V. So, we connected it to the HC-05’s RX pin through a voltage divider using two 3.3k and one 10k resistors as shown in the circuit diagram. [actually any two resistors in ratio 3.3:5 will suffice].

Powering the Arduino: A 9V 6F22 battery was used. Connect the positive terminal of the battery using a battery connector to the Vin pin of the Arduino, and the negative terminal to the ground pin.

Representative diagram of the circuit showing the connections of one instance of each component

Page 3: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

The BotTools and Materials used:

Woodens plank(1 foot by 1 foot) Wheels - 4 Brooms - 2 Pieces of cloth (for mopping) - 2 A container (for dirt collection) - 1 Water Bottle (about 200mL) - 1 Supports for the motors - 4 Screws and nuts Scissors and Glue Soldering equipment

Page 4: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

Procedure followed:1. The main body of the bot is a square wooden piece, which forms the main base of

the bot. Drill four pairs of holes at the four corners of the wooden piece. The measurements depend on the size of the 12V motors which will be attached. To make turning easier, keep the distance between motors on a given side lesser than the distance between motors on different sides of the bot.

2. Now place the four DC motors at four corners and screw them in using supports. Attach the wheels to the motors.

3. On the front left and right corners of the bot, glue two servo motors such that their rotation axis is vertical. Then, glue the brooms on to the blades of the servo motors. Super glue can be used.

4. Fix the container on the underside of the bot near the centre of the wooden piece. The container should be a box like structure with an opening facing the front to take in the dirt.

5. Take the third servo motor and glue it on to the underside of the bot. Keep this behind the container and to one side of the bot. The rotation axis should be horizontal, perpendicular to the length of the bot.

6. Cut small holes in the side of the bottle and glue the bottom of the bottle to the blade of the servo. This will make water pour out of the bottle when it is rotated by the servo motor.

7. Attach the cloth pieces to the rear of the bot so as to act like a mop.8. Now, fix two breadboards side by side at the front of the bot, so as to span the entire

width. Place three ultrasound sensors, facing front, on them - one each on the left, right and the centre.

9. Fix two breadboards along the length on either side of the bot. Fix one sensor each on one breadboard, facing sideways. If the wheels obstruct the sensor, some sponge can be used to increase the height before fixing the breadboards on the wooden piece.

10. Fix the fifth (smaller if possible) breadboard at the back of the bot, and fix the sixth sensor facing backwards.

11. Make all the required connections. Solder the connections to the DC motors to keep them secure. Place and secure all the electronic components to the top of the wooden piece.

The Arduino ProgramThe following was programmed into the Arduino.It consists of three major functions, setup(), loop(), and serialEvent(). setup() sets up the input and output pins on the Arduino and gives the initial parameters to each device. loop() thereafter takes over and runs repeatedly throughout the program execution. serialEvent() runs between each cycle of loop() to check if any data has been received from the app.By default, the bot is set to run autonomously. In this mode, it moves forward while it can. If there is an obstacle, it turns. If a turn in any direction is possible, it randomly decides which direction to turn. As it moves, cleaning devices clean.The bot can be switched to the remote controlled mode through the app. Then, the program waits for movement commands and directs the motors accordingly. It also accepts commands to switch on or off a particular cleaning device.

#include<stdlib.h>#include<Time.h>#include<Servo.h>String inputString = "";int flag=0;boolean stringComplete = false;

Page 5: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

/*The following three variables indicate whether the autonomous mode, brooms and mops are on or off respectively. 1 stands for on and 0 for off.*/int autovar=1;int broomvar=1;int mopvar=1;String command = ""; String value = "";boolean stringOK=false;Servo brol,bror,mopl,mopr,bot;/*The following variables denote the pins for various components. The naming is as follows:

f-frontl-leftr-rightb-backm-midp-positive terminal of DC motorn-negative terminal of DC motort-trigger pin of ultrasonic sensore-echo pin of ultrasonic sensors-sensor (use+d just to make the name three characters long)

For example, ‘flt’ means ‘front left trig’, i.e., the trigger pin of the front left ultrasonic sensor*/int flt=26;int fle=27;int frt=23;int fre=22;int fmt=46;int fme=47;int lst=28;int lse=29;int rst=13;int rse=12;int rfp=38;int rfn=39;int rbp=40;int rbn=41;int lfp=34;int lfn=35;int lbp=36;int lbn=37;int bst=49;int bse=48;//The following are numbers assigned to each sensorint lef=1;int fro1=2;int fro2=3;int fro3=6;int rig=4;int bac=5;/*Function to make the robot move forward at least for a time t, where the default value of t=600ms*/void forw(int t=600){ digitalWrite(lfp,HIGH); digitalWrite(lfn,LOW); digitalWrite(lbp,HIGH); digitalWrite(lbn,LOW); digitalWrite(rfp,HIGH); digitalWrite(rfn,LOW); digitalWrite(rbp,HIGH); digitalWrite(rbn,LOW); Serial.print("Assigning forward for time "); Serial.print(t); Serial.println(" ");   delay(t);

Page 6: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

 }/*Function to make the robot move backward at least for a time t, where the default value of t=600ms*/void back(int t=600){ digitalWrite(lfp,LOW); digitalWrite(lfn,HIGH); digitalWrite(lbp,LOW); digitalWrite(lbn,HIGH); digitalWrite(rfp,LOW); digitalWrite(rfn,HIGH); digitalWrite(rbp,LOW); digitalWrite(rbn,HIGH); Serial.print("Assigning backward for time "); Serial.print(t); Serial.println(" "); delay(t); }/*Function to make the robot move leftward at least for a time t, where the default value of t=1000ms*/void left(int t=1000){ digitalWrite(lfp,LOW); digitalWrite(lfn,HIGH); digitalWrite(lbp,LOW); digitalWrite(lbn,HIGH); digitalWrite(rfp,HIGH); digitalWrite(rfn,LOW); digitalWrite(rbp,HIGH); digitalWrite(rbn,LOW); Serial.print("Assigning left for time "); Serial.print(t); Serial.println(" "); delay(t); }/*Function to make the robot move rightward at least for a time t, where the default value of t=1000ms*/void right(int t=1000){ digitalWrite(lfp,HIGH); digitalWrite(lfn,LOW); digitalWrite(lbp,HIGH); digitalWrite(lbn,LOW); digitalWrite(rfp,LOW); digitalWrite(rfn,HIGH); digitalWrite(rbp,LOW); digitalWrite(rbn,HIGH); Serial.print("Assigning right for time "); Serial.print(t); Serial.println(" "); delay(t);}/*Function to make the robot stop at least for a time t, where the default value of t=0ms*/void stat(int t=0){ digitalWrite(lfp,LOW); digitalWrite(lfn,LOW); digitalWrite(lbp,LOW); digitalWrite(lbn,LOW); digitalWrite(rfp,LOW); digitalWrite(rfn,LOW); digitalWrite(rbp,LOW);

Page 7: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

 digitalWrite(rbn,LOW); Serial.print("Assigning stop for time "); Serial.print(t); Serial.println(" "); delay(t);}//setup function. This function is called first and runs oncevoid setup() { //Assigning pins as input or output as applicable pinMode(flt,OUTPUT); pinMode(fle,INPUT); pinMode(frt,OUTPUT); pinMode(fre,INPUT); pinMode(lst,OUTPUT); pinMode(lse,INPUT); pinMode(rst,OUTPUT); pinMode(rse,INPUT); pinMode(lfp,OUTPUT); pinMode(lfn,OUTPUT); pinMode(lbp,OUTPUT); pinMode(lbn,OUTPUT); pinMode(rfp,OUTPUT); pinMode(rfn,OUTPUT); pinMode(rbp,OUTPUT); pinMode(rbn,OUTPUT); pinMode(fmt,OUTPUT); pinMode(fme,INPUT); pinMode(bst,OUTPUT); pinMode(bse,INPUT); //For servos brol.attach(4); bror.attach(5); mopl.attach(2); mopr.attach(3); bot.attach(6); //Set initial angle for servos brol.write(0); bror.write(200);//We set 200 as servo was behaving abnormally and 200 made it work  bot.write(0); Serial.begin(9600);/* sets baud rate bits per second*/ randomSeed(analogRead(0));/* for random numbers to differ, so an unconnected analog pin*/

}/*Function that checks if a sensor has an obstacle in front of it. It takes the sensor number as the argument and returns 1 if the distance from an object is less than the threshold and 0 if it is more*/int isobs1(int sens){  //tr-trigger pin, e-echo pin int tr,e; if(sens==2) {   Serial.print("Left Front sensor reports ");   tr=flt;   e=fle; } else if(sens==3) {   Serial.print("Right Front sensor reports ");   tr=frt;   e=fre; }   else if(sens==6) {   Serial.print("Front middle sensor reports ");

Page 8: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

   tr=fmt;   e=fme; } digitalWrite(tr,LOW); delayMicroseconds(2); digitalWrite(tr,HIGH); delayMicroseconds(10); digitalWrite(tr,LOW); /*Reads a pulse (either HIGH or LOW) on a pin. For example, if value is HIGH, pulseIn() waits for the pin to go HIGH, starts timing, then waits for the pin to go LOW and stops timing. Returns the length of the pulse in microseconds or 0 if no complete pulse was received within the timeout.(Source: arduino.cc)*/ /*dur-time taken for pulse to be received, dist-distance from obstacle*/ float dur=pulseIn(e,HIGH); float dist=dur/58.2;//Taking 1/29.1 as the speed of sound in cm/microseconds Serial.print(dist); Serial.print(" so "); delay(100); /*Threshold distance of 50 cm has been taken for front sensors because the brooms are at a position of 90 degree in the front increasing effective bot length . Distance greater than 400cm has been counted as an obstacle to account for sound absorbing objects, which cause timeout of pulseIn() and give high values for distance*/ if(dist<50  || dist>400) {   Serial.println("Obstacle");   return 1; } else {   Serial.println("No obstacle");   return 0; }}int isobs(int sens){ int tr,e; if(sens==1) {   Serial.print("Left sensor reports ");   tr=lst;   e=lse; } else if(sens==4) {   Serial.print("Right sensor reports ");   tr=rst;   e=rse; } else if(sens==5) {   Serial.print("Back sensor reports ");   tr=bst;   e=bse; }

 digitalWrite(tr,LOW); delayMicroseconds(2); digitalWrite(tr,HIGH); delayMicroseconds(10);/*sends 8 cycles of 40kHz*/ digitalWrite(tr,LOW); float dur=pulseIn(e,HIGH); float dist=dur/58.2; Serial.print(dist); Serial.print(" so ");

Page 9: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

  /*Threshold distance of 20 cm for the other sensors on left,right and back. Distance greater than 400cm has been counted as an obstacle to account for sound absorbing objects, which cause timeout of pulseIn() and give high values for distance*/ delay(100); if(dist<20 || dist>400) {   Serial.println("Obstacle");   return 1; } else {   Serial.println("No obstacle");   return 0; }}//Function to initiate cleaning actionvoid clean(){ Serial.println("Clean");

     for (int pos = 0; pos <= 180; pos += 1)     {        brol.write(pos);                    delay(15);                            }     for (int pos = 180; pos >= 0; pos -= 1)      { // goes from 180 degrees to 0 degrees       brol.write(pos);              // tell servo to go to position in variable 'pos'       delay(15);                       // waits 15ms for the servo to reach the position     }     for (int pos = 200; pos >= 0; pos -= 1)      { // goes from 180 degrees to 0 degrees       bror.write(pos);              // tell servo to go to position in variable 'pos'       delay(15);                       // waits 15ms for the servo to reach the position     }     for (int pos = 0; pos <= 200; pos += 1)      { // goes from 0 degrees to 180 degrees   // in steps of 1 degree       bror.write(pos);              // tell servo to go to position in variable 'pos'   delay(15);                       // waits 15ms for the servo to reach the position }  for (int pos = 180; pos >=0; pos -= 1) { // goes from 0 degrees to 180 degrees   // in steps of 1 degree  bot.write(pos);              // tell servo to go to position in variable 'pos'   delay(15);                       // waits 15ms for the servo to reach the position }  for (int pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees   // in steps of 1 degree  bot.write(pos);              // tell servo to go to position in variable 'pos'   delay(15);                       // waits 15ms for the servo to reach the position } for (int pos = 20; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees   mopl.write(pos);              // tell servo to go to position in variable 'pos'   delay(15);                       // waits 15ms for the servo to reach the position }

Page 10: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

 for (int pos = 20; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees   mopr.write(pos);              // tell servo to go to position in variable 'pos'   delay(15);                       // waits 15ms for the servo to reach the position } forw(); back(); forw(); stat(); }//loop function, run repeatedlyvoid loop(){   if(stringComplete)//checks if message received via bluetooth {   Serial.print("Input: ");   Serial.println(inputString);   boolean StringOK=false;   if(inputString.startsWith("autonomous off"))   {     autovar=0;     Serial.println("Remote controlled");     stringOK=true;//valid command received   }   if(inputString.startsWith("autonomous on"))   {     //switch on all cleaning devices     autovar=1;     broomvar=1;     mopvar=1;     Serial.println("Autonomous");     stringOK=true;   }   if(inputString.startsWith("brooms on"))   {     broomvar=1;     Serial.println("Sweeping");     stringOK=true;   }   if(inputString.startsWith("brooms off"))   {     broomvar=0;     Serial.println("Not sweeping");     stringOK=true;   }   if(inputString.startsWith("mops on"))   {     mopvar=1;     Serial.println("Mopping");     stringOK=true;   }   if(inputString.startsWith("mops off"))   {     mopvar=0;     Serial.println("Not Mopping");     stringOK=true;   }   if(inputString.startsWith("up") && autovar==0)//Remote controlled commands   {     forw(0);           Serial.println("Forward");     stringOK=true;    }   if(inputString.startsWith("down") && autovar==0)   {

Page 11: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

     back(0);           Serial.println("Backward");     stringOK=true;    }   if(inputString.startsWith("left") && autovar==0)   {     left(0);           Serial.println("Left");     stringOK=true;    }   if(inputString.startsWith("right") && autovar==0)   {     right(0);           Serial.println("Right");     stringOK=true;    }   if(inputString.startsWith("stop") && autovar==0)   {     Serial.println("Stop");     stat(0);     stringOK=true;   }   stringOK ? Serial.println("Command Executed") : Serial.println("Invalid Command");   inputString="";//clear commands   stringComplete=false; } //If autonomous cleaning must be done if(autovar==1 && flag==0) {    int ran=random(1000); Serial.println("Loop"); //No obstacle in the front, move forward and clean while(isobs1(fro1)==0 && isobs1(fro2)==0 && isobs1(fro3)==0 && flag==0) {   Serial.println("No obs");   forw();   stat();   clean();   if(Serial.available())   {     flag=1;     break;   } } //Obstacles in front, check sides while((isobs1(fro1)==1 || isobs1(fro2)==1 || isobs1(fro3)==1) && flag==0) {   Serial.println("Obs");   //Obstacle on right and none on left, move left   if(isobs(lef)==0 && isobs(rig)==1)   {     left();     clean();     stat();   }   //Obstacle on left and none on right, move right   if(isobs(lef)==1 && isobs(rig)==0)   {     right();     clean();     stat();   }   //No obstacle on either side, decide randomly   if(isobs(lef)==0 && isobs(rig)==0)   {

Page 12: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

     int ran=random(1000);     if(ran%2==0)     {       left();       stat();       clean();     }     else     {       right();       stat();       clean();     }   }   //Obstacles on both sides, move back   if(isobs(lef)==1 && isobs(rig)==1)   {     back();     stat();     clean();   }   if(Serial.available())   {     flag=1;     break;   }    } } if(broomvar==1 && flag==0) {          for (int pos = 0; pos <= 180; pos += 1)     { // goes from 0 degrees to 180 degrees       brol.write(pos);   // tell servo to go to position in variable 'pos'       delay(15);      // waits 15ms for the servo to reach the position      }     for (int pos = 180; pos >= 0; pos -= 1)      { // goes from 180 degrees to 0 degrees       brol.write(pos);              // tell servo to go to position in variable 'pos'       delay(15);                       // waits 15ms for the servo to reach the position     }     for (int pos = 200; pos >= 0; pos -= 1)      { // goes from 180 degrees to 0 degrees       bror.write(pos);              // tell servo to go to position in variable 'pos'       delay(15);                       // waits 15ms for the servo to reach the position     }     for (int pos = 0; pos <= 200; pos += 1)      { // goes from 0 degrees to 200 degrees   // in steps of 1 degree       bror.write(pos);              // tell servo to go to position in variable 'pos'   delay(15);                       // waits 15ms for the servo to reach the position }               // waits 15ms for the servo to reach the position      } if(mopvar==1 && flag==0) {    for (int pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees   // in steps of 1 degree  bot.write(pos);              // tell servo to go to position in variable 'pos'

Page 13: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

   delay(15);                       // waits 15ms for the servo to reach the position }  for (int pos = 180; pos >= 0; pos -= 1) { // goes from 0 degrees to 180 degrees   // in steps of 1 degree  bot.write(pos);              // tell servo to go to position in variable 'pos'   delay(15);                       // waits 15ms for the servo to reach the position } for (int pos = 20; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees   mopl.write(pos);              // tell servo to go to position in variable 'pos'   delay(15);                       // waits 15ms for the servo to reach the position } for (int pos = 20; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees   mopr.write(pos);              // tell servo to go to position in variable 'pos'   delay(15);                       // waits 15ms for the servo to reach the position } }}//serialEvent() function, run between executions of loop. Used to check if message received from phone. Source: arduino.cc void serialEvent()/*serial data is added to a string char by char until new line*/ { while (Serial.available()) {   char inChar = (char)Serial.read();/*read incoming byte*/   inputString += inChar;   if (inChar == '\n')   {     stringComplete = true;   } } flag=0;}

The AppTo make the app we used MIT App Inventor. It is programmed using blocks, that can specify a particular action for a particular event. For each button click, a text message is sent to the Arduino which interprets it as a particular command. The following are the blocks of code used:

Page 14: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

The design of the app is as follows:

Page 15: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

Suggested ImprovementsThe project was a useful learning experience. However, it has several practical problems that need to be resolved, and there is a very large scope for improvement. The following are some of the ways in which the project can be made better:

Page 16: ee.iith.ac.inee.iith.ac.in/gadepall/images/cleaner/Cleaner Bot_Group23... · Web viewCleaner Bot Sukrut Rao - CS15BTECH11036 Tejas P - EP15BTECH11010 M S A Siva Satvik - CS15BTECH11023

A proper algorithm to cover the entire room can be devised. This was attempted but later abandoned due practical constraints.

A casing can be given to the bot to make it more presentable and protect the equipment inside.

More powerful motors can be provided for covering diverse terrains. An outdoor mode can be added to enable the robot to clean streets. A better battery source which is portable and rechargeable. Moreover, renewable

sources of energy like solar energy can be used. A vacuum cleaner can be added for improved cleaning. The weight of such a device

will have to be taken into consideration.