Anjali Shaw
Published © GPL3+

Covid - 19 stop the spread

We touch the container and it can also cause the spread. let's break the corona chain without touching the handwash container.

IntermediateFull instructions provided602
Covid - 19 stop the spread

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Male/Male Jumper Wires
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Circuit diagram

Have a schematic look to it.

Code

code for the program

Arduino
Have a look to code. We can also attach two motors as per machanical power required.For the two motors code is 'commented' mentioning "m2". //We can uncomment that as per our requirement
#include<Servo.h>
int trig=8;
int echo=9;
int dt=10;
Servo servo;
// m2 Servo motor;
//int distance,duration;
void setup() {
  // put your setup code here, to run once:
pinMode(trig,OUTPUT);
pinMode(echo,INPUT);
Serial.begin(9600);
servo.attach(11);
// m2 motor.attach(12);
}

void loop() {
  // put your main code here, to run repeatedly:


if (calc_dis()<10)
{
  for (int i=0;i<=540;i++)
  {
    servo.write(i);
    delay(1);
  }
  delay(100);
  for (int i=540;i>=0;i--)
  {
    servo.write(i);
    delay(1);
  }
  delay(100);
}
/* m2
if (calc_dis()<10)
{
  for (int i=0;i<=540;i++)
  {
    motor.write(i);
    delay(1);
  }
  delay(100);
  for (int i=540;i>=0;i--)
  {
    motor.write(i);
    delay(1);
  }
  delay(100);
}
*/

}

//This code is written to calculate the DISTANCE using ULTRASONIC SENSOR

int calc_dis()
{
  int duration,distance;
  digitalWrite(trig,HIGH);
  delay(dt);
  digitalWrite(trig,LOW);
  duration=pulseIn(echo,HIGH);
  distance = (duration/2) / 29.1;
  return distance;
}

Credits

Anjali Shaw

Anjali Shaw

10 projects • 7 followers

Comments