I'm designing a dual-rail DC power supply, with the two rails completely separate (except for sharing a dual-secondary transformer). The main design should work as-is, only by adding a fuse + mains switch, but I want to add a voltmeter and ammeter to each output (and preferably a voltmeter before the voltage regulators, too).
The problem here is that the "meters" will be a microcontroller's ADC inputs (or external ADCs), and the microcontroller only shares ground with ONE of the two rails. I need some way to safely connect the µC to both rails, perhaps opto-isolation or somesuch, while keeping the rails separate.
Don't look too closely at the exact schematic (below), though, as it isn't 100% correct: I couldn't find a dual-secondary transformer in MultiSim; the LM317 package is incorrect and the µC will be AVR-based.
This is just to give the general picture.
Now, the problem: I want to measure output voltage and output current for both rails, from the shared microcontroller, which is powered by one of the two rails.
It would also be great to have a voltage probe just before the LM317s as well; that way, I can both monitor the input voltage, and also calculate and display the approximate LM317 heat dissipation.
The voltage measurement would be easy, if it weren't for the floating rails… A voltage divider, perhaps followed by an opamp voltage follower to take care of any impedance troubles, connected to an analog input on the µC.
As for current, I'm not quite sure. An opamp would surely be needed to amplify the tiny voltage across the 68 mOhm shunts (68 µV – 102 mV for 1 mA – 1.5 A), but I'm not sure how to wire it up, since neither side of the shunt is ground. There's also the issue of offset voltage, not to mention the galvanic isolation issue.
Priorities are simplicity and cost, though needless to say some accuracy is also needed. It would be great to have 10 mV / 1 mA resolution, though something like 25 mV / 5 mA might be OK too.
Any advice on how to solve this? I'm unsure about much of it. I've considered external ADCs (shunt -> opamp -> ADC -> optoisolator -> µC), or shunt -> opamp -> optoisolator -> µC, but that doesn't appear to be a good idea since the optoisolator might muck with the analog reading. Frankly, I don't quite know what I'm doing (though I do feel safe about my knowledge about the PSU in itself), but I'm certainly willing to read up a little to learn.
EDIT: related to a previous question "Dual polarity vs dual rail power supply"
Best Answer
In addition to stevenh's answer, I'd like to suggest 2 more alternatives: