NPN to trigger relay not working


cjdelphi: It's a bad transistor or it's not an npn!

100% agree! At least is what it seams. But they are NPN (at least the part numbers that Das_Wookie gives are from NPN transistors) and he said that he test various transistors.

On a lark, and chaning NOTHING else, I tried bypassing the arduino digital pin and just jumpered from the 5VDC off the Uno, directly to the base pin on the transistor... it WORKED! It's energizing the coil on the relay no problem. I'm mystified as to why THAT works, but the digital pin doesn't.

This is just using a simply blink type bit of code:

define heaterRelay 8

void setup() { Serial.begin(115200); }

void loop() { Serial.println("Enable Relay Pin"); digitalWrite(heaterRelay, HIGH); delay(2000); Serial.println("Disable Relay Pin"); digitalWrite(heaterRelay, LOW); delay(2000); }

Oh SON OF A BITCH!!!! I just realized my problem! In my unit test code, I forgot to call pinmode on the heaterRelay pin! So, it was using the internal resistor...

This is why posting code is important...

Trouble shooting is a matter of divide and conquer.