Controlling Water Filter

filtered water with Arduino


In the house you use drink filtered water. In fact it is found that sometimes cleaning the filter cartridge demonstrates a muddy patina and for this reason there is the preference to filter drinking water.

Last year it presented the problem that the flow-through to the filter is so slow that for a liter of water you had to wait more than a quarter of an hour. With the consequence that sometimes we absented ourselves forgetting the filter open, so that sometimes he made his mark of flooding in the kitchen.

The filter consists of a ceramic cartridge of a certain porosity. The duration is such that as long as the water passes through. For this more would filter it becomes clogged and well.

For this, I chose to add a pump that would speed the delivery. Also I chose one that would raise the pressure to at least 0,7 Mpa (7 bar) with a flow rate of 4 liters / minute. I did well I found one that works 12 V so I can use an old power supply of a laptop (14 V 42 Watt).
Now with the new system the bottle is filled in a quarter of a minute. An improvement of more than sixty times .


The project fto a little more than necessary, because it might be enough of a button and start the 'delivery. So much for fun and comfort control it has the peculiarity to keep a count so that inform you when the delivery has reached a certain volume exempt.

At the beginning I thought I would put everything inside a container, I did not leave too many water and electricity connection to the fact fray, I have taken the CAD and I studying how to arrange the components.
What the published CAD has not mounted control, since there have been several revisions, after the study of the spatial component implementation.
In the end I had to make a little deal with the size of the container, I was hoping to be able to settle in a cheaper one.

the scheme

It was designed to be able to eliminate disturbances that the motor and the 'solenoid valve cause. In fact, the display is prone to drift and the characters appear busted. This is why I adopted transil, MOV, snubbers and even the’ update the display.

The display that I have used is a 8×2 blu. Hath predicted that can be programmed for the control of the backlighting, but blue is not feasible. As hardware can implement PWM, but there is not provided the input for the photoresistor. As with my display I opted not to control PWM.

As hardware you can also opt for some other type of control, one part is provided as an operator interface via knob with encoder and display, on the one hand it allows the communication via the serial and an expected part to control two outputs. One of which can operate in the amplitude modulation.

There is a bridge that allows to separate the power supply from the rest of the circuit arduino. It is expected to be able to program Arduino without moving from the seat and without strange effects of power outside of Arduino.

Green dots are connectors FASTON type, so as to be able to intervene quickly to remove circuit.


To mount the display I preferred to use the tulip connectors and solder pin in the position of connections. With this method it will be possible to perform precisely remove changes in its area below, or replace the display.
You may notice a white LED that is placed on the transparent front panel that is in front of the display. When the display is turned off you are always known an illuminated border around the display and makes a nice.

Lthe same materials

Category Quantity References Value Stock Code Unit Cost
Capacitors 2 C1-C2 330nF
Capacitors 1 C3 220uF
Capacitors 1 C4 33nF
Capacitors 1 C5 22nF
Capacitors 1 C6 1000uF
Resistors 3 R1,R9-R10 10k
Resistors 2 R2,R6 3300
Resistors 2 R3-R4 22
Resistors 1 R5 1800
Resistors 1 R7 2k
Resistors 1 R8 270
Integrated Circuits 1 U1 7805
Transistors 1 Q1 IRL540
Transistors 1 Q3 2N3705
Diodes 2 D1,D5 1N4148
Diodes 2 D2-D3 1N5404
Diodes 1 D4 1N4007
Diodes 1 D6 LED-RED
Diodes 1 D7 TVS17V
Miscellaneous 6 14VA,14VB,EV_OUT,GND,PUMP,V14IN
Miscellaneous 1 ARD1 arduino
Miscellaneous 1 FU1 3A
Miscellaneous 1 H1 100mH M82R
Miscellaneous 1 J1 ENC
Miscellaneous 1 J3 BT
Miscellaneous 1 J4 SENSOR
Miscellaneous 1 JP1 JUMPER
Miscellaneous 1 LCD1 LM802
Miscellaneous 1 RL1 W117SIP-1
Miscellaneous 1 RV1 5K Digikey 3352T-502LF-ND
Miscellaneous 1 VR1 S14K17

The software

Education firmware use


The program source is commented plenty per to help understand what is written, and maybe, in a subsequent period usally the MAINTENANCEne.

Nell'ultima version I had to adjust a lot and also added an online help to remember the available operations.

The display messages are in English, why the family does not know my language. Remains communication via serial which is in Italian. It is, however possible to exclude the compilation with the use of the serial.

It should be noted at the beginning definitions that determine a compilation in a differentiated way of hardware utilization.

The options are:


It used to use the outputs in a separate way. Otherwise it should be wired to connect the solenoid valve and pump together.


Determina the addition of serial communication to the TXD pin and RXD.

L 'pin assignments for use with the serial are those of the hardware serial arduino. Better to remove the Bluetooth module if you want to program without disturbance. I did not have adverse effects, During my tests.


It serves to control the backlight of the display with the aid of a photoresistor. In order to have a proportional lighting.


Option to check if the flow degrades too had dirt. Usually it allows you to wash and replace the cartridge.

How to Use

First method
commandsl device.

A single entrance is governed by a rotary encoder. Preliminary tasks are three:

  • Turn the knob, It involves move to the selection of a delivery program

  • Long press, allows d 'start dispensing until such time as holding down

  • A double click, ago switch the use of the pump.

Here there are high options, after making the first command. In fact they have the 10 dispensing programmings. It was planned to limit 10 liter maximum. It places the value in ounces. However, you can change to a maximum of 255 decilitri.

When you see a program, you can access the tag with a double click. Or long press to exit and return to the main menu.

There is also the 'option eleventh, that allows you to enter setup / information phases. Also through a double click is implemented to enter the menu. The explanation of the comments perhaps make better idea of ​​how it works.

I did not see the need to a measure of 25 l, so usually it fills a bottle to put in the fridge to cool, the most of someone else's family member fills the pan to boil water. Anyhow 4 liters is the commonly accessible limit.

In phase SETTINGS, There are five options. Zero the two filter alarms, modify the pulses per liter of the flow sensor, change the threat level (provided that the option has been compiled), finally reset the counter of goodwill.

second method Serial Commands.

It has been predicted communication with the arduino via serial. This can be a USB-RS232 adapter is compatible with voltage levels of micro. You can also use a Bluetooth module, who may need a focus on the voltage levels of the micro. I put a voltage divider to adapt to 3,3 Volt leg RX Bluetooth module. The TX pin does not create severe problems.

List Commands from serial

The control model is based on an initial letter followed by numbers, if it is necessary. The first letter does not matter whether upper or lower case.

Commands in detail from the serial:


Chandmaid a program location. With n determines which memory.


Si set the frequency of dirty filter alarm limit


It presents the 'on-line help with details of commands


A list of 'information of public use. It may be useful to combine it with the home automation system.


Turn off the pump control signal. That leg which controls the MOSFET.


Select a delivery program. L’ n determines which program location. However, it is only possible in front of the device, since you are required to enter the random number that you see on the display. Here begins to deliver.


Non does almost nothing. Depending on if you have a terminal that supports ANSI escape commands, then you should clear the screen.


Attiva or less the ANSI way of the terminal, if supported.


You choose to effetturare one of three reset. HE n is present directly you choose which of the three. In sequence are filter Dirty, filter Out, Number counts.


SI set the value of the pulse per liter, to make the calculation of liters to be delivered.


SCRIVE a dispensing program. With # determines which memory, with nn It determines how many ounces set. Between # nn and there must be a separator, but it is not decisive that.

End Command Message:

At the end of each command is an information message. Reading the source are unable to understand what they are and how they present themselves.


There may be some oversights or improvements to be made and I would like to know how to do better.

Use the project involves responsibility, that the 'author assumes to cause damage to persons or property.

The package to download if you're interested.

5 replies
  1. Picmicro675
    Picmicro675 says:

    For the encoder reading I've seen different methods, including a couple of libraries. My concern that the number of interrupts is excessive, He made me choose that way. In fact the serial takes an interrupt to the data received, The setup takes another interrupt function for the millis(), there is an interrupt when the timer 1 reaches the end of the count.
    I have tried other methods, but the number of interrupts has stopped me.

  2. Picmicro675
    Picmicro675 says:

    The engine is not far, maybe you can see from the CAD. In practice 30 cm wire.
    I do not know if I could solve, maybe I should separate the power supply of the display and put a diode with a capacitor in the following buffer. But already there is on the whole branch of the Nano and Display. Maybe they are negative spikes on the power supply.
    Only that the behavior is abnormal, since it is not repetitive.
    In another attempt, what to do, It would be to re-initialize the display just after the engine is started, at least tidy up the CGRAM, who loses sync.
    Moreover, the software route is the least hardworking…

    • Amilcare
      Amilcare says:

      It might be a good idea to reset the display preventively.
      For the sensitivity probably you need to use the interrupt command to the change of state rather than testing all the time the two pins
      You would have suffered instant response. Perhaps the least invasive solution would be to decrease the waiting time for the bounce. Of course with moderation to have false positives.
      I'm currently preparing the second part of the description of the IGBT, It would not say it is one of the most read pages on the site every day.

  3. Amilcare
    Amilcare says:

    For displays I see hard unless you have just a few meter of wire between card and motor. In the past, with a pic I had to wire the supply to the motor and that of the tab in a distinct manner starting from the battery.

  4. Picmicro675
    Picmicro675 says:

    Add notes:
    After some experiments and some temporal evil, abutment of transgressions.

    1) The measurement of the pulses varies between entities without pump method and with the pump. I would say that there is a 20% less with the pump, maybe better counts the pulses. Easily the device prefers more sustained measures, In fact, it declares a measure to be 1 a 30 L / min. Possible that we can intervene to recalculate the pulses per liter on the basis of the sensor frequency level.

    2) the display shows unpacked characters, it seems that the precautions on the power they have not had enough effect. Especially starting the pump. Perhaps there are factors were pejorative, in the period that we were not at home.
    I think I should reset the display as soon as possible.

    3) In the settings menu you are missing an entry, although less interesting, because I forgot to change the maximum number of counting of encoder pulses.

    4) I did not understand what factor preventing me from immediately implement. When I turn the knob does not appear on the menu and you have to repeat. At least I can not find a way to accentuate the pulse sensitivity. Many times you have to repeat for the change of position.

    Welcome if someone can do some experiments.


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply