You are on page 1of 11

ACTIVITY 3

CAMPUS ROBOT ROVING SANITIZER

INTRODUCTION

Liquid hand sanitizers, mostly alcohol base gels have

enjoyed an explosion in popularity in the last 10 years. If

you have traveled by airplane or set of foot in a classroom in

the US lately, chances are you have seen hand sanitizers in

use. Hand sanitizer do not serve as a replacement for thorough

handwashing. Instead, they are though to bring consumers some

of the benefits of hand washing when hand washing is not

practical. Applying a large volume of hand sanitizer ensures

excess active ingredient and extends the period of chemical

activity before the hand sanitizer evaporates.

The benefits of CAMPUS ROBOT ROVING SANITIZER

Avoid transfer of diseases: During a monsoon or a

pandemic, it is the time where people are most vulnerable to

transmittable diseases. To decrease the burden of the people,

hand sanitizers are designed to kill germs, keep hand

sanitized and avoid spreading the virus in a more convenient

way. With proper use, hand sanitizers are capable of

eliminating up to 99.9% of germs on hands. It can be used as

an occasional replacement for soap and water.

Arduino Uno
 Lion battery (4pcs)

 Jumper wire

 LED red light

 220R Resistor for LED lights

 Ultrasonic sensor

 Pump bottle

 4x Wheels

 4x DC motor

 L293d Motor shield

 2x IR sensor

 Wooden board

 Motor pump

 Hose

 Alcohol

 Switch button
PROCEDURE

Step 1. Combine Motor shield and Arduino uno

Attach the motor shield on to Arduino uno.

Step 2. Setting of Led

Led light has two pin the short and long pin, the short

pin is connected to GND and the long pin is connected to

digital pin2.

Step 3. Setting of Ultrasonic sensor

Determine the four the trig, echo, volts and GND. The

trig pin is connected to motor shield pin3 and the echo pin is

connected to 10pin. Next the GND is connected to the GRD pin.

The V+ is connected to the 5volts.

Step 4. Setting of DC motors

The motors is connected to any of M1, M2, M3 or M4 motor

terminal. In this case, Arduino pin4 for M1, pin5 for M2, pin6

for M3 and pin7 for M4.

Step 5. Setting of 2x IR sensor


IR sensor1 OUT pin is connected to motor driver A0 pin,

IR sensor2 is connected to motor driver A1. Next the GND pin

is connected to motor driver GND pin. Last the VCC pin is

connected to motor driver 5v pin.

Step 6. Setting of SR-05VDC-SL-C relay

The signal is connected to digital pin3, the GND is

connected to the GND pin, the V+ for 5volts. The NO is

connected to negative wire of water pump motor and the C is

connected to the 5volts.

Step 7. Setting of water pump motor

The negative wire of water pump motor is already

connected to the NO of relay module. The last wire is

connected to the 5volts.

Step 8. Setting of bottle alcohol

Put the water pump motor with hose inside the bottle of

full alcohol.
CIRCUIT DIAGRAM
SOURCE

#include <AFMotor.h>
#include <NewPing.h>

//defining pins and variables


#define lefts A1
#define rights A0

//defining motors
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);

#define echoPin 3 // attach pin D3 Arduino to pin Echo of HC-


SR04
#define trigPin 10 //attach pin D10 Arduino to pin Trig of HC-
SR04
int relayPin=5;//attach relays in to D5 of Arduino(DC Pump is
connected to Arduino)
// defines variables
long duration; // variable for the duration of sound wave
travel
int distance; // variable for the distance measurement
int ledPin = 2;

long inch;

void setup() {
//setting the speed of motors
motor1.setSpeed(90);
motor2.setSpeed(90);
motor3.setSpeed(90);
motor4.setSpeed(90);
//declaring pin types
pinMode(lefts,INPUT);
pinMode(rights,INPUT);

pinMode(trigPin, OUTPUT); // Sets the trigPin as an OUTPUT


pinMode(echoPin, INPUT); // Sets the echoPin as an INPUT
pinMode(relayPin, OUTPUT);
Serial.begin(9600);// Serial Communication is starting with
9600 of baudrate speed 9600
Serial.println("Ultrasonic Sensor HC-SR04 Test"); // print
some text in Serial Monitor
Serial.println("with Arduino UNO");
pinMode(ledPin, OUTPUT);

//begin serial communication


Serial.begin(9600);

void loop(){

//printing values of the sensors to the serial monitor


Serial.println(analogRead(lefts));
Serial.println(analogRead(rights));
//line detected by both

// pump condition
digitalWrite(trigPin, LOW);
delayMicroseconds(2);// Sets the trigPin HIGH (ACTIVE) for 10
microseconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);// Reads the echoPin, returns the
sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);

// Calculating the distance


distance = duration * 0.034 / 2; // Speed of sound wave
divided by 2 (go and back)
inch=distance/2.54;//converting cm to inch

// Displays the distance on the Serial Monitor


if(distance< 8) //Set the distance in centemeters(When an
obstacle is detected the liquid will dispense)
{
digitalWrite(relayPin, LOW);//LOW for the relay to be on
digitalWrite(ledPin, LOW);
delay(370);//For how many milliseconds your Pump works for
pumping the liquid(Dispensing quantity)
digitalWrite(relayPin, HIGH);//HIGH for the relay to be off
delay(3000);//Delay after each dispensing

motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);

}
else
{
digitalWrite(relayPin, HIGH);
digitalWrite(ledPin, HIGH);

motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);

if(analogRead(lefts)<=350 && analogRead(rights)<=350){


//Forward
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
//line detected by left sensor
else if(analogRead(lefts)<=350 && !analogRead(rights)<=350){
//turn left
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);

}
//line detected by right sensor
else if(!analogRead(lefts)<=350 && analogRead(rights)<=350){
//turn right
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);

}
//line detected by none
else if(!analogRead(lefts)<=350 && !analogRead(rights)<=350)
{
//stop
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);

You might also like