Hello and welcome to the ST community,
The overheating issue occurs because LD1086DTxx is a linear low-dropout (LDO) regulator, which sheds excess voltage by converting it entirely into heat. Even at a low current of 0.3A, the (hudge) 19 V drop from 24 V to 5V forces the package to dissipate excessive power.
Power Dissipation:
Pd=(Vin - Vout) x Iout → Pd=(24V - 5V) x 0.3A = 5.7W that you need to dissipate from a “small” package (DPAK).
Solutions, either to:
- Add a heat sink that dissipates this power surplus of 5.7W. The package is DPAK, need to prepare a copper surface in the PCB to dissipate that power. I doubt that’s possible. Or use TO-220 package and find the right heat sink. You need to find the suitable one by calculation.
- Two-stage regulation: use an intermediate regulator to drop the input voltage from 24V down to 8V-10V, then a second stage: feed that intermediate voltage into your LD1086.
- Or need to find another solution like opting to buck DC-DC converter.
Hope that helps.