I have an application where I need to measure the voltage drop over a resistor that varies between 10 ohm - 50 kohm. As I have this set up as a voltage divider, with the result being read by an AtoD, I thought the best way to be accurate is to switch in different resistors, depending on the resistance of the variable one:

simulate this circuit – Schematic created using CircuitLab
Something like the above. This needs to be controlled by a microcontroller, and my initial thought was to use a multiplexer to switch in the different resistors. This seemed like a good idea at first, however, when looking through the datasheets of these components, the ON resistance was a problem. For the higher ranges, it was negligible, but if the 100R resistor was in, the on resistance of the MUX was significant enough to affect the result.
This is a budget controlled design so all of the very low on resistance MUX/decoders etc. are out of the budget (I am not in control of this). My next thought was to perhaps use MOSFETS to switch in the resistors as these can be extremely low with on resistance, however, this takes us more port pins on my microcontroller. 4 rather than 2. This would leave me with only 2 I/O pins left, which doesn't leave much room for adding anything else that may be requested in the future. This method also means more components, which slightly adds to the placement cost.
Is there a better way to do this that I am missing? Or are the MOSFETS perhaps the best way to do this?



