Introduction: Automatic Faucet System With FPGA and IR Object Sensor

Picture of Automatic Faucet System With FPGA and IR Object Sensor

Background:

We built a system that modifies an existing idea that is used extensively in public restrooms: faucet automation. We created an updated design that will lead to more efficient water use in faucets. We chose this idea because the existing sensor/timing system already in place is extremely ineffective at both conserving water and washing hands, not to mention frustrating to use. Our improvement on this idea includes a more effective timer and display, a sensor that will turn the water off if there are no hands sensed under the sink, and a manual override switch that takes precedence over the entire system as an option for filling bottles or buckets with no fear of the timer turning water off. This conserves more water than the existing model because it has 3 conditionals on whether or not the water is on or off, plus the timer display will provide a way for the user to see how long the water has been on. The previous model used one conditional: if hands were sensed under the faucet, a timer would start and only turn off after a preset short amount of time.

Step 1: Materials and Skills Needed

Picture of Materials and Skills Needed

- LM741 Op-Amp IC

- 3-Pin IR Sensor

- 5 volt Power Source (we used an Arduino Uno Board)

- Digilent Basys3 FPGA board or similar FPGA board

- Solderless breadboard

- blue LED

- jumper cables

- basic understanding of VHDL

- Micro USB cable (for the Basys 3 FPGA board)

- A/B USB cable (if you are using an Arduino for power)

Step 2: Black Box, State and Circuit Diagrams

Picture of Black Box, State and Circuit Diagrams

Above you can see our black box diagram and our finite state machine diagram.

System Inputs:

S1: This signal comes from our off-board IR Object Sensor

Switch: This is an on-board (Basys3) switch signal that is essentially an override signal

CLK: This is the clock signal we input into our system, which is the internal clock of the Basys 3 board at 100MHz

System Outputs:

W: Our water signal that ouputs to a blue LED that lets us know whether or not the faucet is outputting water

seg (8 bit): This signal is outputted to the on-board 7-segment display that shows the user how much time the water has been on.

anodes (4 bit): This signal is also outputted to the on-board 7-segment display but indicates which of the 4 digits will be "on". In our case, this output is always "1110", or the right-most digit.

Modules:

fsm_faucet: the finite state machine that is described in the state diagram above

onehz: a clock division file that takes the CLK input (100MHz) signal and converts it into a much slower, human distinguishable, clock signal to drive the fsm and seven-segment display

sseg_dec: a seven-segment decoder that takes in an 8 bit binary number and outputs the decimal form of the number to the Basys 3 FPGA board (courtesy of our professor, Dr. Danowitz, written by Brian Mealy)

Step 3: VHDL

The VHDL uses a finite state machine with moore outputs and a total of 7 states, represented by 3 bits.

State 0:

In state zero, the switch is off and no hands are being sensed; the water is off. When a hand is sensed, the machine transitions to state 1.

State 1-6:

In state 1, a hand is being sensed and the water is on. If the hand continues to be sensed, the machine transitions into state 2, and the water stays on. As long as the hand is being sensed, it will transition from state 1 to state 6, outputting water.

Back to State 0: If a hand is no longer sensed at any time during these states, the machine will transition back to state 0.

If a hand is still being sensed, and the machine is in state 6, the machine transitions to state 7.

State 7:

In state 7 the water is off. The machine will remain in state 7 until hands are no longer being sensed.

State 7 is the most necessary state to ensure the machine works properly. State 7 acts as a safe state for the system. If something were to go wrong with the sensor, and continuously sense something, state 7 ensures the water turns off and stays off until the sensor is fixed.

Additionally, it prevents users from continuously running the water to wash their hands. They must "reset" the system by pulling their hands away and then placing them back in front of the sensor if they need more water.

Step 4: Build IR Sensor Circuit

Step 1: Connect power strips on either end of Breadboard
Connect through wire the opposite side power supply (+ strip) and ground (- strip)

Step 2: Put LM741 Operational-Amplifier into Breadboard where no other components are in series with any of the pins just yet

Step 3: Ground Pin 4 on LM741 Op-Amp By placing a wire into a slot in series with Pin 4, and placing the other end in the ground strip (-)

Step 4: Give the Op-Amp Power By connecting the V+ pin (Pin 7) to the power strip (+)

Step 5: Connect the Output of the Infrared Sensor to the Inverting Input of the Op-Amp The leftmost pin on the IR Sensor is the Output pin and that needs to be connected to the Inverting Input Pin of the Op-Amp (Pin 2)

Step 6: Connect the VCC Pin (Power Supply Pin) of the Infrared Sensor to the Power Strip of the Breadboard The rightmost pin on the IR Sensor is the Power Supply Pin (VCC) and that needs to be connected to the power strip (+)

Step 7: Connect the Ground (GND) Pin on the IR Sensor to the Ground Strip of the Breadboard The middle pin on the IR Sensor is the Ground Pin (GND) and that needs to be connected to the ground strip (-)

Step 8: Connect the anode (positive end) of the LED to the Output of the Op-Amp (Pin 6) To anode of the LED needs to be connected to the output pin of the Op-Amp (Pin 6)

Step 9: Connect the cathode (negative end) of the LED to the Ground Strip of the Breadboard The cathode of the LED needs to be grounded, so it needs to be placed into the Ground strip (-)

Step 10: Connect 5V Power Supply Arduino to Power and Ground Strips on Breadboard Use wire to connect the 5V Supply and Ground Pins in the Power Supply to the Power and Ground Strips in the Breadboard

Completed, and Test! Hold hand over IR Sensor and the LED should turn on

Step 5: Assemble

Picture of Assemble

To assemble the final product, you must connect all your hardware together.

Take your remaining jumper cables and connect the IR Sensor circuit up to a 5 VDC source into the power and ground strips on the breadboard.

Then, take a jumper cable and place it into the output pin (pin 6) row of the breadboard and the other end to one of the Basys 3 pmod inputs. (Data)

Hook up two female-to-male jumper cables to the two ends of the Blue LED and the other ends to a pmod output and ground on the Basys 3 board. (Output and Ground)

These connections can be seen in the upper right hand corner of the picture above.

Step 6: 3D Printed Faucet

In lieu of creating an actual working faucet we modeled a faucet in SolidWorks. This model includes routing for wiring to an LED at the nozzle to simulate water. The model also includes space underneath it for a small breadboard to mount the IR sensor as well as the other necessary components to make the circuit function properly. The model from SolidWorks was then used to print the faucet with an Ultimaker 2+ 3D printer.

The model in solidworks is based in part to Nelson Brazeau's design on GrabCad located at:

https://grabcad.com/library/the-faucet

Step 7: Acknowledgements

Picture of Acknowledgements

This instructable was designed for our Digital Design Final Project (CPE-133) at California Polytechnic State University, San Luis Obispo, with Dr. Andrew Danowitz as our instructor.

A strong benefit to this idea is that it allowed us to combine the knowledge from other Electrical Engineering courses, like op-amps, to new concepts we learned in this Digital Design course, such as finite state machines, clocks, and a seven-segment display. It also allowed us to incorporate our skills which we have developed outside of the class.

Project Designers:

Anuj Gohil, 2nd Year Electrical Engineer

Austin Kurth, 2nd Year Electrical Engineer

Nicholas Luong, 2nd Year Electrical Engineer

Jake Wahl, 2nd Year Electrical Engineer

Comments

AnujG28 (author)2016-12-12

this changed my life

DIY Hacks and How Tos (author)2016-12-10

That is really cool. I really like the idea of 3D printing sink fixtures. I just finished a bathroom renovation and we were really frustrated with the lack of selection at the local hardware store. If you could print your own, you could make it in any design that you want.

Thank you! That was our thinking behindthe 3D modeling :)

About This Instructable

1,566views

26favorites

License:

More by jawahl:Automatic Faucet System with FPGA and IR Object Sensor
Add instructable to: