Water Filter RO system controller

Hi Everyone,

I have Reverse Osmosis home water filter system with 7 stage of filtering, the orders are:

  1. Solids filter
  2. Active Carbon filter
  3. Sediment filter
  4. Reverse Osmosis Mebrane
    -- 3.5 Galloon Tank here in between the stage
  5. Carbon filter
  6. Taste & Odor filter
  7. Lastly, the UV light

The whole out of the shelf package is not convenient when I look at the operation closely. It makes me think of modifying the system specially during the water production process and when collecting the water out of the faucet. Here's my issues:

a) When the tank is full, the Low Pressure (LP) at the inlet is remained engaged because of the inlet high pressure, this is fine; also the High Pressure (HP) between the Tank and RO Membrane is OFF, that must be. But, when I open the faucet, of course I'm collecting product water out of the Tank, it's switching ON the booster pump motor by engaging the HP even I collect a glass of water just when it got filled; in other words, the booster pump had switched ON by HP to produce filtered water again because of the state changes on HP valve. Now, I want the Tank to reach 1/4 or lower in capacity before it reprocess again the good water.

b) Next, by default the UV light has an HP switch valve along the faucet line, when the faucet is Open for collection, the HP valve switches the UV light power supply to do its job on the water flowing out. And when the faucet is Closed, the HP switch valve opens the circuit of UV light to turn the power supply Off. But when the Tank is half-way filled and its pressure is less for HP to remain Off, what's happening is, from half-way filled tank all the way to empty status the UV light remains ON and it heats up the UV housing as well as the stocked waters that last for days until the Tank got filled again. Now I want to replace the HP switch valve to do the switching of UV light, I have the coffee flow sensor switch that is reliable on sensing the flowing water from high to low pressure, my problem is I don't have controller to connect this to switch On and Off the UV light which disregarding the amount of pressure available from the Tank.

c) The controller should switch On the flush valve every 10-15 min for 15 Sec when the booster pump and RO membrane are in the process producing the water to prolong the life of the membrane where I have a flow restrictor at the waste water outlet.

d) Also I want a filter monitor for all of the disposable filters when it is time to replace due to its performance life by counting how many liters or galloon it has been through. And this filter monitor should beep me every certain period of time until it received an attention, acknowledgment or reset. The filter period should be configurable into desired limit when it reaches the liters it process.

There are controllers out of the market for RO system but not giving the necessary performance as I desire.

Is there anybody who can provide me solution using Arduino controllers which not necessarily complicated but the straight forward solution that has a timer and switching features?

Sincerely yours,
makelifeasy

I haven't followed where your pumps are or what they're doing wrong but it sounds as if the system is designed to keep the output reservoir topped up. That would make sense to me if this was a slow process since otherwise if you try to draw more water than is left in the reservoir you might have to wait a long time while the filtration system does its job. Is there any more to your problem than that?

Hi, I have attached the diagram of my RO system and desired controlled system. I hope the illustration makes sense with the previous description.

I have no problem with the status of the process and of the Tank, either I wait or not, but what makes me uncomfortable is when the system is re-filtrating the moment I collected from the faucet a glass of water where it was just finished filling up the Tank. I want to resume the process once the level of Tank had reached to 1/4 or lower. I played on HP valve setting by increasing its sensitivity but still does not meet my desire of like a pump motor would start when the tank is almost empty, not when it's fully filled and reduced by a glass of water and have to restart again to fill the reduced amount.

I observed that the HP switch valve is not reliable when the pressure is on the transition between High and Low, I want to replace the HP valve by controller to do the same job of switching.

let's makelifeasy

Hi Peter, can I use the Arduino Due for my needs, since it has an analog output that suits to my need of controlling solenoid valve?

makelifeasy

makelifeasy:
Hi Peter, can I use the Arduino Due for my needs, since it has an analog output that suits to my need of controlling solenoid valve?

makelifeasy

I'm not sure what you want to do to the solenoid valve but if you're planning to operate it from the Arduino it doesn't need an analog output - it needs a separate power supply which will be switched by a driver circuit under the control of the Arduino.

There seem to be quite a few changes between the original circuit and your proposed new one. As far as I can see, both versions use a high pressure switch to bring in a booster pump to fill a high pressure accumulator. I don't understand your reluctance to keep this topped up, but if you want to let it run down before it gets refilled then you can achieve that by introducing some hysteresis into the pressure switch. Presumably the accumulator pressure changes slightly as it empties, so you would need a switch which opens at a high pressure and closes at some slightly lower pressure. I don't know exactly what 'slightly lower' means since I don't know how the accumulator pressure changes as you drain it.

I can see three ways to achieve that.

  1. Replace the pressure switch with one that has the amount of hysteresis you want
  2. Replace the pressure switch with two separate pressure switches set to the higher and lower pressure and use a relay circuit to simulate hysteresis
  3. Replace the pressure switch with a pressure sensor which can be read by a microcontroller such as an Arduino, decide whether/when to 'turn on' and operate a relay as required.

The complexity is going up as you work down the list, but none of the solutions seem particularly difficult and the main issue I see is the practical issue of sourcing switches/sensors that fit your plumbing system.

Hi Peter,

I would prefer the 3rd way using Arduino to do the control where I can also probably utilize it counter feature for filter monitoring.

The solenoid valve has to energize every 10-15min for 15 Sec when the pump is working, I believe in this advent of time that I understood some application on Arduino during my short research on this portal as well as on the other devices that works with the Arduino, I would say Arduino controller has a programming feature which I can do configuration based on my desire performance.

I've checked on supporting site for Ardino that I can use relays made for Arduino to connect directly from its I/O terminal, looks like this makes sense to energize the solenoid valve at flush out. And accepting the flow sensor signal to energize also the relay to power up the UV light, this will remove the HP switch valve which doing the switching if there's a flow or not.

One thing I need your help is to recommend me which model on Arduino has timer, counter, of course the switching feature that has a multiple selection of commands or functions for programming consideration. I did a short homework or research about these products and looks very handy but I have no knowledge which is appropriate.

At this point of time, I have the following information:

  1. INPUT: pulsating input of flow sensor (1-400Hz), I need to detect this signal when pulsing (active) which means to me that there's a flow of water. On this case, the controller should energize a relay to power switch the UV light

the flow sensor
http://www.ebay.co.uk/itm/G1-4-0-3-3L-min-Water-Coffee-Flow-Hall-Sensor-Switch-Meter-Flowmeter-Counter-1-/271254826118?pt=UK_BOI_Electrical_Test_Measurement_Equipment_ET&hash=item3f280c2c86

2)INPUT: the same pulsating input, I want to use it data to count how many Liters or Galloon its been through. I'm looking forward on Arduino to do me the counting as well as the memory for a longer period of time like 365 days or more without the data being erased on the absence of power supply to Arduino.

  1. INPUT: detecting the pump motor is engaged and start counting for 10-15 min, and when it reached this time, the controller should energize the relay for solenoid valve for 15 such as auto flush out.

Looks like there are more automation I can on my RO system as if the controller have the multiple option of reserved command.

Let me know which one you can recommend.

Sincerely,
makelifeasy

It looks as if the flow meter will work with 5V and just produces a variable frequency square wave so that would be easy enough to handle with a digital input.

To save the cumulative flow I would use EEPROM, but make sure that you only save the counter occasionally because the EEPROM has a limited write life and would wear out very quickly if you tried to save every pulse.

Apart from that it doesn't seem as if you need anything complicated, so a UNO and a suitable relay shield would give you everything you need.

Thanks Peter for agreeing with me, I appreciate the way you lead me on a solution. Now, I'm thinking about of the information you had mentioned that EEPROM shorten the storage life when writing momentarily. Is there a way an integer will keep the count at SRAM for 30 days then auto-write to EEPROM when it reach this day and shall continue the cycle throughout the year, I agreed the EEPROM would last but how reliable the SRAM to handle the stored data for 365 days, if it is good enough for this length I would rather use SRAM for 365 days or for the whole duration of filter lifespan metering.

Using SRAM would worry me about the power cycle, that I believe stored information might erase. One question, using UNO or other controller has feature to add Capacitor to delay the power shutdown to the board when there is a power failure?

I have a few more questions below:

  1. Or does it has this internal feature that delays the shutdown so that the controller have the time to save the data from SRAM to EEPROM?
  2. Also, is the controller has function to detect the power failure to do the storing function to EEPROM?
  3. Can I add an external battery to UNO that would work as backup power in case of power failure?

makelifeasy

makelifeasy:
Is there a way an integer will keep the count at SRAM for 30 days then auto-write to EEPROM when it reach this day and shall continue the cycle throughout the year, I agreed the EEPROM would last but how reliable the SRAM to handle the stored data for 365 days, if it is good enough for this length I would rather use SRAM for 365 days or for the whole duration of filter lifespan metering.

Using SRAM would worry me about the power cycle, that I believe stored information might erase. One question, using UNO or other controller has feature to add Capacitor to delay the power shutdown to the board when there is a power failure?

...

  1. Can I add an external battery to UNO that would work as backup power in case of power failure?

It's actually dead easy!

If you use a RTC - Real Time Clock - module, they have a small piece of SRAM which is battery-backed-up by the lithium battery (with a lifetime of years, longer if it is actually continuously powered) that runs the clock function. And they are really cheap!

There you have it! It doesn't care how often you write; it is battery backed and essentially specifically designed to be immune to power failure, and you get a Real Time Clock to keep track of the time as well if that is of value to you.

You can still of course, write the data to EEPROM each day or so.

People have successfully implemented 'shutdown' triggers using a capacitor to sustain power for a moment after the external source has been disconnected. I'd be cautious about using this technique to save very important data but the less critical the data is the more feasible this approach is.

You can also update the EEPROM stored value each time the counter increments by a certain amount past the previous saved value, or each time the counter has been updated but not stored for some time interval - for example an hour. That way the amount of data at risk of being lost if the device fails can be kept as small as you like.

The EEPROM has a life of 100,000 write cycles. This doesn't mean that it stops working after that point, just that it gradually becomes less reliable and may suffer from bit errors which will gradually get worse the more it is used. The write life is per stored byte so you can extend the life of the device as a whole considerable by changing the location at which the data is stored to spread the wear out.

The two most obvious solutions to me are:

  1. Use a capacitor to power the Arduino for a fraction of a second when power is lost, and add a mechanism to detect loss of incoming power. If you power a Uno from 12V via the barrel jack and you don't connect anything that takes much current to the +5V pin or the output pins, then a 2200uF capacitor connected between Vin and ground will power the Uno for about a quarter of a second, which is way more than you need to save important data to EEPROM. You can detect impending loss of power using an Arduino input pin.

  2. Save data to EEPROM just occasionally, and use wear-levelling to lengthen the life of the EEPROM. For example, if your data along with a 1-bit flag fits in 8 bytes, and you have 1K of EEPROM available, then you can write a different 8 cells each time. When you reach the end of the 1K, you flip the flag and start from the beginning again. When reading the data back, you use the flag to find the most recent data. This increases the number of times you can save the data in this example from 100k to (1K/8) * 100K which is more than 12 million. If you save data to EEPROM once a minute, that gives you 22 years before you reach the 100K rated life.

:)I'm really getting delighted of Arduino, thanks for the information Peter.

Power delay is becoming popular for most of the electronic appliance we have at home, I might look forward to it once I've got the whole system running with satisfaction on the results. Since Peter you confirming the backup will do for a year, seems I still have time to consider a power delay.

dc42:
The two most obvious solutions to me are:

  1. Use a capacitor to power the Arduino for a fraction of a second when power is lost, and add a mechanism to detect loss of incoming power. If you power a Uno from 12V via the barrel jack and you don't connect anything that takes much current to the +5V pin or the output pins, then a 2200uF capacitor connected between Vin and ground will power the Uno for about a quarter of a second, which is way more than you need to save important data to EEPROM. You can detect impending loss of power using an Arduino input pin.

Seems this point would work for me, I'm still not decide which power supply level do I have to use either 12V or 5V, one thing on my mind is to use the Arduino power as shown on the link below:

http://www.ebay.co.uk/itm/5V-4-channel-Relay-Interface-Board-for-Microcontrollers-Arduino-PIC-AVR-MCU-DSP-/130937144756?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item1e7c7645b4

Certainly, I will include this on the system provided that system operation is responding very well.

dc42:
2. Save data to EEPROM just occasionally, and use wear-levelling to lengthen the life of the EEPROM. For example, if your data along with a 1-bit flag fits in 8 bytes, and you have 1K of EEPROM available, then you can write a different 8 cells each time. When you reach the end of the 1K, you flip the flag and start from the beginning again. When reading the data back, you use the flag to find the most recent data. This increases the number of times you can save the data in this example from 100k to (1K/8) * 100K which is more than 12 million. If you save data to EEPROM once a minute, that gives you 22 years before you reach the 100K rated life.

Saving data is one of my major concern at this point where I don't need historical information but instead shall always be the incremented final value. Because I have to reset the value once reaches to certain preset by pressing the designated button probably every 6 months depending on the average life or usage of the filter under monitor.

Just for any information, let me say this:

1st stage filter should be metered for 6 months
2nd stage carbon filter shall be 10 months
3rd stage sediment filter would be 10 months
4th stage RO membrane would be 12 months
5th stage carbon filter would be 14 months
6th stage taste & odor filer is 14 months
7th UV light for performance monitoring only, let me say 2 years

I want to meter the life of each item above through the coffee flow sensor output signal to the controller, and once the count reached the value, it should notify me through simple audio alarm until it got acknowledge or reset. I'm still not sure how to apply a wear-levelling, start and end flag on the data. I hope I can get to it to have more options for configuration.

Let me switch to other areas of clarification. Now, I have this coffee flow sensor that it has pulsating output but input to the Arduino I/O terminal, the flow sensor has a magnetic contact inside to open and close the circuit and gives 5VDC at stationary position and 0V at the other way, but when it is rotating at a different speed everyday due to the pressure that pushes the water out, the voltage output or input to Arduino may read 2.5 or 3.3VDC, is the UNO or other controller can set to threshold voltage of 1 (ON) and below 1V is 0 (OFF) depending on the voltage or current input?

makelifeasy

Paul__B:
If you use a RTC - Real Time Clock - module, they have a small piece of SRAM which is battery-backed-up by the lithium battery (with a lifetime of years, longer if it is actually continuously powered) that runs the clock function. And they are really cheap!

There you have it! It doesn't care how often you write; it is battery backed and essentially specifically designed to be immune to power failure, and you get a Real Time Clock to keep track of the time as well if that is of value to you.

I will look more into it how to do this, RTC would be the best reference in addition to accumulated counts, I will use this in parallel as secondary metering reference. But I'm not seeing any battery on the PCB of UNO, do you mean it is external option?

Although all of the above are really good suggestions, let me add another one.
You could add one of this...

http://www.ebay.com/itm/10000mAh-USB-External-Battery-Backup-Power-Supply-Bank-Charger-for-Mobile-Phone-/360755678693?pt=US_Cell_Phone_PDA_Chargers&var=&hash=item53feb6cde5

You can plug the battery backup to the wall to keep it charging at all times, and then power the arduino with one of the 2 USB outputs. At least in the one ive got, this works perfectly, so if there is a power failure it will keep running from the battery for quite a long time. Then you would just need to make a way of knowing that a power failure has happened, which should be easy with a digital pin.

Very interesting your project.

makelifeasy:
But I'm not seeing any battery on the PCB of UNO, do you mean it is external option?

Yes, it is an extra module.

"56 Bytes of Non-volatile memory available to user" - this is RAM, not EEPROM.

Paul__B:
"56 Bytes of Non-volatile memory available to user" - this is RAM, not EEPROM.

I'm interested in this Shield, one thing on my mind that I need is, like CR2032 3V Battery and MicroSD memory at the same time that enough to power and save the data on schedule respectively. Which one can you suggest Paul?

Sergegsx:
You can plug the battery backup to the wall to keep it charging at all times, and then power the arduino with one of the 2 USB outputs. At least in the one ive got, this works perfectly, so if there is a power failure it will keep running from the battery for quite a long time. Then you would just need to make a way of knowing that a power failure has happened, which should be easy with a digital pin.

Very interesting your project. - Thank you I appreciate it.

I have a long experience on Lithium battery for multiple application, it always end blown up internally when there is a long exposure on atleast medium temperature and 24/7 charging. This is a great battery backup but RO system is Run and Forget type of appliance, sometimes the only time it needs to check is when the water taste differently and on this case I can't wait when the Lithium battery would behave like this.

I have a 24VDC PS for booster pump, for solenoid valve and separate TDS meter. I'm decided to unify the Power Supply even for a controller but separate wall-wart, to avoid confusion on troubleshooting when necessary. On separate wall-wart PS for controller that also powering TDS meter which I can not exclude on the system, I prefer to step down 24VDC to 12VDC for UNO and invest on Shield battery and gives an advantage for compact housing.

I greatly appreciate all the suggestions, it means to me that these are all possible.

makelifeasy:
I'm interested in this Shield, one thing on my mind that I need is, like CR2032 3V Battery and MicroSD memory at the same time that enough to power and save the data on schedule respectively. Which one can you suggest Paul?

That sounds a bit too complicated.

The idea of this module, which has its own CR2032 battery only for storing the data and keeping the time, is that you write data into it until either it "fills", or a time interval occurs, at which point you write that to EEPROM and then delete that data and mark it as empty - in that order.

If a power outage occurs, in the process of recovery you examine the data in the BBRAM, see if it that data has been put in the EEPROM, check the EEPROM data in general (in case the outage occur at the moment of it being written) and complete the above procedure as necessary. This is essentially the same process as you expect your PC disk system to do in "journalling".

makelifeasy:

dc42:
The two most obvious solutions to me are:

  1. Use a capacitor to power the Arduino for a fraction of a second when power is lost, and add a mechanism to detect loss of incoming power. If you power a Uno from 12V via the barrel jack and you don't connect anything that takes much current to the +5V pin or the output pins, then a 2200uF capacitor connected between Vin and ground will power the Uno for about a quarter of a second, which is way more than you need to save important data to EEPROM. You can detect impending loss of power using an Arduino input pin.

Seems this point would work for me, I'm still not decide which power supply level do I have to use either 12V or 5V, one thing on my mind is to use the Arduino power as shown on the link below:

http://www.ebay.co.uk/itm/5V-4-channel-Relay-Interface-Board-for-Microcontrollers-Arduino-PIC-AVR-MCU-DSP-/130937144756?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item1e7c7645b4

If you do decide to use a 12v supply so as to have time to write to EEPROM when the power goes off, then you should use a 12V relay board instead of a 5V one. These are also available on eBay.

makelifeasy:
Now, I have this coffee flow sensor that it has pulsating output but input to the Arduino I/O terminal, the flow sensor has a magnetic contact inside to open and close the circuit and gives 5VDC at stationary position and 0V at the other way, but when it is rotating at a different speed everyday due to the pressure that pushes the water out, the voltage output or input to Arduino may read 2.5 or 3.3VDC, is the UNO or other controller can set to threshold voltage of 1 (ON) and below 1V is 0 (OFF) depending on the voltage or current input?

Are you saying that the sensor provides 5V or 0V, but the average voltage may be 2.5V or 3.3V?

Paul__B:
If a power outage occurs, in the process of recovery you examine the data in the BBRAM, see if it that data has been put in the EEPROM, check the EEPROM data in general (in case the outage occur at the moment of it being written) and complete the above procedure as necessary. This is essentially the same process as you expect your PC disk system to do in "journalling".

I still don't get the idea on writing environment and trying to catch it up; in layman's term, having CR3032 Shield would protect my data from power failure or it would still remain?

dc42:
Are you saying that the sensor provides 5V or 0V, but the average voltage may be 2.5V or 3.3V?

I am using an analog volt meter when the sensor is engaged during my testing, my meter show 2.5V to 3.3VDC, may be because I am using analog meter while the actual input to sensor voltage is 5V, but I believed oscilloscope or Arduino may able to read the 2.5V on my eye as 5VDC, I agree, analog tester will not provide the actual peak voltage on 200Hz to 400Hz of square wave but I believe Arduino can catch the peak voltage enough to tell On and Off through input terminal. My previous elaboration is not complete, but here it is, I'm hoping UNO can catch it but how it manage to take up that input voltage?

makelifeasy:
I still don't get the idea on writing environment and trying to catch it up; in layman's term, having CR3032 Shield would protect my data from power failure or it would still remain?

In broad terms, what you write to the Battery Backed RAM will be protected from loss by the battery, and could survive for years. But you want it in EEPROM, especially as that has much more space.

You therefore create a system which writes the data as you collect it to the BBRAM. Every so often, either when you have collected a certain number of events (BBRAM is full, or nearly so) or else after a certain period of time on which you have decided, you write this information to the EEPROM. Only when you have checked that the information has been completely written to the EEPROM, do you wipe the BBRAM clean, ready to collect more data. You check this by writing a serial number to the BBRAM and (only after all the data has been written and checked) to the EEPROM, if the serial numbers are equal when you do the check (which you have to do whenever the power has been lost), then the EEPROM is up to date and you can clear the BBRAM to collect more data.

If data occurs whilst the power is off, well, you lose it.