Using electric solenoid valves with arduino.

Hello!

I'm doing a fire suppression system with gas and i need help deciding how to handle the output to the valves.
I will need to open max 2 valves at a time, depending on the reading from the sensors, how should i approach it.

I found some valves that needs 5-6 v for example, can arduino handle these ones by itself?
If i buy ones 12 v ones, should i use relays (6 relays for 6 valves) with another 12v power supply or can i use boost modules?
In the case of relays, is 1 12v power supply enough to handle all valves?(not all activated at once as i said, only 2)
I can post the links to the valves if i'm allowed and if it will help.
I appreciate the help!

Cristian

An Arduino can CONTROL you solenoids, etc, but CANNOT power any of them or relays. Also, remember the very FIRST thing fire fighters do is disconnect the AC power.

Paul

This is ment to simulate a system taht will act before the firefighters arrive, dont mind the details.
So are yous saying i'm going to need another power supply in both cases? will 1 be enough?

crysty1810:
This is ment to simulate a system taht will act before the firefighters arrive, dont mind the details.
So are yous saying i'm going to need another power supply in both cases? will 1 be enough?

If your devices, including the Arduino, need two different voltages, then you need to supply those voltages. The amperes for each you can add up based on the sum of the maximum currents for each device, plus a margin for errors.

Paul

"So are yous saying i'm going to need another power supply in both cases? will 1 be enough?"
Maybe but there is not ONE correct answer. I mean what you want can be built in many ways. It depends on for instance how much you can build your self.
You need power for solenoids and Arduino. And you need something between solenoid and Arduino. A relay shield or a fet shield (if there exists one), that may also need power.

You need a 12V power supply that can supply enough current for the solenoids.

Then you need a 5V supply for the Arduino - it can probably take 12V, it's internally stepped down to 5V.

Then you need a switch for the solenoids - I'd go for a MOSFET rather than relay for switch, much easier to implement.

Allright guys , thank you for the help! I Got 1 more question:

-I will buy relays, if my valves are 12v, but the arduino can output 5v, wich tipe of relays do i buy, the 12v or 5v(does the voltage reffers to the trigger or the swithes?)

You cannot connect relays(or solenoids) directly to Arduino, so relay voltage is not very important. But I would buy 12V relays here. The voltage refers to coil voltage of the relay. Or as you say trigger voltage. There are several types of 12V, or any relay. Like how much contacts can handle and how many contacts there are. But I think most relays can handle 12V and your solenoids.

If you get a relay, make sure you get a full relay breakout board like the one pictured here:

That has an on-board mosfet that powers the relay coil. If you get only the bare relay, you'll be right back to square one where you're trying to control an electromagnet straight off your 'duino (solenoid vs. relay coil).

Allright so i can use the same 12v transformer power supply that i'm using on the valves for the relay as well right? given that the summ of all theyr currents is within its specification right?

Or if i buy the one from the picture, i can power it with my arduino? I will only use 1 relay at once, so maybe the board can power even the normal 5v one?

the relay boards pictured above pull ~100 mA when in use, so you can power it off the 5V pin on the 'duino.

I would use a single 12V power supply and power everything off that. Just make sure you power the 'duino from the RAW power pin, you don't want 12V going to the 5V pin.

Here's the catch with relays, though, you have to make sure they're not wired in such a way that you have a closed circuit when they're powered off, otherwise your solenoids will fire anytime you disconnect or reprogram the arduino. A way around this is to tie the trigger pin to ground through a 10K resistor. That way it will only be active when the 'duino is actively sending a HIGH signal.

Ok so a 5v 4 ch relay like the one above is the way to go, powered by arduino, or a 12v 4ch one?

the 5V one is what you're after if you want to trigger it directly from an arduino pin. And if you're powering it off the arduino's on-board 5V regulator, I wouldn't have more than one or two firing simultaneously otherwise you might overload the regulator or cause the arduino to reset.

Thank you very much, i will buy a 12v one, just to be safe, maybe i implement more things as i go and i will power everything with a 12v power transformator, 3A should be enought for all of them, i think the valves are 0.4a each.

if you get a 12V relay, make sure it can trigger with 5V, otherwise you'll need a lot of extra stuff to control it from an arduino pin.

note that the voltage of the relay isn't what its capable of switching, its what is required to trigger the relay itself. so a 12V relay will require a 12V signal, a 5V relay requires a 5V signal (which is what is supplied by the arduino).

I've made a number of boards to control 12V solenoids that I use for irrigation, hydroponics, mushroom tents, etc and I always opt for on-board mosfets since it keeps things nice and tidy and they're pennies a piece. The boards are powered by 12V, which covers all the solenoids and the pro-mini through its raw power pin. The only thing not integrated onto the board are the flyback diodes for the solenoids, but I just put those on the solenoids connectors themselves.

silly_cone:
the relay boards pictured above pull ~100 mA when in use, so you can power it off the 5V pin on the 'duino.

That you maybe can, doesn't make it a good idea. If that Arduino is powered by 12V itself (so that current all goes through the regulator) it won't work as the regulator will overheat very quickly.

Just about any 12V relay module can be switched with a 5V signal, as that's what they're normally used for. Just remember to also connect the Arduino ground to the relay.

Well I learned something! You're right, those 12V relay boards will operate with 5V trigger from the arduino!

I was thinking they would not because I have previously purchased standalone 12V relays, not integrated into a board, which clearly do not work with a 5V signal. And I wasn't considering that the integrated boards have mosfets which will switch the 12V relay from a 5V signal.

Thank you for pointing that out, wvmarle.

Crysty1810, here's a webpage I found pertaining to your desired use. It shows you how to wire everything up, and how if you get 12V relays you can simplify the wiring to your arduino.

{Edit}: It was pointed out to me that the diagram in the link provided incorrectly shows a common ground between the relays and the arduino. Doing this will negate opto-isolation. Instead, just connect VCC from the relay to power the arduino, but do not connect common ground to maintain opto-isolation. I apologize for that oversight.

One thing. Ifyou are using just a single relay without any shield, you should connect a diode between the pins of the coil of the relay. Othervise you'll get an over voltage spike everytime the coil loses voltage. By the way, solenoids can also make that spike.

But a good relay shield is much easier to use, and probably has those diodes already.

If you find your Arduino doesn't supply enough current to drive your solenoids, there are Optocouplers like the 4N35-X that can handle 100 mA and voltage up to 70. Just FYI. Arduino Uno kit uses it in the "Hacking Buttons" sketch.