how to make an automatic faucet

Now you will not forget to close your faucet or waste water when you pick a soap to wash your hand or face. This project shows you how to make an automatic faucet, you can even use the faucet that water valve damage because of this circuit use solenoid valve to control water.

Electronic components you need:
1 Arduino Uno R3
1 TR1 = IRF 540n N channel MOSFET
1 Sensor1 = IR sensor
1 IR1 = IR led
R1 = 10 kilo-ohms
R2 = 100 ohms
R3 = 4.7 kilo-ohms
1 12 volts solenoid valve
12 volts 1 Ampere adapter

The Arduino code is very simple and you don't need to load any special module to make this project works

 created 29 Dec. 2008
 modified 9 Apr 2012
 modified 20 Oct 2017
 by Tom Igoe

 This example code is in the public domain.


// These constants won't change.  They're used to give names
// to the pins used:
const int analogInPin = A0;  // Analog input pin that the ir sensor is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to

int sensorValue = 0;        // value read from the IR
int outputValue = 0;        // value output to the PWM (analog out)

void setup() {
  // initialize serial communications at 9600 bps:

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 1023 , 0, 255);
  // change the analog out value:
  analogWrite(analogOutPin, outputValue);

  // print the results to the serial monitor:
  Serial.print("sensor  = ");
  Serial.print("\t output = ");
if (sensorValue < 500)
  digitalWrite(LED_BUILTIN, HIGH);
else if (sensorValue > 500)
   digitalWrite(LED_BUILTIN, LOW);

  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:

Change this code from 500 to 600 if you want to increase detector range.
if (sensorValue < 500)
  digitalWrite(LED_BUILTIN, HIGH);
else if (sensorValue > 500)
   digitalWrite(LED_BUILTIN, LOW);

See the video below about how to connect every component to Arduino.


Popular posts from this blog

How to connect volume control to an amplifier

5 watts amplifier TDA7056A wiring diagram

How to add power supply filter capacitor to amplifier board.

Hall effect sensor wiring diagram and test video

Cellphone white spot on back body repair

Resistor color code

PAM 8403 board amp wiring diagram

10 watts 8 ohms class d amplifier pam8610 sound test

simple bass booster circuit diagram

How to make a simple audio pre-amplifier