You measure the voltage drop across drain-source of the mosfet. From I = V / R with V = measured value and R = Rdson you get Ids = Vmeasured/Rdson. The difficulty here is that Rdson can vary considerably, so you will have to trim the circuit.
A much more precise solution puts a small sense resistor (e.g. 0.1 Ω) in the connection between source and ground. Then the same rule applies ass above, but this time with a known and much more stabel sense resistor.
In both cases of course the measured voltaeg will be very small (you don't want to drop much voltage becaus you want the voltage at the load (relays), so you'll have to amplify the measured voltage, then you can feed it to e.g. an analog input pin of the microcontroller and use the ADC to get a measurement.
The measured voltage will probably be quite noisy, so some low pass filtering may be reuqired, e.g. in the analog front end (amplifier) of in the digital domain (avaraging after A/D conversion).
A much more precise solution puts a small sense resistor (e.g. 0.1 Ω) in the connection between source and ground. Then the same rule applies ass above, but this time with a known and much more stabel sense resistor.
In both cases of course the measured voltaeg will be very small (you don't want to drop much voltage becaus you want the voltage at the load (relays), so you'll have to amplify the measured voltage, then you can feed it to e.g. an analog input pin of the microcontroller and use the ADC to get a measurement.
The measured voltage will probably be quite noisy, so some low pass filtering may be reuqired, e.g. in the analog front end (amplifier) of in the digital domain (avaraging after A/D conversion).