transistor switching circuit with optoisolation. Is this designed correctly?
Ask QuestionAsked todayActive todayViewed 6 times1
I am working on a project where I want to switch a 12v DC LED strip(power consumption 300mA) using ESP32 having a complete isolation between LED strip power source. I came up with following circuit.

Here optocoupler is PC817, transistor is NPN 2n2222, LED-STRIP_ESP_14 is the esp32 GPIO pin, GND2 is esp32’s GND, GND1 is common for 5V1 and 12v+, I’m using 5V at the phototransistor side of the pc817 because i have 5v readly available on another part of same circuit.
So, when LED-STRIP_ESP_14 goes HIGH, i want LED_STRIP to glow mode and when LED-STRIP_ESP_14 goes LOW, i want LED_STRIP to off. Is this circuit designed correctly for the purpose?transistorsopto-isolatorshareedit follow flag asked 32 mins agoMcLosys Creative11355 bronze badges
- 1No that relies on too much current gain to run saturated and cool. The pn2222 can be as low as 5 ohms with a 50 ohm driver but must have Ic/Ib=10 to 20 max. But if your Ic exceeds 50% of rated power it will be finger burning hot (85’C). So use a power FET – Tony Stewart Sunnyskyguy EE75 30 mins ago
- @McLosys Creative, Welcome and nice to meet you. Ah let me see. (1) If I remember correctly, 2N2222 max current is 500mA. Now if your 12VDC LED strip is only 300mA, then of course 2N2222 can handle the job. (2) I remember 2N2222 current gain is around 100. (3) So let me do my dodgy calculation. Ib = Ic/gain = 300mA/100 = 3mA, (4) Now let me see if your Rb = 390R is OK: Rb = (Vcc – Vce(sat)1 – Vce(sat)2) / Ic = (5V – 1V – 1V) / 300mA = 3V / 300mA = (3000/300) = 10R. Ah it is locking down lunch time! I need to go and eat and let you verify my always dodgy calculation, (5) Rb = 10R OK?. Cheers. – tlfong01 just now Edit
Categories: Uncategorized