Is it better to use a MOSFET with an Optocouple for PWM? Answered
I want to control an LED strip from a microcontroller, ideally with parts I have on hand:
- IRF740 MOSFET
- PC123 Optocouple
- ESP32 Microcontroller (Has 5V power regulator)
- 12V LED strip (5m)
A lot of the tutorials online seem to suggest that only a MOSFET are required (Except this one, which seems to me like a safer way of designing this, since I get to treat the 12V and 5V circuits as completely separate). I have a relatively limited knowledge of these things but it seems like sending the full current through the microcontroller on the ground side is a bad idea.
Is it safe to run the LED strip's ground through the microcontroller?
Are there any additional steps I should take to make sure I don't destroy my LEDs, MicroController, or anything else?