Hi, I have a 6V 300mA - JF-0530B solenoid that I've been trying to get to work. I've followed this tutorial: https://core-electronics.com.au/tutorials/solenoid-control-with-arduino.html and I'm using a 220 ohm resistor, a 1N4001 diode and a 2n3904 transistor. When I manually push the solenoid in, it pops back out after a second, but it doesn't pull the pin in automatically. Do I need another transistor or is there something else I'm doing wrong?
300mA solenoid. Low power transistor good for a maximum of 200mA. And you're trying to power it from 5V not 6V.
Can't you spot a few things there that aren't right?
Yes I noiticed that as well, I've also tried a BC516 and LM317T transistor that I had lying around but those also don't work. What do I need to adjust for the voltage difference? When I directly connect the 5v and gnd pins to the solenoid, it does work.
Thanks for the response.
The LM317 is not a transistor, it’s an voltage regulator integrated circuit and the BC516 a PNP Darlington transistor. Neither is a substitute for the 2N3904.
When you use a transistor as a switch, there is a small amount of voltage drop across the collector to emitter junction of the transistor when it is turned on. Since the 2N3904 is rated for 200ma maximum, you’re exceeding the rating of the device and what is normally a small voltage is likely a high voltage drop in the range of a volt or more. Every bit of voltage that drops across the transistor is voltage that does not reach the motor. It is possible that the motor is voltage starved and it is unable to start. A voltmeter could confirm that, if you have one.
Leaving an overloaded transistor turned on for too long will cause the transistor to become very hot and it will eventually be destroyed by the heat.
You’ll find that a modern mosfet is a better switch for controlling a motor as the voltage drop is extremely low when you have an appropriate device like this one.
You’ll find that a modern mosfet is a better switch for controlling a motor
And you would connect it thusly:
Similar to the arrangement with the bjt, but note the 10k pulldown.
I will try this, thanks for the help!
Is the IRLB8721 an option as well?
Yes an IRLB8721 would be a good choice.