I’ve got a standard “how to control a relay” problem. The coil on the relay is 5v and takes 71mw. No problem, can’t drive it directly off a pin so, enter the NPN transistor. So, wire that up according to all the standard tutorials I can find. They are all more or less the same. Some use the optional flyback diode so the collapsing field doesn’t feedback into the micro, some don’t. Some use a 1k (or 2.2k) resistor on the base, some don’t. By and large tho, it’s all pretty identical. So, I wire it up. doesn’t work. I try a different transistor, still no joy. OK, test with an LED, it’s working. I can blink the LED on/off/on/off no problem. Back to the relay, no joy still. The LED uses 20mw, OK, so let’s try 71mw+ worth of LEDs. Doesn’t work. I try 2 LEDs (40mw), it works. 3 LEDs (60mw) and bingo, doesn’t work. OK, so SOMEWHERE between 40mw and 60mw this transistor isn’t working, so that would probably explain why my 71mw coil on the relay isn’t working either.
This is BASIC stuff. This SHOULD Just Work™. It doesn’t tho, and I’ve not a clue as to why. I’ve tried reversing the collector and emitter. I’ve tried using a different Arduino, different wires, 3 different NPN transistor types (2N2222, 2N4401 and 2N3904), different relays, every singular component in fact has been swapped with another to eliminate any specific component failure. I’ve tried driving the Arduino off of battery (3 AA’s for a 4.95v pack) and just the transistor off of battery in case the amount of USB power was an issue. I’ve duplicated the problem with the relay with a secondary device type (LEDs) so I know it’s not just the relay, but a general issue I’m having over 40mw’s worth of power… under 40mw the NPN is working just fine as a controller for switching to ground, over that, nadda.
I haven’t a CLUE as to WHY it’s not working tho, or what to do about it.