Very nice presentation of your problem. Well done, and thanks.
(1) Check that your switch connects left to right when pressed and not top to bottom.
Remove switch - does LED go out.
Use a piece of wire. Does LED turn on?
(2) It appears that the problem is that the circuit they have given you is utterly and completely and inexplicably scrambled. It would be hard to have the circuit much wronger that that and still light the LED! It just MAY be sort of correct given several unlikely assumptions.
How can this be?
I so didn't believe what I was seeing that I checked several times.
2N2222 data sheet here
![enter image description here](https://i.stack.imgur.com/7gYqe.jpg)
What transistor are YOU using?
What is the pinout.
Even if YOU are not using a 2N2222 they should be.
The circuit is wrong because:
They say 2n2222 so it should be NPN
It is normal to put the LED in the collector circuit but not essential.
If R3 is in collector then it should not go to V- power rail but to V+.
If we assume LED is in Emitter circuit then R1 must be in collector circuit and the transistor is being used as an "emitter follower". Not what you would usually do or for a beginner but say that's correct. And the pinout is backwards. Let's assume it is.
Then base should be being pulled +ve to turn on. It is.
They should have a pulldown on the bas to ground to turnthe transistor off - especially when used as an emitter follower. Connect another 10k from SW1/R1 junction to ground. Test . report.
BUT
Ensure transistor is CBE bottom to top as per 2N2222 datasheet or find what it really is.
Like this with different values, but I have added extra 10k from base to ground (a wise precaution).
![enter image description here](https://i.stack.imgur.com/WPSqU.jpg)
I checkd 2N2222 data sheets from several manufacturers. ALL I found including metal can ones show transistor is CBE readingUP the breadboard as shown. (terminals 48-49-50) SO there is NO DOUBT that they have the circuit VERY WRONG as shown. Their C (terminal 48( goes via R3 to B- (ground). For an NPN transistor it should be B+ / +12v. etc. Build the circuit as I have suggested. It will work ;-). Transistor MAY be dead.
Datasheets
metal can
[TO18 & TO39 metal can both the same](metal can
)
All TO92 plastic seem to be ONSemi - several distributors:
Did they provide a proper circuit diagram?
If so please show it.
ONSemi TO92 plastic
Update:
Here is the book concerned .
(1) The transistor is reversed. Turn it around 180 degrees and their circuit is as they intended. Their basic data shows the transistor wrongly.
(2) And / But - the circuit is an emittee follower as it was obvious it would be if you "just" reversed the transistor. This is such an 'interesting' way to do things that it was hard to believe that it was intended. It was.
![enter image description here](https://i.stack.imgur.com/Rfuu0.jpg)
Their "rather interesting" circuit:
![enter image description here](https://i.stack.imgur.com/GGTrB.jpg)
Whether the 2N2222 will be able to do the job depends on the current drawn by the relay coils. I would guess it would be no problem. There is no fundamental benefit of BJT's over MOSFET's (or vice-versa) in this application: you just need to switch the current; any transistor capable of handling the current & voltage needed to energize the coil will do.
However, make sure you install a fly-back diode over the relay coil leads, and a current-limiting resistor on the AVR output, otherwise you will fry your circuit. A coil stores magnetic energy, and switching the current off will result in a large negative voltage over the coil. Basically, the voltage will drop indefinitely until something starts conducting; if no fly-back diode is present this will be your poor transistor, and perhaps the AVR driving it.
Safety in this application is determined by:
- Ensuring through other means that even when the AVR keeps the heater on for ever, no damage will be done.
- Using a relays capable of handling the HV voltage and current with at least a 30% safety margin (preferably more: don't squibble on safety).
- Proper separation of the HV and low voltage cabling.
- Proper insulation of the HV part.
- Using cables suitable for the HV current and voltage, again with a wide safety margin.
- Using proper fuses for when there are short circuits.
- Especially the HV connections to the relays switches are important: ensure that a proper insulation distance is maintained (at least half a centimeter from any conductor for 240V). Also ensure that the wires won't detach, even when the cable is pulled!
As always, working with 240VAC can get you killed or set your house on fire! Be sure that you know what you are doing.
Best Answer
The 2N2222 should be totally fine. Voltage, hFE, etc. all look equivalent for your purposes. There's nothing critical about the VU Meter design since it's merely switching the LEDs on and off.