DETAILED EXPLANATION OF HOW TO MAKE AN AUTOMATED WIRELESS SMART SOAP / LIQUID DISPENSER USING ARDUINO | IR PROXIMITY SENSOR | SERVO MOTOR

in STEMGeeks2 years ago

The need for smart devices is growing rapidly as they make life easier and smarter for their users. I'm @techlhab and today I would be sharing with us how to make is DIY Automated Smart Soap or Liquid Dispenser using Arduino Uno microcontroller, IR Proximity Sensor, and Servo Motor as the major hardware components which don't require to be touched before it dispenses the liquid or soap put in it. Its kinds were highly utilized during the pandemic to prevent the spread of the virus. While the software components are; the Arduino IDE, Embedded C/C++ programming language, and fritzing for circuit design and simulation.

hive posters (24).png


HARDWARE COMPONENTS


  • Arduino Uno
  • Servo Motor
  • IR Proximity Sensor

SOFTWARE COMPONENTS


  • Arduino IDE (Integrated Development Environment)
  • Embedded C/C++
  • Fritzing

The Arduino Uno


The Arduino Uno is a popular open-source microcontroller that uses the ATMEGA328P PIC (Programmable Integrated Circuit) chip developed by Arduino.cc. It has 14 digital I/O (Input / Output) pins and 6 analog I/O pins.

In this project, that is the stopwatch, the Arduino Uno microcontroller serves as the brain of the device, with which other components connected to it sends and receives instructions to and from respectively based on the code or instructions programmed to the microcontroller.

arduino.png


The Servo Motor


It is a micro motor that converts electrical signals to produce rotary effects, with which the speed, angular or linear position, velocity and acceleration can be controlled precisely with a microcontroller like the arduino uno.

In this project or tutorial, the servo motor is used in opening and closing the top lid of the liquid or soap dispenser.

It has 3 pins which are:

  • Vcc
  • Gnd
  • Signal


ServoM.png


The IR Proximity Sensor Module


The IR (Infrared) Proximity Sensor as an IR transmitter and a IR receiver on it which it uses to detect objects and obstructions in front of it as the IR transmitter keeps on transmitting infrared light and any object obstructs the transmitted light it reflects the light to the IR receiver which is how the sensor is been able to detect or monitor objects and obstacles.

So when the sensor detects objects or obstacles it sends the information to the Arduino Uno which then instructs the servo motor to dispense the liquid or soap in the dispenser.

It also has 3 pins which are:

  • Vcc
  • Gnd
  • Out


IR.png


THE HARDWARE CONNECTIONS


  • Conneting the IR Proximity Sensor to the Arduino Uno
Arduino UnoIR Proximity Sensor
15vVcc
2GndGnd
3D9Output
  • Connecting the Servo Motor to the Arduino Uno
Arduino UnoServo Motor
15vVcc
2GndGnd
3D8Signal

THE WIRING DIAGRAM


DISPENSER CD.png


THE CIRCUIT DIAGRAM


DCD.png


CODE



#include <Servo.h>
Servo myservo; 
int pos;
int Signal = 8;
void setup() 
{
  pinMode(Signal, INPUT);
  myservo.attach(9);  
}
void loop() {
  int buttonState = digitalRead(Signal);
  delay(1); 
if (buttonState == 0)
    {
  for ( ;pos >= 40; pos -= 1) 
   { 
    myservo.write(pos);             
    delay(15);                        
   }
    }
else
    {
  for ( ;pos <= 80; pos += 1) 
  { 
    myservo.write(pos);             
    delay(5);                        
   }
    }
}


Thanks for reading and visiting my blog 🤝. Kindly support this post by reblogging, upvoting, and commenting, it would be highly appreciated.

Images used in this post were all designed by me using frizting, a circuit design and simulation software, and canva.

Posted with STEMGeeks

Sort:  

Nice one! It would be great to see a photo of the assembly of the servo and the soap dispenser!

A question, is the output of the proximity sensor just 0 or 1?

Congratulations @techlhab! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

You received more than 4250 upvotes.
Your next target is to reach 4500 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

We have finished upgrading our website
Our Hive Power Delegations to the April Power Up Month Winners
Feedback from the May 1st Hive Power Up Day
Support the HiveBuzz project. Vote for our proposal!