I need to control solenoid valves. After doing some research i came up with the system in the attached schematic.
I tried to adapt the solenoid tutorial but it deeply confuses me.
Since then i also found out that the Arduino “recommended” design uses totally different components (see screenshot).
Made me realize that my diodes needed to be replaced with 1N4004, but my understanding is that the transistors are still ok, maybe a bit much but since i do not need to do switching at crazy frequencies, they would do the job.
My question is if my circuit and the components make sense since the transistor chosen is most readily available to me.
Basically, is my system ok or do I need to go shove my nose back in my book before even trying to put this together?
Hi and welcome.
The second schematics you posted, show FETs that do not seem to be logic level FETs (meaning it isn't optimised for 5 volt control).
Taking a peek at the datasheet, there is no mentioning of any logic level (as far as i could see, glimpsing over it), but examples for 12 volt and keyword "automotive" are in there.
They do already have their protection diodes inside.
Also, valve L11 will not work, Fritzing hints to the unconnected wire by coloring it red.
A digital ouput -> 10 OHM -> GND (dont like it !!!)
The disign will not work... Cannot use 0V,5V swing to control the mosfets fed 12V
OK i guess i'll have to stick with the readymade schematics till i learn more.
The transistor is sold on sparksfun as to control motors and such, i might have misunderstood something(s),
i also somehow gathered that it took 2 to 4V on the base to open....
my ugly 10 Ohms resistor was to voltage divide the 5V pulse from the Arduino to something in what i understood to be the working range of the transistor base, which i also thought had a 27 Ohm resistance when open.
in regards to the protection valve i read that it's ideally soldered between the solenoid's poles, plus ill be having around 10m of cabling with connectors on both ends between control and the actual valves... Better put the flybacks on the valves no?
I should have mentioned i saw the missing connection when i uploaded the schematics... slack.
As i thought, must go back to my book and internet tutorials!!
Thank you for the advice and quick answers!!
U can use a N-channel FET (or bipolar NPN as in schematic)
If u can choose - go for a logic level N-channel mosfet
Ur P-channel can be uses if the external voltage is belov 5.5V. In your case the transistor is saturated at all times!
on second thoughts, it can be done with P-channel…
A pullup (gate to 12V) may be needed
I understand your schematic except for the 5V connected to the 12V .
Would it be ok to connect all grounds together if i leave the Arduino one out off the bunch?
If you want to use those P-channels, the connetion MUST have common + (instead of common - )
One can NOT connect both + and - rails !!
There is no problems with this solution except one:
If both 5V av 12V circuits have their gnd-level connected to a ground pin in the wall outlet, the gnd-levels will be connected that way
Your first drawing looks OK to me.
Your second drawing just looks ridiculous. I could not even figure out where the solenoid is supposed to go. The drawing is also way too big to fit on my computer screen, you should re-size it.
I am so often impressed by the imagination and ingenuity of the code found on this site, but appalled by the inability of so many to implement the most basic interface to the world on the other side of the pins. People are continually trying to build the most basic of circuitry without any real grasp of basic principles. Why? On the coding side the beginner uses a library to safely isolate himself from mysteries yet to be more fully understood. Makes sense. One discovers more and more until some considered experimenting can take place. So why not do the same for the hardware. If you need to connect a solenoid use a "DriveLoad" or "DriveSolenoid" (there can be a difference) circuit found in a section of this site. It will stop senseless waste of time and well intentioned but often plain wrong offers of help. I think such a concept a match to the Arduino spirit and that we would soon see a profusion of well designed hardware blocks of great diversity for the beginner to just use. To IanDelord:
There are a great many configs that work adequately. PNP, NPN,PFET,NFET, etc, etc. if you've got a big parts bin its worth reading up before picking one. If you're a beginner going from scratch and you want power just go for MTP3055VL fets.(if you are older you'll smile at the numbering) Why? Cheap. 12A/60V makes it a great starter. Easy to drive from 5V (or 3v with care) So its overkill for some. So what. Remember for anything sellable you really do need to know what you're doing. The 10 ohm resistor between the arduino and the fet gate is good practice but will work without for YOU. There may come a time when you really do need it. 1N4004 diode is ok for YOU. Gets the job done mostly. Now here's where you JUST DO IT. (at least till you know better) All power supply's commons (i.e 0V) Together. Directly. Short wires. Fat wires. Arduino 0V common here. Other input commons also here. You REALLY want all of the 0v to BE 0V all over, all the time, not just when you're looking. Makes sure your load supply is up to the task. Especially if you are deriving your 5V logic supply from it.(there are tricks) Use a pull down resistor form the gate to 0v if you are likely to disconnect the arduino pin. Just touch the unconnected gate with your finger to see why. Few K ohm to few hundred K ohms is ok. Just remember things usually mostly work if you're in the ball park.
Where is the park? Use google to search for it. A lot. Remember this has all been done decades ago. Don't overthink till you need to. I could go on, but I am getting boring and so maybe someone else could now run with this theme.
Leolfs, thank you
the " just go for it" advice is fine by me, that's usually my way of doing those things (already fried a laptop and a surveillance camera this way...) and altho if code fails, generally at worst you'd have to restart the computer, if i fry my Arduino or Valves, living in New Caledonia i'll be without supply for a little while plus the solenoids are quite expensive because i tried and get proper ones even tho sourced from China.
I really didn't want to show a mess of crossing wires which is why my commons are not linked together. The 12V and 5V supplies are probably going to be from a computer power supply, for the Arduino part it's widely enough (it's been done on Instructables apparently) and the 12V supply is generally around 350W, i'll need 180W for 10 valves at worse, and so all commons will end up on the PSU grounding thru to the wall socket (right?).
Oh and i don't sell any of my experiments, I really just need them to function properly and to avoid fires...
Anyways thank you (good advice and explanations aren't boring), I'll probably go for the transistor you recommend.
Michinyon, the first drawing is fine because it's the "Arduino recommended" one :), not mine...
Sorry for the drawing being too big, first post, I'll get better with time...
TO all, thanks for your help, I think this thread can be left alone unless there is very very special advice for me (apart from the "read the " " manual").