In this tutorial we are going to develop an automatic sanitizer machine using Arduino Microcontroller.
SOFTWARE: ARDUINO IDE
SIMULATION: PROTEUS
PROTEUS ARDUINO UNO LIBRARY DOWNLOAD LINK:
https://www.theengineeringprojects.com/2015/12/arduino-library-proteus-simulation.html
PROTEUS IR SENSOR LIBRARY DOWNLOAD LINK:
https://www.theengineeringprojects.com/2018/07/infrared-sensor-library-for-proteus.html
COMPONENTS REQUIRED:
1.
ARDUINO UNO
2.
IR Sensor
3.
12 V Relay
4.
BC 547 TRANSISTOR
5.
12 V Pump Motor
6. Battery or External Power Supply
CODE:
/*************************************************************************/
#define IR 2
#define RELAY 3
void setup() {
pinMode(IR, INPUT);
pinMode(RELAY,
OUTPUT);
digitalWrite(RELAY,
LOW);
}
void loop() {
if
(digitalRead(IR)==1)
{
digitalWrite(RELAY, HIGH);
delay(100);
digitalWrite(RELAY, LOW);
while(digitalRead(IR)==1);
}
else
{
digitalWrite(RELAY, LOW);
}
}
- In This Above program, Arduino Micro controller is connected with IR sensor and Relay Module which turns ON and OFF the Pump Motor.
- The IR sensor is connected in 2 pin of Arduino
- The BC 547 NPN Transistor is connected to 3 pin of Arduino
- Once the pins are initialised as INPUT and OUTPUT, IR sensor continuously transmits the IR rays and once the IR receiver receives the IR rays it transmits 5 V supply to the output pin of the IR sensor.
- Arduino checks if the IR sensor sends 5 V (logical 1 ) to micro controller, the IF condition is satisfied and the relay is turned ON by BC 547 and it is turned OFF with the time delay of 500 MS.
- The relay module turns ON the DC Motor for 500 MS and after that it is turned OFF
- This process is done only one time, because the IR sensor will continuously detected.
- The while condition holds the program until the IR is not detected 0 volt (logical 0).
- If the IR sensor is not detected the while loop breaks and the else condition is processed.
- This process is repeated until the power is turned OFF.
Comments
Post a Comment