Manikant savadatti
Published © GPL3+

How to Make vaccum cleaning Robot From Scratch

This is a line following robot with vaccum cleaning capabilities. This project explains how to build it using Arduino and also NodeMCU.

IntermediateFull instructions provided1 hour15,886
How to Make vaccum cleaning Robot From Scratch

Things used in this project

Hardware components

cardboard
×1
Glue bottle
×1
Bo motor
×1
Amazon Web Services wheels
×1
Ir sensor (built in last project)
×1
Arduino UNO
Arduino UNO
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
Jumper wires (generic)
Jumper wires (generic)
×1
impellor / blower
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Robot Chasi and Connection

Dust collector making images

Code

code for vaccum cleaning robot using arduino

C/C++
int leftMotorForward = 3;            
int  leftMotorBackward = 4;          
int rightMotorForward  = 5;           
int rightMotorBackward = 6;  
int rightMotorENB = 8;            
int leftMotorENB = 9;            
#define LS 10    // left sensor                                         

 #define RS 7      // right sensor */


void setup(){
  // put your setup code here, to run once:       
 pinMode(leftMotorForward, OUTPUT);
  pinMode(rightMotorForward, OUTPUT); 
  pinMode(leftMotorBackward, OUTPUT);  
  pinMode(rightMotorBackward, OUTPUT);  /* initialize motor enable pins as output */
  pinMode(leftMotorENB, OUTPUT); 
  pinMode(rightMotorENB, OUTPUT);    

// initialize sensor pins as input
pinMode(LS, INPUT);
  pinMode(RS, INPUT);

}



void loop() {
if(digitalRead(LS) && digitalRead(RS))     // code to Move Forward
  { digitalWrite(leftMotorENB, HIGH);
   digitalWrite(rightMotorENB, HIGH);
    digitalWrite(leftMotorForward, HIGH);
    digitalWrite(leftMotorBackward, LOW);
    digitalWrite(rightMotorForward, HIGH);
    digitalWrite(rightMotorBackward, LOW);
  }
  
  if(!(digitalRead(LS)) && digitalRead(RS))     // code to  Turn right
  {digitalWrite(leftMotorENB, HIGH);
   digitalWrite(rightMotorENB, HIGH);
    digitalWrite(leftMotorForward, LOW);
    digitalWrite(leftMotorBackward, LOW);
    digitalWrite(rightMotorForward, HIGH);
    digitalWrite(rightMotorBackward, LOW);
  }
  
  if(digitalRead(LS) && !(digitalRead(RS)))     // turn left
  {digitalWrite(leftMotorENB, HIGH);
   digitalWrite(rightMotorENB, HIGH);
    digitalWrite(leftMotorForward, HIGH);
    digitalWrite(leftMotorBackward, LOW);
    digitalWrite(rightMotorForward, LOW);
    digitalWrite(rightMotorBackward, LOW);
  }
  
  if(!(digitalRead(LS)) && !(digitalRead(RS)))     // stop
  {digitalWrite(leftMotorENB, LOW);
   digitalWrite(rightMotorENB, LOW);
    digitalWrite(leftMotorForward, LOW);
    digitalWrite(leftMotorBackward, LOW);
    digitalWrite(rightMotorForward, LOW);
    digitalWrite(rightMotorBackward, LOW);
  }   }
  

code for vaccum cleaning robot using Nodemcu

C/C++
If you are using Esp8266 Nodemcu use this code
// pin declaration if you are using Nodemcu                        
int leftMotorForward = 2;     /* GPIO2(D4) -> IN3   */              
int  leftMotorBackward = 12;   /* GPIO12(D6 ) -> IN4  */            
int rightMotorForward  = 4;    /* GPIO4(D2) -> IN1   */                
int rightMotorBackward = 0;  /* GPIO0(D3) -> IN2  */                 
int rightMotorENB = 5; /* GPIO5(D1) -> Motor-A Enable */                 
int leftMotorENB = 14;  /* GPIO14(D5) -> Motor-B Enable */              
#define LS 13     // D7  left sensor                                         
 #define RS 15     // D8 right sensor                                    


void setup(){
  // put your setup code here, to run once:       
 pinMode(leftMotorForward, OUTPUT);
  pinMode(rightMotorForward, OUTPUT); 
  pinMode(leftMotorBackward, OUTPUT);  
  pinMode(rightMotorBackward, OUTPUT);  /* initialize motor enable pins as output */
  pinMode(leftMotorENB, OUTPUT); 
  pinMode(rightMotorENB, OUTPUT);    

// initialize sensor pins as input
pinMode(LS, INPUT);
  pinMode(RS, INPUT);

}



void loop() {
if(digitalRead(LS) && digitalRead(RS))     // code to Move Forward
  { digitalWrite(leftMotorENB, HIGH);
   digitalWrite(rightMotorENB, HIGH);
    digitalWrite(leftMotorForward, HIGH);
    digitalWrite(leftMotorBackward, LOW);
    digitalWrite(rightMotorForward, HIGH);
    digitalWrite(rightMotorBackward, LOW);
  }
  
  if(!(digitalRead(LS)) && digitalRead(RS))     // code to  Turn right
  {digitalWrite(leftMotorENB, HIGH);
   digitalWrite(rightMotorENB, HIGH);
    digitalWrite(leftMotorForward, LOW);
    digitalWrite(leftMotorBackward, LOW);
    digitalWrite(rightMotorForward, HIGH);
    digitalWrite(rightMotorBackward, LOW);
  }
  
  if(digitalRead(LS) && !(digitalRead(RS)))     // turn left
  {digitalWrite(leftMotorENB, HIGH);
   digitalWrite(rightMotorENB, HIGH);
    digitalWrite(leftMotorForward, HIGH);
    digitalWrite(leftMotorBackward, LOW);
    digitalWrite(rightMotorForward, LOW);
    digitalWrite(rightMotorBackward, LOW);
  }
  
  if(!(digitalRead(LS)) && !(digitalRead(RS)))     // stop
  {digitalWrite(leftMotorENB, LOW);
   digitalWrite(rightMotorENB, LOW);
    digitalWrite(leftMotorForward, LOW);
    digitalWrite(leftMotorBackward, LOW);
    digitalWrite(rightMotorForward, LOW);
    digitalWrite(rightMotorBackward, LOW);
  }   }

Credits

Manikant savadatti

Manikant savadatti

8 projects • 14 followers
I'm an Robotics Enthusiast and an Electronics and communication Engineering student studying in India .

Comments