Disinfection plays a critical role in the fight against covid-19. Evidence shows that covid-19 Omicron can remain active on cardboard for up to 24 hours[1] and plastic for up to 237.1 hours[2], and logistical disinfection is very labor-intensive. On the other hand, the home is the basic place where people live, and parcels delivered to the home can easily bring the virus into the home. We should pay attention to daily cleaning and disinfection to ensure the health of our family.
Design Positioning
In this robotics development course we want to build a robot to disinfect parcels.
When we pick up a parcel, our hands come into direct contact with the courier's hands or the parcel, which leads to a high risk of exposure to the virus. When disinfecting manually, the skin still comes in contact with the parcels and there is still a risk of incomplete disinfection.
How can robots contribute to the health of the home environment during covid-19 pandemic?
This robot keeps us out of direct contact with the virus.
The expected functions are:
Move in different directions;
Grab the parcels;
Spray the disinfection solution evenly;
Place the disinfected parcels back in their original position.
Prototyping
We used Arduino to develop this prototype. Flexible robotic arms made with 4 servos to grab and place packages, and a pump and 4 nozzles to spray disinfectant.
By halfway through the semester, Tsinghua University's teaching schedule was adjusted. Because covid-19 was spreading widely in Beijing, we returned home and had online classes. I took the unfinished prototype home and completed the subsequent assembly.
//Xiao In by Hongyu Jia, Tianqi Wei,Xuan Ding, Quan Yuan, 2022
#include<Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
const int STOP = 0;
const int FORWARD = 1;
const int BACKWARD = 2;
const int left_front_speed = 200;
const int right_front_speed = 200;
const int left_rear_speed = 200;
const int right_rear_speed = 200;
const int right_front_EN_PIN = 9;
const int right_front_IN1_PIN = 31;
const int right_front_IN2_PIN = 30;
const int left_front_EN_PIN = 8;
const int left_front_IN1_PIN = 33;
const int left_front_IN2_PIN = 32;
const int right_rear_EN_PIN = 13;
const int right_rear_IN1_PIN = 26;
const int right_rear_IN2_PIN = 27;
const int left_rear_EN_PIN = 12;
const int left_rear_IN1_PIN = 28;
const int left_rear_IN2_PIN = 29;
const int servo1_PIN = 6;
const int servo2_PIN = 4;
const int servo3_PIN = 3;
const int servo4_PIN = 5;
const int PUMP_PIN = 14;
String command;
int pos1;
int pos2;
int pos3;
int pos4;
void left_rear(int state);
void right_rear(int state);
void left_front(int state);
void right_front(int state);
void car_forward();
void car_backward();
void car_turn_left();
void car_turn_right();
void turn_around_left();
void turn_around_right();
void stay_still();
void setup() {
// put your setup code here, to run once:
servo1.attach(servo1_PIN);
servo2.attach(servo2_PIN);
servo3.attach(servo3_PIN);
servo4.attach(servo4_PIN);
Serial.begin(9600);
Serial1.begin(9600);
command = '0';
int pos1 = 45;
int pos2 = 90;
int pos3 = 90;
int pos4 = 90;
pinMode(right_rear_EN_PIN, OUTPUT);
pinMode(right_rear_IN1_PIN, OUTPUT);
pinMode(right_rear_IN2_PIN, OUTPUT);
pinMode(left_rear_EN_PIN, OUTPUT);
pinMode(left_rear_IN1_PIN, OUTPUT);
pinMode(left_rear_IN2_PIN, OUTPUT);
pinMode(right_front_EN_PIN, OUTPUT);
pinMode(right_front_IN1_PIN, OUTPUT);
pinMode(right_front_IN2_PIN, OUTPUT);
pinMode(left_front_EN_PIN, OUTPUT);
pinMode(left_front_IN1_PIN, OUTPUT);
pinMode(left_front_IN2_PIN, OUTPUT);
pinMode(PUMP_PIN, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial1.available() > 0){
command = Serial1.readStringUntil(';');
Serial.println(command);
if(command == "turn_left"){
turn_around_left();
}
else if(command == "turn_right"){
turn_around_right();
}
else if(command == "forward"){
car_forward();
}
else if(command == "backward"){
car_backward();
}
else if(command == "stop"){
stay_still();
servo1.write(pos1);
servo2.write(pos2);
servo3.write(pos3);
servo4.write(pos4);
}
else if(command == "servo1_clockwise"){
pos1++;
if(pos1 <= 170)
servo1.write(pos1);
else
servo1.write(170);
delay(100);
}
else if(command == "servo1_counterclockwise"){
pos1--;
if(pos1 >= 10)
servo1.write(pos1);
else
servo1.write(10);
delay(100);
}
else if(command == "servo2_clockwise"){
pos2++;
if(pos2 <= 170)
servo2.write(pos2);
else
servo2.write(170);
delay(100);
}
else if(command == "servo2_counterclockwise"){
pos2--;
if(pos2 >= 10)
servo2.write(pos2);
else
servo2.write(10);
delay(100);
}
else if(command == "servo3_clockwise"){
pos3++;
if(pos3 <= 170)
servo3.write(pos3);
else
servo3.write(170);
delay(100);
}
else if(command == "servo3_counterclockwise"){
pos3--;
if(pos3 >= 10)
servo3.write(pos3);
else
servo3.write(10);
delay(100);
}
else if(command == "servo4_clockwise"){
pos4 = 170;
servo4.write(pos4);
delay(100);
}
else if(command == "servo4_counterclockwise"){
pos4 = 10;
servo4.write(pos4);
delay(100);
}
else if(command == "pump_on"){
digitalWrite(PUMP_PIN, HIGH);
}
}
}
void left_rear(int state)
{
if (state == FORWARD)
{
analogWrite(left_rear_EN_PIN, left_rear_speed);
digitalWrite(left_rear_IN1_PIN, HIGH);
digitalWrite(left_rear_IN2_PIN, LOW);
}
else if (state == BACKWARD)
{
analogWrite(left_rear_EN_PIN, left_rear_speed);
digitalWrite(left_rear_IN1_PIN, LOW);
digitalWrite(left_rear_IN2_PIN, HIGH);
}
else if (state == STOP)
{
digitalWrite(left_rear_IN1_PIN, LOW);
digitalWrite(left_rear_IN2_PIN, LOW);
}
}
void right_rear(int state)
{
if (state == FORWARD)
{
analogWrite(right_rear_EN_PIN, left_rear_speed);
digitalWrite(right_rear_IN1_PIN, LOW);
digitalWrite(right_rear_IN2_PIN, HIGH);
}
else if (state == BACKWARD)
{
analogWrite(right_rear_EN_PIN, right_rear_speed);
digitalWrite(right_rear_IN1_PIN, HIGH);
digitalWrite(right_rear_IN2_PIN, LOW);
}
else if (state == STOP)
{
digitalWrite(right_rear_IN1_PIN, LOW);
digitalWrite(right_rear_IN2_PIN, LOW);
}
}
void left_front(int state)
{
if (state == FORWARD)
{
analogWrite(left_front_EN_PIN, left_front_speed);
digitalWrite(left_front_IN1_PIN, HIGH);
digitalWrite(left_front_IN2_PIN, LOW);
}
else if (state == BACKWARD)
{
analogWrite(left_front_EN_PIN, left_front_speed);
digitalWrite(left_front_IN1_PIN, LOW);
digitalWrite(left_front_IN2_PIN, HIGH);
}
else if (state == STOP)
{
digitalWrite(left_front_IN1_PIN, LOW);
digitalWrite(left_front_IN2_PIN, LOW);
}
}
void right_front(int state)
{
if (state == FORWARD)
{
analogWrite(right_front_EN_PIN, right_front_speed);
digitalWrite(right_front_IN1_PIN, LOW);
digitalWrite(right_front_IN2_PIN, HIGH);
}
else if (state == BACKWARD)
{
analogWrite(right_front_EN_PIN, right_front_speed);
digitalWrite(right_front_IN1_PIN, HIGH);
digitalWrite(right_front_IN2_PIN, LOW);
}
else if (state == STOP)
{
digitalWrite(right_front_IN1_PIN, LOW);
digitalWrite(right_front_IN2_PIN, LOW);
}
}
void car_forward()
{
left_rear(FORWARD);
right_rear(FORWARD);
left_front(FORWARD);
right_front(FORWARD);
}
void car_backward()
{
left_rear(BACKWARD);
right_rear(BACKWARD);
left_front(BACKWARD);
right_front(BACKWARD);
}
void car_turn_left()
{
left_rear(STOP);
right_rear(FORWARD);
left_front(STOP);
right_front(FORWARD);
}
void car_turn_right()
{
left_rear(FORWARD);
right_rear(STOP);
left_front(FORWARD);
right_front(STOP);
}
void turn_around_left()
{
left_rear(BACKWARD);
right_rear(FORWARD);
left_front(BACKWARD);
right_front(FORWARD);
}
void turn_around_right()
{
left_rear(FORWARD);
right_rear(BACKWARD);
left_front(FORWARD);
right_front(BACKWARD);
}
void stay_still()
{
left_rear(STOP);
right_rear(STOP);
left_front(STOP);
right_front(STOP);
digitalWrite(PUMP_PIN, LOW);
}