I am a first year mechanical engeneering student at the Technical University Delft.
This will be the first time that i am working with an Arduino board.
For a project we would like to control 12 solenoid valves (to control 12 pneumatic cylinders) with an Arduino Uno.
These valves have a working voltage of 24v (DC), so we need to convert the 5v signals of the arduino to the required 24v signals.
I have already searched for some possible solutions and one of them is to use an optocoupler.
Can anyone here tell me how to use these or how to wire them properly.
What is important that we need to have 12 outputs.
Also we would like to use a wireless (playstation)controller. This should be a fairly simple process according to some tutorials I have found. Thats why I would like to know if it is possible to combine these 2 systems.
The Arduino UNO has 20 I/O pins (0-13 and A0-A5) so it shouldn't be a problem picking 12 for outputs. You should not use Pin 0 or Pin 1 since those are the Serial pins. Depending on how the PlayStation controller connects you may have other dedicated pins that you can't use for I/O so get that working first.
The easiest way to control a 24V solenoid is with an NPN transistor or N-Channel logic-level MOSFET. Google for Arduino Transistor to get the details.
Follow the tutorials for connecting your wireless PlayStation controller to the Arduino.
Thanks for the replys!
Sorry for my late answer, i have been very busy last week.
I have looked into the N-Channel MOSFETS and I think this could be a good solution.
I made a little test circuit with some simulation software, could you tell me if this would work?
The LED's represent the valves and the 18v powersupply should be 24v ofcourse, but they were not so easy to find in the program.
For the playstation controller I would like to use the PSX library, so I might have to use different pins for the valves.
The transistors are added to make sure that the MOSFETS won't get any signal when they should be off.
I was also wondering if there should be any protection against the higher voltage for the Arduino board.
Looks like the +24V supply isn't connected to anything, which is fine as long as the load connects between +24V and the Drain of the MOSFET. You don't specify what MOSFET you are going to use. They are not all the same.
I don't see any current-liniting resistors for the LEDs.
I don't see any current limiting resistors between the Arduino pin and the Gate of the MOSFET. My limited understanding is that the MOSFET Gate acts as a capacitor and draws a lot of current when you switch from OFF to ON.
I don't think the pull-down resistors are wired correctly. I would expect them to be connected between the Gate and Ground. This should keep the MOSFET off until a solid HIGH is output on the pin.
Perhaps you should just show one circuit (since they are all the same) so you can spread the parts out a little more to make is more clear how things are connected. Or you could generate a schematic and mistakes in wiring will be more obvious.
I still have to figure out what kind of MOSFET I am going to use.
I am a complete noob when it comes to building circuits like this so what i made was based of things I found/read on the internet.
Here is only one circuit, which I revised a bit.
You were right about the powersupply being connected to nothing.
The LED's in this circuit aren't actual LED's, but the valves which work at 24V, so they don't need current limiting resistors.
I also added a diode (1N4001) between the + and - of the valve to protect the MOSFET for voltage spikes from the solenoid
That looks pretty good to me and will probably work.
In theory you should put a current limiting resistor between the Arduino pin and MOSFET Gate like I mentioned above.
Be sure to use a Logic Level (5V Gate) MOSFET. Common MOSFETS expect 10V at the Gate to switch fully on. Look at the datasheet and if the On Resistance (Ron) is specified only at Vg=10V then you don't have a Logic Level MOSFET.
Alright, so now i am confused...
I would like to just use the solution with the MOSFETS because I finally get to understand it a bit.
The MOSFET I would like to use is an IRFZ44Z, I saw this being used numerous times and I think it will suit my project, I only have to check the input (gate) voltage.
John, by the current limiting resistor, do you mean i have to basically replace the wire with a resistor? And what kind of capacity should it have then?
Thanks for answering, you are really helping out here.
For LED's the MOSFETs aren't really necessary, but we would like to switch some 24v solenoid valves.
I couldn't find those in the program I was using, so I put some LEDs in it (to simulate the valves)...
Those MOSFETs should work indeed, it is really hard to make a choice, because there are so many of them.
The ones you chose are also available at my supplier so I geuss I am going with those.
To clear things up I made another Diagram.
What kind of resistors should I use, the ones I used in the diagram are 10 kilo Ohms would this be sufficient?
Also, I put a resistor (220 Ohm) between the pinof the Arduino and the gate of the MOSFET, is this correct?
Alright, then I will try to build the circuit and test it.
Thanks for al the help!
If everything works right I will post it here and if there are more questions I will probably do the same
I have no affiliation with SainSmart. But I control pneumatics with Arduinos for the haunted rides and attractions industry all the time with these babies as a side-business. ( See http://www.hauntsoft.com ) These relay modules have all the protection circuitry built-in and will handle 24V solenoids no problem, and they have LED indicators on each relay. They can also handle 110V AC no problem, which makes them perfect for adding fog machines and AC lights to the mix.