# Interfacing an automotive pressure sensor to microcontroller circuit

This is a follow up to Measuring water pressure in a tank. I've decided to try and go a different direction so I'm asking a new question.

I have an application in which I need to electronically measure the pressure inside of a pool filter. Because the sensor will be subjected to chlorinated water I can't use a simple pressure sensor such as the MPX5700 from Freescale.

I've got a cheap 150 PSI Pressure Transducer from Ebay with the following technical details:

Input: 0-150 psi. Output: 0.5V – 4.5V linear voltage output. 0 psi outputs 0.5V, 75 psi outputs 2.5V, 150 psi outputs 4.5V.

Works for oil, fuel, water or air pressure. Can be used in oil tank, gas tank, etc.

Accuracy: within 2% of reading (full scale).

Wiring connector: water sealed quick disconnect. Mating connector is included.

Wiring: Red for +5V. Black for ground. Blue for signal output.

I tested it out on the bench using an oscilloscope and multimeter and measured the following:

1. When no pressure is applied it is producing about 418mV. This seems correct based upon the above.
2. When I force some air into it using my mouth the voltage goes up as expected.
3. The resistance between 5V and GND is 42.7K ohm
4. The resistance between 5V and signal OUTPUT is 120K ohm
5. The resistance between GND and signal OUTPUT is 69K ohm

I connected the sensor signal wire to my LPC1768 micro-controller on P17 ( analog in ), sensor Red wire to +5V and the sensor ground wire directly to ground.

When I read the 12 bit AD convertor output I saw wildly varying output such as the following in the Pressure column:

Cycle   Level        Pressure
================================
[211]   W:[184]     F:[2200]
[212]   W:[184]     F:[2071]
[213]   W:[185]     F:[1279]
[214]   W:[184]     F:[418]
[215]   W:[184]     F:[1514]
[216]   W:[184]     F:[3002]
[217]   W:[185]     F:[1499]
[218]   W:[185]     F:[0]
[219]   W:[183]     F:[1430]
[220]   W:[184]     F:[2501]
[221]   W:[184]     F:[1965]
[222]   W:[185]     F:[1311]
[223]   W:[184]     F:[263]
[224]   W:[184]     F:[1509]
[225]   W:[183]     F:[3195]
[226]   W:[186]     F:[1518]
[227]   W:[184]     F:[74]
[228]   W:[185]     F:[1306]
[229]   W:[184]     F:[2037]
[230]   W:[184]     F:[2409]
[231]   W:[184]     F:[1478]
[232]   W:[184]     F:[30]
[233]   W:[184]     F:[1503]
[234]   W:[185]     F:[3254]
[235]   W:[184]     F:[1549]
[236]   W:[184]     F:[433]
[237]   W:[185]     F:[1025]
[238]   W:[184]     F:[1714]
[239]   W:[184]     F:[2691]
[240]   W:[185]     F:[1479]
[241]   W:[184]     F:[0]


I'm using the same software routine to read both the Level and Pressure column. The Level column is very stable unlike the Pressure column.

My questions are as follows:

• If the sensor is supposed to output .5V with no pressure how is it that I'm reading 0?
• Do I have to add some components to the circuit interface because of the resistance noted above in points 3,4 and 5 such as a unity gain buffer? If so, what op-amp would you recommend? Note that I'm not an electrical engineer, just a hobbyist new to op-amps. Thanks Joe Hass for the unity gain buffer idea.

• What about power supply filter capacitors? Should they be needed and if so have much?
• Should I add pull-down or pull-up resistor?
• Is it possible to get this to work or would I need to use a much more expensive item such a Honeywell industrial pressure sensor?

Note: This is both an electronics and software question. Right now I am working on the electrical interface.

Update: Things appear for the moment to have been solved. I had the sensor signal connected to the LPC1768 P18 which is shared as Analog In and Analog Out. The sensor signal is now connected to P17 ( Analog In only ). That change and adding a 0.1uF cap to filter the sensor output has made the output at 0 PSI appear correct. I just have to test it with an air compressor and certain PSI settings to ensure the ADC readings remain correct.

• I'd suggest you consult the maker's datasheet to see what connections are required - but since the eBay listing doesn't give the maker name or part number, this may not be possible, unless the information came with the device. Without that data, I'd measure the output with a multimeter, and try to relate the meter readings to your ADC readings. – Peter Bennett Jan 5 '14 at 1:50
• You did connect the ground of the 5V supply to the ground for the microcontroller, didn't you? I know it sounds silly but it is often overlooked. – Joe Hass Jan 5 '14 at 12:43
• @JoeHass Sure did. :-) – Chimera Jan 5 '14 at 15:23
• The normal procedure here is that if you found that a particular answer helped you solve your problem, you officially accept that answer. It helps later readers to understand what was going on, and prevents this question from being bubbling up over and over as unanswered. And, of course, it boosts the reputation of the person who gave you the helpful answer. – Joe Hass Jan 6 '14 at 23:44
• @JoeHass Thanks Joe. I am aware of how the system works here. I will accept an answer when I'm done with my testing. I always accept the best answer in this forum as well as the others I'm involved with on stack exchange. I updated my question just to be thorough. – Chimera Jan 7 '14 at 1:03

These problems are hard to diagnose. The first thing I would do is swap the level and pressure ADC inputs to make sure that there isn't some sort of software issue. Even if you've looked at the code a thousand times I would do this.

The impedance of your sensor is pretty high to feed directly to the ADC input. I think you should add a unity gain, non-inverting buffer between the sensor and the ADC input.

Bypass capacitors may be needed. There's not enough information to tell where they should be added or what their values should be. I would be sure to bypass the 5V supply for the sensor. You could add a small capacitor to the output of the sensor as well, assuming that the pressure is not changing rapidly.

You could also try slowing the ADC clock rate to give the sample-and-hold more time to charge. Sometimes putting the processor to sleep during a conversion can reduce noise as well.

• Thanks Joe I appreciate your input. So you think perhaps a simple unity gain op-amp might help? I guess I need to go through the LPC1768 datasheet and see if I can find out what impedance range the analog inputs can handle. – Chimera Jan 5 '14 at 3:41
• I suggested a unity gain op amp under the assumption that the pressure in your pool filter was low enough that the sensor voltage would stay below 3.3V. I work with the LPC13xx and LPC11xx series and they recommend a maximum source impedance of 40 kilohm for the ADC inputs, if I recall correctly. – Joe Hass Jan 5 '14 at 12:38
• Seriously, swap the analog inputs before you start worrying about bypass capacitors and such. If that's too hard, replace the pressure sensor with a low resistance voltage divider, say two 1 kilohm resistors, and try to measure that voltage reliably. You need to make certain that there isn't a software issue. – Joe Hass Jan 5 '14 at 12:42
• Thanks Joe. Today I will switch the inputs to rule out a software issue. – Chimera Jan 5 '14 at 15:22

Due to the fact the output range of your sensor exceeds the allowable input range of the LPC1768 ADC input channel, maximum Vdda/Vrefp of 3.3V, you maybe better served to utilize the opamp to scale the source/sensor output range as well reduce the source/sensor output impedance.

Reference: NXP AN10974 LPC176x/175x 12-bit ADC design guidelines Discusses effective Power Supply filtering, Use of Bypass/Decoupling Capacitors

Reference: NXP LPC1769/68/67/66/65/64/63 Datasheet, page 62 and Fig. 27, Page 65

Max Source Output Resistance ~ Rvsi (voltage source interface resistance) maximum of 7.5 kohm

Max Source Output Capacitance ~ Cia analog input capacitance) maximum of 15 pF

• Thanks BigDogGuru. I appreciate the references! Actually the PSI range I expect to be measuring is between 0 and 60 at the most. I don't need the ability to read the full voltage range the sensor can output. I just picked it because it was cheap and covered the range. – Chimera Jan 5 '14 at 5:47
• Are you powering the sensor from +5v, and hoping that it never tries to output a signal larger than 3.3v? – rdtsc May 1 '17 at 5:59