Microcontroller based Pump Controller

Print Friendly
  1. 28 Jun 11: I cant help but thank the kind guys at Texas Instruments. I cant believe my eyes, they have shipped me a sample of their instrumentation amplifier. Thats would help me simplify my input block. Thanks u guys… You rock.
  2. 01 Jul 11: Received Sample. Waiting for Farnell guys to ship my pressure sensors…
  3. 07 Jul 11 :  Received Pressure sensors.
This project will describe building of a Pump control system. The requirement primarily arose to satiate the requirements of my parents, who have to manually switch on the pump every day morning and switch it off and continuously monitor the tank for overflow. So I have taken up the challenge onto myself…
However I would be ungrateful, I do not acknowledge the inputs I received after reading Kayne Richens blog post.
This blog is progressive ; hence will get updated as things progress…..Lets me see how do things unfold…

Basic Design Objectives:

  1. Should be cheap and affordable.
  2. Should be as automated as possible requiring minimal user supervision.
  3. Should have a user-friendly MMI.
  4. Prevent water and electricity wastage.

Design Challenges:-

  1. Erratic water supply timings.
  2. Non scheduled Electrical Load shedding .
  3. High head of water tank.
  4. Intelligent control system.

Preliminary System Design:-


System Blocks Functions:-
Input Block:-
Input Description  Sensor Type  Micro-controller Input
Sense Tank Capacity
Differential Pressure Sensor
Sense Electricity Availability Optocoupler Digital/Interrupt
Sense Time RTC Digital
Sense Input Water Supply Availability Differential Pressure Sensor Analog
Output Block:-
Output Description  Transducer Type  Micro-controller Output
Motor On/Off
Solid State Relay
Valve Solenoid On/Off Relay Digital
Alarm Buzzer Analog
Mathematics for Selecting Differential Pressure Sensor:-
Why Differential Pressure Sensor?
A differential pressure sensor will eliminate variation in pressure due to changes in atmospheric pressure.
Capacity of Water Tank = 500 Lt
Water Tank Head = 30 Ft = 9.144 Mt = 914.4 Cm
Average Ambient Temperature = 25 deg Celcius
Specific Gravity of Tap water=0.997gm per cubic cm = 997Kg per cubic meter
Dia of Discharge Pipe=1/2 in = 1.27 Cm=0.0127 M
Pressure exerted at Base of Building by a column of Water at height
P = h * rho * g
P = Pressure
h = height of liquid column (2000 mm = 2m)
rho = Density of water (1000 kg/m^3)
g = Acceleration due to gravity (9.81 m/s^2)
P=9.14 x 997x 9.81 = 89394.4098 Pascals = 89.39kPa = 89.4 kPa (approx)
Similarly Pressure at Rooftop at the base of tank itself
P=1.5 x 997x 9.81 =14670.855 Pascals =14.67kPa = 14.7 kPa (approx)
Selected Sensor  :  Freescale Differential Pressure Sensor MPX2100DP  0-100 kPa

Selection  of MCU:-

Family : Microchip PIC
Why : Because I have necessary experience and required development tools.

Max No of ADC Channels Required = 3 (2xpressure Sensor + 1 spare)
No of Interrupts : 02 (Electrical Supply Available & Float Valve)
Digital I/O = 8
Operating Voltage= 5V
SPI Required = Yes (For Interfacing RTC)
MCU Selected  = 16F876A  or 16F877A Why? Because I already have!
Design of Pressure Sensor Amplifier:-
Design Guide/Reference : –
  1. Op Amps for Everyone Design Guide.
Amplifier Design Objective : The output span of the transducer must be matched to the input span of the ADC to achieve optimum performance.Mathematics for Amplifier Design

Span and Offset Characteristics at 10v,15v & 5V Excitation Voltage. As sensor is ratio-metric the the values are scaled for.
Excitation Voltage Min Span 
Max Span 


Min. Offset 


Max Offset 


15V (scaled)
57.75 60 -1.5 1.5
5V (scaled)
20 -0.5 0.5
9V(scaled) 34.65 3.6 -0.9 0.9
Excitation Voltage Min Span 
Max Span 


Min. Offset 


Max Offset 


15V (scaled)
36 39 -1.5 1.5
5V (scaled)
13 -0.5 0.5
9V(scaled) 21.6 23.4 -0.9 0.9
Desired Amplified Span and Offset

Desired Offset= 0.5V
Desired Span = 5V
Gain Range & Offset Calculation

Maximum Gain      =Desired Span (V)

                           Sensor’s Minimum Span
Desired Span = 5V

Excitation Voltage

Maximum Gain (MPX2100DP)

Maximum Gain (MPX2010DP)

10V =5/38.5 = 129.8 = 130


15V =5/57.75 = 86.58 = 87


5V =5/19.25 = 259.75 = 260


9V =5/34.65=144.300=144


Since Texas Instruments was kind to ship me samples of their instrumentation amplifiers, I would be basing my calculations on same. There is no rocket science involved since the datasheet is fairly self explanatory and the instrumentation amplifier itself requires only one external component for gain adjustment.
Texas Instruments was generous in mailing following samples to me
INA126, INA128,INA122,INA2126
I would be using INA126 amplifier for testing purpose
Brief description about INA126 ..”The INA126 and INA2126 are precision instrumentation amplifiers for accurate, low noise differential signal acquisition. Theirtwo-op-amp design provides excellent performance with very low quiescent current (175µA/channel). This, combined with awide operating voltage range of ±1.35V to ±18V, makes them ideal for portable instrumentation and data acquisition systems. Gain can be set from 5V/V to 10000V/V with a single external resistor. Laser trimmed input circuitry provides low offset voltage (250µV max), low offset voltage drift (3µV/°C max) and excellent common-mode rejection.”
Gain calculation formulae

Instr Amplifier

Gain Formula

INA 122 G=5+200k?
INA 126 G=5+80k?
INA 128 G=1+50k?
RG (IN OHMS)values at Max Gain. Values in (brackets) indicate nearest standard resistor values.

Instr. Amplifier





INA 122

   1602 ? (1.6K?)


785? (750?)

INA 126

641? (620?)

981? (1k?)

584? (560?)

INA 128

388? (390?)

548? (560?)

193? (180?)


Instr. Amplifier





INA 122

   984 ? (1K?)


486? (470?)


INA 126

393? (390?)

598? (560k?)

194? (200?)


INA 128

241? (240?)

363? (360?)

120? (120?)


Amplifier Interface Design
In the MPX sensor, each of the resistors in the bridge is an active strain gage, so this design illustration is applicable for the amplifier design.
Test Schematic
3D PCB Render (Using Diptrace)

Ishan Karve

About Ishan Karve

Ishan Karve is just an every day normal guy next door who happens to be an Electronics Engineer by profession and dabbles with PHP, Javascript, C++ and python. His interests vary as seasons change.. they change from astronomy to soul searching. This site is just a reflection of what he does to keep his mind engaged when he is not occupied by work and family. He is an extremely objective guy and is always ready for some good arguments.. of course over a glass of 40% proof alcohol.
This entry was posted in CCS C, Electronics, PIC, Programming, Projects and tagged , , , , , , , , , , , , , . Bookmark the permalink.

4 Responses to Microcontroller based Pump Controller

  1. Pingback: Dynamic Water Pump Controller | Reverse Biased

  2. n.madhava says:

    i want to wireless system of water tank level.please forward to this mail id madhav_niche12@yahoo.co.in .if water level high pump will stop.if water level is low pump will start.i want this type of system.

  3. Pingback: Non Contact Wireless Liquid Level Gauge | Reverse Biased

Leave a Reply

Your email address will not be published. Required fields are marked *