# Phototransistor relay circuit

I don't quite understand this type of circuit:

When light strikes Q1 (phototransistor), if the light is intense enough, Q1 is turned on, then current flows into the base of Q2 which also turns Q2 on, then what happens? Where is the current through the relay coil coming from, and how does the 2nd circuit work? Thank you.

• What are you asking exactly? What do you mean where is the current coming from--it's coming from Vcc, surely? – Hearth Apr 3 '19 at 20:11
• I meant which transistor is the collector voltage connected to – khaled014z Apr 3 '19 at 20:21
• What do you mean "which transistor is the collector voltage connected to"? I'm even more confused now than I was before! – Hearth Apr 3 '19 at 20:32
• I learned that Vcc is the voltage applied to the collector terminal of a transistor, I don't know if I'm misunderstanding the concept because I only learned about transistors individually and I'm having a hard time understanding applications such as these, if I still don't make sense, can you please tell me what the roles of of these transistors are? – khaled014z Apr 3 '19 at 20:41
• While the etymology of the name Vcc relates to being the collector voltage, its actual usage in schematics now means the power supply voltage. – Hearth Apr 3 '19 at 20:47

When light strikes Q1 (phototransistor), if the light is intense enough, Q1 is turned on, then current flows into the base of Q2 which also turns Q2 on, then what happens? Where is the current through the relay coil coming from

The current in the relay coil is coming from VCC, because Q2 does turn on, and conducts that current to ground. – TimWescott

how does the 2nd circuit work?

The transistors on the first circuit is acting like normally open switch. So when there's no light shining on Q1 there will be no current through the base of Q2 and prevent the relay current to flow.

Contrary to the first one, the transistors on the second circuit is acting like normally closed switch. When there is a light shining on Q1, its collector and emitter terminal is shorted to ground, thus there will be no base current flowing to Q2, preventing the current to flow. When there is no light, the base current can flow again.

In case you're wondering about the diode, the relay coil is an indcutor and the current from an Inductor can't instantaneously change, the diode purpose is to prevent inductive spiking and thus protect the Q2 transistor, read more here or watch Afrotechmod's video on it here

I've build a simulation for you using falstad, you can open it here.
I'm using PWM signal on npn bjt with led to simulate the light and phototransistor
As you can see the the second circuit working principle is the opposite as to the first one.

• The 20 ohms I used is to model the internal relay coil resistance. – Unknown123 Apr 4 '19 at 6:40