This is the circuit I'm having problems with.
ADPWR = 5V supplied from a microcontroller IO pin when required.
ASENSE = ADC pin on microcontroller (5V reference)
ATM = A load on the ground rail.
The idea is that when the resistance of ATM is required, the microcontroller brings ADPWR high which powers the opamp and also sets up a voltage divider between R12 and R13+ATM (R13 is just to make sure some voltage goes into the non-inverting input even if ATM is a short circuit. The op amp is in a simple negative feedback amplifier configuration to multiply the relatively low voltage (usually about 27-28 times), the pot is used to calibrate the upper limit of the detection (higher upper limit = less accurate but more range, lower upper limit = more accurate but less range). D3 is required to prevent damage to the microcontroller as another circuit also sometimes applies current to ATM (not at the same time the resistance is being measured). The reading are slightly off linear (they show a small parabolic curve), but 2 lines of code can compensate for that. I'm getting an ADC reading of 0 all the time. Can't figure it out.
I've used this circuit before in other projects (without terminating the unused gate) and it's worked fine, so I'm a bit lost. I'm going over my SMD soldering atm as I'm very new to SMD stuff. I'm not sure if I've terminated that gate correctly, it was a bit of a lazy way.
EDIT: Something's definitely wrong with the op-amp. I've desoldered it and put a multimeter across its power input pins. It was reading about 2 ohms. When I tried the same with a new, never used one I get 3.5 megaohms.
EDIT2: Hmmmm, I just sacrificed a new one to test a theory. All I did was apply 5V to pin 8 and ground to pin 4 assuming pin 8 is the top left pin in the picture and pin 4 is the bottom right pin. Then I multi metered it afterwards, it now reads 2 ohms across the VCC and ground pins. Buggered it just by correctly applying power.
EDIT3: No sorry, I messed that up. What I think is happening is that when ATM is powered up properly (this is from a 12V supply) the 12V is going into the non inverting inputs of the op amp, I assumed that this wouldn't matter as the op amp is powered down when this happens (both supply pins are grounded) and also I thought the inputs of an op-amp are at some crazily high resistance so it wouldn't matter, but it definitely seems to be damaging the device. I might be able to put a transistor or mosfet between ATM and the NII, would this be a valid solution?