Hi,
You say "constant power control".
Power: P = V × I.
I see you regulate the current ... but I see nothing about voltage.
--> So indeed it seems to be a "constant current control". Is this true?
(Otherwise you need to measure the load voltage to be able to regulate the power)
*****
The circuit shows:
* DAC --> current control loop--> load current
And
* load current --> ADC
--> To me this is somehow redundant. If you set the DAC .. you already know the current. So why measure it?
In most cases you will read back the expected value ... with (a lot of) tolerance.
There will be errors:
* from DAC to current
* from current to ADC
Thus the measurement of the current does not give much reliable information.
If there is a big deviation you may just assume the the current control loop is "out of regulation".
But why does this matter for the "isolation problem"?
Because in your application now are two analog paths that need to be isolated.
But isolating analog paths is rather difficult and usually generates rather big. Low quality.
Thus - my personal way is - to place the isolation into digital paths.
Without knowing details .. my approach would be this:
ESP32, SPI --> isolation --> cheap SPI DAC --> current control loop --> load current
Current control output --> comparator --> optocoupler --> ESP32
The idea behind the second path:
As soon as the current control loop is out of regulation the current_control_loop_output immediately saturates close at VCC.
This is a good (digutal) indicator of: regulation is O.K. / not O.K.
Additional hints: I personally
* don't like the potis in the analog paths. Its easier, cheaper and more precise and reliable to do the correction in software.
* don't like the ADCs and DACs of the ESP32. They have poor accuracy, poor resolution, poor linearity and poor precision.
( thus using a cheap external DAC improves overall performance)
* would install low pass filters in the analog paths to reduce noise.
The current measurement shunt has high power dissipation. Consider to replace it with a lower value one.
Also the worst case power dissipation of the Mosfet is about 300W. This is huge! You need a big heatsink with fan ... and still it is likely for the Mosfet to explode.
If you could replace linear regulation with switch mode control (PWM) you avoid a lot of heat problems.
Klaus