transistor to switch on 12v solenoid

I am trying to switch on and off a solenoid using arduino I wired it up using a PN2222 transistor. When the arduino sends a high to the base of the transistor all that happens is the transistor gets very hot. attached is an image of how its set up.

I think everything is wired okay. Does the solenoid require too much current for the 2N2222 ? Can you give a link or the brand and type of that solenoid ?

its taken from a doorbell. no brand or anything. I think it might take too much current. the coil gets very hot pretty quick (15 sec)... I am new to this how can I test how much current it draws. I have a cheapo multimeter... Thanks.

I wouldn't ask a 2222 to switch more than about 250mA without heatsinking. You could reduce the base resistor to 150 ohms in case that helps, but the '2222 isn't a new design and has poor saturation performance compared to modern bipolar switching transistors such as the ZTX851

A MOSFET would be much more capable if its a high current solenoid.

If the solenoid is low current then something else must be wrong.

Doorbells in our country are almost always AC, and about 8V, maybe 1A. You could make a picture of your doorbell.

its not a doorbell anymore. its basically bell wire wound around a plastic tube. its taken out of a doorbell.

Well, that coil relies on having an iron core to increase the inductance, and the AC impedance to limit current, and expects a very low duty cycle. With DC, current is limited only by the wire resistance.

You will likely have to reduce the voltage drastically.

And a 2N2222, although rated at 600mA max, requires 1/10th the collector current be fed into the base to be in saturation. If it is not saturated (fully turned on), then the heat goes up drastically.

With 220 ohms, that's 4V/220 ohms = 18mA. So if the coil is drawing much more than about 200mA, the transistor is going to heat up quite a lot. 4V is Vcc of 5V minus the BE voltage drop and the drop in the Arduino output when loaded.

Do NOT try to draw more than about 30mA from an Arduino pin.

https://cdn.sparkfun.com/datasheets/Components/General/P2N2222A-D.PDF

maybe using a simple relay, will help.

What is it you are really trying to do? You called it a solenoid, but it turns out it is just an air core coil.

intertronic, why would a relay help? It'll still draw lots of current and the coil will get hot.

A solenoid can be air-cored. What matters here is the resistance of the coil - can you measure that?

Usually when someone says "solenoid", they mean something like a pinball solenoid.

Yes, what matters is the DC resistance of the wire.

One definition of a solenoid is a symmetric cylindrical coil of even turns density and significantly longer than wide, thus having an approximately constant enclosed magnetic field.

The name refers to the geometry.

Yes, thank you, I'm aware of that. As it turns out, the OP was using the name solenoid in the usual colloquial usage, and I was correct in my assessment.

So, foxsam, what is the status?

I've been having problems with the computer used for my arduino and did not get a chance to reply. The status is still the same meaning that I don't have a way to measure the resistance and don't mind the coil getting hot because its only activated for a few seconds to unlock. But when its connected via arduino the transistor gets hot not the coil. Maybe the coil is drawing too much current more than the transistor can supply?

Thanks.

I am not sure what is different from what I have vs a “pinball solenoid” but you gave me an idea to see if anyone used an arduino for a pinball machine. I came up with this: Hobby for the Hobbies: Custom Pinball controlled by Arduino: low powered solenoid driver I also attached a picture from that page in case the page there changes.
Thanks again

You really, really need to buy a meter.

I think we gave you answers.

Does your selenoid work when connected directly to the battery?