Controlling a 12v motorised valve

I'm hoping you can help. I want to use a 12v motorised valve to control the flow of liquid. The valve I have is THIS

!(http://i.ebayimg.com/t/motorized-ball-valve-G1-2-DN15-2-way-12V-electrical-valve-/00/s/NTAwWDUwMA==/$T2eC16RHJIkE9qU3kWtOBQ3U(HJ9Cw~~60_12.JPG)

This valve basically opens and closes by applying 12v for a few seconds. And remains in that state until the voltage is reversed, regardless whether the motor remains energised. I figure that a DPDT relay would be the answer to this. But I am now trying to figure out how to connect this into the arduino. And how to make the relay flip polarity. The power would come from an external source with the signal coming from the arduino. As a complete novice at this has anyone got any advice or can point me to where it has already been done. The plan is to control about 9 valves in all, as part of my homebrew automation project.

If your relay coil needs more then 5V or more then 30 mA you will need a transistor to drive the relay. You can often find boards that include one or more relays and transistor drivers. Like this one with two relays:

http://www.ebay.com/itm/Two-DPDT-Signal-Relays-Module-12V-for-MCU-Project-/400262668162?pt=US_Amplifier_Parts_Components&hash=item5d31839f82

That one has relays that can handle 1A at 24V. If your valves don't need more than 1A they should work. Just make sure to get 5V or 12V relays (you don't want to complicate things by adding even more power supplies).

Thanks. The valve itself is only 12v 2w so less than .2 amp. I was planning on using an external power source for the valve, but send the signal to open or close from the arduino. So the 5v from the arduino should power the relay with no problem.

You should connect your relay like this to change the polarity to the valve. A second relay contact in series with the 12VDC supply will allow you to disconnect the supply from the valve when it has reached its final position.

                           _
                            )|
                            )|     Relay coil
                           _)|
 
          +12V ------+----o
                     |    __--o-----+
                     | +--o         |
                     | |            C|
                     | |            C|        Valve
                     | |            C|
           GND ------|-+--o         |
                     |    __--o-----+
                     +----o
(created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de)

This is sounding more complicated than I thought. But if I am reading your diagram right, the DPDT coil is powered from the 5v arduino output. The 12 v is going through the relay switches, and a second relay to power off/on. So that one would also need to be controlled via the 5v source from the arduino. But where do I connect the second relay. On the output to the valve? Could the signal from the arduino control both relays? I.e. use one output from the board to power both relays. The DPDT would flip the polarity and the second relay power it on and off?

Your valve(s) have a feature in that they are latching valves that need no continuous voltage (and resulting current flow) once the valve state has changed, that you would not be utilizing unless you use pulses to control the valves(s). So any control arrangement either by manual switches or micro/motor control should be designed to pulse the valves in the proper polarity for the proper amount of time and then keep valve coils unpowered until next operation.

Lefty

I guess that's why I need the second relay. To control the power. So the circuit needs to be Valve- SPST - DPDT- 12v. I'm only starting out with this and a complete newbie so please be patient if I'm stating the obvious. I'm assuming the SPST relay will work with either polarity it is fed from the DPDT relay? So that it can power on and off when it opens or closes?

If the valve can stay powered all the time (probably has internal diodes/limit switches like below), then you probably could use a setup like below. You might need to use a transistor to drive the relay depending on the control voltage/current the relay requires.

I don't know if the valve motor will be fine if left powered on, until the change of state. But the valve is being used to control the flow of water into a tank. The valve will probably be open for about 5 mins or so depending on the flow, then close and remain closed. The literature about the valve is minimal, but this is the circuit diagram.


Site instructions.
1.Connecting SW and OPEN, the valve opens, getting the position, automatically power off, the valve remain fully open position.
2.Connecting SW and CLOSE, the valve close, getting the position, automatically power off, the valve remains side passes position (fully closed)

The instructions above don't mention if the valve's internal circuitry has a relay to switch the power on and off. I'm guessing not, so figure I need to incorporate this into the control circuit.

To give you some idea on the use of this, I am using it as part of my home brew setup. Valve 1 will open and allow about 30lt of water into the tank. The water will then be heated for about 30 mins or so, then valve 2 will open to position 1 and allow about 20lt flow to another tank containing the grain. After about 90 mins the liquid is then diverted to another tank.. I have put a rough diagram below showing the various valves and flow.

Why not just use one half of a L293? $3 and you're done.

I’m not familiar with that chip? How will it control the valves? $3 sound tempting. :smiley:

You could test your valve for internal protection by putting your multimeter in series measuring amps, energize the valve, and see if the current stops flowing when the valve reaches the open/closed positions.

Good thinking Zoomkat. Just tested it and the current goes to zero on it's own after opening or closing.

Thanks also to BillO. I have also had a quick look at the L293 which looks as though it may well do the job. I found a Adafruit lesson on the L293 which seemed to do what I want it to do. And even better a shield that has two chips controlling 4 motors. That at least covers half of my needs. Now to figure out how to connect two shields to a UNO. :~

Bobsbeer:
Good thinking Zoomkat. Just tested it and the current goes to zero on it's own after opening or closing.

Did you take note of (or do you have any specs on) what the startup (stall) current of the motor is, versus the running current (which you should have noticed when you measured it)...?

Bobsbeer:
Thanks also to BillO. I have also had a quick look at the L293 which looks as though it may well do the job. I

I only asked the above, because the L293 can only handle about 1 amp; that may or may not be enough for your application.

I didn't notice, but the motor is only 2 watts, so at 12v should be less than 1 amp. I did notice what I think was .4 register but wasn't paying attention to the current. But as the valve opens/closes in about 2-5 seconds it wasn't on the screen long. I can check it again to make sure before I go down that route. Thanks for the heads up.

Not all motor control boards need to be shields. There are lots that are just wired to the arduino.
Be aware, most motor control boards, drop about 2 volts, so if you have 12 volts supply, you will end up with about 10 volts. That may be enough to run your motors.

Thanks. I may have to separate the boards anyway, as I also need to connect an LCD display, pressure sensor inputs, and one wire temp probes, along with the motor controllers for the valves. So a fair bit to clip onto the arduino. I also need to connect in a higher powered 12v 3amp pump. The valves will probably work on 10v, but the open/closure time may be extended, so I will have to check that as that will possibly throw out the volume measurements being read by the pressure sensors. They will give the signal to close the valves at a set volume and there may be too much over run. But I can test that by running 10v to it via my power supply and seeing what happens. If it's too much I will have to go back to relays.

Thanks for all your help. I need every bit of it. :smiley:

cr0sh:
I only asked the above, because the L293 can only handle about 1 amp; that may or may not be enough for your application.

The L293 is designed to drive inductive loads like motors and can handle occasional over-current as high as 100% for short periods (under 5ms) and 50% over-current for much longer periods. Given that he mentioned the valve was rated to 2w @ 12V, the L293 should have no issue at all with this device. I would not imagine there is too much inertia in that valve, so the motor should spin up fairly quickly and then run at around 170ma. I suggested the L293 as an overkill measure. A L293D would probably suffice with room to spare.

For the pump control I may have to use one of THESE The pump doesn't need to reverse or be speed controlled so I think one of these may do. But the valve control seems to be the most complicated part.

The only dual L293 expansion boards I can see on ebay seem to be fitted with header pins to stack onto the arduino and be L293D versions.

There are several motor control boards available. I have used this L298N dual motor board with success (not a shield).
http://dx.com/p/l298n-stepper-motor-driver-controller-board-for-arduino-120542

Usually arduino uses 3 output pins per motor, but since you don't need speed control, you can get by with just 2 pins per motor (directions). But if you want to use only one pin from the arduino, I think you can use an inverter Ic on one of the direction pins. For example, when you send a high to in1, the inverter sends a low to in2, and vise versa. With eight valves you may want not to waste arduino pins. Since you don't have to stop the motor (self contained in the valve), arduino only needs to tell when to open, and when to close.