I have a question here as I am very newbie in electronics. I have a solenoid valve which has a such rating: DC12V 120mA. I kind of understand the voltage meaning basically saying to run the valve properly I must use 12V DC power (or even slightly less voltage as long as not higher than 12V then I will be safe). And about the 120mA, my understanding is that it is the maximum current for the valve right ? Does it mean to communicate with the solenoid valve, I can use any smaller current ? Because the Arduino board can only output 20mA current through its digital Pin right ?
I know I must connect Arduino with a transistor to control the 12V DC solenoid, but how about the 120mA current rating of the solenoid ? Or as long as I use transistor or relay to transfer the voltage (5V from Arduino to 12V of solenoid), and because Arduino can only output 20mA current which is far less than the 120mA of solenoid, then it's ok. In other words, any smaller current can communicate with the solenoid with no problem as long as no excessive voltage being put on it ?
The 120mA is what the solenoid will use (approx), so your 12V power supply must be able to provide at least 120mA. If you have for example a 12V 1A power supply then it's all good. As long as it's at least 120mA ;).
It's not related to the max current output of the arduino pin.
In other words, any smaller current can communicate with the solenoid with no problem as long as no excessive voltage being put on it ?
No smaller currents will not turn on the solenoid. If you connect the solenoid directly to an arduino pin you will damage the arduino. The 20mA is not a limit as to how much a pin can supply but the limit to how much you should let it supply. Anything over 40mA from the arduino will cause damage.
Grumpy_Mike:
No smaller currents will not turn on the solenoid. If you connect the solenoid directly to an arduino pin you will damage the arduino. The 20mA is not a limit as to how much a pin can supply but the limit to how much you should let it supply. Anything over 40mA from the arduino will cause damage.
Thank you for your reply guys. I have a built a working circuit, but I want to know how it works exactly. I am still confused how Arduino can communicate with the solenoid when they are working at different current.
So, if I understand correctly, the 12V DC power serves the solenoid directly (feed the solenoid with 12V voltage and 120mA current), but at this stage the solenoid can not work as the circuit is not completed (as the cathode of the 12V power is connected to Arduino). So to finish the circuit, one end of solenoid is connected to the transistor which is in turn connected to Arduino through a resistor. The transistor acts like a switch (like a relay), without given order from Arduino, the current from the solenoid can not go through it to reach the Arduino. When given order from the digital Pin on Arduino, the transistor then inter-connects the solenoid and Arduino which finishes the circuit so that now the solenoid is working.
In other words, the purpose of transistor is a switch to separate the circuit connecting solenoid to Arduino unless received order from Arduino saying now connecting. And the resistor is to make sure the 120mA from the working solenoid is lowered to 20mA so that the Arduino will not be fried.
Jeff27:
When given order from the digital Pin on Arduino, the transistor then inter-connects the solenoid and Arduino which finishes the circuit so that now the solenoid is working.
In other words, the purpose of transistor is a switch to separate the circuit connecting solenoid to Arduino unless received order from Arduino saying now connecting. And the resistor is to make sure the 120mA from the working solenoid is lowered to 20mA so that the Arduino will not be fried.
Am I right.....
No, the arduino control the transistor, and the transistor control the solenoid. Those are 2 separate circuits.
Like... when you turn on a lamp in your house: you are the arduino, the switch is the transistor, the lamp is the solenoid: you never need to touch the wires of the lamp directly, you only need to provide minimal effort with your finger (pressing the switch) to turn on the lamp
guix:
Like... when you turn on a lamp in your house: you are the arduino, the switch is the transistor, the lamp is the solenoid: you never need to touch the wires of the lamp directly, you only need to provide minimal effort with your finger (pressing the switch) to turn on the lamp
Thank you guix, I just read the link you give me and understand the circuit now: After receiving HIGH signal, Arduino sends signal to the transistor to its Base Pin, and after some magic (don't know how to read the circuit inside the transistor) the transistor inter-connects the circuit of solenoid powered by the 12V power source : inter- connecting its Collect Pin and Emitter Pin to finish the circuit.
But am I right about the resistor thing ? The 120mA current from solenoid is lowered to 20mA through the resistor (also lowered inside the transistor ? ) which in turn flows into Arduino and finally flows back to the cathode of the 12V power.
guix:
Like... when you turn on a lamp in your house: you are the arduino, the switch is the transistor, the lamp is the solenoid: you never need to touch the wires of the lamp directly, you only need to provide minimal effort with your finger (pressing the switch) to turn on the lamp
Btw, this is the best mimic I have seen so far, thank you
No you have to understand that these are really 2 separate circuits, the arduino only need to provide a small current to the transistor. The transistor need this small current to "link" the 12V power supply and the solenoid, which will "suck" 120mA from that power supply.
To understand better, you have to understand how a transistor work. Look some videos on youtube
And if you are talking about the 2.2 KOhm resistor in the linked tutorial:
This type of transistor is switched by current and not voltage, so we need to make sure to supply the correct current to the base to switch it, so a resistor is connected from the Arduino to the base to limit the current to the proper amount.
The resistor is not connected to the solenoid, at all