Hi, I'm new to Arduino. I'm looking to get some advice and help on how to create a computer controlled electro magnet. I have the Arduino receiving serial input to turn on and off a digital out pin and I've tried to link this up to an NPN transistor that will switch on an off the current to the magnet. I've drawn the basic schematic here:
I have a few concerns. First, this circuit isn't working. Even when I use something more detectable like a LED or a small DC motor it doesn't appear to function. What am I doing wrong? Second, I'm not entirely sure this us safe to hook up. Is it sufficiently decoupled from the arduino board? Last, the magnet is basically shorting the battery and will pull max current. I've tried putting a 110 ohm resistor inline but that was enough to drop the current so low that the magnet didn't function. Should I use a bigger battery, and if so... how can I preserve it's life. Also, will PWM work for an electromagnet.
Thanks in advance.