Reverse Osmosis Computer

Hi All,

I am trying to make and Arduino Water Reverse Osmosis Controller. I have written up the code but for some reason does not work. I would really appreciate if somebody out there could look at it and advise where am i going wrong.

Brief of Functions Required In Order.

1/ A float switch situated within a holding tank sends a signal that Fresh RO water is needed.
2/ The booster pump and a selenoid(1) switch are activated and the function goes into flushing membrane mode for 2 minutes.
3/ After 2 minutes the selenoid(1) closes and selenoid(2) is activated and the function goes into Old Standing water flush for 2 minutes.
4/ After 2 minutes selenoid(2) closes and selenoid(3) is activated. We are now in Fresh RO water mode. this continues until the holding tank float switch switches everything off.
5/ Meanwhile the booster pump needs to have a few parameters attached to its function and they are as follows
a/ the maximum on period for the booster pump in one period is 30 minutes.
b/ if the maximum on period is reached the booster pump must shut off and cool down for 10 minutes.

When I load my sketch up nothing happens.

Any help please??

AQUA_PRO_ROSystem.ino (4.49 KB)

Your state machine is not straight forward.

This is normal:

switch(state)
{
case 0:
  ...
  state = 1;
  break;
case 1:
  ...
  state = 2;
  break;
case 2:
  ...
  state = 3;
  break;
...
}

You have this:

switch(state)
{
case 0:
  ...
  state = 0;
  break;
case 1:
  ...
  state = 1;
  break;
case 2:
  ...
  state = 2;
  break;
...
}

Does the timer operate without being initialiozed in setup?

It doesn't make much sense to add "logical" values like this:

 if (SensorState == HIGH + AlarmSt)    //Water level high sensor stuck in "ON" position

SensorState can only be (numerically) 0 or 1. You are probably thinking of a logical OR operation: "||".

I'm really disappointed. I thought this was going to be about a computer that somehow operates using reverse osmosis.

@Koepel thanks for that I will try it today.
@jremington, what I am trying to do here is to check whether the stepper motor pin has been on for certain specified period of time, how would you do that?
@jrdoner I will check. The timer was taken from an example sketch with library.

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks....Tom... :slight_smile:

Here you go.

RO Eagle Files.zip (28.6 KB)

what I am trying to do here is to check whether the stepper motor pin has been on for certain specified period of time, how would you do that?

You simply record the time when the motor is started, and compare that to the current time, all using the timing function millis().

The stated purpose doesn't agree with the comment on that line, though, and I don't see any use of millis() in your program.

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Please not in Eagle format, you should be able to export the image as jpg or png from the Eagle program.

Thanks...... Tom... :slight_smile:

here you go

RO Board.pdf (223 KB)

RO Schematic.pdf (145 KB)