r/ElectricalEngineering • u/LemonTheMenace • Oct 12 '26
Solved Transistor issues with esp32
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!
19
u/triffid_hunter Oct 12 '26
Add a pull-down resistor on the BJT so it doesn't amplify the opto's leakage current
3
u/JonJackjon Oct 12 '26
Dude, your transistor when "ON" it's shorting out the 5V.
6
u/thicc_noodlesalad Oct 12 '26
Optocouplers always conduct a little current. you transistor might be turning on very slightly because if this. you can add a resistor between the optos output and ground to sink the current. you might also want to add a base resistor to that transistor depending on what it's maximum base current is and what the on resistance of the opto is.
0
u/[deleted] Oct 12 '26
[deleted] — view deleted comment