Jim, I've done a similar thing, but using a BASIC Stamp and an external A/D converter (a MAX 186 8-channel unit) to measure battery voltage and current, plus compute amphours for my sailboat. Using an external A/D gets you 12 bits of resolution (1 part in 4096), but at a cost of more external components. Your voltage divider with the FET could get you into some problems due to the on-resistance of the FET being both unknown (although calibration can take care of that) and variable with temperature. If you really wanted to go this route, you might use a small reed relay. For the current, I'd use an op-amp to bring the signal up to 2 volts, rather than divide the reference down. I wouldn't use the Vdd as a reference, if you really want your .1 volt of resolution to refelect any great degree of accuracy. I don't think a typical 5 volt regulator chip will give you enough stability under conditions of changing temperature and line voltage change. It all really depends on what results you need. What accuracy (which is different from resolution) do you need? Waht is the environment? Will temperature and line voltage vary much? Is the project cost-sensitive, such that an external A/D would make it to expensive? .1 volt resolution in a 25 volt signal is fine, (about .4%), but if you are using 1% resistors in your dividers, you could be out by 2% in accuracy if both resistors happen to fall on the opposite extremes of their limits. And when youtake into account the regulator as reference, the FET switch, etc, you could be in the 5% accuaracy range, no better than an analog meter. Have fun! Larry >---------- >From: jim ruxton[SMTP:cinetron@PASSPORT.CA] >Sent: Monday, February 24, 1997 6:26 PM >To: PICLIST@MITVMA.MIT.EDU > >I am designing a small digital voltmeter and current meter to build into a >piece of equipment. I'm probably going to use a 16c73 or 16c74. > I would like to be able to measure 0 to 40 Volts and 0 to 20 Amps. In the >lower range ( 0 to 25 Volts) I wanted .1 volt of resolution. If I feed the >input voltage through a 5.1:1 voltage divider network and into an A/D pin >clamping the voltage at 5 volts I should get .1 volts per step ie. 255 = >25.5 volts, using Vdd = 5 volts as the reference. My problem is what do I >do to read above 25.5 volts with lower resolution? I was thinking about >switching in a further 2:1 divider network with a FET when my A/D reads 255 >and scaling the result in software to reflect the 2:1 division. > For measuring current I am planning on using a .01 ohm shunt, ie. 20 >Amps would yield .2 Volts. I would scale Vdd down to .2 volts (25:1) and use >that as Vref. For measuring voltage as described above I would change the >A/D settings and use Vdd as the reference voltage. > Can anyone suggest some way to simplify this project especially the >voltage measurement scaling. I would like to do away with the FET if >possible. Any comments or suggestions would be appreciated. > Jim >