Electrical – 24V output with microcontroller using mosfets

microcontrollertransistors

I want to controll 24V output which will be used by PLC with 3V3 logic uC.

I've created sth like this:
enter image description here

Q1 is my output from uC. VIN1 is supply voltage and COM1 common of it. I want to have various output voltage (like 5-24). But let's focus only on 24V now. Will this circuit work? What if there will be no load on Q1OUT? Will transistor boil to death? Am I missing something?

Thanks in advance and best regards,
g.voooo16.

Best Answer

A MOSFET needs a gate voltage well above the source to conduct properly, for your type ~ 10V. Obviously your circuit can't deliver this. That's why the common way to use such a transistor is with the source grounded and the load at the drain, and teh collector of the PC817 at a suitable voltage level (12V would be OK).