am trying to create an automatic plant watering system as outlined here
its a very simple project. uses the arduino to activate the motor via a transistor, which acts as the on/off switch for the motor with a dedicated power supply. so the arduino output pin at the base activates the transistor. the author of the article says that since PN2222A is the transistor, no resistor is needed in between the arduino output and the base.
Complete nonsense. Alas many instructables contain bad errors and this is no exception.
No transistor can tolerate 5V from base to emitter, it will burn out. What the author of
the instructable has discovered is that the 40 ohms or so output impedance of an Arduino
pin is enough to prevent the 2222 from melting. Alas it will damage the Arduino pin.
but if some other transistor were to be used, what should be the value of the resistor to be used?(am intending to use the 2N2222 instead of PN2222A)
in general, how to compute this?
Whatever transistor you need a minimum resistor value of about 150 ohms to limit
the Arduino pin current to a safe (non damaging value). This is about 30mA, the
maximum I'd use given the abs max is 40mA.
With 30mA through the base the 2222 can switch about 0.3A maximum without too
much voltage drop. There are plenty of better transistors these days. You have to
read the datasheet to see what the device saturation characteristics are. Don't be
fooled into thinking that the DC-gain parameter applies to saturation, it does not.