hmmm connect the ground to the negative terminal of that 5V. i.e, connect the negative of the 5V and emitter of the transistor together to the ground. see the figure
hmmm connect the ground to the negative terminal of that 5V. i.e, connect the negative of the 5V and emitter of the transistor together to the ground. see the figure
I thought of doing that but I was afraid. Wouldn't that burn my port if for example I use a larger relay which needs to be powered by say a 12V supply?
anyways it gets the closed path through the ground. it just gives path to current and its a ground so should not be a problem,try doing this for the 5V relay, if it works then try for 12V
anyways it gets the closed path through the ground. it just gives path to current and its a ground so should not be a problem,try doing this for the 5V relay, if it works then try for 12V
Another suggestion is to put a resistor from your parallel port output pin to the base of the transistor since right now a very large base current will be flowing when the transistor goes into saturation. You should limit that using a resistor.
adding a series resistor is necessary to limit the max current drawn from the port and it will work 12v relay..
but if you are still not satisfied you can add a optocoupler between the port and transistor...
When you use 12 volts, use a MCT2E Optocoupler for safety. Parellel port Pin 2 > 470E resistor> Pin 1 of MCT2E, Pin 2 Gnd (18 to 25 all pins shorted). PIN5 > 2K2> +12Volts. Pin 4 > Transistor base. transistor base >10K to 12volts Negetive.
Cheers