Hi Andreas,
I will simply post some drawings here. But you are free to create a project on GitHub, pimp my schematics a bit and post it there.
Alternative B is easier (you need to switch the grounding and signal at the shunt resistor compared to A), but it is more susceptible to noise, especially with loose hanging wires (better twist the pair of wires from the shunt). Maybe you could also increase the shunt resistor to 33 Ohms or more, to get higher voltages (e.g. 330 mV@10mA@33 Ohms instead of 100 mV@10mA@10 Ohms).
For Alternative A, the OpAmp needs to be quite fast, low supply-voltage and include the negative rail (GND) on input and output. Not easy to find these days and could be expensive.
Comparators often have an Open-Drain-Output to negative (GND) and need a pull-up to provide a meaningful output. So the LMx93 (293, 393,…) does. The good-old LM393 should do well in this application, is available in PDIP bread-board-friendly packaging and usually dead-cheap (<0.5$). Other comparators with better than 5us rise/fall-time should also do well for 2400 baud or less. Additionally, you can supply it with voltages from 2 to 32V (or up to 38V for some types). Maybe you need to add a 15pF output capacitance to the output of the comparator (at least the datasheet tells to do it).
Depending on your USB-serial converter, you can supply the parts with 3.3 or 5V (re-check the divider ratios, depending on your supply voltage).
But most importantly, the supply of the circuit should be isolated from the stuff connected on M-Bus. Best would be to first test with some laptop running on batteries, not connected with any cables (power, network,…) and supply the circuit from the USB-converter (many provide a 5V output and accept 5V levels on RX, but the 10K pull-ups will protect also 3.3V inputs). Remeber the 24/36V of the M-Bus. USB and serial converter will not love it, when directly feeded into
If this all works well, you can think about adding opto-couplers or an USB galvanic isolator or other stuff to avoid ground-loops, short circuits and such stuff…
A more sophisticated circuit could adapt to the steady-state/standby current and adjust it’s trip-point accordingly, but this would make things much more complicated and would also not help you to get up and running quickly.
PS: You need to find out the polarity of the M-Bus. M-Bus usually is build in a way, that it does not care about polarity. Adding stuff to also make my circuit polarity-agnostic would add quite some more stuff and complexity.
PPS: The OpAmp has its positive input on the down-side input.
Hope this helps and have some fun
Regards,
Daniel