Professional Documents
Culture Documents
Design and Construction of Water in Fuel Detector
Design and Construction of Water in Fuel Detector
Design and Construction of Water in Fuel Detector
With water in your fuel tank, initially, for few minutes, the engine won't cause any issue.
However, after a while, the process of fuel combustion would become weak and will start
showing the water in fuel tank symptoms. Additionally, if there is a large amount of water in the
fuel system then, it may stop the engine immediately. Any water in your fuel tank will create
severe problems with fuel injectors and may result in them exploding. Importantly, larger slugs
of water induced into the fuel supply may result in severe damage to an engine as water will not
compress in an engine cylinder. This can also cause an engine to cool too quickly and potentially
crack core components. Bacteria and fungus also breed in water. As these microbes multiply
over time, they produce acids which affect fuel quality, clog filters and cause storage tanks to
corrode. Finally, there is the fundamental loss of power as less fuel is being pumped into the
engine. This project is design so as to detect water in fuel and to immediately cut off the fuel to
avoid any damage to the car engine. The achieved this set goals, a microcontroller 16F877A will
1
CHAPTER ONE
INTRODUCTION
1.1 BACKGROUND
Water becomes a problem during transport, storage and use. Newly refined fuel is clean and free
of excessive moisture. Refiners and pipeline operators adhere to strict fuel storage tank
maintenance procedures with regular removal of water bottoms and occasional chemical
treatment to assure American Society for Testing and Materials (ASTM) specifications are met.
Unfortunately, after it leaves these facilities water bottoms removal is often neglected. Several
factors contribute to moisture accumulation, including climate, storage tank installation and fuel
handling procedures. Temperature changes can cause suspended water in the fuel to settle out.
For instance, any time warm fuel is placed in a cooler tank, whether for storage or transport,
moisture will drop out of the fuel as it cools. This makes it necessary to periodically drain off the
water, which is a simple task. Water is denser than fuel, so it always settles out to the bottom of
the tanks. Water condensation in fuel storage tanks is a common problem. The longer the fuel is
stored, the more pronounced the problem. If water is allowed to remain in the fuel while it is
stored, microorganisms or bacteria can form that feed on the hydrocarbons in the fuel. This
results in slim, which can clog filters. A Water In Fuel or WIF sensor detects the presence of
water in diesel fuel and gasoline typically using the difference of electric conductivity between
two electrodes through water and fuel. Detection of water in fuel can prevent or at least reduce
any damage water could cause to fuel injectors should water bypass the filter media. Water in the
engine fuel system can cause injection system damage, hard starting, loss of power, misfiring,
surging or stalling WIF sensors are usually placed in the bottom of a fuel filter water separator. A
fuel filter separator provides a space in the bottom of the separators dirty side for collection of
2
water. The signal generated is then sent to the ECU or a dashboard indicator light, alerting the
operator that the filter needs servicing. Water can get carried into fuel tanks from other storage
tanks and can also form in fuel from condensation, alcohol in fuel, high humidity, contaminated
fuel, old fuel, periods of no activity. This project is design to detect water in fuel and when
detected its automatically cut-off the fuel pump so as to avoid any damage to the car engine. The
project will be design using microcontroller PIC16f877A and water in fuel sensor.
1.2 MOTIVATION
At least some of us might be concerned if water seeps into the fuel tank during the rainy season.
Modern cars have good sealing against water. However, there would be chances in which water
does come into your car's fuel tank. So what if water gets in the fuel tank? Water and fuel (petrol
or diesel) have different densities and do not mix with each other. Engine components are
designed to function with a specific type of fuel. Fuel is not only used for combustion but also
acts as a lubricant and coolant in components such as the injectors and fuel pump.
Since water and fuel do not mix with each other and because water is denser than fuel, water
rests at the bottom of the fuel tank. The prolonged presence of water will cause rust there. The
rusting is accelerated if there are ridges and sharp edges in the fuel tank. Rust can also extend to
other parts of the fuel line. Hence, the motive behind this project design is to design a system that
is capable of detecting water in fuel and automatically stop the vehicle fuel pump to avert any
The aim of carrying out this project is to design a system that will detect water in fuel and to
automatically stop the fuel pump. The project is design to have the following objectives:
3
2. To design and construct the water in fuel sensor and the microcontroller PIC16F877A
1.4 METHODOLOGY
In designing this project the following methods were employed the circuit was divided into four
Each sub-circuit was design separately, and it will depend on the electrical characteristics of
individual components. Each sub-circuit design is compatible with the other sub-circuit and the
power supply.
POWER SUPPLY
CIRCUIT
FUEL PUMP
SWITCHING CIRCUIT
4
1.5 REPORT ORGANISATION
This project was arranged into five chapters: with chapter one as an introduction to the general
aim and objective of the project, and the ideas at focus presented. Chapter two deals with
relevant literatures of components used in realising this project, chapter three is design
procedures, chapter four deals with construction procedures, testing and result, while chapter
five gives the conclusion and recommendations for upgrading the project.
The project has the limitation of detecting and controlling the vehicle fuel pump using water in
5
CHAPTER TWO
LITERATURE REVIEW
2.1 INTRODUCTION
This chapter, present the review of related literature, that were reviewed before designing and
constructing this project, titled design and construction of water in fuel detection with fuel pump
cut-off.
Several researchers have worked on water or liquid level control systems with different results
and modus operandi. In one of the research works, Ebere and Francisca (2013) designed a
microcontroller based water level control system for the purpose of starting and stopping a
pump, as well as display the level of the water in the tank. The system has the same objective as
this design but differs in the type of sensor and display units. While they used comparators as
sensors and LCD as display units, this design used metallic sensors and seven-segment ICs as
display units. Furthermore, this design used PIC microcontroller embedded with C language
while the other design used ATMEGA microcontroller embedded with assembly language.
In a related development, Jatmiko et al, (2012) developed a prototype module for detecting the
level of water, with wireless system. The module used an ultra sound sensor (ping sensor) to
transmit and receive signal between the position of the sensor and the water (Abdullah et al,
2014; Viswanathet al, 2015). The microcontroller used was ATMEGA and the output device was
LED and LCD. The technicality behind this module is different from that of this design in the
type of sensor and the output device. However, they produce the same result of detecting water
level. It is generally obvious that microcontroller has got a significant role to play in level control
6
(Patil and Abrar, 2014). It is on this note that Chakraborty et al(2014) also worked on a water
level control system using PIC microcontroller. This design is similar to this work in that it was
meant for a residential building. The design used USART interface to communicate the water
The wireless and ATMEGA microcontroller gained popularity in level control system as the
metal strip sensor which operates in the principles of electrical conductor of water was used for
level control using radio frequency via Global System for Mobile (GSM) communication. The
GSM was used in transmitting and receiving signal with an interface to the computer system for
displaying only HIGH or LOW level for the control action to be taken (Mukthaet al, 2013;
This design is similar to this research design work in that it was meant for a residential building
but will incorporate an intelligent device that will give alarm when the water level underground
cannot be reached. Under this condition, the system is shut down after three seconds.
Very recently, Teo and Tiew (2015) embarked on a similar venture where the Water Level
Automated Management System was introduced. The information to top-up water from a
reservoir tank when the water level in the main tank fall s below half of the tank; was sent
through SMS to the user. When it falls below the critical level, the buzzer will be activated to
warn the user of the critical state of the system. Peak microcontroller PIC16F84A was adopted
for this design. The water level sensor here was water conductivity sensor. The ON/OFF sensors
were used to sense the presence of water at a particular level(Umeh et al, 2015). Obikoya (2014)
deviated a little from the water control system into fuel. The researcher designed, constructed,
and implemented a remote fuel-level monitoring system. The system was uniquely configured
such that the remote Aplicom 12 GSM module interfaced the connected sensor. Here the status
7
message from the module was sent back via a Global System for Mobile (GSM)
Communications network (Johari et al, 2011; Abdullah1 and Ali, 2014). The fuel-level sensor
was designed and uses arms and floater, where the displacement of the fluid from the floater was
converted to a readable value. Their work has flaws in that incases of network failure, there
won’t be any other medium of communication thereby bringing the entire system to a halt.
Based on this conceptual principle, this Microcontroller-Based Water in fuel System was
designed. The materials listed below were technically selected for this design and the
experimental approaches form the method suitable for this design piece
This part of this project explained and descript each components used in designing this project
The PIC microcontroller PIC16f877 is one of the most renowned microcontrollers in the
industry. This controller is very convenient to use, the coding or programming of this controller
is also easier. One of the main advantages is that it can be write-erase as many times as possible
because it use FLASH memory technology. It has a total number of 40 pins and there are 33 pins
for input and output. PIC16F877 is used in many pic microcontroller projects. PIC16F877A
8
PIC16f877a finds its applications in a huge number of devices. It is used in remote sensors,
security and safety devices, home automation and in many industrial instruments.
An EEPROM is also featured in it which makes it possible to store some of the information
permanently like transmitter codes and receiver frequencies and some other related data. The
cost of this controller is low and its handling is also easy. Its flexible and can be used in areas
where microcontrollers have never been used before as in coprocessor applications and timer
functions etc.
As it has been mentioned before, there are 40 pins of this microcontroller IC. It consists of two 8
bit and one 16 bit timer. Capture and compare modules, serial ports, parallel ports and five
PIN 1: MCLR
9
The first pin is the master clear pin of this IC. It resets the microcontroller and is active low,
meaning that it should constantly be given a voltage of 5V and if 0 V are given then the
controller is reset. Resetting the controller will bring it back to the first line of the program that
Fig.2.3 MCLR
A push button and a resistor is connected to the pin. The pin is already being supplied by
constant 5V. When we want to reset the IC we just have to push the button which will bring the
PIN 2: RA0/AN0
PORTA consists of 6 pins, from pin 2 to pin 7, all of these are bidirectional input/output pins.
Pin 2 is the first pin of this port. This pin can also be used as an analog pin AN0. It is built
PIN 3: RA1/AN1
PIN 4: RA2/AN2/Vref-
10
It can also act as the analog input2. Or negative analog reference voltage can be given to it.
PIN 5: RA3/AN3/Vref+
It can act as the analog input 3. Or can act as the analog positive reference voltage.
PIN 6: RA0/T0CKI
To timer0 this pin can act as the clock input pin, the type of output is open drain.
PIN 7: RA5/SS/AN4
This can be the analog input 4. There is synchronous serial port in the controller also and this pin
PIN 8: RE0/RD/AN5
PORTE starts from pin 8 to pin 10 and this is also a bidirectional input output port. It can be the
analog input 5 or for parallel slave port it can act as a ‘read control’ pin which will be active low.
PIN 9: RE1/WR/AN6
It can be the analog input 6. And for the parallel slave port it can act as the ‘write control’ which
It can be the analog input 7, or for the parallel slave port it can act as the ‘control select’ which
will also be active low just like read and write control pins.
11
PIN 11 and 32: VDD
These two pins are the positive supply for the input/output and logic pins. Both of them should
be connected to 5V.
These pins are the ground reference for input/output and logic pins. They should be connected to
0 potential.
This is the oscillator output pin. A crystal resonator is connected between pin 13 and 14 to
provide external clock to the microcontroller. ¼ of the frequency of OSC1 is outputted by OSC2
Fig.2.4 OSC2/CLKOUT
12
PORTC consists of 8 pins. It is also a bidirectional input output port. Of them, pin 15 is the first.
It can be the oscillator input of timer 1 or the capture 2 input/compare 2 output/ PWM 2 output.
It can be the output for SPI or I2C modes and can be the input/output for synchronous serial
clock.
It can be the SPI data in pin. Or in I2C mode it can be data input/output pin.
13
It can be the synchronous data pin or the USART receive pin.
All of these pins belong to PORTD which is again a bidirectional input and output port. When
the microprocessor bus is to be interfaced, it can act as the parallel slave port.
All these pins belong to PORTB. Out of which RB0 can be used as the external interrupt pin and
The entire circuit is powered by the car battery, though regulated to 5Vdc by a voltage regulator
7805.
The regulator receives the input of a fairly constant DC voltage and supplies, as output, a
somewhat lower value of DC voltage, which maintains fixed or regulated over a wide range of
load current or input variation. The 7805 regulator maintains a 5V DC supply voltage to the
system. Normally, the input voltage to the regulator should be at least 2volts greater than the
14
2.3.3. RESISTOR
Resistors come in a variety of sizes, related to the power they can safely dissipate. Colour-coded
stripes on a real-world resistor specify its resistance and tolerance. Larger resistors have these
Any electrical wire has resistance, depending on its material, diameter and length. Wires that
must conduct very heavy currents (ground wires on lightning rods, for example) have large
The power dissipated by a resistive circuit carrying electric current is in the form of heat.
Circuits dissipating excessive energy will literally burn up. Practical circuits must take power
capacity into account. Ohm's law states that current flow depends on circuit resistance:
I = E/R
Circuit resistance can be calculated from the current flow and the voltage
R = E/I
R = R1 + R2 +...+ Rn
Placing one resistor in parallel with another can reduce circuit resistance:
1 1 1
R= + +
R1 R2 R3
I = E/R
Circuit resistance can be calculated from the current flow and the voltage:
15
R = E/I
Diodes exhibit a number of useful characteristics, such as predictable capacitance (that can be
voltage controlled) and a region of very stable voltage. They can, therefore, be used as switching
diodes will conduct current easily in only one direction, they are used extensively as power
rectifiers, converting AC signals to pulsating DC signals, for both power applications and radio
receivers. Diodes behave as voltage-controlled switches, and have replaced mechanical switches
and relays in many applications requiring remote signal switching. Even indicator lamps are now
replaced with diodes (LEDs) that emit light in a variety of colours when conducting. A special
Fig. 2.7 symbols of diode (a) diode, (b) LED, (c) full-wave Rectifier and (d) regulator diode
2.3.5 RELAY
16
A relay is an electrically operated switch. Many relays use an electromagnet to operate a
switching mechanism, but other digital operating relays are also used. Relays find applications
where it is necessary to control a circuit by a low-power signal, or where several circuits must be
controlled by one signal. The first relays were used in long distance telegraph circuits, repeating
the signal coming in from one circuit and re-transmitting it to another. Relays found extensive
use in telephone exchanges and early computers to perform logical operations. Refer to fig.2.13
below which shows a type of relay that can handle the high power required to directly drive an
electric motor is called a contactor. Solid-state relays control power circuits with no moving
parts, instead using a semiconductor device to perform switching. Relays with calibrated
operating characteristics and sometimes multiple operating coils are used to protect electrical
circuits from overload or faults; in modern electric power systems these functions are performed
A simple electromagnetic relay consists of a coil of wire surrounding a soft iron core, an iron
yoke, which provides a low reluctance path for magnetic flux, a movable iron armature, and a
set, or sets, of contacts; two in the relay pictured. The armature is hinged to the yoke and
mechanically linked to a moving contact or contacts. It is held in place by a spring so that when
the relay is de-energized there is an air gap in the magnetic circuit. In this condition, one of the
two sets of contacts in the relay pictured is closed, and the other set is open.
Other relays may have more or fewer sets of contacts depending on their function. The relay in
the picture also has a wire connecting the armature to the yoke. This ensures continuity of the
circuit between the moving contacts on the armature, and the circuit track on the printed circuit
board printed (PCB) via the yoke, which is soldered to the PCB.
17
Contacts
When an electric current is passed through the coil, the resulting magnetic field attracts the
armature and the consequent movement of the movable contact or contacts either makes or
breaks a connection with a fixed contact. If the set of contacts was closed when the relay was de-
energized, then the movement opens the contacts and breaks the connection, and vice versa if the
contacts were open. When the current to the coil is switched off, the armature is returned by a
force, approximately half as strong as the magnetic force, to its relaxed position. Usually this
force is provided by a spring, but gravity is also used commonly in industrial motor starters.
Most relays are manufactured to operate quickly. In a low voltage application, this is to reduce
noise. In a high voltage or high current application, this is to reduce arcing.When the coil is
energized with direct current, a diode is often placed across the coil to dissipate the energy from
the collapsing magnetic field at deactivation, which would otherwise generate a voltage spike
dangerous to circuit components. Some automotive relays already include a diode inside the
relay case. Alternatively a contact protection network, consisting of a capacitor and resistor in
series, may absorb the surge. If the coil is designed to be energized with alternating current (AC),
a small copper ring can be crimped to the end of the solenoid. This "shading ring" creates a small
out-of-phase current, which increases the minimum pull on the armature during the AC cycle.
The relay's switch connections are usually labeled COM, NC and NO:
COM = Common, always connect to this; it is the moving part of the switch.
18
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
Connect to COM and NO if you want the switched circuit to be on when the relay coil is on.
Connect to COM and NC if you want the switched circuit to be on when the relay coil is off.
2.3.6 TRANSISTOR
A bipolar junction transistor, or BJT, is a current-based valve used for controlling electronic
current. BJTs are operated in three different modes, depending on which element is common to
input and output common base, common emitter or common collector. The three modes have
different input and output impedance and different current gains, offering individual advantages to a
designer.
electronic switch in cut-off and saturation modes. In its linear region, it must be biased
appropriately (i.e., subjected to external voltages to produce a desired collector current) to establish
BJTs are commonly used in amplification and switching applications. They come in two versions:
NPN and PNP. The letters refer to the polarities, positive or negative, of the materials that make up
the transistor sandwich. For both NPNs and PNPs, the terminal with the arrowhead represents the
emitter. An NPN transistor has two n-regions (collector and emitter) separated by a p-region (base).
The terminal with the arrowhead is the emitter. A PNP transistor has two p-regions (collector and
emitter) separated by an n-region (base). The terminal with the arrowhead represents the emitter.
19
Fig.2.9 symbols of transistor (a) NPN and (b) PNP
167F877
The basic building block of PIC 16F877 is based on Harvard architecture. This microcontroller
also has many advanced features as mentioned in the previous post. Here you can see the basic
20
Fig.2.10 Internal Architecture of PIC16F877A Chip
The use of each functional block inside this controller has already been explained in the previous
post. Now let us look in to the detailed explanation about each sections inside the PIC 16F877.
The memory of a PIC 16F877 chip is divided into 3 sections. They are
1.Program memory
3.Data EEPROM
21
1. PROGRAM MEMORY
Program memory contains the programs that are written by the user. The program counter (PC)
executes these stored commands one by one. Usually PIC16F877 devices have a 13 bit wide
program counter that is capable of addressing 8K×14 bit program memory space. This memory
is primarily used for storing the programs that are written (burned) to be used by the PIC. These
devices also have 8K*14 bits of flash memory that can be electrically erasable /reprogrammed.
Each time we write a new program to the controller, we must delete the old one at that time. The
22
Program counters (PC) is used to keep the track of the program execution by holding the address
of the current instruction. The counter is automatically incremented to the next instruction during
The PIC16F87XA family has an 8-level deep x 13-bit wide hardware stack. The stack space is
not a part of either program or data space and the stack pointers are not readable or writable. In
the PIC microcontrollers, this is a special block of RAM memory used only for this purpose.
Each time the main program execution starts at address 0000 – Reset Vector. The address 0004
The data memory of PIC16F877 is separated into multiple banks which contain the general
purpose registers (GPR) and special function registers (SPR). According to the type of the
microcontroller, these banks may vary. The PIC16F877 chip only has four banks (BANK 0,
BANK 1, BANK 2, and BANK4). Each bank holds 128 bytes of addressable memory.
23
Fig.2.12 Data Memory Organization
The banked arrangement is necessary because there are only 7 bits are available in the instruction
word for the addressing of a register, which gives only 128 addresses. The selection of the banks
are determined by control bits RP1, RP0 in the STATUS registers Together the RP1, RP0 and
the specified 7 bits effectively form a 9 bit address. The first 32 locations of Banks 1 and 2, and
the first 16 locations of Banks2 and 3 are reserved for the mapping of the Special Function
Registers (SFR’s).
24
0 0 0
1 1 0
2 0 1
3 1 1
A bit of RP1 & RP0 of the STATUS register selects the bank access.
The data EEPROM and Flash program memory is readable and writable during normal operation
(over the full VDD range). This memory is not directly mapped in the register file space. Instead,
it is indirectly addressed through the Special Function Registers. There are six SFRs used to read
• EECON1
• EECON2
• EEDATA
• EEDATH
• EEADR
• EEADRH
The EEPROM data memory allows single-byte read and writes. The Flash program memory
allows single-word reads and four-word block writes. Program memory write operations
automatically perform an erase-before write on blocks of four words. A byte write in data
25
EEPROM memory automatically erases the location and writes the new data (erase-before-
write). The write time is controlled by an on-chip timer. The write/erase voltages are generated
by an on-chip charge pump, rated to operate over the voltage range of the device for byte or
word operations.
To know about the Register Memory Organization, and more of PIC 16F877 click on the link
below.
The rain sensor module is an easy tool for rain detection. It can use as a switch when raindrop
falls through the raining board and for measuring rainfall intensity. The module features, a rain
board and the control board that is separate for more convenience, power indicator LED and an
adjustable sensitivity though a potentiometer [25]. The analog output is use in detection and
measurement of raindrops. Connected to 5V power supply, the LED will turn on when induction
board has no raindrop, and DO output is high. When dropping a little amount water, DO output is
low, the switch indicator will turn on. Brush off the water droplets, and when restored to the
26
Fig 2.13 water sensor
27
CHAPTER THREE
This chapter discusses the design procedure of this project. In designing this project, the circuit
U1
7805
SW1
1 3
VI VO
GND
BAT1
C1 C2
2
12V
28
The power supply enables a 5dc supply to the circuit for entire circuit operation it is from 12Vdc
battery regulated to 5Vdc by a regulator 7805. Capacitor C1 is 2200µf with main function of
U1
7805
1 3
VI VO
GND
C1 C2
2
W ATER SENSOR
00
01
X1
10
11
16MHz
U2
13 33
OSC1/CLKIN RB0/INT
14 34
OSC2/CLKOUT RB1
35
RB2
2 36
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RA2/AN2/VREF-/CVREF RB5
5 39
RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
R3 RC0/T1OSO/T1CKI
15
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
23
RC4/SDI/SDA
1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
LED2 19
RD0/PSP0
LED1 20
RD1/PSP1
21
RD2/PSP2
R2 RD3/PSP3
22
R1 RD4/PSP4
27
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7
PIC16F877A
Voltage on any pin with respect to VSS (except VDD MCLR. and RA4)-0.3V to (VDD+ 0.3V)
29
Total power dissipation (Note 1).......................................................................1.0W
Note:
Power dissipation is calculated as follows: Pdis = VDD x {IDD- ∑IOH} + ∑{(VDD- VOH) x
IOH} + ∑(VOl x IOL)2:Voltage spikes below VSS at the MCLR pin, inducing currents greater
Thus, a series resistor of 50-100Ω should be used when applying a “low” level to the MCLR pin
30
NOTE: Stresses above those listed under “Absolute Maximum Ratings” may cause permanent
damage to the device. This is a stress rating only and functional operation of the device at those
Vcc = V3 + VIH1
5 = V3 + 4.5
V3 = 0.5V
But V3 = I3R3
From manufacturer data Maximum output current sourced by any I/O pin is 25 mA
0.5
R3 =
0.0005
R3 = 1KΩ
VOH9 = V1 +Vf1
4.5 = V1 + 2
V1 = 2.5V
From first principle all LEDs will light on with forward current from 5mA to 15mA
But If1 = I1
IOH9 = mA (chosen)
V1 = I1R1
2 .5
R1 =
0 .005
32
U1
7805
1 3
VI VO
GND
C1 C2
2
RL1
12V
U2 D1
13 33
OSC1/CLKIN RB0/INT
14 34
OSC2/CLKOUT RB1
35
RB2
2 36
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RA2/AN2/VREF-/CVREF RB5
5 39
RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT BUZ1
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10
RE2/AN7/CS RC3/SCK/SCL
18 FFUEL PUMP
23
RC4/SDI/SDA
1 24
MCLR/Vpp/THV RC5/SDO
RC6/TX/CK
25 R4
26
RC7/RX/DT
RD0/PSP0
19 Q1
20
RD1/PSP1
21
RD2/PSP2
22
RD3/PSP3
27
RD4/PSP4
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7
PIC16F877A
Transistor Q1 was chosen to be BC547 it has the below features also transistor Q2 and Q3 are
Going through data books Q1 was chosen to be BC547, it has the following characteristics.
Ft(max) = 150MHZ
Ptot(max) = 300mW
33
Vbe = 0.7V.
4.5 = V4 + 0.7
V4 = 3.8V
V4 = I4R4
3.8
R4 =
0.0038
R4 = 1KΩ
34
1
Vce3 = of Vcc
3
Vcc = 5V
Vce1 = 1.67V
Where:
Rr = Relay resistance
5 = IL1Rr1 + 1.67
3.3V = IL1Rr1
Rr1 = 3.3/0.01
Hence, the Relay JZC-20F with 6V DC, 10A-and 400Ω characteristic was chosen.
35
U1
7805
SW1
1 3
VI VO
GND
BAT1
C1 C2
2
12V
2200u 100u
X1
10
11
12V
16MHz
U2 D1
13 33
OSC1/CLKIN RB0/INT
14 34
OSC2/CLKOUT RB1
35
RB2
2 36
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RA2/AN2/VREF-/CVREF RB5
5 39
RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT BUZ1
R3 RC0/T1OSO/T1CKI
15
560 8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10
RE2/AN7/CS RC3/SCK/SCL
18 FFUEL PUMP
23
RC4/SDI/SDA
1 24
MCLR/Vpp/THV RC5/SDO
RC6/TX/CK
25 R4
26 1K
RC7/RX/DT
LED2 RD0/PSP0
19 Q1
LED1 20 BC547
RD1/PSP1
21
RD2/PSP2
R2 RD3/PSP3
22
560 R1 RD4/PSP4
27
560 28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7
PIC16F877A
Software Implementation can be divided into four parts: Power supply circuit, Microcontroller
Input and indicator circuit and Wiper motor circuit the PIC16F877A is chosen to perform the
The flow chart algorithm was drawn that is the way the program will run, with the flow chart, the
program will run step by step according to how the program developed.
36
Start
Is water in fuel?
NO
YES
End
37
3.7 SYSTEM SOFTWARE
The program was written in the MPLAB integrated development environment and debugged from
3.7.1 PROCEDURE
1. The program was written in the MPLAB integrated development environment and debugged
2. The software is used to show the results and characteristics of the output result when the
38
CHAPTER FOUR:
4.1 INTRODUCTIONS
The material for the construction includes all components as shown in fig.3.5, vero board and
lead. The components were soldered on the vero board according to the sub-circuit arrangement
as shown in fig.3.4; caution was must be taken to avoid open or short circuit between component
4.2 CONSTRUCTION
The materials used while constructing this project include, bread board, vero board, soldering
iron, soldering lead wire, sucker and flexible wires i.e. jumpers.
Vero board – is made up of a thin sheet limited insulating material manufactured with regular
spaced holes permit mounting of electronics used as a permanent board on which the circuit was
constructed.
Bread board – is a special board made for testing the circuit before mounting the component onto
a vero board for construction and soldering. The components were not soldered on the test board
but rather tighten holes conductors are used to provide easiness of connection.
Soldering iron – is the material used to heat the lead wire between the conductors and connecting
Soldering lead wire – this is the material used as means of connection between conductor and the
39
Sucker – is a material used to removed excess lead wire at the soldered joint or when removing
component i.e. to suck out the lead wire away from the terminal.
Jumpers – these wires that are used when connecting two or more terminals of the component
together.
1. Pic16F877A microcontroller
2. Buzzer
4. 20 x 20 IC socket
5. LED red
6. 7805 Regulator
7. Power switch
14 IN4148
15 Transistors BC547
Safety precaution is very important in all electronics circuit construction, hence, below are the
40
1. Try to avoid open circuit were they are not needed
2. Also, try to avoid short circuit by taking time to carry out all soldering
3. Soldering must be done with care so as to avoid dry joint which might cause open circuit
6. Wearing of goggles is very important to safe the eyes from soldering smoke
4.3 PACKAGING
The casing of the project was purchase in the market as ready made (adoptable box), though the
H
L
W
Where H = 7 cm = height
W = 15 cm = width
L = 15cm = Length
=870cm square.
=15 x 15 x7
= 1575cm cubed
Where H = 10 cm = height
W = 15 cm = width
L = 22cm = Length
=1400cm2
=22 x 15 x10
= 3300cm3
42
4.3.1 PICTORIAL VIEW
4.4 TESTING
The complete circuit was build and tested for a period of six hours and it worked according to
specifications, pulling a current of 7.5mA, 5V from the power supply. It was assembled on a
testing board and tested later constructed, permanently on copper stripped vero board and it was
found to be working, the test was repeated several times and the project was working perfectly.
After successful construction of the project, each unit was tested using appropriate tools and
2 The circuit was observed to identify any open or short circuit and partial contact.
4 The circuit was tested and working satisfactory, then it was finally and permanently
6 The permanent constructed circuit was tested and it was working according the circuit
specifications.
43
4.5 RESULTS
After the testing of the system it was found to be working satisfactorily with a minimum or no
error with very high reliability. This means that, the project meets its objectives and requirements.
44
CHAPTER FIVE
5.1 INTRODUCTION
In this chapter, the summary and achievement of the constructed project were explained inform
CONCLUSION
● The chances of water entering the fuel tank increases if the tank has a bad top fuel pump.
● Condensation of atmospheric moisture leads to accumulation of water vapor into the petrol
tank.
● Another cause can be the poorly sealed cap on top of the tank. Therefore, rains or a regular car
● It can also happen when ground water seeps into the storage tank at the filling station, thereby
making the fuel pump to circulate water all across the fuel lines and the fuel injectors.
●Hydrolock An hydrolocked engine has water inside the combustion chamber that prevents
combustion and compression. The engine will be unable to start and possible unable to crank.
●Engine Stalls The engine may be able to start and maintain itself for a while. However, the
●Engine Will Not Start .The engine may turn over while the ignition is engaged, but the lack
45
ofthe proper amount of fuel will prevent normal operation.
●Poor Fuel Economy The water will reduce engine power, but allow the same amount of fuel to
be burned. The result being the same fuel burned for reduced mileage.
● As petrol is lighter than water, when water enters the tank, it settles at the bottom of the tank.
Eventually, the tank begins to rust. ● The watered-down fuel in a car can make it sputter and
behave as if it has lost power.● Water in a gas tank can lead to bio-degradation of the fuel.
● It can also cause microbial growth in the fuel, which will damage the entire fuel system and
induce filter plugging. ● Certain other likely effects of this problem are holes in the fuel tank and
RECOMMENDATION
1. Very high profile fuel filter can be to filter any impurities especially water molecules.
2. Future development in technology can be develop to notify can user of water in fuel before
3. GSM sms can be incorporate to send sms to owner when water is detected.
46
REFERENCES
[1].Abang, J. O. (2013). Construction of Automatic Water Level Controller for Both Overhead
[2].Abdullah,U. & Ali, A. (2014). GSM Based Water level and Temperature Monitoring S
ystem. International Journal of Recent Development in Engineering and Technology, 3(2), 1–7.
[4].Chakraborty, T.; Alam, K.; Mal, S. & Biswas, U. (2014). Automatic Electronic Water Level
[6].Fisher, D. K. & Sui, R. (2013). An inexpensive open-source ultrasonic sensing system for
monitoring liquid levels. Agricultural Engineering International: CIGR Journal, 15(4), 328–334.
Nigeria
[8].Jagadal, S. B. & Halse, S. V. (2013). 8051 Microcontroller Based Multiple Water Tank
47
[9].Jatmiko, S.; Mutiara, A B. & Indriati, M. (2012). Prototype of Water Level Detection
[10].Johari, A.; Helmy, M.; Wahab, A.; Suryani, N.; Latif, A.; Ayob, M. E.& Ayob, M. A.
(2011). Tank Water Level Monitoring System using GSM Network. International Journal of
[11].Makanjuola, N.T; Shoewu, O.O; Akinyemi, D. & Ajasa, A. (2015). Design and
Development of Microcontroller Based Liquid Level Detector with. The Pacific Journal of
[12].Muktha, S. K; Jyothi, K.; Manu, E. O.; Naveen, I. P. & Herle, H. (2013). Wireless Autom
atic Water Level Control using Radio Frequency Communication . International Journal of
1324.
[13].Nnadi, D.B.N;Oti, S.E & Ezika, P. C. (2015). Radio Frequency Based Water Level Monitor
and Controller for Residential Applications. Nigerian Journal of Technology, 34(3), 573–581.
76.
[15].Parade, D.& Group, B. & Dublin, C. (2015). Low-Power Wireless Liquid Monitoring
System Using Ultrasonic Sensors. International Journal on Smart Sensing and Intelligent System,
8(1), 26–44.
[16].Patil,R. R.&Abrar, M. M. (2014). Logic gate based automatic water level controller.
48
[17].Reza, S. M. K.; Tariq,S. M.; Reza, S. M. M.; Douglas, C.; Grundfest, W. S. & Burgstone, J.
(2010). Microcontroller Based Automated Water Level Sensing and Controlling: Design and
Implementation Issue. World Congress on Engineering and Computer Science, Vols 1 and 2,
I(2010), 220–224.
[18].Teo, P. & Tiew, C. D. (2015). Automated Water Level Management System. International
[19].Uddin, M.S.M; Alam, R.M; Bansal, M; Akhter, P; Baidya, R & Kabeer, R. (2013). Design
49
APPENDIX
;April-2018
LIST P=PIC16F877A
include "p16f877a.inc"
__config 0x0842
Zs macro
btfss STATUS,Z
endm
Zc macro
btfsc STATUS,Z
ENDM
Cs macro
btfss STATUS,C
endm
Cc macro
btfsc STATUS,C
endm
bank0 macro
50
bcf STATUS,RP0
bcf STATUS,RP1
endm
bank1 macro
bsf STATUS,RP0
bcf STATUS,RP1
endm
bank2 macro
bcf STATUS,RP0
bsf STATUS,RP1
endm
bank3 macro
bsf STATUS,RP0
bsf STATUS,RP1
endm
51
#define ADC_done_flag genreg,2
cblock 0x20
genreg
genreg2
delay1
delay2
delay3
debouncetimer
subPORTA
subPORTB
subPORTC
subPORTD
subPORTE
countA
52
ADCresultL
ADCresultH
ADC_count
pulsewidthH
pulsewidthL
temp2
temp3
ADC_timer
ADC_acc
hi_count
mid_count
lo_count
none_count
endc
org 0h
goto start
org 4h
countA += 1
countA = 0
ADC_timer += 1
ADC_timer = 0
53
ADC_read_flag = 1
endif
endif
retfie
start bank0
clrf PORTA
clrf PORTB
clrf PORTC
clrf PORTD
clrf PORTE
bank1
movlw b'11110001'
movwf TRISA
movlw b'11111111'
movwf TRISB
movlw b'11111011'
movwf TRISC
movlw b'11111111'
movwf TRISD
movlw b'00001100'
movwf TRISE
bank0
subPORTA = 0
54
PORTA = 0
subPORTB = 0
PORTB = 0
subPORTC = 0
PORTC = 0
subPORTD = 0
PORTD = 0
subPORTE = 0
PORTE = 0
clrf genreg
genreg2 = 0
clrf debouncetimer
ADCresultL = 0
ADCresultH = 0
power_led = 1
call del1sec
power_led = 0
call del1sec
power_led = 1
main
if ADC_done_flag = 1 then
ADC_done_flag = 0
55
hi_led = 1
lo_led = 1
mid_led = 1
hi_count += 1
mid_led = 1
lo_led = 1
hi_led = 0
mid_count += 1
lo_led = 1
mid_led = 0
hi_led = 0
lo_count += 1
else
lo_led = 0
mid_led = 0
hi_led = 0
none_count += 1
endif
ADC_acc += 1
ADC_acc = 0
56
if hi_count >= 15 then
hi_speed_flag = 1
lo_speed_flag = 0
mid_speed_flag = 0
mid_speed_flag = 1
hi_speed_flag = 0
lo_speed_flag = 0
lo_speed_flag = 1
hi_speed_flag = 0
mid_speed_flag = 0
hi_speed_flag = 0
mid_speed_flag = 0
lo_speed_flag = 0
endif
hi_count = 0
mid_count = 0
lo_count = 0
none_count = 0
endif
endif
57
if hi_speed_flag = 1 then
pulsewidthH = 3
pulsewidthL = b'11101000'
pulsewidthH = 2
pulsewidthL = b'10111100'
pulsewidthH = 1
pulsewidthL = b'11000010'
else
pulsewidthH = 0
pulsewidthL = 0
endif
call load_pulsewidth
if ADC_read_flag = 1 then
ADC_read_flag = 0
call ADC_read
ADC_done_flag = 1
endif
goto main
58
ADC_read
bsf ADCON0,2
goto AD1
bank1
movf ADRESL,w
bank0
movwf ADCresultL
movf ADRESH,w
movwf ADCresultH
return
load_pulsewidth
temp3 = pulsewidthH
temp2 = pulsewidthL
bcf STATUS,C
rrf temp3,f
rrf temp2,f
Cs
goto calc5
bsf CCP1CON,4
goto calc6
59
rrf temp3,f
rrf temp2,f
Cs
goto calc7
bsf CCP1CON,5
goto calc8
movwf CCPR1L
return
del1sec
clrf delay2
movlw .19
movwf delay3
goto del1sec1
decfsz delay2,f
goto del1sec1
decfsz delay3,f
goto del1sec1
return
end
60