Smart Soap Dispenser(with Timer)
by Arnav_Sinha in Circuits > Arduino
425 Views, 1 Favorites, 0 Comments
Smart Soap Dispenser(with Timer)
So as we all know about the current situation happening around the world due to this global pandemic. And for our safety doctors and scientists from around the world have suggested us to wash our hands for about 20 seconds for better protection against the virus. But we all find it difficult to wash our hands and keep count of time at the same moment so here I am going to write an instructable on how to make a 'Smart Soap Dispenser' to solve this problem. This machine will be touch-free and will also have a timer display.
This project is a fantastic combination of Electronics, Software(Coding), and Mechanical Mechanisms.
I'm Arnav Sinha, age 14, and Welcome to my First Instructable on how to make a Smart Soap Dispenser!
Supplies
Here is a list of materials that you will require for this project:
- Arduino UNO
- Ultrasonic Sensor (HC-SR04)
- 5V Relay Module (Single Channel)
- BO Motor / Geared Motor (Single Shaft) (Pick one with a high Torque and less RPM)
- 7 segment display *2 pcs
- 1k ohms Resistor *14 pcs
- 5V Active Buzzer
- Vero Board / Perfboard / Zero PCB (3.8 × 5 cm) (If you are not able to find it in this size you can buy a bigger one and cut it from that.)
- Connecting Wires (approx. 5.20 meters of connecting wire is required in this project) (buy it in different colors)
- Some Levers (use a strengthy one so that it can bear some load without breaking or bending) (you can DIY it too!! You can use some scrap metal piece and cut it in the required length and breadth.)
- 16 Bolts and 19 Nuts (3 extra nuts are for use as check nuts) (a small one with 3mm diameter)
- 5V 2Amp DC Power Adaptor
- Female Port for DC Jack
- 6 female headers & 2 male headers
- Small PVC Buffer *4 Pcs
- A container for use as a body frame for the project, make sure to use a strong and rigid container. If you are unable to find the perfect container you can DIY it as I did. I used Mild Steel. You can use other hard materials too.
Here is a list of tools that you may require to build this project:
- A laptop or PC with Arduino IDE Installed
- Cutter Blades
- Wire Stripper
- Soldering Iron
- Drill Machine
- Glue Gun & Glue Sticks
- Cello Tapes
- Double-Sided Tapes
- Zip Tie
Now Since everything is ready let's jump into the steps for making this project!!
Making the Body(Frame)
First, you should make the main body of the project. Here I have attached a CAD design made by me, it is of the whole body of the project. You can refer to it. It's a 1:1 scale CAD Design.
It consists of two parts: The base Part & the Front Case Part.
After making the fame, paint it for a better look. I painted it with Black Spray paint, you can try different colors and share how does it look.
After completing the First Step let's get to the second step.
Downloads
Circuitry
After completing the frame let's get into its circuitry.
Here I have attached a Circuit Diagram of the Wiring. After completing the wiring move to the next step and burn the code in the Arduino UNO.
Note: In the given Circuit Diagram I have directly connected the Motor to the Arduino Pin but you need to add a Single Channel Relay Module between them. I could not show that in the Circuit Diagram because Relay Module was not available in TinkerCAD Circuits, but I added the Relay Module in my project.
Code
Now as you have completed the wiring part, let's burn the code in the Arduino.
Here is the code for this Project(for Arduino UNO) :
int f = 13; int g = 12; int e = 11; int d = 10; int c = 9; int b = 8; int a = 7; //1st Display Pins (7 Segment pins) int f2 = 6; int g2 = 5; int e2 = 4; int d2 = 3; int c2 = 2; int b2 = 1; int a2 = 0; //2nd Display Pins (7 Segment pins)<br> int Relay = A3; int Buzzer = A0; int de=1000; // delay time const int trigPin = A2; const int echoPin = A1; float duration, distance; void setup() { pinMode(f, OUTPUT); pinMode(g, OUTPUT); pinMode(e, OUTPUT); pinMode(d, OUTPUT); pinMode(c, OUTPUT); pinMode(b, OUTPUT); pinMode(a, OUTPUT); pinMode(f2, OUTPUT); pinMode(g2, OUTPUT); pinMode(e2, OUTPUT); pinMode(d2, OUTPUT); pinMode(c2, OUTPUT); pinMode(b2, OUTPUT); pinMode(a2, OUTPUT); pinMode(Relay, OUTPUT); pinMode(Buzzer,OUTPUT); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); } void loop() { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration / 2) * 0.0343; if (distance <= 8 ){ digitalWrite(Relay,HIGH); delay(1000); //Increase this Delay to get more Soap. digitalWrite(Relay,LOW); delay(3000); digitalWrite(a,1); digitalWrite(b,1); digitalWrite(c,0); digitalWrite(d,1); digitalWrite(e,1); digitalWrite(f,0); digitalWrite(g,1); // 2 digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,1); digitalWrite(g2,0); // 0 // 20 delay(de); digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // 1 digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,0); digitalWrite(f2,1); digitalWrite(g2,1); // 9 // 19 delay(de); digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // 1 digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,1); digitalWrite(g2,1); // 8 // 18 delay(de); digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // 1 digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,0); digitalWrite(e2,0); digitalWrite(f2,0); digitalWrite(g2,0); // 7 // 17 delay(de); digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // 1 digitalWrite(a2,1); digitalWrite(b2,0); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,1); digitalWrite(g2,1); // 6 // 16 delay(de); digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // 1 digitalWrite(a2,1); digitalWrite(b2,0); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,0); digitalWrite(f2,1); digitalWrite(g2,1); // 5 // 15 delay(de); digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // 1 digitalWrite(a2,0); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,0); digitalWrite(e2,0); digitalWrite(f2,1); digitalWrite(g2,1); // 4 // 14 delay(de); digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // 1 digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,0); digitalWrite(f2,0); digitalWrite(g2,1); // 3 // 13 delay(de); digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // 1 digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,0); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,0); digitalWrite(g2,1); // 2 // 12 delay(de); digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // 1 digitalWrite(a2,0); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,0); digitalWrite(e2,0); digitalWrite(f2,0); digitalWrite(g2,0); // 1 // 11 delay(de); digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // 1 digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,1); digitalWrite(g2,0); // 0 // 10 delay(de); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,0); digitalWrite(f2,1); digitalWrite(g2,1); // 9 // 9 delay(de); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,1); digitalWrite(g2,1); // 8 //8 delay(de); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,0); digitalWrite(e2,0); digitalWrite(f2,0); digitalWrite(g2,0); // 7 // 7 delay(de); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,1); digitalWrite(b2,0); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,1); digitalWrite(g2,1); // 6 // 6 delay(de); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,1); digitalWrite(b2,0); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,0); digitalWrite(f2,1); digitalWrite(g2,1); // 5 // 5 delay(de); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,0); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,0); digitalWrite(e2,0); digitalWrite(f2,1); digitalWrite(g2,1); // 4 // 4 delay(de); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,0); digitalWrite(f2,0); digitalWrite(g2,1); // 3 // 3 delay(de); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,0); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,0); digitalWrite(g2,1); // 2 // 2 delay(de); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,0); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,0); digitalWrite(e2,0); digitalWrite(f2,0); digitalWrite(g2,0); // 1 // 1 delay(de); digitalWrite(a,1); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,1); digitalWrite(e,1); digitalWrite(f,1); digitalWrite(g,0); // 0 digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,1); digitalWrite(g2,0); // 0 // 0 tone(Buzzer,500); delay(500); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,0); digitalWrite(b2,0); digitalWrite(c2,0); digitalWrite(d2,0); digitalWrite(e2,0); digitalWrite(f2,0); digitalWrite(g2,0); // null noTone(Buzzer); delay(500); digitalWrite(a,1); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,1); digitalWrite(e,1); digitalWrite(f,1); digitalWrite(g,0); // 0 digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,1); digitalWrite(g2,0); // 0 // 0 tone(Buzzer,500); delay(500); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,0); digitalWrite(b2,0); digitalWrite(c2,0); digitalWrite(d2,0); digitalWrite(e2,0); digitalWrite(f2,0); digitalWrite(g2,0); // null noTone(Buzzer); delay(500); digitalWrite(a,1); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,1); digitalWrite(e,1); digitalWrite(f,1); digitalWrite(g,0); // 0 digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,1); digitalWrite(g2,0); // 0 // 0 tone(Buzzer,500); delay(500); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,0); digitalWrite(b2,0); digitalWrite(c2,0); digitalWrite(d2,0); digitalWrite(e2,0); digitalWrite(f2,0); digitalWrite(g2,0); // null noTone(Buzzer); delay(500); digitalWrite(a,1); digitalWrite(b,1); digitalWrite(c,1); digitalWrite(d,1); digitalWrite(e,1); digitalWrite(f,1); digitalWrite(g,0); // 0 digitalWrite(a2,1); digitalWrite(b2,1); digitalWrite(c2,1); digitalWrite(d2,1); digitalWrite(e2,1); digitalWrite(f2,1); digitalWrite(g2,0); // 0 // 0 tone(Buzzer,500); delay(500); digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); // null digitalWrite(a2,0); digitalWrite(b2,0); digitalWrite(c2,0); digitalWrite(d2,0); digitalWrite(e2,0); digitalWrite(f2,0); digitalWrite(g2,0); // null noTone(Buzzer); } delay(100); }<br>
Mechanics
Now after successfully compiling and uploading the code to the Arduino let's have a look at the Mechanics.
Here I have attached a drawing in which the mechanism of the project is given.
The mechanism consists of three levers connected through movable joints. This mechanism converts the rotational movement of the motor into Linear Movement which presses the Liquid Soap Dispenser Bottle and the Liquid Soap comes out in our hands.
Note: The diagram which I have attached in this step does not represent actual electric wirings. This diagram is just for showing the Mechanical Levers. Ignore other components!
A Closer Look at the Final Product!!
Here I have attached a video of the final product.
So, now The Smart Soap Dispenser Project is completed. Hurray!!
Now you can have this advanced Soap Dispenser in your Home too. Do share how does your version of this project turns out!
Thank you very much for reading this instructable. Hope you liked it!