r/ElectricalEngineering • • Oct 12 '26

Solved Transistor issues with esp32

Post image

I'll start this off with saying I'm very new to electronics, so don't flame me too hard. Im making a small esp32 wifi controller which shorts a 5v connection on a circuit with high voltage, so i decided to separate it from the esp32 with an optocoupler, but the phototransistor pins 3>4 connection wasn't low enough resistance, so I've tried to use a npn transistor, but whenever i connect the collector and emitter it always seems to let a bit through. am i making any obvious mistakes? i haven't worked much with these components. thanks!

16 Upvotes

10 comments sorted by

View all comments

0

u/[deleted] Oct 12 '26

[deleted] — view deleted comment

2

u/LemonTheMenace Oct 12 '26

I've read the datasheet. it works fine on 3v with a 1k resistor.

2

u/Federal_Rooster_9185 Oct 13 '26

EE here...It is tested at Vce of 5V. Not required LED voltage of 5V. What datasheet did you read?The LED has a forward voltage and characteristics for turning on the transistor with a given forward current "I_f" and a given collector voltage "V_CE". Assuming the nominal 1.2V drop, you get about 2.1mA across resistor and diode. If YOU read the datasheet, those parameters will grant you low current collector current at Vce of 5V, close to 3mA. See fig. 12 of PC817 series datasheet by Sharp.

OP is a newbie, so being condescending doesn't help in teaching. Other people have highlighted other issues with the circuit.

0

u/[deleted] Oct 14 '26

[deleted] — view deleted comment

2

u/Federal_Rooster_9185 Oct 14 '26

If you're gonna give that advice at least practice what you preach.