**Designing the Sensor Frontend**

The design objectives for the Sensor Frontend were as follows

- Accurate.
- Scalable.
- No Contact between fluid and sensing element.
- Cost Efficient.
- Uniquely Identifiable (Possible, but not attempted).
- Wireless.
- Simple.
- Value Added.

**Sensing Liquid Level** : This is the fundamental aspect of the whole project and the design of the sensor frontend rests on this selection choice. The question is how do you design a system that measures liquid level accurately, while at the same time prevents any contact between the transducer and the liquid to be monitored.

There were three choices in front of me,

(a) **Capacitive Measurement**: Not exactly non contact. Cannot be used for flammable liquids.

(b) **Ultrasonic Measurement**: Complex to implement. Not very accurate (I suppose).

(c) **Pressure Measurement**: Non Contact, Simple to implement.Cheap(?)

Of all the methods that I mentioned above, the pressure measurement method found favor with me as it was incredibly easy to use, was scaleable and accurate, though the sensor was a bit costlier. Also the analog interface circuit was very easy to design and required only two components (amplifier and a gain setting resistor) in addition to the sensor element.

**Selection of Pressure Sensor: **The sensor I have selected is a differential pressure sensor. A differential pressure sensor has two ports and measures difference of pressure between the ports. The advantage of such a sensor is that it eliminates variation in sensed pressure due to changes in atmospheric pressure. This helps in giving the system better accuracy and some sort of stability in readings. In such a setup, one port is left open to atmosphere, while the other port is connected to a pipe which is put immersed in the liquid.

Now lets delve a bit into the mathematics of selecting a suitable pressure sensor .

**Static Pressure** exerted by a still column of water is given by the equation

**P= rho * g * h
**where

**P is pressure, rho is fluid density and g is gravitational acceleration and h is height of fluid column.**

Hence pressure exerted by a water tank of 1 meters height = 9.81 kPa (kiloPascals)

Hence I selected MPX2010 from Freescale Semi for the sensing pressure from the main tank. However there is a caveat to this calculation. The above calculation holds good if and only if the sensing element is at the base of the tank, thus the sensing element is effectively in contact with the liquid -nada. In my design setup, a straight tube would be dipped in liquid as I wanted a non contact probe. Consequently, the mathematics would be different. The sensor would be connected to the non contact end of the tube. Hence Boyle’s Pressure Law will be applicable in this case (P1V1=P2V2=K).

We shall expand this a bit

**P1V1=P2V2=K**(constant)

**P1 x (A x L1) = P2 x (A x L2)** (Where **A** is the cross section area of the tube and L1,L2 is the height of **air** column **not** the **liquid** column.

Hence** P1L1=P2L2
**Now working backwards for the selected sensor MPX2010DP, we know from datasheet that it can sense differential pressure up-to 10KPa, hence P2-P1 <=10KPa.

At sea level standard atmospheric pressure is 101.325KPa, so maximum pressure value (P2) the selected sensor can detect is 111.325KPa (P2=P1+10) so consequently the ratio of L1:L2 = P2/P1 = 0.910 (at sea level using standard values).

Height of the liquid column=L1-L2

So if you want to measure liquid in a tank 1m in height .. you will require a tube of length of 11 m.. you can calculate that for yourself

**Sensor Instrumentation Amplifier: **The MPX2xxx series differential pressure sensors can be approximated to a resistor (Wheatstone) bridge. As the output is a differential voltage, the span of the differential voltage demands a sensitive instrumentation amplifier. TI guys had been kind to ship me samples of their instrumentation amplifiers. I was keen to keep the design simple and wanted to avoid complexities of designing dual power supply so I designed my circuit around a single supply instrumentation amplifier.

Lets delve into the specs of MPX2xxx sensors from their data sheets

*Characteristics of MPX2010 and MPX2100:*

Excitation Voltage | Min Span (mV) | Max Span (mV) | Min Offset (mV) | Max Offset (mV) |

10 V | 38.5 | 40 | -1 | 1 |

3.3 V (scaled) | 12.7 | 13.2 | -0.33 | 0.33 |

12 V (scaled) | 45.6 | 48 | -1.2 | 1.2 |

Excitation Voltage | Min Span (mV) | Max Span (mV) | Min Offset (mV) | Max Offset (mV) |

10 V | 24 | 26 | -1 | 1 |

12 V (scaled) | 28.8 | 31.2 | -1.2 | 1.2 |

3.3 V (scaled) | 7.92 | 8.58 | -0.33 | 0.33 |

**The obvious questions which popped out were**

**What is Span?** Span, put simply is the the max output of the sensor minus the min output.

**What is Offset?**Offset is the output of the sensor without any applied stimulus. For our sensor according to data-sheet Offset is defined as the output voltage at the minimum rated pressure.

Considering the analog input characteristics of MSP430 devices, the desired offset is 0.5V and the desired span is 3V. 3V is the maximum analog input voltage for MSP430G2x53 devices.

**Gain Calculation:
**

*Maximum Gain (G*

_{Max}) = Desired Span(V) / Sensor’s Minimum Span*Maximum Gain (G*

_{Min})= Desired Span(V) / Sensor’s Minimum SpanExcitation Voltage | MPX 2010 G_{Max} |
MPX2010 G_{Min} |
MPX2100 G_{Max} |
MPX2100 G_{Min} |

10 V | 125 | 115 | 78 | 52 |

3.3 V (scaled) | 378.8 | 349.65 | 236.22 | 227.27 |

12 V (scaled) | 104 | 96 | 65 | 53 |

As I mentioned earlier, to keep the overall circuit simple and costs low, I would be using a single supply instrumentation amplifier from Texas Instruments. I would be using INA126 from TI for the project.

For INA126, Gain (G) = 5 + (80 /R_{G}). R_{G} is a gain setting resistor.

Now lets calculate values of R_{G} (in Kilo Ohms) for different gain settings

R_{G (in K ohm)}=80/(G-5) for a designed excitation voltage of 3.3V (VCC for MSP430).

Excitation Voltage | 3.3 V |

MPX2010 | 232 |

MPX2100 | 360 |

Excitation Voltage | 3.3V |

MPX2010 | 240 |

MPX2100 | 360 |

Hi can u give me an idea for how to manage current cuts in your home..can u suggest how to build a cheap generator or inverter to supply current for home?

Hi

I am having a hard time finding a good link to your liquid level gauge project with schematics, board layout, parts list and code could you please provide this thanks wayne.

Dear Wayne

Eagle schematics and code updated on page 5.

Pingback: karve.in: ??????? ?? ????? | MyLinks

Olá estou procurando um esquema de circuito eletrônico para nível de caixa d’água, que tenha as seguintes medidas, 25%, 50%, 75%, 100%, através de sensores por fios e que tenha visor LCD para indicação. Também quero outo esquema que mim indique 50%, 75%, 100%, através de sensores com fios e tenha visor LCD, não sei se uma placa só serve para os dois casos. se você tiver algum me envie por favor.

Atenciosamente,

José Elaesso da Silva.

Dear Jose

Request an English translation.

Regards

Hi interest in a unit like this can you contact me at my email philarkinc@gmail.com