This is obvious of course. It needs an infrared transmitter and sensor to track your hands movements and a controller for operation.
What is the problem then?
The only problem is the power that supplies the controller and infrared transmitter and sensor.
Would you make them powered by DC or AC? Would you power them from a battery or from a wall outlet?
Here in this instructable, the author has made a brilliant idea.
He came up with a simple yet efficient idea to power the system.
He made it self powered. The water tap makes it own power.
Here the faucet system generates its own power by a small hydro-generator.
This small generator can power the system and can also store the power inside a battery to use it in all times.
So you don't need a wall outlet nor you need a battery to keep checking and recharging. The system is self powered.
Here is the hydro generator
Components
1. 3.6V Micro Hydro Generator
2. Screw thread (G 1/2", female)
3. Thread seal tape
4. Arduino Uno
5. IR Transmitter
6. IR Receiver
7. 56k Resistor
8. 220 ohm resistor
9. PCB board
10. Micro servo motor
11. Polymer Lithium Ion Battery
12. 1.25" diameter plastic pipe
13. Some wires
Code
#include <Servo.h> int value = 0; int avg_value = 0; int sensorPin = A5; //connect ir receiver output to this pin int buttonPin = 18; // button pin to A4 boolean buttonState = HIGH; boolean tapState = LOW; int ledPin = 13; //this is for testing purpose int tapForState = 0; Servo myservo; // create servo object to control a servo // twelve servo objects can be created on most boards void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(buttonPin, INPUT); pinMode(ledPin, OUTPUT); digitalWrite(buttonPin, HIGH); //servo motor is connected to Arduino digital pin 3 myservo.attach(3); } void loop() { buttonState = digitalRead(buttonPin); delay(50); if(buttonState==LOW && tapState==LOW){ digitalWrite(ledPin, HIGH); myservo.write(0); delay(7000); tapState = HIGH; tapForState = 1; // check either tap was on for button press or not } else if(buttonState==LOW && tapState==HIGH && tapForState==1){ digitalWrite(ledPin, LOW); myservo.write(80); delay(100); tapState = LOW; tapForState = 0; } // put your main code here, to run repeatedly: for(int i=0; i<20; i++){ value += analogRead(sensorPin); delay(5); } avg_value = value / 20; Serial.println(avg_value); if(avg_value<=500){ digitalWrite(ledPin, HIGH); myservo.write(0); delay(7000); tapState = HIGH; if(tapForState==0) tapForState = 2; // check tap was on using sensor data } if(avg_value>500 && tapForState==2){ digitalWrite(ledPin, LOW); myservo.write(80); delay(100); tapState = LOW; } value = 0; }
Source: Instructables
No comments:
Post a Comment