Chapter-1 Preamble: Page - 1
Chapter-1 Preamble: Page - 1
PREAMBLE
1.1 Introduction:
Optimum pH for fish or shrimps ranges from 6.5 to 8.5. The growth
was poor in fish kept at pH 4.0-6.0 or 9.0-11.0. Investigations of the effect of
pH on shrimp larvae have shown that an abrupt fall (from 8.2 to 7.0 within
six hours) resulted in mass mortality. Various factors influence the pH of
Page | 1
rearing water, but it remains an important indicator of water quality for fish
or shrimp culture. The success of aquaculture may depend on maintenance of
a stable pH in culture ponds. The toxicity of certain heavy metals, gases and
other chemicals is dependent on pH. Ammonia ionization is dependent upon
pH. The toxicity of ammonia is due to the free, un-ionized form NH3
whereas the ionized form (NH4) is of low toxicity to aquatic animals.
Page | 2
indicators of dynamic processes occurring in the pond. Most of the water
quality problems can be solved with careful monitoring and data collection.
Thus, if large quantities of water suitable for aquaculture were available,
monitoring would not be as critical and high production levels can be
targeted.
Page | 3
Chapter-2
SYSTEM OVERVIEW
2.1 SYSTEM BLOCK DIAGRAM
The data from the different sensors are monitored by Lab VIEW. The
LabVIEW stands for Laboratory Virtual Instrumentation Engineering
Workbench. It is commonly used for data acquisition, instrument control,
and industrial automation on a variety of platforms including Microsoft
Windows, various flavors of UNIX, Linux, and Mac OS X.
Page | 4
The code files have the extension .vi, which is an abbreviation
for Virtual Instrument. LabVIEW offers lots of additional Add-Ons and
Toolkits. It provides comprehensive tools that you need to build any
measurement or control application in dramatically less time, LabVIEW
is the ideal development environment for innovation, discovery, and
accelerated results. A brief discussion of the sensors is presented in this
chapter. The detailed explanation is presented in chapter 3.
2.1 pH MEASUREMENT
In the forming of aquatic organisms pH is one of the most important
parameter. pH is the negative log of the activity of the hydrogen ion in an
aqueous solution. Primary pH standard values are determined using
a concentration cell with transference, by measuring the potential difference
between a hydrogen electrode and a standard electrode such as the silver
chloride electrode. Measurement of pH for aqueous solutions can be done
with a glass electrode .
E = E0 - 2.3RT nf log ai
Page | 5
T = absolute temperature (in Kelvin)
The entire term "2.3RT/nF" is called the Nernst factor, or slope factor.
This term provides the amount of change in total potential for every ten-fold
change in ion concentration. For hydrogen ion activity, where n = 1, the
Nernst factor is 59.16 mV for every ten-fold change in activity at 25C. This
means that for every pH unit change, the total potential will change 59.16
mV.
E = E0 + (1.98 x 10-4) TK
Page | 7
adjustments. Easy interfacing to microprocessors is provided by the latched
and decoded multiplexer address inputs and latched TTL TRI-STATE
outputs.
Page | 8
for beginners and starters. The board includes utilizes the Atmel 8051 based
microcontroller with 8k of In-System Flash Memory, power supply and
crystals oscillator are in place for the microcontroller.
An 8051 Evaluation Board is a General Purpose board with 8051 core
based a micro-controller and a programme to download the hex code into the
memory of the microcontroller. 8051 development board a single board
computer or SBC generally has lots of program memory and resources of
microcontroller, data memory, programme memory so user can test and run
simple and complex programmes into it. 8051 development board or SBC
has so many options for user and student to develop their applications for
number of input and output devices like keyboards, seven segment display,
LCD display, serial or parallel port like available in computer.
Page | 9
Chapter-3
DEVELOPMENT BOARDS
Page | 10
3.1.1 NI Elvis II Series Prototyping Board
Page | 11
NI Elvis mx Instrument Launcher
The NI Elvis mx Instrument Launcher opens automatically when a NI ELVIS
is connected to a system that has NI Elvis mx installed. You also can find the
Instrument Launcher in the Windows Start menu at:
From the Instrument Launcher, you can choose from 12 different software
instruments developed through the power of LabVIEW. By accessing the
tabs at the bottom of the Instrument Launcher, you can learn about featured
instruments and other resources.
Page | 12
Figure 3.3 - Instrument Launcher (Expanded View)
Page | 13
Digital Multi-meter (DMM
The NI Elvis mx digital multimeter (DMM) controls the basic DMM
capabilities of the NI ELVIS. It can perform voltage (DC and AC), current
(DC and AC), resistance, diode test, and audible continuity measurements.
This commonly used instrument can perform the following types of
measurements
Page | 14
Figure 3.4: digital multimeter
Digital Reader
The NI Elvis mx digital reader (DigIn) reads digital data from the digital
lines on the NI ELVIS. The digital reader can read either four or eight of the
digital lines at a time. This instrument reads digital data from the NI ELVIS
II Series digital lines. You can read eight consecutive lines at a time: 0..7,
8..15, 16..23 either continuously or you can take a single reading.
Digital Writer
The NI Elvis mx digital writer (Dig Out) writes digital data to the digital
lines on the NI ELVIS. The digital writer can write to either four or eight of
the digital lines at a time. This instrument updates the NI ELVIS II Series
digital lines with user-specified digital patterns. You can manually create a
pattern or select predefined patterns, such as ramp, toggle, or walking 1s.
This instrument can control eight consecutive lines and either continually
output a pattern or just perform a single write.
Page | 15
Function Generator (FGEN)
This instrument generates standard waveforms with options for the type of
output waveform (sine, square, or triangle), amplitude selection, and
frequency settings. In addition, the instrument offers DC offset setting,
frequency sweep capabilities, and amplitude and frequency modulation. You
can route the FGEN to the prototyping board or to the FGEN/TRIG BNC
connector on the left side of the workstation.
Oscilloscope (Scope)
This instrument provides the functionality of the standard desktop
oscilloscope found in typical undergraduate laboratories. The NI ELVIS mx
Oscilloscope SFP has two channels and provides scaling and position
adjustment knobs along with a modifiable time base. You can also choose
trigger source and mode settings. The auto scale feature allows you to adjust
the voltage display scale based on the peak-to-peak voltage of the AC signal
Page | 16
for the best display of the signal. You can choose between digital or analog
hardware triggering. You can connect to the NI ELVIS II Series Oscilloscope
from the BNC connectors on the side panel of the workstation. The
computer-based scope display has the ability to use cursors for accurate
screen measurements.
Page | 17
3.1.4 Using NI-DAQmx with NI ELVIS II Series
NI ELVIS II Series is supported by NI-DAQmx, and therefore you can program it using
the NI-DAQmx API. Furthermore, some general AI, AO, and timing functionality of
the device is available through the workstation and you can program it using NI-
DAQmx
Open the LabVIEW program, in the Block Diagram select functions, express
input then select the DAQ Assistant icon.
Page | 18
The DAQ system has following parts
The parts are:
Physical input/output signals
DAQ device/hardware
Driver software
your software application (Application software)
DAQ device/hardware:
DAQ hardware acts as the interface between the computer and the outside world. It
primarily functions as a device that digitizes incoming analog signals so that the
computer can interpret them
Page | 19
Figure 3.8: Select Analog I/O or Digital I/0 depending on our requirement.
Driver software
Driver software is the layer of software for easily communicating with the hardware.
It forms the middle layer between the application software and the hardware. Driver
software also prevents a programmer from having to do register-level programming or
complicated commands in order to access the hardware functions.
The DAQ Assistant, included with NI-DAQmx, is a graphical, interactive guide for
configuring, testing, and acquiring measurement data. With a single click, you can even
generate code based on your configuration, making it easier and faster to develop
complex operations. Because DAQ Assistant is completely menu-driven, you will make
fewer programming errors and drastically decrease the time from setting up your DAQ
system to taking your first measurement.
Page | 20
Figure 3.9: Data acquisition in lab view
Page | 21
3.2 8051 Development board
A Microcontroller is a programmable digital processor with necessary peripherals.
Both microcontrollers and microprocessors are complex sequential digital circuits meant
to carry out job according to the program / instructions. Sometimes analog input/output
interface makes a part of microcontroller circuit of mixed mode (both analog and digital
nature).A microcontroller can be compared to a Swiss knife with multiple functions
incorporated in the same IC.
Learn 8051 Programming and Code with 8051 Development the quick and easy
way, with this easy to use 8051 Educational or 8051 Training Board. The 8051
development educational board uses 8051 core Atmel Microcontroller with 8k of In-
System Flash Memory that can be programmed with the given software and re
programmed very easily with the using given burner software.
8051 development board is the most important device in the field of embedded
software development for any electronics or embedded engineer. The 8051 development
board is the first step and starting point for any student who wants to learn the embedded
systems programming and technology. 8051 board, also called as 8051 evaluation board
or 8051 development board is an essential device for experiments and testing of 8051
based applications and programmes.
Atmel 8051 core is common terms used for explaining 89C51, 89S51, 89S52 and
89V51RD2 microcontrollers. 8051 development board as student or learner can develop
programmes with any of 8051 40 or 20 pin microcontrollers. The RS232 serial port driver
on board allows easy connection with PC or other embedded hardware. The board have
so many buttons and status LEDs. AC and DC power supply adapters.
Page | 22
3.2.1 MAIN FEATURES:
Main features of 8051 Basic Development Evaluation Board:
1. Power supply : 12V AC or DC input 5V regulated output and 12VDC
unregulated output
2. Microcontroller : 89V51RD2 or any 89C family 40 pin chip
3. Analog input : 8channel analog input using ADC0809
4. Interface : 1. 4 x 4 hexadecimal keyboard
2. RS 232 serial interface
5. Peripherals : 1. EEPROM using 24C02
2. RTC using Ds1307
6. Display : 1. 16 X 2 LCD display
2. Multiplexed four common anode seven segment displays.
3. Eight Led indication for checking the port operation
7. Output drives : 1.1channel relay drive
2. 8channel uln2803 drive that can be used to drive stepper
motor or 8 relays
Page | 23
Fig. 3.10 8051 Pin Diagram
In 40 pin AT89V51RD2, there are four ports designated as P 1, P2, P3 and P0. All
these ports are 8-bit bi-directional ports, i.e., they can be used as both input and output
ports. Except P0 which needs external pull-ups, rest of the ports have internal pull-ups.
When 1s are written to these port pins, they are pulled high by the internal pull-ups and
can be used as inputs. These ports are also bit addressable and so their bits can also be
accessed individually.
Port P0 and P2 are also used to provide low byte and high byte addresses,
respectively, when connected to an external memory. Port 3 has multiplexed pins for
special functions like serial communication, hardware interrupts, timer inputs and
read/write operation from external memory. AT89V51RD2 has an inbuilt UART for serial
communication. It can be programmed to operate at different baud rates. Including
two timers & hardware interrupts, it has a total of six interrupts.
3.2.3 BASIC 8051 ARCHITECTURE:
Various features of 8051 microcontroller are given as follows.
8-bit CPU
16-bit Program
Counter
Page | 24
8-bit Stack Pointer
Page | 25
interface ) , S PI and CAN bus controllers, MP3 decoders and hardware PWM.
Chapter-4
SYSTEM DESCRIPTION
Page | 26
4.1.1.1 Combinational pH electrode
In most process sensors, the electrodes and the temperature element are combined into a
single body. Such sensors are often called combination electrodes.
The cell voltage is the algebraic sum of the potentials of the measuring electrode, the
reference electrode, and the liquid junction. The potential of the measuring electrode
depends only on the pH of the solution. The potential of the reference electrode is
unaffected by pH, so it provides a stable reference voltage. The liquid junction potential
depends in a complex way on the identity and concentration of the ions in the sample. It
is always present, but if the sensor is properly designed, the liquid junction potential is
usually small and relatively constant. All three potentials depend on temperature.
Page | 27
The circuit consists of four probes arranged in an overhead tank and are interfaced
with ADC. The positive terminal of sensor is given to channel-0 and negative terminal is
connected to ground. From the figure the output of ADC is given to port-0 of the
microcontroller. The probes are arranged in such a way that they sense th, 1/2, th and
even full levels as they are placed with equal spacing one above the other with the bottom
positive probe.
A wire connected to VCC and four other wires are dipped in tank at different
levels namely quarter, half, three-fourth, full and their output are given to analog to
digital convertor. It is also possible to add alarm system to the circuit which is capable of
alerting intimates, whenever water levels are high or low or exceeds limits.
Page | 28
Figure 4.4: resistance type level sensor
Resistive chain level sensors are similar to magnetic float level sensors in that a
permanent magnet sealed inside a float moves up and down a stem in which closely
spaced switches and resistors are sealed. When the switches are closed, the resistance is
summed and converted to current or voltage signals that are proportional to the level of
the liquid.
The choice of float and stem materials depends on the liquid in terms of chemical
compatibility as well as specific gravity and other factors that affect buoyancy. These
sensors work well for liquid level measurements in marine, chemical processing,
pharmaceuticals, food processing, waste treatment, and other applications. With the
proper choice of two floats, resistive chain level sensors can also be used to monitor for
the presence of an interface between two immiscible liquids whose specific gravities are
more than 0.6, but differ by as little as 0.1 unit.
Page | 29
Fig: 4.5 Ultrasonic Principle
As the distance to an object is determined by measuring the time of flight and not
by the intensity of the sound, ultrasonic sensors are excellent at suppressing background
interference.
Virtually all materials which reflect sound can be detected, regardless of their
color. Even transparent materials or thin foils represent no problem for an ultrasonic
sensor. Micro sonic ultrasonic sensors are suitable for target distances from 20 mm to 10
m and as they measure the time of flight they can ascertain a measurement with pinpoint
accuracy. Some of our sensors can even resolve the signal to an accuracy of 0.025 mm.
Page | 30
Fig: 4.6 HC-SR04 ultrasonic ranging module
The supporting circuits fabricated on the module makes it almost stand alone and
what the programmer need to do is to send a trigger signal to it for initiating transmission
and receive the echo signal from it for distance calculation. The HR-SR04 has four pins
namely Vcc, Trigger, Echo, GND and they are explained in detail below.
Page | 31
found in a wide variety of industries-- not limited to-- manufacturing, food and beverage,
chemical and pharmaceutical, marine, medical, and fuel/energy management.
The block represents the interfacing of temperature sensor with adc. The temperature
sensor consist of three terminals such as 5v supply terminal, output and ground terminals.
The output terminal is given to channel-1 and ground terminal is given to ground pin of
ADC. The digital data D0-D7 in ADC are given to port-0 of the microcontroller.
Page | 32
required to subtract a large constant voltage from the output to obtain convenient
Centigrade scaling.
4.1.3.2 FEATURES:
Operates from 4 V to 30 V
4.1.3.3 LM35outputvoltage
The output of the LM 35 is 10 mV (0.01 volts) per degree Celsius. This means at
20C we will get 20x0.01=200mV, or 0.2volts. At 100C we will get 100x0.01= 1.0 volts.
At 50C we will get 50 x 0.01 = 0.5v. To be able to use the output voltage, we have to
feed it into an analogue input on the training board and then write a program to convert
the voltage back into a temperature figure to be displayed on the LCD.
Page | 33
Figure4.8: LM 35 temperature sensor
Page | 34
4.2 INTERFACING OF MICROCONTROLLER BOARD TO Elvis BOARD
p
8051 Microcontroller ELVIS board
Page | 35
Figure 4.9: transmission of data from microcontroller to ELVIS Board
The sensor data is converted into digital form using analog to digital converter
(ADC0808). The converted digital data is given to 8051 microcontroller through port
0.Then the data from 8051 microcontroller is send to ELVIS Board through port 1. The
data from port1 is connected to ELVIS Board digital input/output pins (example d0 to d7
(or) d8 to d15 (or) d16 to d24). Data from digital pins read thorough digital reader in NI
Instrument launcher. The NI ELVISmx digital reader (DigIn) reads digital data from the
digital lines on the NI ELVIS. The digital reader can read either four or eight of the
digital lines at a time.
This instrument reads digital data from the NI ELVIS II Series digital lines. You can read
eight consecutive lines at a time: 0...7, 8...15, 16...23 either continuously or you can take
a single reading. After checking the data using the digital reader, give the data to main
program through DAQ.
CHAPTER 5
SOFTWARES
Page | 36
5.1 Lab VIEW Introduction
The latest version of LabVIEW is version LabVIEW 2011. The code files have
the extension .vi, which is an abbreviation for Virtual Instrument. LabVIEW
offers lots of additional Add-Ons and Toolkits. It provides comprehensive tools that
you need to build any measurement or control application in dramatically less time,
LabVIEW is the ideal development environment for innovation, discovery, and
accelerated results.
Page | 37
LabVIEW ties the creation of user interfaces (called front panels) into the
development cycle. LabVIEW programs/subroutines are called virtual instruments (VIs).
Each VI has three components: a block diagram, a front panel, and a connector panel. The
last is used to represent the VI in the block diagrams of other, calling VIs. Controls and
indicators on the front panel allow an operator to input data into or extract data from a
running virtual instrument. However, the front panel can also serve as a programmatic
interface. Thus a virtual instrument can either be run as a program, with the front panel
serving as a user interface, or, when dropped as a node onto the block diagram, the front
panel defines the inputs and outputs for the given node through the connector pane. This
implies each VI can be easily tested before being embedded as a subroutine into a larger
program.
Page | 38
5.1.3 Front Panel
When you have created a new VI or selected an existing VI, the Front Panel and
the Block Diagram for that specific VI will appear.
In LabVIEW, you build a user interface, or front panel, with controls and
indicators. Controls are knobs, push buttons, dials, and other input devices. Indicators
are graphs, LEDs, and other displays.
You build the front panel with controls and indicators, which are the interactive
input and output terminals of the VI, respectively. Controls are knobs, push buttons,
dials, and other input devices. Indicators are graphs, LEDs, and other displays. Controls
simulate instrument input devices and supply data to the block diagram of the VI.
Indicators simulate instrument output devices and display data the block diagram
acquires or generates.
5.1.4 Block Diagram
After you build the user interface, you add code using VIs and structures to
control the front panel objects. The block diagram contains this code. In some ways, the
block diagram resembles a flowchart.
Page | 39
Figure 5.2: Block diagram
After you build the front panel, you add code using graphical representations of
functions to control the front panel objects. The block diagram contains this graphical
source code. Front panel objects appear as terminals, on the block diagram. Block
diagram objects include terminals, subVIs, functions, constants, structures, and wires,
which transfer data among other block diagram objects.
This chapter explains the basic concepts of Loops and Structures in LabVIEW.
The topics are as follows:
For Loop
While Loop
Case Structure
Sequence Structure
The different Loops and Structures available are located in the Structures sub palette in
the Functions palette on the Block Diagram.
Page | 40
Figure 5.3: loops and structures
5.1.6 Loops
For Loop
A For Loop executes a sub diagram a set number of times. The Figure below shows an
empty For Loop in LabVIEW.
A For loop executes its sub diagram n times, where n is the value wired to the
Page | 41
count ( ) terminal. The iteration ( ) terminal provides the current loop iteration count,
which ranges from 0 to n-1.After you create a For Loop, you can use shift registers to
pass values from one iteration to the next. If you wire an array to a For Loop, you can
read and process every element in that array by enabling auto-indexing. You also can
enable auto-indexing by configuring a For Loop to return an array of every value
generated by the loop.
You can add a conditional terminal to configure a For Loop to stop when a
Boolean condition or an error occurs. A For Loop with a conditional terminal executes
until the condition occurs or until all iterations complete, whichever happens first. To add
a conditional terminal to a For Loop, right-click the For Loop border and select
Conditional Terminal from the shortcut menu. You must wire the conditional terminal
and either wire the count terminal or auto-index an input array for the loop to execute
and for the VI to run. To convert a For Loop to a While Loop, right-click the For Loop
and select replace with While Loop from the shortcut menu.
While Loop
A While loop repeats the sub diagram inside it until the conditional terminal, an
input terminal, receives a particular Boolean value. The Boolean value depends on the
continuation behavior of the While Loop. Right-click the conditional terminal and select
Stopif True or Continue if True from the shortcut menu.
You also can wire an error cluster to the conditional terminal, right-click the
terminal, and select Stop on Error or Continue while Error from the shortcut menu. The
While Loop always executes at least once. Below we see an empty While loop:
Page | 42
Figure 5.5: while loop
After you create a While Loop, you can use shift registers to pass values from
one iteration to the next. If you wire an array to a While Loop, you can read and process
every element in that array by enabling auto-indexing.
In order to convert a While Loop into a For Loop, right-click the While Loop
and select Replace with For Loop from the shortcut menu. To convert a While
Loop into a Timed Loop, right-click the While Loop and select Replace with Timed
Loop from the shortcut menu.
5.1.7 Structures
Case Structure
The Case Structure has one or more sub diagrams, or cases, exactly one of which
executes when the structure executes. The value wired to the selector terminal
determines which case to execute and can be Boolean, string, integer, or enumerated
type. You may right-click the structure border to add or delete cases. Below we see an
empty Case structure:
Page | 43
5.1.8 ARRAYS
An array can either resemble a vector or a matrix. As does a vector and a matrix,
an array groups similar pieces of data. An array consists of two different components, the
elements (pieces of data) and the dimension (the size of the array). Arrays may contain
numeric, Boolean, path, string, waveform, and cluster data types. They may be used as
an indicator (output) or a control (input) and they are advantageous to use when you are
dealing with similar pieces of data and/or repetitive computations, which means that they
are ideal for storing waveform data and data from loop iterations with each array element
being the loop iteration value.
Some of the functions used in project explained below Depending on the type of array
you want to create, different methods in creating the array must be taken.
Page | 44
Create an input or output array
This function builds a new array. It takes value from Boolean array to number and
constructs an array. The output of Boolean array to number function is given to element
in the Build array function. The output of build array function i.e., appended array is
given to an array. To select the build array function follow the below steps
Page | 45
Index array
When you wire an array to this function, the function resizes automatically to
display index inputs for each dimension in the array you wire to n-dimension array. You
also can add additional element or subarray terminals by resizing the function. The
connector pane displays the default data types for this polymorphic function. To select the
index array function follow the below steps
Page | 46
These are the steps to follow to write data into excel sheet:
1. Add the Write To Measurement File Express VI to the block diagram. Notice that
the File Name text box in the Configure Write To Measurement File dialog box
displays the full path to the output file.
2. In the File Format section, select the format for the file to which you want to write
data.
3. In the Segment Headers section, select the header option for the file.
4. Configure the X Value Columns section if you selected Text (LVM) in the File
Format section and you plan to view the data in a spreadsheet or text editor, or if you
selected Binary (TDMS) or Binary with XML Header (TDM) in the File
Format section and you plan to use the Express VI to save single-point data.
5. Configure the remaining sections in the Configure Write To Measurement
File dialog box and click the OK button to save the configuration and close the dialog
box.
6. Add the Simulate Signal Express VI to the block diagram and configure the
VI.
Page | 47
Figure 5.12: configure to Write To Measurement File
7. Wire the output of the Simulate Signal Express VI to the Signals input of the Write
to Measurement File Express VI.
8. Run the VI. The VI writes the data from the Simulate Signal Express VI to the file
specified in the File Name section of the Configure Write to Measurement File dialog
box.
9. To view the data you saved, open the output file with a spreadsheet or word
processing application.
Page | 48
5.1.10 Creating program and data acquiring using Lab VIEW:
Using above all functions we created a Lab VIEW Program for automation of
aquaculture monitoring. Data from 8051 microcontroller board is send to ELVIS board
from this ELVIS board through the DAQ take data into program. These are the steps to
monitor date from Lab VIEW.
Step 1: design the program for aquaculture monitoring using Lab VIEW according to
requirement.
Step 2: Acquire the data from ELVIS board using DAQ and make connections to Lab
VIEW and DAQ.
Step 3: For every 2 minutes it takes data from the DAQ .Due to the case structure
arrangement it shows different parameters.
Step 4: It stores the data automatically in excel sheet using the function Write TO
Measurement file.
Page | 49
Step 5: From the stored data we can create the graphs and analyze the data for present
and future purpose.
5.2.1 Introduction
51 Develop Tools are designed to solve the complex problems facing embedded software
When starting a new project, simply select the microcontroller you use from the
Device Database and the Vision IDE sets all compiler, assembler, linker, and
memory options for you.
Numerous example programs are included to help you get started with the most
popular embedded 8051 devices.
The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN,
UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM
Modules) of your 8051 device. Simulation helps you understand hardware
configurations and avoids time wasted on setup problems. Additionally, with
simulation, you can write and Here is simple guide to start working with Keil
uVision
which can be used for
Writing programs in C/C++ or Assembly language
Compiling and Assembling Programs
Page | 50
Debugging program
Creating Hex and Axf file
Testing your program without Available real Hardware (Simulator Mode)
5.2.2 HOW TO USE KEIL
These are the simple steps to debug in keil:
Step 1: After opening Keil uV4, go to Project tab and Create new Vision project
Step 3: So now your project is created and Message window will appear to add
Startup file of your device, click on Yes so it will be added to your project
folder.
Step 4: Now go to File and create new file and save it with .C extension if you will
write program in C language or save with .asm for assembly language.
Step 6: After that on left you see project window [if its not there.go to view tab and
click on project window].Now come on Project window. Right click on target and click
on options for target. Here you can change your device also. On Target tab select
use on-chip ROM and give Xtal frequency of 11.0592 MHz. Click output tab here
& check create Hex file if you want to generate hex file. Now click on OK so it will
save changes.
Page | 51
Step 7: Now Expand target and you will see source group, Right click on group and
click on Add files to source group. Now add your program file which you have written
in C/ assembly. You can see program file added under source group.
Step 8: Now Click on Build target. You can find it under Project tab or in toolbar. It
can also be done by pressing F7 key.
Step 9: you can see Status of your program in Build output window [If its not there
go to view and click on Build output window]
Finally you have decided to write your own code for the 8051 microcontroller.
It doesn't matter whether you have chosen Assembly or C Language for yourself but what
matters now is that you need an environment specially designed for 8051. Basically you
are looking out for IDE (Integrated Development Environment) that will help you build
and compile programs. While there are many options out there, I prefer KEIL uVision in
this regard.
Page | 52
5.3 FLASH MAGIC
Page | 53
Software-selectable modes of reduced activity and an 8 bit clock pre scalar can
further control power consumption.
The rich functionality and efficiency of Atmel 8051 Flash ISP microcontrollers
make them ideal for applications that need A/D conversion, pulse width modulation, high
speed I/O and counting capabilities such as industrial control, consumer goods, alarms,
motor control, and more.
Page | 54
Step7: Click on Start, now a dialogue box Reset Device will be opened.
Step8: Reset the device. Now the program is dumped into the Micro controller.
CHAPTER 6
RESULTS
The sensor data is converted into digital form using analog to digital converter
(ADC0808). The converted digital data is given to 8051 microcontroller through port
0.Then the data from 8051 microcontroller is send to ELVIS Board through port 1. The
data from port1 is connected to ELVIS Board digital input/output pins (example d0 to d7
(or) d8 to d15 (or) d16 to d24). Data from digital pins read thorough digital reader in NI
Instrument launcher. The NI Elvis mx digital reader (DigIn) reads digital data from the
digital lines on the NI ELVIS.
Page | 55
Figure 6.1: Interfacing of 8051 with ELVIS Board
The level in the pond is sensed by the resistance type level sensor then the sensed
analog data is given to analog to digital converter. ADC 0808 converts analog data
from sensor into digital form and it is given to 8051 microcontroller. In the first 30
seconds the data from controller is given to ELVIS Board .the data from the ELVIS
Page | 56
Board is send to the program through DAQ according to given time period i.e. in
first 30 seconds. Based on the program it measures the level and displays in the
front panel and also indicates in graph. The measured data is stored in excel sheet
using Write TO Measurement file Function.
Page | 57
Based on the program it measures the pH and displays in the front panel and it also
indicates in graph. The measured data is stored in excel sheet using Write TO
Measurement file Function.
The temperature in the pond is sensed by the LM35 sensor then it is given to
ADC. ADC 0808 converts analog data from sensor into digital form and it is given
to 8051 microcontroller. In the next 30 seconds the data from controller is given to
ELVIS Board .the data from the ELVIS Board is send to the program through DAQ
according to given time period i.e. in first 30 seconds. Based on the program it
Page | 58
measures the temperature and displays in the front panel and it also indicates in
graph. The measured data is stored in excel sheet using Write TO Measurement file
Function.
CONCLUSION
The system provides with several benefits and can operate with less manpower.it
maintains level of the pond automatically using level sensors and it also maintains water
quality parameters like pH, temperature and ammonia. It will increases the overall growth
of the shrimps or fishes in the pond. The continuous monitoring of this parameters leads
to gradually decrease the impacts caused by the water quality parameters.
Page | 59
FUTURE SCOPE
The current system is designed for monitoring and control of one pond. Same
method can be extended for monitoring and control of multiple ponds. The proposed
system makes use of wired communication from microcontroller board. It could be
improved by wireless communication methods like Bluetooth, Zigbee or RF
communication. Also the current system uses NI ELVIS II board for interfacing with PC.
It could be replaced with a simple DAQ card with a wireless receiver. Currently the
Page | 60
system makes use of monitoring and control action from microcontroller board. This can
be extended to monitoring and control also through Labview based PC for simpler
systems.
Bibliography
1. www.google.com
2. The 8051 Microcontroller by Ayala.
Page | 61
3. The 8051 microcontroller and embedded systems by Muhammad Ali Mazidi
4. www.food and agriculture organization.com
Page | 62