Our Handless Tap
Our goal was to make a project that help the environment. My former cat had the habit to only drink directly from the tap and it became a huge loss in water. So, we mix these ideas and thinking about our own handless tap which count our water consumption.
Disclaimer : Our last test had some errors and we need to correct some. Firstly we used an alimentation of 9V, and our solenoid couldn't let water flow
Thanks to some people, we have a strong theory which conclude us to this result.
Control a Solenoid with an Arduino : https://www.instructables.com/Controlling-solenoi...
Database Tutorial :
Materials :
To make this project happen, we need these materials:
Give you 2 choices to buy, amazon is generally faster but more expensive
-Esp 8266: A low-cost microchip with a WIFI plugin, able to communicate.
https://www.amazon.fr/AZDelivery-NodeMCU-ESP8266-d...
https://fr.aliexpress.com/item/32665100123.html?sp...
-Solenoid Valve: Valve able to make water flow under a voltage
https://www.amazon.fr/%C3%89lectrovanne-%C3%A9lect...
https://fr.aliexpress.com/item/4000067341651.html?...
-PiR HC-SR501: Our movement detector
https://www.amazon.fr/D%C3%A9tecteur-Mouvement-Inf...
https://fr.aliexpress.com/item/33059656157.html?sp...
-Darlington TIP120: Our Transistor, needed for the power supply
https://www.amazon.fr/Ils-Transistors-Darlington-T...
https://fr.aliexpress.com/item/33017353462.html?sp...
-Diode 1N4001: Important for the voltage of our solenoid valve
https://www.amazon.fr/dp/B07CJBDGTY/ref=redir_mobi...
https://fr.aliexpress.com/item/1005001552094086.ht...
-12V cell: Our power supply
https://www.amazon.fr/AmazonBasics-A23-Alkaline-Ba...
-2.2kOhm resistance
https://www.amazon.fr/10-couche-R%C3%A9sistances-m...
-Jumper Wires: Connections
The Transistor : Darlington TIP120
Datasheet : https://www.onsemi.com/pdf/datasheet/tip120-d.pdf
A transistor is a semi conductor which allow to manipulate a voltage on the output pin electrode with a voltage on input pin.
In our case, it allow to send a voltage to our solenoid valve from our esp (3.3 output voltage) into a valid voltage (12V from our Cell).
On the base pin (1), we will connect to a resistance and to our PiR
Collector pin (2), to the Solenoid Valve (+)
Emitter pin (3), to the Ground
The PIR : HC-SR501
The PIR is a sensor capable of detecting movement.
It detects infrared radiation in its field of vision and deduces a presence or movement.
This sensor can be used in many applications including in an alarm system.
The 3 pin are :(left to right) the ground , the output signal and the power supply (5V) .
It also has two buttons to adjust: the one on the left for the time at high power state (3 seconds to 5 minutes) and one on the right for the sensitivity (3 to 7 meters)
Solenoid Valve
A solenoid valve is an electromechanically-operated valve. A normally closed solenoid valve allows water to flow through it when a current is applied.
Thanks to our transistor, we could apply a 12V when our PIR detect a movement.
Because a solenoid valve have the same comportement than a motor, when we shut down the voltage, our solenoid valve could produce some current, so we put a diode 1N4001 to protect our circuit.
The Database :
1) Download XAMPP
https://www.apachefriends.org/fr/index.html
2) Start Apache and MySQL
3) Create a folder in xampp/htdocs (named here: codeprojet)
4) Create a file named pir.php with the following code (pir.txt):
5) Create a new database on phpMyadmin called “electrovanne”
6) Create a new structure pir
7)Associate these 4 variables with the following values:
Name: ID | Type: BIGINT |Default: AUTO_INCREMENT
Name: PIR | Type: int |Default: NULL
Name: Duration| Type: float |Default: NULL
Name: date | Type: timestamp |Default: CURRENT_TIMESTAMP
8) Test with a new url in your browser: http://localhost/codeprojet/pir.php?Duration=11&P...
9) Verify with a refresh if it comes out on your database
10) Modify the Arduino code with your WIFI configuration, IP address... (connectedPIR)
11) try it on your Arduino board.