At 09:03 PM 26/05/98 -0400, you wrote: >I need to measure a voltage 3-30VDC using a PIC, but the PIC has a totally >different ground reference than the voltage I'm supposed to be measuring >(the two circuits _are_ connected, but I have no way of knowing how because >each install will probably be different). > >I was thinking that this is an ideal situation for using an opto-isolator, >and was wondering if anybody knew in a practical way if this would provide >reasonable accuracy with varied temps, etc. > >Anybody have any other suggestions? > >Thanks! > >Andy > >================================================================== > Andy Kunz - Montana Design > Go fast, turn right, and keep the wet side down! >================================================================== > > Ah Andy, You are about to undertake what people whom design Hi side switches do on a regular basis. Firstly you need to chose the OPTO carefully, as the operating curve is what you are after. If I remember this is for a battery powered system ,so look at the Sharp OPTOs as there are quite a few that operate very well in the low current range. Once you have characterised the OPTO, the rest is quite simple, but do look for OPTOs that have a largish linear type area. Be careful, as some OPTOS will just start to enter the 3V area, this would make switching and self calibration difficult) Unfortunately, I can't think of a way that will be cheeper than a POT in order to calibrate this thing, as each will be somewhat different too (You could use two OPTOS, two FETs and a reference to self calibrate). This of course may not be a problem depending on the accuracy required. By this, the gain should be quite OK, just the offset may need shifting. Note that you may find it better to alter the current flowing through the diode, rather than the current sinked by the transistor. The range that you need to measure is quite large, so some form of current scaling may be required (This may even be a simple resistor) The calibration point should remain fixed, so if the range is acceptable, then a simple 8 bit offset is all that's required As for stability over temp, what range? Most of these simple OPTO circuits will work quite well over a nominal temp of 0 to + 40C But as both circuits are connected together, then maybe a differential amp could be used, or even a current mirror. Dennis