Electronic – Is it possible to use a Mosfet in switching mode as an electronic load

electronic-loadmosfetpwm

I'm trying to use a mosfet as an electronic load to measure the IV curve of a solar cell, but if I use it in linear region it dissipates too much power. I was thinking that I could use it in switching mode like sending a PWM value from a microcontroller, and set the output over drain pin, signal which should be a pwm as well as its input, but with the real value like modulate and demodulate the signal using a low pass filter.
I have tried that and it works, the problem is that it doesn't produce the real IV curve, it shows a linear function. Could you advice me how can I use this mosfet in switching mode to produce that electronic load?. In the picture there's a scheme that I have used to achieve it.enter image description here

In the circuit Current sensor is a ACS712 for 20Amps and the voltage circuit is just a voltage divider, both filtered signals go to a ESP32 Microcontroller.

Thanks, I'm a little frustrated and I would like to know the reason why this method is not as effective as a electronic load in linear region.

Best Answer

Here is kind of a sketch of an idea that could work. I didn't do any calculations to determine what are the best inductor or capacitor values. You might have to change C1 and L1. But if you are interested you can enter it in a simulator and play with it a bit. In addition to M1 and R1, you could possibly add additional stages with smaller resistor values to get higher currents. The power rating for R1 should be greater than the peak power that the cell can deliver.

schematic

simulate this circuit – Schematic created using CircuitLab