(problem) controlling "parallel mounting Magnetic Valve for Sensor Faucet"

Hi to all,
I bought a magnetic valve like THIS.

I tired ti control the valve with arduino, with a scratch used in this Italian tutorial: HERE.

the schematic is quite the same, but I used as Power supplie the arduino 5V pin (the valve works at 4.5V)
so i used a button instead of battery (in schematic), and I wired every on 5V pin.
so this is my schematic:

and here the code (very simple):

#define MotorL 9
#define MotorR 10
const int button = 12;

void setup() {
	pinMode(MotorL, OUTPUT);
	pinMode(MotorR, OUTPUT);
	pinMode(button, INPUT);
}

void loop(){
	digitalWrite(MotorL, digitalRead(button));
	digitalWrite(MotorR, !digitalRead(button));
	delay(50);
}

I ear like a click, when I push and when I release the button,
but the water doesn't flow...

Tank you for any suggestion.

  • The valve may need a separate supply - it draws 333 mA at 5V. It's not shown how the valve is powered on your diagram.
  • The valve is controlled by a 30 ms impulse. This means that valve is latching type and both control signals are normally LOW and never high for extended periods or the valve's coil could overheat and become defective.
  • The valve requires about 3 psi minimum water pressure on it's inlet to work.
    This code should get you started without harming the valve. If open and close operation is reversed, switch wires to pins 9 and 10:
const int valveOpen = 9;
const int valveClose = 10;
const int button = 12;

boolean buttonState = LOW;
boolean previousButtonState = LOW;

void setup() {
  pinMode(valveOpen, OUTPUT);
  pinMode(valveClose, OUTPUT);
  pinMode(button, INPUT);
}

void loop() {
  buttonState = digitalRead(button);

  if ((buttonState == HIGH) && (previousButtonState == LOW)) {  // open valve
    digitalWrite(valveOpen, HIGH);
    delay(35);
    digitalWrite(valveOpen, LOW);
  }

  if ((buttonState == LOW) && (previousButtonState == HIGH)) {  // close valve
    digitalWrite(valveClose, HIGH);
    delay(35);
    digitalWrite(valveClose, LOW);
  }
  previousButtonState = buttonState;

  // your code
}

Thank you very much.
I had much to learn about, but at the end,
the problem was simply caused by a insufficient pressure on valve..

I tried to use a 20L jerrycan,
but it can't give enough pressure to flow trought the valve.

Tank you, for your example code that I used.
Now the valve works correclty.

Bye.

Needless to say that I'm a newbie to the whole Arduino thing, but nevertheless it is fascinating opportunity to learn automation and I want to learn.
As the topic starter I purchased a Amico 2W-160-15 2 Way 2 Position DC 12V Water Gas Solenoid Valve
and would like to control it based on the liquid temperature - the hotter the water gets the wider the valve opens, temperature range 1 - 100 C
I need any help I can get for this
Thank you!

I'm thinking to use one of this Precision Thermocouple Amplifiers with Cold Junction Compensation
Does any one knows where can I find a sample code for this thing?

Vertebrate:
Needless to say that I'm a newbie to the whole Arduino thing, but nevertheless it is fascinating opportunity to learn automation and I want to learn.
As the topic starter I purchased a Amico 2W-160-15 2 Way 2 Position DC 12V Water Gas Solenoid Valve
and would like to control it based on the liquid temperature - the hotter the water gets the wider the valve opens, temperature range 1 - 100 C
I need any help I can get for this
Thank you!

I think you are going to have problems, This valve is on/off.
There is no partway open.
The best you could do is cycle it to adjust the flow rate. The problem with this Idea, The valve is not designed to open and close millions of times. It would wear out quickly and would not respond well to pulsed control.

you need a proportional valve like this one Proportional Valve

chuck.

chucktodd:
you need a proportional valve like this one Proportional Valve

chuck.

I see your point, but the proportional valve is cost prohibitive at this point and I will have to deal with what I have.
Any suggestions regarding the programming?
The idea is to be able to set a temperature which will be tested using a Thermocouple Temperature Control K Type Sensor Probe and if temperature raises above preset point open the valve

Vertebrate:
I see your point, but the proportional valve is cost prohibitive at this point and I will have to deal with what I have.
Any suggestions regarding the programming?
The idea is to be able to set a temperature which will be tested using a Thermocouple Temperature Control K Type Sensor Probe and if temperature raises above preset point open the valve

The only way I can see, is to have a 'mixing' chamber into which you can inject specific volumes (timetempflowrate) of hot water. As long as the you have a big enough volume and good agitation you could control the temperature. you would need both hot and cold water inputs, or have a model of the heat loss of the tank.

with a fixed volume, pressurized system, you need variable rates. Else you would have 'slugs' of hot, warm, cold, water moving through your system.

Chuck.

looks likethis valve can be used to resolve the 'slugs' issue.
Should this one be programmed as a motor?

Vertebrate:
looks likethis valve can be used to resolve the 'slugs' issue.
Should this one be programmed as a motor?

Yes, Select the CR05 version, It is a 5 wire, 2 for the motor(polarity for direction), 3 for sense (common, open, close) CR05 Wiring Diagram

with this valve, you could adjust the flow rate from 0% to 100%. The 3 sense wires allow you to identify position. you could measure the opening, closing time to calculate valve position vs drive duration.

you will need a Full Bridge driver like a L298 Dual Driver

This driver could control two of those valves (hot,Cold).

you just need your temp sensor

chuck.

got all the parts, they are nice and shiny :slight_smile:
the only two things left is to program the Arduino and connect the hardware ...

This is what I got so far

I don't like to have a hard-coded value for my thresholdTemp variable.
Would be nice to do an input from a LCD shield or a TFT touch screen, I just don't know how to do this yet.