I have an mpx12DP pressure sensor that I want to use to measure the depth of water in a 1m tall water tank.

But it only measures up to 55mV of voltage change, which the arduino can't really detect changes in. (The sensor measures 0 to 1.45psi- 1m of water should give me 1.4psi, so I should be able to get really good accuracy).

Is this as good sensor to use for this purpose? How do I amplify the signal from the sensor? I have tried an LM324 op-amp, but couldn't get it to work (this may be entirely the wrong thing to use! And I was utterly unsure of the kind of circuit to use it in). Any advice on parts.. schematics.. a suitable already-amplified sensor that reads only up to 1.45psi?

Thank you,

Pressure sensor datasheet: http://www.digikey.co.uk/product-detail/en/MPX12DP/MPX12DP-ND/684659 Op amp datasheet: http://www.ti.com/lit/ds/symlink/lm124-n.pdf

  • 55 mV should be (barely) measurable by the Uno, as its analog resolution is ≈ 4.9 mV. The op-amp looks fine, how did you wire it? Did you try the non-inverting schematic on p. 13 of its datasheet? – Edgar Bonet Jun 19 '15 at 9:59
  • I can just about measure it- but not good enough to tell you how full the tank is! I was hoping for much better accuracy! And I tried to wire it up like this: practicalarduino.com/projects/water-tank-depth-sensor but its awfully complex and I'm not sure I did it right... however I'm not really sure how to do it correctly! – UglyTeapot Jun 19 '15 at 18:16
  • So to try the non-inverting schematic as on the datasheet pg13.. pin 4 goes to 5v, pin 11 to gnd, then pin 9 to the -ve pin of my sensor, and pin 10 to the +ve pin of my sensor, then i should be able to read from pin 8.. this doesn't work so I have read it wrong somewhere! – UglyTeapot Jun 19 '15 at 18:36
  • Oops, sorry, didn't notice the sensor had differential output. – Edgar Bonet Jun 19 '15 at 19:03

You could try using analogReference(INTERNAL);, to reduce the upper range of the ADC to 1.1volts, thus giving you better voltage resolution.


It is reasonable to use analogReference(INTERNAL);, as suggested by Alexander M, to set the range of the ADC to 1.1 V.

Another alternative is to use two resistors to make a voltage divider, to make an external reference of 1 V (min.) at the AREF pin, and then use analogReference(EXTERNAL);, but the Arduino's supply voltage is likely to be noisier than the internal reference.

Regarding tiggun's suggestion about grounding the V- pin, it isn't clear to me that the mpx12DP will function correctly with V- and ground connected together.

In any case, you can use two or three of the op amps in the four-op-amp LM324 package to make a differential amplifier or an instrumentation amplifier. See figures 38 and 39 on page 20 of the LMx24 datasheet mentioned in the question. Figure 38 shows a differential amplifier; you could, for example, replace R3 with a 50KΩ resistor and R4 with a 1MΩ resistor to get a voltage scaleup of about 21, via the formula shown: Vₒ = (1 + R4/R3)·(V₂-V₁). Alternately, you can use a small variable resistor as in figure 39 to make a variable-gain instrumentation amplifier.


Your sensor has differential output, with a voltage difference between the Vout+ and Vout- being the measurement. The span of this difference is 0 to 55mV. The reason the sensor is wired this way is to reduce noise. To amplify this type of output you would need a differential output amplifier which is more complicated than a single op amp.

However, you can also just wire the Vout- from the sensor to ground, and then use the sensor as a single-ended output from 0 to 55mV (noise might be a problem). If you do this, you can then amplify Vout+ with your LM324 op-amp as described on page 13 of the LM324 datasheet with a non-inverting amplifier. By setting the ratio of R2/R1 to 60, you would get up to 55mV*80 = 4.4V which is pretty good.

The op amp needs some voltage headroom, so if you are using 5V supply for it, don't set the amplified voltage max to 5V.

edit: I don't think you need much headroom and 4.4V will give you better resolution than 3.3V

  • I can't find anything in the ATmega328 datasheet describing differential capabilities of the ADC. I did find info in the ATtiny85 datasheet, however. It has built-in 1x or 20x gain. – tiggun Jun 19 '15 at 20:34
  • 1
    Never mind, I must've been thinking of the Mega. – Ignacio Vazquez-Abrams Jun 19 '15 at 20:36

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .