Go Down

Topic: (problem) controlling "parallel mounting Magnetic Valve for Sensor Faucet"  (Read 21 times) previous topic - next topic


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):
Code: [Select]
#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));

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:

Code: [Select]
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);
    digitalWrite(valveOpen, LOW);

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

  // your code

Go Up