68
CONTENTS 1.INTRODUCTION 2. BLOCK DIAGRAM 3. BLOCK DIAGRAM DESCRIPTION A) PIC Microcontroller B) LCD Display C) Relay Driver D) Relay E) Float Sensor F) DC Motor Pump G) Power Supply 4.PROGRAMMING CODE 5. ADVANTAGE AND APPLICATIONS 6.CONCLUSION 7.BIBLIGRAPHY

waterlevel

Embed Size (px)

Citation preview

Page 1: waterlevel

CONTENTS

1. INTRODUCTION

2. BLOCK DIAGRAM

3. BLOCK DIAGRAM DESCRIPTION

A) PIC Microcontroller

B) LCD Display

C) Relay Driver

D) Relay

E) Float Sensor

F) DC Motor Pump

G) Power Supply

4. PROGRAMMING CODE

5. ADVANTAGE AND APPLICATIONS

6. CONCLUSION

7. BIBLIGRAPHY

Page 2: waterlevel

INTRODUCTION

Page 3: waterlevel

INTRODUCTION:

The aim of the project is to construct the

microcontroller based automatic water level ctrl.The project consists of a transparent

process tank, in which we will be maintaining the required water level. One float

sensor is mounted in the process tank to view the level of water. The setup has a

reservoir with pump to fill the process tank. The pump is controlled by

microcontroller. The ON/OFF control is implemented, which means when the water

level reaches the maximum level then the pump will be turned OFF & when the water

level goes lower than the minimum level then the pump will be turned ON. The user

can set their required level using keypad and the level is displayed in the LCD

display.

For sensing the water level float sensor is used. The first rod carries +5V

supply and passes to the water. That supply is passed to the movable floating arm.

Depending upon the level float sensor output voltage gets varied. These signals are

applied to the PIC microcontroller, to sense the water level. The internal adc process

the input voltage and display the waterlevel on the display. The output port line of

Micro controller has to be connected to drive the relay. The relay is used to control

the supply voltage of the pump. So the user has to write the controlling program to

sense the level and control the pump. The low signal becomes logic 1, when the

liquid reaches low level. The HI signal becomes logic 1, when the liquid reaches the

high level. When logic 1 is set on CTRL line, then the pump will be ON.

The basic firmware for the microcontroller is written in ‘C’ language and

cross-complied using C Cross complier. The cross compiler generates the

machine code for the microcontroller and the machine code is stored in flash memory

of micro controller.

Page 4: waterlevel

EMBEDDED

SYSTEMS

Page 5: waterlevel

EMBEDDED SYSTEMS:

An embedded system is a special-purpose computer system, which is completely encapsulated by the device it controls. An embedded system has specific requirements and performs pre-defined tasks, unlike a general-purpose personal computer.

An embedded system is a programmed hardware device. A programmable hardware chip is the 'raw material' and it is programmed with particular applications. This is to be understood in comparison to older systems with full functional hardware or systems with general purpose hardware and externally loaded software. Embedded systems are a combination of hardware and software which facilitates mass production and variety of application

A combination of computer hardware and software, and perhaps additional mechanical or other parts, designed to perform a dedicated function.

In some cases, embedded systems are part of a larger system or product, as in the case of an antilock braking system in a car.

EMBEDDED SYSTEM is a combination of SOFTWARE and HARDWARE.

An Embedded system is a system, in which software is embedded into hardware.

These are the controllers, processors, arrays or other hardware using dedicated (embedded) logic or programming (code) called “firmware” or a “microkernel”

Embedded systems are designed around a µC which integrates Memory &

PeripheralsBLOCK DIAGRAMBLOCK

DIAGRAM:MICROCONT

Page 6: waterlevel

ROLLER PIC: PIC stands for Peripheral

Interface Controller as coined by Microchip Technology Inc., USA. PIC FEATURES:PIC is a very popular Micro controller worldwide.

Microchip is the first Manufacturer of 8 pin RISC MCU.

Microchip is the world’s second largest chip Manufacturer.

Focus on high performance cost-effective, field-programmable embedded

control solutions.

Variety of end-user Application-Specific Standard Products (ASSP) and

Application-Specific Integrated Circuits (ASIC)

Global network of manufacturing and customer support facilities.

Only 35 single-word instructions to learn.

All single-cycle instructions except for program branches, which are two-

cycle.

Operating speed: DC – 20 MHz clock input DC – 200 ns instruction cycle.

Up to 8K x 14 words of Flash Program Memory, Up to 368 x 8 bytes of Data

Memory (RAM), Up to 256 x 8 bytes of EEPROM Data Memory.

Peripheral Features:

• Timer0: 8-bit timer/counter with 8-bit prescaler.

• Timer1: 16-bit timer/counter with prescaler can be incremented during

Sleep via external crystal/clock.

• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and

Postscaler.

• Two Capture, Compare, PWM modules

- Capture is 16-bit, max. Resolution is 12.5 ns

- Compare is 16-bit, max. Resolution is 200 ns

- PWM max. Resolution is 10-bit

• Synchronous Serial Port (SSP) with SPI™ (Master mode) and I2C™ (Master/Slave)

• Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI)

with 9-bit address detection.

Page 7: waterlevel

• Parallel Slave Port (PSP) – 8 bits wide with external RD, WR and CS controls

(40/44-pin only)

• Brown-out detection circuitry for Brown-out Reset (BOR)

Analog Features:

• 10-bit, up to 8-channel Analog-to-Digital Converter (A/D)

• Brown-out Reset (BOR)

• Analog Comparator module with:

- Two analog comparators

- Programmable on-chip voltage reference (VREF) module

- Programmable input multiplexing from device inputs and internal

Voltage reference.

- Comparator outputs are externally accessible.

Special PIC Features:

• 100,000 erase/write cycle Enhanced Flash program memory typical

• 1,000,000 erase/write cycle Data EEPROM memory typical

• Data EEPROM Retention > 40 years

• Self-reprogram able under software control.

• In-Circuit Serial Programming™ (ICSP™) via two pins.

• Single-supply 5V In-Circuit Serial Programming.

• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation.

• Programmable code protection.

• Power saving Sleep mode.

• Selectable oscillator options.

• In-Circuit Debug (ICD) via two pins.

Single Word Instructions:

Single Word Instruction opcodes are 14-bits wide making it possible to have

all single word instructions. A 14-bit wide program memory access bus fetches a 14-

bit instruction in a single cycle. With single word instructions, the number of words of

program memory locations equals the number of instructions for device. This means

that all locations are valid instructions. Typically in the Von-Neumann architecture,

Page 8: waterlevel

most instructions are multi-byte. In general, a device with 4-Kbytes of program

memory would allow approximately 2K of instructions. This 2:1 ratio is generalized

and dependent on the application code. Since each instruction may take multiple

bytes, there is no assurance that each location is a valid instruction.

Instruction Pipeline:

The instruction pipeline is a two-stage pipeline, which overlaps the fetch and

execution of instructions. While the execution of one instruction is in progress, it

fetches the next instructions to be executed.

Single Cycle Instructions:

With the Program Memory bus being 14-bits wide, the entire instruction is

fetched in a single machine cycle (Tcy). The instruction contains all the information

required and is executed in a single cycle. There may be a one-cycle delay in

execution if the result of the instruction modified the contents of the Program

Counter. This requires the pipeline to be flushed and a new instruction to be fetched.

Reduced Instruction Set:

When an instruction set is well designed and highly orthogonal (symmetric),

fewer instructions are required to perform all needed tasks. With fewer instructions,

the whole set can be more rapidly learned and programmed.

Orthogonal (Symmetric) Instructions:

Orthogonal instructions make it possible to carry out any operation on any

register using any addressing mode. This symmetrical nature and lack of “special

instructions” make programming simple yet efficient.

In addition, the learning curve is reduced significantly. The mid-range instruction set

uses only two non-register oriented instructions, which are used for two of the cores

features. One is the SLEEP instruction, which places the device into the lowest power

use mode. The other is the CLRWDT instruction, which verifies the chip is operating

properly by preventing the on-chip Watchdog Timer (WDT) from overflowing and

resetting the device.

CMOS Technology:

Page 9: waterlevel

• Low-power, high-speed Flash/EEPROM technology

• Fully static design

• Wide operating voltage range (2.0V to 5.5V)

• Commercial and Industrial temperature ranges

• Low-power consumption

Page 10: waterlevel

PIN DIAGRAM:

Page 11: waterlevel

DEVICE OVERVIEW:

PIC16F873A/876A devices are available only in 28-pin packages, while

PIC16F874A/877A devices are available in 40-pin and 44-pin packages. All devices

in the PIC16F87XA family share common architecture with the following differences:

• The PIC16F873A and PIC16F874A have one-half of the total on-chip

Memory of the PIC16F876A and PIC16F877A.

• The 28-pin devices have three I/O ports, while the 40/44-pin devices have

Five ports.

• The 28-pin devices have fourteen interrupts, while the 40/44-pin devices

have fifteen.

• The 28-pin devices have five A/D input channels, while the 40/44-pin

devices have eight.

• The Parallel Slave Port is implemented only on the 40/44-pin devices.

RESET:

The PIC16F87XA differentiates between various kinds of Reset

• Power-on Reset (POR)

• MCLR Reset

• WDT Reset

• Brown-out Reset (BOR)

Power-on Reset (POR):

A Power-on Reset pulse is generated on-chip when VDD rise is detected (in the range

of 1.2V-1.7V). To take advantage of the POR, tie the MCLR pin to VDD through an

RC network.

When the device starts normal operation (exits the Reset

condition), device-operating parameters (voltage, frequency, temperature, etc.) must

be met to ensure operation. If these conditions are not met, the device must be held in

Reset until the operating conditions are met.

Brown-out Reset:

Brown-out Reset may be used to meet the start-up conditions. If VDD falls

below VBOR (about 4V) for longer than TBOR the brown-out situation will reset the

Page 12: waterlevel

device. If VDD falls below VBOR for less than TBOR, a Reset may not occur. Once

the brown-out occurs, the device will remain in Brown-out Reset until VDD rises

above VBOR. The Power-up Timer then keeps the device in Reset for about 72 mS.

MCLR:

PIC16F87XA devices have a noise filter in the MCLR Reset path. The filter

will detect and ignore small pulses. It should be noted that a WDT Reset does not

drive MCLR pin low.

Voltages applied to the pin that exceed its specification can result in

both Resets and current consumption outside of device specification during the Reset

event. For this reason, Microchip recommends that the MCLR pin longer be tied

directly to VDD.

Watchdog Timer (WDT):

The Watchdog Timer is a free running, on-chip RC oscillator, which does not

require any external components. This RC oscillator is separate from the RC oscillator

of the OSC1/CLKI pin. That means that the WDT will run even if the clock on the

OSC1/CLKI and OSC2/CLKO pins of the device has been stopped, for example, by

execution of a SLEEP instruction. During normal operation, a WDT time-out

generates a device Reset (Watchdog Timer Reset). If the device is in Sleep mode, a

WDT time-out causes the device to wake-up and continue with normal operation

(Watchdog Timer Wake-up).

In-Circuit Debugger:

This function allows simple debugging functions when used with MPLAB®

ICD. When the micro controller has this feature enabled, some of the resources are

not available for general use.

To use the in-circuit debugger function of the micro controller, the design must

implement In-Circuit Serial Programming connections to MCLR/VPP, VDD, GND,

RB7 and RB6. This will interface to the in-circuit debugger module available from

Microchip or one of the third party development tool companies.

Page 13: waterlevel

LCD

Page 14: waterlevel

LCD

Standard HD44780 LCDs are useful for creating standalone projects.

16 characters wide, 2 rows White text on blue background Connection port is 0.1" pitch, single row for easy bread boarding and

wiring Pins are documented on the back of the LCD to assist in wiring it up Single LED backlight included can be dimmed easily with a resistor or

PWM and uses much less power than LCD with EL (electroluminescent) backlights

Can be fully controlled with only 6 digital lines! (Any analog/digital pins can be used)

Built in character set supports most English/European/Japanese text, see the HD44780 datasheet for the full character set

Up to 8 extra characters can be created for custom glyphs or 'foreign' language support

Page 15: waterlevel

A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers.

  

1.   Command/Instruction Register- stores the command instructions given to the

LCD. A command is an instruction given to LCD to do a predefined task like

initializing, clearing the screen, setting the cursor position, controlling display etc.

 2.    Data Register- stores the data to be displayed on the LCD. The data is the ASCII

value of the character to be displayed on the LCD.

 

Commonly used LCD Command codes:

Hex Code Command to LCD Instruction Register

1 Clear screen display

2 Return home

4 Decrement cursor

6 Increment cursor

E Display ON, cursor blinking

80 Force the cursor to the beginning of the 1st line

C0 Force cursor to the beginning of the 2nd line

38 Use 2 lines and 5x7 matrix

 

 

 

 

 

 

 

  

Pin configuration:

Page 16: waterlevel

Pin Symbol Description  

1 VSS Ground 0 V

2 VCC Main power supply +5 V

3 VEE Power supply to control contrast

Contrast adjustment by providing a variable resistor through VCC

4 RS Register Select 

RS=0 to select Command RegisterRS=1 to select Data Register

5 R/W Read/write 

R/W=0 to write to the registerR/W=1 to read from the register

6 EN Enable A high to low pulse (minimum 450ns wide) is given when data is sent to data pins

7 DB0

To display letters or numbers, their ASCII codes are sent to data pins (with RS=1). Also instruction command codes are sent to these pins.

8 DB1  

9 DB2  

10 DB3              8-bit data pins

11 DB4  

12 DB5  

13 DB6  

14 DB7  

15 Led+ Backlight VCC +5 V

16 Led- Backlight Ground 0 V

Programming the LCD:

Page 17: waterlevel

Data pin8 (DB7) of the LCD is busy flag and is read when R/W = 1 & RS = 0.

When busy flag=1, it means that LCD is not ready to accept data since it is busy

with the internal operations. Therefore before passing any data to LCD, its

command register should be read and busy flag should be checked.

To send data on the LCD, data is first written to the data pins with R/W = 0 (to

specify the write operation) and RS = 1 (to select the data register). A high to low

pulse is given at EN pin when data is sent. Each write operation is performed on

the positive edge of the Enable signal.

To send a command on the LCD, a particular command is first specified to the

data pins with R/W = 0 (to specify the write operation) and RS = 0 (to select the

command register). A high to low pulse is given at EN pin when data is sent.

  

Displaying single character ‘A’ on LCD:

The LCD is interfaced with microcontroller (AT89C55WD). This microcontroller has

40 pins with four 8-bit ports (P0, P1, P2, and P3). Here P1 is used as output port which

is connected to data pins of the LCD. The control pins (pin 4-6) are controlled by pins

2-4 of P0 port. Pin 3 is connected to a preset of 10k? to adjust the contrast on LCD

screen. This program uses the above concepts of interfacing the LCD with controller

by displaying the character ‘A’ on it.

Page 18: waterlevel

KEY PAD

KEYPAD:

Page 19: waterlevel

These demonstrate how to read a HEX keypad, these are a standard device

with 16 keys connected in a 4x4 matrix, giving the characters 0-9 and A-F. You can

also use a 4x3 keypad, which gives the numbers 0-9, * and #.

This is how the HEX keypad is connected, each square

with a number or letter in it is a push to make switch, which

connects the horizontal wires (rows) with the vertical wires

(columns). So if you press button 'A' it will connect COL1

with ROW4, or pressing button '6' will connect COL3 with

ROW2. For a numeric (4x3) keypad COL4 will be missing,

and 'A' and 'B' replaced with '*' and '#' but is otherwise the

same. The sample programs use a lookup table for the keys,

this would need to be changed to insert the correct values

for the non-numeric characters.

As the switches are all interconnected, we need a way to differentiate between the

different ones - the four resistors on the interface board pull lines COL1 to COL4

high, these four lines are the ones which are read in the program. So in the absence of

any switch been pressed these lines will all read high. The four ROW connections are

connected to output pins, and if these are set high the switches will effectively do

nothing - connecting a high level to a high level, results in a high level.

In order to detect a switch we need to take the ROW lines low, so if we take all the

ROW lines low - what happens?. Assuming we press button 1, this joins COL1 with

ROW1, as ROW1 is now at a low level, this will pull COL1 down resulting in a low

reading on COL1. Unfortunately if we press button 4, this joins COL1 with ROW2, as

ROW2 is at a low level this also results in a low reading at COL1. This would only

give us four possible choices, where each four buttons in a COL do exactly the same

(e.g. 1, 4, 7, and A are the same).

The way round this is to only switch one ROW at a time low, so assuming we set

ROW1 low we can then read just the top row of buttons, button 1 will take COL1

low, button2 will take COL2 low, and the same for buttons '3' and 'F' in COL3 and

COL4. The twelve lower buttons won't have any effect as their respective ROW lines

are still high. So to read the other buttons we need to take their respective ROW lines

Page 20: waterlevel

low, taking ROW2 low will allow us to read the second row of buttons (4, 5, 6, and

E), again as the other three ROW lines are now high the other 12 buttons have no

effect. We can then repeat this for the last two ROW's using ROW3 and ROW4, so

we read four buttons at a time, taking a total of four readings to read the entire keypad

- this is a common technique for reading keyboards, and is called 'Keyboard

Scanning'.

One obvious problem is what happens if you press more than one key at a time,

there are a number of ways to deal with this, one way would be to check for multiple

key presses and ignore them, a simpler way (and that used in the examples) is to

accept the first key you find which is pressed. We will find that various commercial

products deal with this situation in similar ways, some reject multiple key presses, and

some just accept the first one.

Page 21: waterlevel

RELAY

Page 22: waterlevel

A relay is an electrical switch that opens and closes

under control of another electrical circuit. In the original form, the switch is operated

by an electromagnet to open or close one or many sets of contacts. It was invented by

Joseph Henry in 1835. Because a relay is able to control an output circuit of higher

power than the input circuit, it can be considered, in a broad sense, to be a form of

electrical amplifier.

These contacts can be either Normally Open (NO), Normally Closed (NC), or change-

over contacts.

•Normally-open contacts connect the circuit when the

relay is activated; the circuit is disconnected when the relay is inactive. It is also

called Form A contact or "make" contact. Form A contact is ideal for applications that

require to switch a high-current power source from a remote device.

•Normally-closed contacts disconnect the circuit

when the relay is activated; the circuit is connected when the relay is inactive. It is

also called Form B contact or "break" contact. Form B contact is ideal for applications

that require the circuit to remain closed until the relay is activated.

•Change-over contacts control two circuits: one

normally-open contact and one normally-closed contact. It is also called Form C

contact.

Page 23: waterlevel

OPERATION:

When a current flows through the coil, the resulting

magnetic field attracts an armature that is mechanically linked to a moving contact.

The movement either makes or breaks a connection with a fixed contact. When the

current is switched off, the armature is usually returned by a spring to its resting

position. Latching relays exist that require operation of a second coil to reset the

contact position.

By analogy with the functions of the original

electromagnetic device, a solid-state relay operates a thyristor or other solid-state

switching device with a transformer or light-emitting diode to trigger it.

TYPES OF RELAY:

Small relay as used in electronics

A solid state relay, which has no moving parts

• A latching relay is mechanically arranged so that the

armature can rest in either of two positions. There are two coils that pull the armature

in opposite directions, so the relay can be switched to one position or the other and

then left in that state indefinitely. This type of relay has the advantage that it

consumes power only for an instant, while it is being switched, and it retains its last

setting across a power outage. Some common relays may be wired to electrically

latch, which offers no power saving but does ensure that the relay returns to a known

state during and after a power outage.

• A reed relay has two, usually normally open,

contacts inside a vacuum or inert gas filled glass tube. This protects the contacts

against atmospheric corrosion. The two contacts are closed by magnetism from a coil

around the glass tube, or a permanent magnet moved towards it. See also: reed switch.

• A mercury wetted relay is a form of reed relay in

which the contacts are wetted with mercury. Such relays are used to switch low-

voltage signals (one volt or less), or for high-speed counting and timing applications

where the mercury eliminated contact bounce. Mercury wetted relays are position-

sensitive and must be mounted vertically to work properly. Because of the toxicity

and expense of liquid mercury, these relays are rarely specified for new equipment.

See also mercury switch.

Page 24: waterlevel

• A machine tool relay is a type standardized for

industrial control of machine tools, transfer machines, and other seqential control.

They are characterized by a large number of contacts (sometimes extendable in the

field) which are easily converted from normally-open to normally-closed status, easily

replaceable coils, and a form factor that allows compactly installing many relays in a

control panel. Although such relays once were the backbone of automation in such

industries as automobile assembly, the programmable logic controller mostly

displaced the machine tool relay from sequential control applications.

• A contactor is a very heavy-duty relay used for

switching electric motors and lighting loads. Such devices are often used for motor

starters, and may be built up with overload protection devices attached. The overload

sensing devices are a form of heat operated relay where a coil heats a bi-metal strip to

open contacts, or where a solder pot melts, releasing a spring to operate contacts.

• A Buchholz relay is a safety device sensing the

accumulation of gas in large oil-filled transformers, which will alarm on slow

accumulation of gas or shut down the transformer if gas is produced rapidly in the

transformer oil.

• A Solid State Relay (SSR) is a solid state

electronic component that provides a similar function to an electromechanical relay

but does not have any moving components, increasing long-term reliability.

APPLICATIONS:

Relays are used:

• to control a high-voltage circuit with a low-

voltage signal, as in some types of modems,

• to control a high-current circuit with a low-

current signal, as in the starter solenoid of an automobile,

• to detect and isolate faults on transmission and

distribution lines by opening and closing circuit breakers (protection relays),

• to isolate the controlling circuit from the

controlled circuit when the two are at different potentials, for example when

controlling a mains-powered device from a low-voltage switch. The latter is often

applied to control office lighting as the low voltage wires are easily installed in

Page 25: waterlevel

partitions, which may be often moved as needs change. They may also be controlled

by room occupancy detectors in an effort to conserve energy,

• to perform logic functions. For example, the

boolean AND function is realised by connecting relay contacts in series, the OR

function by connecting contacts in parallel. Due to the failure modes of a relay

compared with a semiconductor, they are widely used in safety critical logic, such as

the control panels of radioactive waste handling machinery.

• as oscillators, also called vibrators. The coil is

wired in series with the normally-closed contacts. When a current is passed through

the relay coil, the relay operates and opens the contacts that carry the supply current.

This stops the current and causes the contacts to close again. The cycle repeats

continuously, causing the relay to open and close rapidly. Vibrators are used to

generate pulsed current.

• to generate sound. A vibrator, described above,

creates a buzzing sound because of the rapid oscillation of the armature. This is the

basis of the electric bell, which consists of a vibrator with a hammer attached to the

armature so it can repeatedly strike a bell.

• to perform time delay functions. Relays can be

used to act as an mechanical time delay device by controling the release time by using

the effect of residual magnetism by means of a inserting copper disk between the

armature and moving blade assembly.

Page 26: waterlevel

RELAYDRIVER ULN2003

Page 27: waterlevel

RELAY DRIVER ULN2003:

The ULN2003 is a monolithic high voltage and high

current Darlington transistor arrays. It consists of seven NPN darlington pairs that

features high-voltage outputs with common-cathode clamp diode for switching

inductive loads. High voltage and high current darlington transistor array

description .The collector-current rating of a single darlington pair is 500mA. The

darlington pairs may be paralleled for higher current capability. Applications include

relay drivers, hammer drivers, lamp drivers, display drivers(LED gas discharge),line

drivers, and logic buffers. The ULN2003 has a 2.7kW series base resistor for each

darling ton pair for operation directly with TTL or 5V CMOS

Ideally suited for interfacing between low-level logic circuitry and multiple

peripheral power loads, the Series ULN20xxA/L high-voltage,high-current Darlington

arrays feature continuous load current ratings to 500 mA for each of the seven drivers.

At an appropriate duty cycle depending on ambient temperature and number of

drivers turned ON simultaneously, typical power loads totaling over 230 W (350 mA

x 7, 95 V) can be controlled. Typical loads include relays, solenoids, stepping motors,

magnetic print hammers, multiplexed LED and incandescent displays, and heaters.

All devices feature open-collector outputs with integral clamp diodes. The

ULN2003A/L and ULN2023A/L have series input resistors selected for operation

directly with 5 V TTL or CMOS. These devices will handle numerous interface needs

— particularly those beyond the capabilities of standard logic buffers.The

ULN2004A/L and ULN2024A/L have series input resistors for operation directly

from 6 to 15 V CMOS or PMOS logic outputs.

The ULN2003A/L and ULN2004A/L are the standard

Darlington arrays. The outputs are capable of sinking 500 mA and will withstand at

least 50 V in the OFF state. Outputs may be paralleled for higher load current

capability. The ULN2023A/L and ULN2024A/L will withstand 95 V in the OFF state.

These Darlington arrays are furnished in 16-pin dual in-line plastic packages (suffix

“A”) and 16-lead surface-mountable SOICs (suffix “L”). All devices are pinned with

outputs opposite inputs to facilitate ease of circuit board layout. All devices are rated

for operation over the temperature range of -20°C to +85°C. Most (see matrix, next

page) are also available for operation to -40°C; to order, change the prefix from

“ULN

Page 28: waterlevel

FEATURES:

_ TTL, DTL, PMOS, or CMOS-Compatible Inputs

_ Output Current to 500 mA

_ Output Voltage to 95 V

_ Transient-Protected Outputs

_ Dual In-Line Plastic Package or Small-Outline IC Package

Page 29: waterlevel

FLOAT SENSOR

Page 30: waterlevel

FLOAT SENSOR

FEATURES:

· Ability to activate and control switching up to nine switching points.

· Hermetically sealed.

· Ability to work under very hot and cold temperatures as normal

operation.

· Ability to withstand very toxic chemical atmosphere without any material

degradation.

· Dynamically tested contacts.

· Reliable switching.

· Designed to handle high shock environments.

· Millions of reliable switching operations.

Applications:

· Water level monitoring systems

· Ability to monitor any liquid level particularly when multiple point monitoring is

required

Page 31: waterlevel

DC MOTOR PUMP

Page 32: waterlevel

ROLLING PUMP:

At OKENSEIKO, we call the diaphragm-driven compact pumps with a generic name of rolling pumps. The rolling pumps include three types of products including air pumps, vacuum pumps and liquid pumps. Each of these types includes a versatile line of pumps.

Air pumps / Vacuum pumps / Liquid pumps

Mechanism of rolling pump:

Each pump contains multiple diaphragm-driven cylinders to minimize the pulsation and implement a pump featuring a silent operation, long life and high discharge pressure.This mechanism is a result of OKENSEIKO's unique design and development technology.

The rolling pump mechanism is simple and easy to implement using multiple cylinders per motor .This is the reason that our rolling pumps feature space saving and high flow .In addition, this structure also reduces the motor torque variation and thereby minimizes pulsation.

Page 33: waterlevel

Line of rolling pump products:

Features: Compact size / Compact size and light weight. The most compact product is

as thin as 8 mm and weighs only 10 grams (5cc/min). Low nois / Silent pumps with minimum noise of 40 dB. Low discharge pulsation / the multi-cylinder design help maintain the

pressure constant. Self-priming capability / Suction is possible without restriction of the pump

installation position with respect to the liquid level. High discharge pressure / Max. 120 kPa. Wide storage temperatures / Normal operation are possible under

temperatures from -30 to +80 .℃ ℃ Long life / More than 3000 hours (actual achievement).

Page 34: waterlevel
Page 35: waterlevel

POWER SUPPLY

POWER SUPPLY:

Most of the electronic equipments and devices require a DC source for their

operation. We can get this DC power from storage batteries. But they are costly and

require frequent maintenance and replacement. The easily available power is AC.

There are circuits which can easily convert the AC into DC. Such electronic circuit is

called as power supply. A typical DC power supply consists of five stages.

BLOCK DIAGRAM OF POWER SUPPLY

Page 36: waterlevel

BLOCK DIAGRAM DESCRIPTIONS:

Figure gives the block diagram of power supply. This block diagram consists of the following blocks:

AC INPUT

TRANSFORMER

RECTIFIER

FILTER

VOLTAGE REGULATOR

VOLTAGE DIVIDER

DC OUTPUT

AC INPUT:

This block is used to give the ac supply to the transformer. Here we use the

available main AC power.

TRANSFORMER:

Its job is either to step up or (mostly) step down the AC supply voltage to suit

the requirement of the solid state electronic devices and circuits fed by the DC power

supply. It also covers isolation from the supply line an important safety consideration.

RECTIFIER:

RECTIFIERTRANSFORMERAC I/P

VOLTAGE DIVIDER

FILTER

VOLTAGE DIVIDER DC O/P

Page 37: waterlevel

It is a circuit in which employs one or more diodes to convert AC voltage

into pulsating DC voltage.

FILTER:

The function of this circuit element is to remove the fluctuations or pulsation

(called ripples) present in the output voltage supplied by the rectifier. Of course, no

filter can, in practice, give an output voltage as ripple-free as that of a DC battery but

it approaches it so closely that the power supply performs as well.

VOLTAGE REGULATOR:

Its main function is to keep the terminal voltage of the DC supply constant

even when

AC input voltage to the transformer varies (deviations from 220V are

common); or

The load varies

Usually, zener diodes and transistors are used for voltage regulation purposes.

Again, it is impossible to get 100% constant voltage but minor variations are

acceptable for most of the jobs.

VOLTAGE DIVIDER:

Its function is to provide different DC voltages needed by different

electronic circuits. It consists of a number of resistors connected in series across the

output terminals of the voltage regulator. Obviously, it eliminates the necessity of

providing separate DC power supplies to different electronic circuits working on

different DC levels.

DC OUTPUT:

The required DC output voltage is obtained from this block.

TRANSFORMER:

WORKING PRINCIPLE OF TRANSFORMER:

Page 38: waterlevel

The transformer works on the principle of faradays law of electro magnetic

inductions. A transformer in its simplest form.

The core is built up of thin laminations insulated from each other in order to

reduce eddy current loss in the more. The winding are unguarded from each other

and also from the care. The winding connected to the load is called the secondary

winding for samplings they are shown on the opposite side of core but in practice

they are distributed owner broth sides of the cores. The high voltage winding

encloses the low voltage.

Let us say that transformer has N1 turns in its primary winding and N2 turns

in its secondary winding. The primary winding is connected to a sinusoidal

voltage of magnitude V1 at a frequency FH2. A working flux is set up in

magnetic core. The working flux is alternating and sinunsocial as the applied

voltage is alternating and sinusoidal. When these flux link the primary and the

secondary winding emf are induced in them. The emf induced in this is called the

self-induced emf and that induced in the secondary is the mutually induced emf.

These voltages will have sinusoidal waveform and the same frequency as that of

the applied voltage. The currents, which flow in the close primary and secondary

circuits, are respectively I1 and I2.

RESISTOR:

A resistor is an electric component. It has a known value of resistance. It is

especially designed to introduce a desired amount of resistance in a circuit. A resistor

is used either to control the flow of current or to produce a voltage drop. It is the most

commonly used component in electrical and electronic circuits.

TYPES OF RESISTOR:

1. Carbon resistor

2. Metal oxide resistor

3. Metal film resistor

4. Wire wound resistor

5. Variable resistor-carbon resistor

CAPACITOR:

Page 39: waterlevel

Capacitor is an electrical device used for storing electrical energy. The stored

electrical energy is the form of a current in to the circuits which the capacitor form a

part. Capacitor is one of the important components used in Radio, TV and other

electronic circuits.

TYPES OF CAPACITOR:

1. Paper Capacitor

2. Mica Capacitor

3. Ceramic Capacitor

4. Electrolytic Capacitor

5. Variable Capacitor

VOLTAGE REGULATOR:

A voltage regulator is an electronic circuit that provides a stable DC voltage

independent of the load current, temperature and AC line voltage variations.

Although Voltage regulators can be designed using op-amps it is quicker and easier to

use IC voltage regulator. The IC voltage regulators are inscribe and inexpensive and

are available with features such as programmable, output, current voltage, boosting

and floating operation for high voltage application.

7805 VOLTAGE REGULATOR:

3

1

Un regu- Regulated

-lated O/p voltage

I/P voltage

2

Voltage Regulator IN OUT

GND

Page 40: waterlevel

78XX series are three terminal positive fixed voltage regulators. There are seven

output voltage option available such as 5,6,8,12,15,18 and 24V in 78XX the two

number (XX) indicate the output voltage.

In 7805 the output voltage is 5 volts

The connection of a 7805-voltage regulator is show infix. The AC line

voltage is stepped down a cross each half of the center tapped transformers. If full

wane rectifier and capacitors filter then provides an unregulated DC voltage with AC

ripple of a few volts as a input to the voltage regulator. The 7805 of IC provides an

output of +5 Volt D.C.

BRIDGE RECTIFIER:

OPERATION BRIDGE RECTIFIER

During positive half cycle of input signal, anode of diode 1 becomes positive

and at the some time due anode of diode D2 becomes negative. Hence D1 conducts

and D2 does not conduct. The load currier flow through D1 and the voltage drop

across RL will be equal to the in put voltage.

During the negative half cycle of the input the anode of D1 becomes negative

and the anode of D2 becomes positive. Hence D1 does not conduct and D2 conducts.

The load current flow through D2 and the voltage drop across RC will be equal to the

input voltage.

The maximum efficiency of a full wane rectifier is 81.2% and ripple factor is

0.48 peak inverses voltage for full ware rectifies is 2VM because the entire secondary

voltage appears across the non-conducting diode.

Page 41: waterlevel

CIRCUIT

DIAGRAM

CIRCUIT DIAGRAM:

Page 42: waterlevel
Page 43: waterlevel

PROGRAMMING

CODE

#include<pic.h>

#include<string.h>

__CONFIG(3F31H);

static bit rl @ ((unsigned)& PORTD*8+4);

Page 44: waterlevel

static bit dw @ ((unsigned)& PORTD*8+1);

static bit up @ ((unsigned)& PORTD*8+2);

static bit set @ ((unsigned)& PORTD*8+3);

static bit RS @ ((unsigned)& PORTD*8+7); // Register select

static bit EN @ ((unsigned)& PORTD*8+6); // Enable

static bit ss;

unsigned char dr[16];

unsigned int I,u,ik,ik1,v,high,low,mask,d,t1,t2,t3;

unsigned int adcl,adch,adc,l,t4,temp1,temp,ts2,ch,chc;

unsigned char num[10]={"0123456789"};

void write1(int dat,int op)

{

PORTB=dat;

RS=op;

EN=1;

EN=0;

for(i=0;i<500;i++);

}

void init(void)

{

write1(0x01,0);//clear LCD & memory cursor is placed in

home position

write1(0x3c,0);//data length=8bit no of rows 2 5*10 matrix

write1(0x0e,0);//screen is ON cursor is ON cursor no blink

write1(0x14,0);//Cursor shift right

Page 45: waterlevel

}

void tep(void)//lm35 display

{

write1(0x87,0);

write1(num[t1],1);

write1(num[t2],1);

write1(num[t3],1);

write1(' ',1);

// write1(num[t4],1);

write1('%',1);

}

void display1(int xx)//initial display

{

write1(0x80,0);

if(xx==0)

strcpy(dr,"LEVEL :");

RS=1;

for(l=0;l<=8;l++)

{

PORTB=dr[l];

EN=1;

EN=0;

for(i=0;i<1000;i++);

}

write1(0xc0,0);

Page 46: waterlevel

if(xx==0)

strcpy(dr,"SET lev :");

RS=1;

for(l=0;l<=8;l++)

{

PORTB=dr[l];

EN=1;

EN=0;

for(i=0;i<1000;i++);

}}

void main(void)//main function

{

u=0x40;ss=0;rl=0;

TRISB=0x00;

TRISD=0x0F;

init();

ADCON0=0x05;

ADCON1=0x8f;

TRISA=0x0f;

display1(0);

for(;;)

{

ADGO=1;

while(ADGO)

continue;

Page 47: waterlevel

adcl=ADRESL;

adch=ADRESH<<8;

adc=adch+adcl;

t1=adc/0x03E8; temp=adc%0x03e8;

t2=temp/0x0064; temp1=temp%0x0064;

t3=temp1/0x000a;

t4=temp1%0x000a;

if(up==0)

{

while(up==0);

u++;

low=u&0x0f;

high=u&0xf0;

high=high>>4;

write1(0xcB,0);

write1(num[low],1);

write1(0xcA,0);

write1(num[high],1);

write1(0xce,0);

write1('C',1);

mask=u&0x0f;

if(mask==0x09)

u+=0x06;

}

if(dw==0)

Page 48: waterlevel

{

while(dw==0);

u--;

low=u&0x0f;

high=u&0xf0;

high=high>>4;

write1(0xcb,0);

write1(num[low],1);

write1(0xca,0);

write1(num[high],1);

write1(0xce,0);

write1('C',1);

mask=u&0x0f;

if(mask==0x00)

u-=0x06;

}

if(set==0)

{

while(set==0);

d=u;

low=d&0x0f;

high=d&0xf0; high=high>>4;

write1(0xcb,0);

write1(num[low],1);

write1(0xca,0);

Page 49: waterlevel

write1(num[high],1);

write1(0xce,0);

write1('%',1);

//mask=d&0x0f;

//if(mask==0x00)

//u-=0x06;

ss=1;

rl=1;

}

if(ss==1)

{

ch=(t2<<8)+t3; chc=(high<<8)+low;

if(ch>=chc)//40

rl=0;

if(ch<=(chc/2))

rl=1;

}

tep();

}

}

MERITS:

1. AVOID WATER WASTAGE.

2. AVOID ELECTRICITY WASTAGE.

3. REDUCE MANPOWER

Page 50: waterlevel

REFERENCE:

“INTRODUCTION TO EMBEDDED C”- N.MATHIVANNAN

“BASIC OF EMBEDDED SYSTEM”- KENNTHAYALA.

WWW.ALLDATASHEET.COM

WWW.FIGRO.COM

WWW.SUNROM.COM