user27363: I have set up solenoid on of based on soil moisture, 
The solenoid is powered by 24 volts, so I power solenoid by 24 volt and Arduino uno by stepping down to 6 volt powering through Vin and gnd. 
I have used resistance of 10k ohm but I have twice burnt em.
Not sure how should calculate resistance required of signal coming out from D6 pin to TP120 base !


user2881: To calculate you need to know the maximum current the solenoid uses. The TP120 has a gain of around 500-1000. So the current going into the base needs to be 1/500th of the current going through the solenoid. 
So now you know the current needed. Then you can calculate the resistance value you need with R = V/I. So R = 5 / ( <solenoidcurrent> / 500 ). 
So with e.g. a 2A solenoid, you get a value of 1.2kOhm.

27363: <p>I have set up solenoid on of based on soil moisture, 
The solenoid is powered by 24 volts, so I power solenoid by 24 volt and Arduino uno by stepping down to 6 volt powering through Vin and gnd. </p>

<p>I have used resistance of 10k ohm but I have twice burnt em.
Not sure how should calculate resistance required of signal coming out from D6 pin to TP120 base !</p>

<p><a href="https://i.stack.imgur.com/hT0Hv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hT0Hv.png" alt="enter image description here"></a></p>
 2881: <p>To calculate you need to know the maximum current the solenoid uses. The TP120 has a gain of around 500-1000. So the current going into the base needs to be 1/500th of the current going through the solenoid. </p>

<p>So now you know the current needed. Then you can calculate the resistance value you need with <code>R = V/I</code>. So <code>R = 5 / ( &lt;solenoidcurrent&gt; / 500 )</code>. </p>

<p>So with e.g. a 2A solenoid, you get a value of 1.2kOhm.</p>
