Electronic – Auto-ranging voltmeter circuit with PIC uC ADC

adcmicrocontrolleroperational-amplifierpic

I want to design an autoranging voltmeter with a PIC microcontroller and its ADC.

Requirements:

  • Measure voltages from +0.2v to +50v
  • Protect against reverse inputs or slightly higher voltages
  • Input impedance can be quite low, drawing up to a few mA.
  • Accuracy of around 1% or better (although not necessary for smaller voltages)
  • Sample time of around 0.5ms or better

I have a circuit in mind, and would appreciate feedback. Perhaps there are simpler circuits I could use. The PIC will be on a 5v supply. I would probably use a basic, cheap op-amp running from 0v and a +12v rail. The tristate uC outputs would either set the input voltage dividers or alter the gain of the op-amp circuit to higher than unity.

schematic

simulate this circuit – Schematic created using CircuitLab

Does this look reasonable?

Best Answer

I'm not 100% on this but I think most PIC ADCs are 10 bit (1 in 1024 resolution) but can have up to 10x LSBs inaccuracy - this means you're just about at the 1% accuracy stage without considering resistor accuracies.

Using PIC outputs as pull downs isn't a good idea either because there will be leakage currents from the pins that will add/subtract a voltage from the signal via the resistors. Also, you appear to be relying on PIC outputs going exactly to ground but neither is this the case and your accuracy on the lowest range will be dented.

Also, I think the zener won't be needed because R1 will limit current into the op-amp and it will self protect - 50V across 50k gives 1mA and most op-amps are capable of dealing with this sort of current using their internal diodes. I'd run the op-amp from 5V too - this means there's no chance it can stuff a killer voltage (6V or above) into the PIC ADC pin. Use something like an AD8605 - it is rail to rail but, because you can't exactly achieve 5V, scale things down by 10% and restore in the CPU with a frig-factor.

Having an op-amp that is self-protecting (due to the 50k) means negative voltages are also protected against but read the data sheets on the op-amp to be absolutely sure. If you still think you need the zener, consider that a zener will be starting to draw current at voltages significantly below 5V - it isn't an on-off thing as soon as you hit 4.99 volts.