Você está na página 1de 45

CHAPTER ONE

INTRODUCTION
1.1

Background

A data logger (also called data recorder) is an electronic device that records data over time or
in relation to location either with a built-in instrument sensor or via external instruments and
sensors. Data loggers are based on a digital data processing using computers. They generally are
small, battery powered, portable devices equipped with a microprocessor, internal memory for
data storage, and sensors. Some data loggers interface with a personal computer and utilize
software to activate the data logger, to view and analyze collected data, while others have local
interface devices (keypad, liquid crystal display (LCD), etc) and can be used as stand-alone
devices.

Data loggers vary between general purpose types for a range of measurement applications to
very specific devices for measurement in one environment or application type only. It is common
for general purpose types to be programmable; however, many remain as static machines with
only a limited number or no changeable parameters. Electronic dataloggers have replaced chart
recorders in most applications.

One of the primary benefits of using data loggers is the ability to automatically collate data on a
24-hour basis. Upon activation, data loggers are typically deployed and left unattended to
measure and record information for the duration of the monitoring period. This allows for
comprehensive, accurate picture of the environmental conditions being monitored, such as air
temperature and relative humidity.

The cost of data loggers has been declining over the years as technology improves and costs are
reduced. Data loggers are nowadays based on the microcontroller technology. Most of them are
usually portable battery-operated devices with internal storage and some incorporate sensors to
1

measure physical quantities such as temperature, pressure, voltage, current, power in watt,
humidity, liquid flow, displacement, frequency, and so on.

Data loggers can be divided into two basic groups: standalone data loggers and computer
interface data loggers.

1.2

Standalone Data Loggers

This type of data loggers can be used on their own, without requiring other devices for data
collection and storage. Standalone data loggers have large internal non-volatile memory. They
may also have real time clock chips. The collected data can be saved in the memory with time
stamping. The data collected in a standalone data logger is usually analysed offline. A standalone
data logger is usually configured and then left at the required site to collect data. At the end of
the data collection period the device is connected to a PC and the collected data is read and
analysed with the PC. Some standalone data loggers are dedicated for specific measurements, for
example temperature, pressure, etc. data loggers.

The Thermo Recorder TR-5 Series [spencer (2010)] is a typical standalone temperature data
logger. This data logger has LCD output, and it can take up to 16,000 readings with time
intervals from one second to one hour and the battery life is quoted as four years.

One of the disadvantages of standalone data loggers is that the devices should be checked at
regular intervals to make sure that the memory is not full, or the battery is not flat. This may
sometimes cause problems since the device may be located at a remote location or at a place not
easily reachable.

1.3

Computer Interfaced Data Loggers

Computer Interfaced data loggers are used only to capture the data. These devices do not have
large internal memories and are normally connected to a PC. The captured data are then stored in
a PC for storage or for analysis. The data can either be analysed offline or online. One of the
disadvantages of interfaced data loggers is that the devices cannot be used on their own as
another device (e.g. a PC) is required to store the captured data. The Pico Technology is a typical
interface data logger that is connected to a PC to transfer the captured data. The device has built
in sensors for light, sound and temperature measurements. Some interface data loggers have
wireless capabilities. Usually a transmitter- receiver pair is used: the transmitter captures the data
and sends it to the receiving device using wireless communication. The receiving device usually
has large internal memory and stores the received data.

1.4

Research problem

Preventive measure rather total repair of equipment breakdown is a key feature in present day
engineering. There is therefore need for performance monitoring via data logging so as to know
when systems/equipment are efficient or failing.

1.5

General Objectives

The aim of this project is to eliminate problems associated with sudden break down of power
generating plant via routine and real-time data logging of the systems performance. It does this
by taking samples of three electrical parameters; Voltage, Current, and Frequency, and storing
the data for analysis and evaluation.

1.6

Scope

This project takes and log samples of Voltage, Current, and Frequency on a PC. Its core is based
on a microcontroller. It can also be used as a standalone data logger depending on the settings.
3

1.7 Justifications
As power engineering trends changes issues become more important, engineers need to have data
to argue their case. Whether you believe in operational changes or not, its only by systematic
collecting hard data that we will enable one to figure out how the operational process is
changing. The key to this is a versatile data logger. Having a platform like this will facilitate the
step towards understanding some great operational performances. Thus the need for a more
robust way for fault finding and performance monitor.

1.8 Limitations
This project focuses on sampling voltage, current, and frequency at specific voltage, current,
noise level, and stress. It does not provide extensive guidance on different sampling designs for
making inferences about larger magnitude of voltages and current that exceeds 500 Volt 30Amp.
Another factor that is worthy of consideration is the documentation and archiving of data in a
format that is readily accessible. The project tends to monitor electrical characteristics alone and
not mechanical stress related issue thus making the data logging system not complete because
mechanical faults may also breakdown the power generating plant so a need to incorporate this
in further research.

1.9 Organization of Chapters


Chapter 1 describes the background of the temperature data logger and temperature measurement
significance. Aim and objectives that provides direction for this project were stated.
Chapter 2 covers the literature review. The data loggers evolution, types of temperature loggers
review as well.
Chapter 3 presents the methodology of the project. The hardware used and implementation were
also included.

Chapter 4 covers the testing result of the three input data logger module developed and result.
In Chapter 5 conclusion, recommendation and contribution to knowledge are presented.

CHAPTER TWO
LITERATURE REVIEW
Saha et al (1986) design a Low Cost Multi Channel Data Logger. Development of a low-cost
multi-channel (eight to twenty two channels) data logger can easily be made and easily be used
to convert the analog signal of physical parameters of various tests. Interfacing these signals
using ADC with the parallel port of a computer satisfies the very goal of data communication.
The user friendless and reliability in using PC and channel selector multiplexers further add to
the versatility of the Data logger. Design and implementation of such equipment cost only at
US$300, makes it very inexpensive comparative to other commercially available data loggers.

Dedrick et al (1990) Microprocessor-Based Data Logging System. Which The PIC 16C73A, 8bit, microcontroller (Microchip Technology, Inc) is well suited for an inexpensive data logger.
Segregating host communications functions into the reader: (1) reduces the number of
components and complexity of the logger thus reducing the cost of each logger, (2) allows the
data logger to operate at the lower power.

In 1990, M.Moghavvemi represented a paper on Simple Low Cost Data Acquisition System for
Remote Sensing of Relative Humidity and Temperature. It combines logic circuits together with
programming technique to control the hardware for remote sensing of temperature and relative
humidity. The sensor circuit converts the relative humidity and temperature into an analog
signal, which will be applied to a microcontroller based data logger for storage purpose. This is
transferred to the computer through RS232 standard serial port. The system can be real time and
offline.

Kanukurthy et al (1994) covered a data acquisition unit for an Implantable Multi-Channel


Optical Glucose Sensor. This new technology relies on the unique optical characteristics of
glucose in a near infrared spectrum. The sensor element will be implanted in the subcutaneous
6

tissues of the human body. The data acquisition unit acquires optical data from the sensor and
converts it into spectral data for processing.

Moon et al (2009) Microcontroller based Data Logger System The data logger will be based
around ATMEGA 128 microcontroller. This has a built-in analog-to-digital (ADC) with a
conversion accuracy of 12-bits as well as memory. The interface program was implemented as
software adoptable for graphical user interface environment using Visual C++.

Greenburg (2011) in his book principles of data capturing described the concept of logging and
how logging is done is in detail. Logging is a process to record events with the use of data
loggers during a test or field use of a system or a product. Logging is one of the usability
methods that can and should be used to gather more supplementary information as an integral
part of the iterative design of the usability engineering cycle. Logging has the major advantage
compared with other usability methods of not interfering with the users in their performing their
tasks. Users can basically ignore the log and use the system in exactly the way they would
anyway.

Mazidi et al (2013) in their book the overview of 8051 stated that microcontrollers and
microprocessors are widely used in embedded system products. An embedded product uses a
microcontroller to do one task and one task only. In addition to the description of criteria for
choosing a microcontroller, the interfacing with the real world devices such as LCDs, ADCs,
sensors and keyboard is described in detail. Finally; they discussed the issue of interfacing
external memories, both RAM and ROM.

Scientific data collection has been a complicated task and time consuming for years and the data
collected somehow may not 100 % accurate. With the invention of electronic instruments, the
data collection task can be done automatically and thus releasing engineers and scientist, or their
7

assistants for other tasks. Data logging is commonly used in scientific experiments and in
monitoring systems where there is the need to collect information faster than a human can
possibly collect the information and in cases where accuracy is essential. [Kale et al
(2007)].

Many loggers archive information such as temperature using sensors and then convert the
information into electrical signals. The data is archived and once retrieved can be filtered and
properly understood. Earlier data loggers used magnetic tape, punched paper tape, or directly
viewable records such as strip chart recorders, [Crystal, (2011)].

[Wheeler et al, (2010)] Chart recorder is an electromechanical device that records electrical or
mechanical input trend onto a piece of paper and they are appeared in three different types, the
strip, circular, and roll types. Strip chart recorders, as shown in Figure 2.1 have a long strip of
paper ejected out the side of the recorder. Circular chart recorders have a rotating disc of paper
are more compact and amenable but the chart paper must be replaced frequently, as shown in
Figure 2.2. Roll chart recorders meanwhile are similar to strip chart recorders except that the unit
is fully enclosed and the recorded data is stored on a round roll.

Figure 2.1: Strip Chart Recorders. [Wheeler et al (2010)].

Figure 2.2: Circular Chart Recorders, [Moyer Instruments, (2011)].

[Ladyada.net, (2011)] Analogue temperature sensor uses a solid-state technique to determine the
temperature. It does not use mercury, which can be found in old thermometers or bimetallic
strips which used in some home thermometers or stoves. Instead, it uses the fact as temperature
increases, the voltage across a diode increases at a known rate or the voltage drop between the
base and emitter, VBE of a transistor. By precisely amplifying the voltage change, it is easy to
generate an analogue signal that is directly proportional to temperature. As these sensors have no
moving parts, they are precise, never wear out, don't need calibration, work under various
environmental conditions, and are consistent between sensors and readings. Moreover they are
very inexpensive and easy to use.

[Varalakshmi, (2011)] Thermocouple is a junction between two different metals that produces a
voltage related to a temperature difference and is a widely used type of temperature sensor for
measurement and control and can also be used to convert heat into electric power. They are
interchangeable and inexpensive, are supplied fitted with standard connectors, and can measure a
wide range of temperatures. However, the main limitation is accuracy where system errors of
less than one degree Celsius (C) can be difficult to achieve. Thermocouple is available in
different combinations of metals or calibrations and the most common calibrations are J, K, T
and E. There are high temperature calibrations R, S, C and GB. Each calibration has a different
temperature range and environment, although the maximum temperature varies with the diameter
of the wire used in the thermocouple. Although the thermocouple calibration dictates the
temperature range, the maximum range is also limited by the diameter of the thermocouple wire.

10

CHAPTER THREE
METHODOLOGY
Evaluation of Figure 3.1 highlights that the memory device is used by both modules. In order to
increase the functionality of the system the memory device was designed as an independent unit
which could be transferred between modules when required. To create the required system three
separate units were designed and constructed, namely:

Measurement Unit, Memory Unit and PC interface Unit. The Measurement Unit in conjunction
with Memory Unit forms the Measurement Module. The PC Interface Unit connected to the
Memory Unit in conjunction with a PC forms the PC Interface Module. The units and their
associated modules are illustrated in the following diagram.

For reasons of simplicity the functional unit performing the task of measurement and data
storage will be known as the measurement module while the functional unit performing the
tasks of data download and data processing will be known as the PC Interface module.

11

Figure 3.1: Block Diagram of System Modules


The implementation of these two functions could be achieved in a single physical device. Such
an implementation would be cost effective as manufacturing, housing and materials costs would
be reduced. However, since both functions can be done independently, physically separating the
functions provides advantages that are undoubtedly superior. These benefits are now discussed
with reference to the following diagrams.

12

Figure 3.2: Block Diagram of the Data Logger

3.2 BLOCK DIAGRAM DESCRIPTION


3.2.1 Microcontroller Unit (MCU)
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of
in-system programmable Flash memory. The device is manufactured using Atmels high-density
nonvolatile memory technology and is compatible with the industry- standard 80C51 instruction
set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or
by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with insystem programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful
13

microcontroller which provides a highly-flexible and cost-effective solution to many embedded


control applications. The AT89S52 provides the following standard features: 8K bytes of Flash,
256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters,
a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and
clock circuitry.

In this design the microcontroller forms the core of the system, meaning that all mathematical
and logical operation of the system is executed from within it.

Figure 3.2: Pin Configuration of Atmel 89S52 Microcontroller

As shown on the previous picture, the 8051 microcontroller has nothing impressive at first sight:

4 Kb program memory is not much at all.


128Kb RAM (including SFRs as well) satisfies basic needs, but it is not imposing
amount.

14

4 ports having in total of 32 input/output lines are mostly enough to make connection to
peripheral environment and are not luxury at all.

3.2.2 Microcontroller's Ports


Port 0
It is specific to this port to have a double purpose. If external memory is used then the lower
address byte (addresses A0-A7) is applied on it. Otherwise, all bits on this port are configured as
inputs or outputs.
Another characteristic is expressed when it is configured as output. Namely, unlike other ports
consisting of pins with embedded pull-up resistor ( connected by its end to 5 V power supply ),
this resistor is left out here. This, apparently little change has its consequences:

If any pin on this port is configured as input then it performs as if it floats. Such input has
unlimited input resistance and has no voltage coming from inside.

When the pin is configured as output, it performs as open drain, meaning that by writing 0 to
some ports bit, the appropriate pin will be connected to ground (0V). By writing 1, the external
output will keep on floating. In order to apply 1 (5V) on this output, an external pull-up
resistor must be embedded.

15

Port 1
This is a true I/O port, because there are no role assigning as it is the case with P0. Since it has
embedded pull-up resistors it is completely compatible with TTL circuits.
Port 2
Similar to P0, when using external memory, lines on this port occupy addresses intended for
external memory chip. This time it is the higher address byte with addresses A8-A15. When
there is no additional memory, this port can be used as universal input-output port similar by its
features to the port 1.
Port 3
Even though all pins on this port can be used as universal I/O port, they also have an alternative
function. Since each of these functions use inputs, then the appropriate pins have to be
configured like that. In other words, prior to using some of reserve port functions, a logical one
(1) must be written to the appropriate bit in the P3 register. From hardwares perspective , this
port is also similar to P0, with the difference that its outputs have a pull-up resistor embedded.

3.2.3 Power Supply Unit


The main supply to the unit is gotten from the USB port of the PC and also an auxillary power
supply for backup that run directly from a 9VDC and stabilised down to 5VDC for proper
operation of the microcontroller incase the unit is to be operated as a stand alone metering
device.

Obviously, all this is about very simple circuits, but it does not have to be always like that. If
device is used for handling expensive machines or for maintaining vital functions, everything
becomes more and more complicated! This kind of solution is quite enough for the time being.

3.2.4 Visual Display Unit


The visual display unit is used to show the current value of calculated instantaneous
parameters of the data collection unit.

It is built around the microcontroller which serves

16

as the core for the system by outputting the desired values of information unto the display and
a multiplexed seven segment display.

Liquid Crystal Displays (LCD)


These components are specialized for being used with the microcontrollers, which means that
they cannot be activated by standard IC circuits. They are used for writing different messages on
a miniature LCD.

A model described here is for its low price and great possibilities most frequently used in
practice. It is based on the HD44780 microcontroller (Hitachi) and can display messages in two
lines with 16 characters each. It displays all letters of alphabet, Greek letters, punctuation marks,
mathematical symbols etc. In addition, it is possible to display symbols that user makes up on its
own. Automatic shifting message on display (shift left and right), appearance of the pointer,
backlight etc. are considered as useful characteristics.

Pins Functions
There are pins along one side of the small printed board used for connection to the
microcontroller. There are total of 14 pins marked with numbers (16 in case the background light
is built in). Their function is described in the table below:

Function
Ground
Power supply
Contrast
Control
operating

of

Pin Number
1
2
3

Name
Vss
Vdd
Vee

RS

Logic State
0
1

Description
0V
+5V
0 - Vdd
D0 D7
commands

are

interpreted

as

17

Data / commands

R/W

7
8
9
10
11
12
13
14

D0
D1
D2
D3
D4
D5
D6
D7

D0 D7 are interpreted as data


0
Write data (from controller to LCD)
1
Read data (from LCD to controller)
Access
to
LCD
disabled
0
Normal
operating
1
Data/commands are transferred to
From 1 to 0
LCD
0/1
Bit 0 LSB
0/1
Bit 1
0/1
Bit 2
0/1
Bit 3
0/1
Bit 4
0/1
Bit 5
0/1
Bit 6
0/1
Bit 7 MSB

LCD Screen

LCD screen consists of two lines with 16 characters each. Each character consists of 5x8 or 5x11
dot matrix. This book covers 5x8 character display because it is commonly used.
Contrast on display depends on the power supply voltage and whether messages are displayed in
one or two lines. For that reason, variable voltage 0-Vdd is applied on pin marked as Vee.
Trimmer potentiometer is usually used for that purpose. Some versions of displays have built in
backlight (blue or green diodes). When used during operating, a resistor for current limitation
should be used (like with any LE diode).

18

Figure 3.3: Pin Configuration of an LCD


3.2.5 Data Collection Unit
This unit is made up of an analog-to-digital converter (abbreviated ADC, A/D or A to D) is a
device which converts continuous signals to discrete digital numbers. The reverse operation is
performed by a digital-to-analog converter (DAC) and an analogue multiplex.

Typically, an ADC is an electronic device that converts an input analog voltage (or current) to a
digital number proportional to the magnitude of the voltage or current. However, some nonelectronic or only partially electronic devices, such as rotary encoders, can also be considered
ADCs. The digital output may use different coding schemes, such as binary, Gray code or two's
complement binary.

19

Its prime function in this circuit is to digitize the analog quantity that is gotten from the
transducer (sensor) or the instantaneous voltage that is to be logged to the system unit to a
form that will be easily processed by the microcontroller. The accuracy of the converter
depends on these factors resolution, Accuracy, Quantization error, Aperture error, and Nonlinearity.

3.2.6 Resolution
The resolution of the converter indicates the number of discrete values it can produce over the
range of analog values. Here we have decided to use an 8-Bit Analog-Digital converter for its
low cost and simplicity hence at expense of lower performance when it comes to step size or
resolution. The values are usually stored electronically in binary form, so the resolution is
usually expressed in bits. In consequence, the number of discrete values available, or "levels", is
usually a power of two. For example, an ADC with a resolution of 8 bits can encode an analog
input to one in 256 different levels. The values can represent the ranges from 0 to 255 (i.e.
unsigned integer) or from -128 to 127 (i.e. signed integer), depending on the application.

Resolution can also be defined electrically, and expressed in volts. The voltage resolution of an
ADC is equal to its overall voltage measurement range divided by the number of discrete
intervals as in the formula:

. Eqn (1)

Where:
Q is resolution in volts per step (volts per output codes less one),
EFSR is the full scale voltage range =,
M is the ADC's resolution in bits.
20

N is the number of intervals, (one less than the number of available levels, or output
codes), which is:

Example 1
o

Full scale measurement range = 0 to 10 volts

ADC resolution is 12 bits: 212 = 4096 quantization levels (codes)

ADC voltage resolution is: (10V - 0V) / 4095 steps = 10V / 4095 steps
0.00244 V/step

2.44 mV/step

Example 2
o

Full scale measurement range = 0 to 7 volts

ADC resolution is 3 bits: 23 = 8 quantization levels (codes)

ADC voltage resolution is: (7 V 0 V)/7 steps = 7 V/7 steps = 1 V/ step = 1000
mV/step

In practice, the smallest output code ("0" in an unsigned system) represents a voltage range
which is 0.5Q, that is, half the ADC voltage resolution (Q), as does the largest output code. The
other N 2 codes are all equal in width and represent the ADC voltage resolution (Q) calculated
above. Doing this centers the code on an input voltage that represents the Mth division of the
input voltage range. For example, in Example 3, with the 3-bit ADC spanning a 7 V range, each
of the N divisions would represent 1 V, except the 1st ("0" code) and the last ("7" code) which
are 0.5 V wide. Doing this the "1" code spans a voltage range from 0.5 to 1.5 V, the "2" code
spans a voltage range from 1.5 to 2.5 V, etc. Thus, if the input signal is at 3/8ths of the full-scale
voltage, then the ADC outputs the "3" code, and will do so as long as the voltage stays within the
range of 2.5/8ths and 3.5/8ths. This practice is called "mid-tread" operation.

21

In practice, the useful resolution of a converter is limited by the best signal-to-noise ratio that can
be achieved for a digitized signal. An ADC can resolve a signal to only a certain number of bits
of resolution, called the effective number of bits (ENOB). One effective bit of resolution changes
the signal-to-noise ratio of the digitized signal by 6 dB, if the resolution is limited by the ADC. If
a preamplifier has been used prior to A/D conversion, the noise introduced by the amplifier can
be an important contributing factor towards the overall SNR.

3.2.7 Accuracy
An ADC has several sources of errors. Quantization error and (assuming the ADC is intended to
be linear) non-linearity is intrinsic to any analog-to-digital conversion. There is also a so-called
aperture error which is due to a clock jitter and is revealed when digitizing a time-variant signal
(not a constant value).

These errors are measured in a unit called the LSB, which is an abbreviation for least significant
bit. In the above example of an eight-bit ADC, an error of one LSB is 1/256 of the full signal
range, or about 0.4%.

3.2.8 Quantization error


Quantization error is due to the finite resolution of the ADC, and is an unavoidable imperfection
in all types of ADC. The magnitude of the quantization error at the sampling instant is between
zero and half of one LSB.

In the general case, the original signal is much larger than one LSB. When this happens, the
quantization error is not correlated with the signal, and has a uniform distribution. Its RMS value
is the standard deviation of this distribution, given by. In the eight-bit ADC example, this
represents 0.113% of the full signal range.
22

At lower levels the quantizing error becomes dependent of the input signal, resulting in distortion
with amplitude of 1 quantization step added to the signal. This slightly reduces signal to noise
ratio, but completely eliminates the distortion. It is known as dither.

3.2.9 Non-linearity
All ADCs suffer from non-linearity errors caused by their physical imperfections, resulting in
their output to deviate from a linear function (or some other function, in the case of a deliberately
non-linear ADC) of their input. These errors can sometimes be mitigated by calibration, or
prevented by testing.

Important parameters for linearity are integral non-linearity (INL) and differential non-linearity
(DNL). These non-linearities reduce the dynamic range of the signals that can be digitized by the
ADC, also reducing the effective resolution of the ADC. The multiplexer is used to select
different analogue quantity that is to be measured and it is concatenated to the ADC since it
has only one input.

3.3 IMPLEMENTATION
3.3.1 Block Diagram Design
A rough sketch on how the project would look like was first drawn, detailing all the components
blocks that would make-up the complete system.

Once drawn and checked for consistency,

the second phase was proceeded to immediately.

23

3.3.2 Schematic Design


Schematic design poses one of the most difficult constraints in the design of this project because
here for sure, we are dealing with discrete components that have one common goal speak the
language of electronics effectively this simply means that all sections of the system should work
in harmony with little deviation from the target.

3.3.3 Soldering
Soldering is the process of a making a sound electrical and mechanical joint between certain
metals by joining them with a soft solder. This is a low temperature melting point alloy of lead
and tin. The joint is heated to the correct temperature by soldering iron. For most electronic work
miniature mains powered soldering irons are used. These consist of a handle onto which is
mounted the heating element. On the end of the heating element is what is known as the "bit", so
called because it is the bit that heats the joint up. Solder melts at around 190 degrees Centigrade,
and the bit reaches a temperature of over 250 degrees Centigrade. This temperature is plenty hot
enough to inflict a nasty burn, consequently care should be taken.

Good soldering is a skill that is learnt by practice. The most important point in soldering is that
both parts of the joint to be made must be at the same temperature. The solder will flow evenly
and make a good electrical and mechanical joint only if both parts of the joint are at an equal
high temperature. Even though it appears that there is a metal to metal contact in a joint to be
made, very often there exists a film of oxide on the surface that insulates the two parts. For this
reason it is no good applying the soldering iron tip to one half of the joint only and expecting this
to heat the other half of the joint as well

24

3.3.4 Testing the Circuit


After the construction, the circuit was properly analyzed and short circuit and open circuits were
all corrected. The circuit is then powered with a voltage supply of 5V and some parameters such
as clock pulses were measured.

25

CHAPTER FOUR
Result and Analysis
In any given design there must be a set rules and regulation guiding it, in view of this project
industrial data logger with computer is not a left out.

This design was triggered off by first;

trying to figure out how the project can be actualized, getting the desired clue, surfing online to
gather more Intel, and thus the Ideal was achieved.

Figure 4.1: Circuit Diagram of the Sensor Unit For The Three Input Data Logger
26

Figure 4.2: Circuit Diagram of the MCU for Three Input Data Logger

27

Figure 4.3: System User Application Console

Figure 4.4: System Logged Data


28

4.1 How it Works


All microcontroller embedded system runs on an internal firmware burnt into the chip or outside
the chip in a ROM. This design uses the ever familiar MCU microcontroller unit from Atmel
semiconductors owing to the fact that its brand of MCU has a wider data I/O lines for the job.

The firmware program was written in assembly language and compiled using the ASEMW
brand of macro cross-assembler to finally get the machine executable file. Once the exec file is
gotten, it was downloaded it into the MCU internal flash memory from where it is to be executed
using a gadget called a Programmer.

4.1.1 Programmers are device used to get the executable file that resides in the computer down
to the microcontroller for final execution of the program.
Below are the modes of operation of the system outlined in a sequential manner in order to aid
quick understanding of how the project works.
Three buttons are used to control operation of the data logger: START, PAUSE, and RESET.

4.1.2 Step-By-Step Analysis


1. At power ON, the microcontroller immediately initializes the state of the visual display
unit to a known state, and also resets its self to a defined status that conforms to the preloaded program.
2. A routine is called upon by the controller to clear the visual display unit and also to clear
the content of the register that is used to store the converted data that resides in the
controller.

29

3. An instruction is called upon, to check the serial control line and also to power down the
USB controller so that the issue of unwanted logging would be combated. During this
sequence of system initialization the visual display is defaulted to the value of zero.
4. At this point the system is fully initialized. Here it waits for the appropriate command for
logging to commence else it will serve as a standalone metering instrument.
5. The data collection unit proceeds to these modes of operation labeled i thru vi.
i) The MCU counts the number of pulses at the counter input pin if any, stores the data
in a special register that is used for its temporary store, and then calls upon a routine
that outputs this data onto the corresponding display then jumps to the next step.
ii) At this point, the ADC unit is activated. Here since there are four analogue
parameters that s to be measured, the multiplexer unit is automatically enabled as well
since the four inputs are concatenated to the multiplexer. Thus taking us to the next
step.
iii) The MCU issues a command to the multiplexer that enables the temperature channel,
the analogue value is quickly made available to the input of the ADC, and the MCU
further gives a command to the ADC to start conversion. Once the conversion is done
the data is the gated to the MCU for digital processing. Here the data is analysed,
stored in its temporary register, then displayed onto the corresponding indicator.
From here the MCU jumps to the next step.
iv) The MCU issues a command to the multiplexer that enables the current channel, the
value of the current which has been converted to voltage by the current transformer
quickly made available to the input of the ADC, and the MCU further gives a
command to the ADC to start conversion. Once the conversion is done the data is the
gated to the MCU for digital processing. Here the data is analysed, stored in its
temporary register, then displayed onto the corresponding indicator. From here the
MCU jumps to the next step.
v) Here the MCU repeats the steps above but this time around the AC voltage is
measured. The MCU enables the channel that corresponds to the AC voltage input;
30

the ADC does its conversion and then gates its output to the MCU which then
finishes up the digital processing by storing the data in its corresponding register and
also displaying the data on the status display. A jump is made to ascertain the power
of the connected load if their exist any thus taking the MCU to the final step in data
collection.
vi) The MCU issues a command to the multiplexer that enables the power channel, the
power value is quickly made available to the input of the ADC, and the MCU further
gives a command to the ADC to start conversion. Once the conversion is done the
data is the gated to the MCU for digital processing. Here the data is analysed, stored
in its temporary register, then displayed onto the corresponding indicator. From here
the MCU jumps to the next step.

This process is repeated continuously so long as the unit is powered thus this function also makes
it a standalone metering instrument.

6. From this point, if the start command button is clicked on the system GUI, the stored
content in the temporary register is automatically sent to the system via the USB port as
the means of communication.

It should be pointed out that the speed of data logging to the system is the sole control of the
system and not the data collection unit or the MCU. This is achieved by the system issuing a
query to the controller to send its stored content that resides in the register at a specified time
selectable by the user via the log time on the menu bar located at the top left of the system
based application. This gives the user the flexibility to adjust the intervals between logs.

Also, the user can pause the logging in other to get a clearer view of the data base, resets the
buffer, save the content of the data base for future reference or print the saved document.
31

Since every program is a well-defined loop, hence this program is by no means an exception.
This means that the whole action is cyclical hence once in the standalone state or data logging
state the whole action repeats itself.

4.1.3 NOTE: the standalone as used means that the instrument can be used as a conventional
metering device and not a standalone data logger.

4.1.4 Mechanical Construction


After finalizing the construction of the circuit, what remains now is the mechanical outlook of
the enclosed system.

In this design consideration of price and usage in real time

application was done, since the aim of this project is for prototyping, a white plastic finishing
was chosen to give it slick and wonderful look, and as well as given it the desired ruggedness.

4.1.5 Problems Encountered


Basically, the problems I encountered during the making of this project were the unavailability
of the core controller that is to be used in the project. This particular problem introduced the
highest bottle neck in the prototyping face of my project because it forms the frame work.

Some of the semiconductors were out of specification and this made the mathematical and
electrical parameters deviate by about 15% at the initial stage of the bread boarding. Thus
making the time expended on a particular circuit block high. But through careful adjustment of
pre-calculated the error rate was reduced to about 2%.

32

Also, establishing a clearly defined protocol for data transfer to and from the PC and the
hardware was not that rosy as the PC has 2 be in synch with the hardware hence data may be lost
thus leading to error in the data logging process.
Sending data unto the USB is one of the most technical aspects of the project because it makes
use of win32 API calls. This problem was solved by the use of prolific USB win32 driver which
has all the enumeration process that a typical USB controller needs.

Developing a computer based application using the Microsoft Visual Studio that will meet
technical standard like; real time logging, setting up a data base, plotting graphs etc. demands
greater precision on the part of program coding and this was not easy to come by because while
keeping up with the data received, the program should be able to multitask hence process
variation may be introduced.

Time , this plays a major factor in any given line of project, the time frame allocated to develop a
project of this standard is so small looking at the technicality so involved and this made the
sequences involved in the project a little bit unbearable for me.

33

CHAPTER FIVE
5.0 Conclusion
The fundamental objective of the design was to create a system that could take temperature,
frequency, power, voltage, and current measurements and store all this data till such time that it
is needed. This objective was successfully achieved within the low power consumption
condition. The desired accuracy were also achieved and validated by comparing the measured
temperature results to a calibrated digital thermometer.

The main change in operation of the Measurement Unit was with regard to the Time Stamping
Method employed. It was decided that rather than taking only an initial base time stamp and
incrementing this based on the number of a sample, a time stamp would be taken at a user
defined interval.

The data logger which is responsible for the downloading and processing of stored data was
successfully designed, constructed and tested. The design was achieved with a degree of user
friendliness and provides hassle free operation.

The design was achieved using a modular design approach which optimized the efficiency of the
system, increased its versatility as well significantly aided in troubleshooting during the
prototyping stage.

5.1 Recommendation
In this design a centralized AC input source was adopted in other to aid simplicity of the design
this has a limitation in terms of flexibility when the unit is to be deployed in a remote area thus
subsequent design should make provision in other to combat this downside.

34

Also, provision should be made so that data transfer could be made wireless, with this wireless
connectivity, data can as well be transferred via the internet instead of coming close to the unit.

5.2 Contribution to Knowledge


With the aid of this unit artisan, technicians, engineers, and every other sector of life will know
the importance of data logging. So this project will add value to the way we see things around us
and how to maximize the full potentials of any given design.

35

REFRENCE
8052.com (2011), Software-Based Real Time Clock (RTC). Retrieved March 25,
2011, from http://www.8052.com/tutrtc

Analog Devices (1999), Monolithic Thermocouple Amplifiers with Cold Junction


Compensation. Retrieved February 27, 2011, from http://www.analog.com/
static/imported-files/data_sheets/AD594_595.pdf, pp. 13-16.

Data Logger. (2010), Introduction to Data Loggers. Retrieved June 10, 2013, from
http://www.omega.com/prodinfo/dataloggers.html

Dedrick et al (1990), Microprocessor-Based Data Logging System.


pp. 92-100.

Electronics Technology, (2006), ISSE '06. 29th International Spring Seminar on,
vol., no., pp.309-312.

Ibrahim, D. (2008), Advanced PIC Microcontroller Projects in C: From USB to


RTOS with the PIC18F Series. Burlington: Elsevier Ltd, pp. 142-156.

Ibrahim, D.(2010), SD Card Projects Using the PIC Microcontroller. Burlington:


Elsevier Ltd, pp. 132-136.

Moghavvemi, M. (1990), Simple Low Cost Data Acquisition System for Remote
Sensing of Relative Humidity and Temperature, pp. 1-13.

Moore, G. (1986), Data Loggers, Modern Recorders. Electronics and Power,


Pp22-36.

36

APPENDIX
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;VARIABLE DECLARATION;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
T2CON
RCAP2L
RCAP2H
;;;;;;;;;;;;;;;;;;;;;;;;;

DATA 0C8H
DATA 0CAHs
DATA 0CBH

OUTPUT
SCAN
ADC_IN
CONTROL

DATA
DATA
DATA
DATA

0A0H
090H
0B0H

WRITE
ADD_L
ADD_H

BIT
BIT
BIT

CONTROL.2
CONTROL.3
CONTROL.5

COUNTER
STORE_1
STORE_2
STORE_3
TEMPERATURE_STORE
FREQUECNY_STORE
AC_VOLTAGE_STORE
CURRENT_STORE
POWER_STORE
DC_VOLTAGE_STORE
DELAY_REG
DELAY_REG1
DELAY_REG2
RESTORE
SAMPLER
STATUS_1
STATUS_2
STATUS_3
LOG_COUNTER
AUX_TEMP
AUX_FREQ
AUX_AC_VOL
AUX_CURRE
AUX_POW
SAMPLER_1
LOG_STORE

DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA

000H
001H
002H
003H
004H
005H
006H
007H
008H
009H
00AH
00BH
00CH
00DH
00EH
00FH
010H
011H
012H
013H
014H
015H
016H
017H
018H
019H

080H

37

FLAGS
SAMPLE_FLAG

DATA
BIT

020H
FLAGS.0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;END OF VARIABLE
DECLARATION;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

ORG 000H
AJMP BOOTSTRAP

ORG 023H
AJMP SETUP_DATA_LOGGING

ORG 02BH
AJMP SAMPLE

ORG 02FH

BOOTSTRAP:
MOV SP,#030H
CLR WRITE
MOV OUTPUT,#000
MOV COUNTER,#001
MOV LOG_COUNTER,#001
MOV ADC_IN,#255
MOV FREQUECNY_STORE,#000
MOV TEMPERATURE_STORE,#000
MOV AC_VOLTAGE_STORE,#000
MOV CURRENT_STORE,#000
MOV POWER_STORE,#000
MOV SAMPLER,#100
MOV SAMPLER_1,#025
MOV AUX_TEMP,#000
MOV AUX_FREQ,#000
MOV AUX_AC_VOL,#000
MOV AUX_CURRE,#000
MOV AUX_POW,#000
MOV SCAN,#000
MOV TL0,#000
38

MOV STATUS_1,#071H
MOV STATUS_2,#071H
MOV STATUS_3,#03FH
CLR ADD_L
CLR ADD_H
SETB WRITE
SETB TR0
MOV PCON,#080H
MOV TMOD,#025H
MOV TH1,#0FFH
MOV SCON,#050H
CLR TI
CLR RI
SETB TR1
MOV RCAP2L,#000H
MOV RCAP2H,#0DCH
MOV T2CON,#004
MOV IE,#10110000B
AJMP MAIN

MAIN:

MOV A,FREQUECNY_STORE
ACALL BIN_DEC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_1
ACALL DISP_MASK
MOV SCAN,#000
MOV OUTPUT,A
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_2
ACALL DISP_MASK
MOV SCAN,#001
MOV OUTPUT,A
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV A,TEMPERATURE_STORE
ACALL BIN_DEC
;;;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_1
ACALL DISP_MASK
MOV SCAN,#002
MOV OUTPUT,A
39

PROC:

ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_2
ACALL DISP_MASK
MOV SCAN,#003
MOV OUTPUT,A
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV A,CURRENT_STORE
ACALL BIN_DEC
;;;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_1
ACALL DISP_MASK
MOV OUTPUT,A
MOV SCAN,#004
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_2
ACALL DISP_MASK
MOV OUTPUT,A
MOV SCAN,#005
SETB SCAN.4
ACALL DELAY_900_11
CLR SCAN.4
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV A,FREQUECNY_STORE
CJNE A,#000,PROC
MOV AC_VOLTAGE_STORE,FREQUECNY_STORE
MOV A,AC_VOLTAGE_STORE
ACALL BIN_DEC
;;;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_1
ACALL DISP_MASK
MOV OUTPUT,A
MOV SCAN,#006
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_2
ACALL DISP_MASK
MOV OUTPUT,A
MOV SCAN,#007
40

ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_3
ACALL DISP_MASK
MOV OUTPUT,A
MOV SCAN,#008
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV A,POWER_STORE
ACALL BIN_DEC
;;;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_1
ACALL DISP_MASK
MOV OUTPUT,A
MOV SCAN,#009
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_2
ACALL DISP_MASK
MOV OUTPUT,A
MOV SCAN,#010
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;
MOV A,STORE_3
ACALL DISP_MASK
MOV OUTPUT,A
MOV SCAN,#011
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV OUTPUT,STATUS_1
MOV SCAN,#012
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;
MOV OUTPUT,STATUS_2
MOV SCAN,#013
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;
MOV OUTPUT,STATUS_3
41

MOV SCAN,#014
ACALL DELAY_900_11
MOV OUTPUT,#000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ACALL ADC_IN_ROUTINE
ACALL REFRESH_SCREEN
AJMP MAIN

REFRESH_SCREEN:

RETURN:

DJNZ SAMPLER_1,RETURN
MOV SAMPLER_1,#025
MOV TEMPERATURE_STORE,AUX_TEMP
MOV FREQUECNY_STORE,AUX_FREQ
MOV AC_VOLTAGE_STORE,AUX_AC_VOL
MOV CURRENT_STORE,AUX_CURRE
MOV POWER_STORE,AUX_POW
RET

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ADC_IN_ROUTINE:

CLR ADD_H
CLR ADD_L
ACALL DELAY_12KHz
ACALL GET_PARAMETER
MOV AUX_CURRE,ADC_IN
;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETB ADD_L
CLR ADD_H
ACALL DELAY_12KHz
ACALL GET_PARAMETER
MOV AUX_AC_VOL,ADC_IN
;;;;;;;;;;;;;;;;;;;;;;;;;;;
CLR ADD_L
SETB ADD_H
ACALL DELAY_12KHz
ACALL GET_PARAMETER
MOV AUX_TEMP,ADC_IN
;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETB ADD_H
SETB ADD_L
ACALL DELAY_12KHz
ACALL GET_PARAMETER
MOV AUX_POW,ADC_IN
;;;;;;;;;;;;;;;;;;;;;;;;;;;
RET

42

GET_PARAMETER:

CLR WRITE
NOP
NOP
NOP
NOP
SETB WRITE
ACALL DELAY_12KHz
RET

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LOG_TO_SYSTEM:
CLR SAMPLE_FLAG
CLR TI
MOV A,LOG_STORE
FREQUECNY_LOGGER: CJNE A,#016,TEMPERATURE_LOGGER
MOV SBUF,FREQUECNY_STORE
JNB TI,$
CLR TI
AJMP MAIN
TEMPERATURE_LOGGER: CJNE A,#008,AC_VOLTAGE_LOGGER
MOV SBUF,TEMPERATURE_STORE
JNB TI,$
CLR TI
AJMP MAIN
AC_VOLTAGE_LOGGER: CJNE A,#128,POWER_LOGGER
MOV SBUF,AC_VOLTAGE_STORE
JNB TI,$
CLR TI
AJMP MAIN
POWER_LOGGER:

CJNE A,#032,CURRENT_LOGGER
MOV SBUF,POWER_STORE
JNB TI,$
CLR TI
AJMP MAIN

CURRENT_LOGGER:

CJNE A,#064,SHOW_STATUS
MOV SBUF,CURRENT_STORE
JNB TI,$
CLR TI
AJMP MAIN

SHOW_STATUS:

CJNE A,#099,SHOW_STATUS_1
MOV STATUS_1,#071H
MOV STATUS_2,#071H
43

MOV STATUS_3,#03FH
AJMP MAIN
SHOW_STATUS_1:

SHOW_STATUS_EXIT:

CJNE A,#199,SHOW_STATUS_EXIT
MOV STATUS_1,#037H
MOV STATUS_2,#03FH
MOV STATUS_3,#040H
AJMP MAIN

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_DATA_LOGGING: JNB RI,OUT
MOV LOG_STORE,SBUF
SETB SAMPLE_FLAG
CLR RI
OUT:
RETI
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DISP_MASKLAY MASK SUBROUTINE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DISP_MASK:

BIN_DEC:

INC A
MOVC A,@A+PC
RET
DB 03FH
DB 006H
DB 05BH
DB 04FH
DB 066H
DB 06DH
DB 07DH
DB 007H
DB 07FH
DB 06FH

; Digit 0 mask 0C0H


; Digit 1 mask 0F9H
; Digit 2 mask 0A4H
; Digit 3 mask 0B0H
; Digit 4 mask 099H
; Digit 5 mask 092H
; Digit 6 mask 082H
; Digit 7 mask 0F8H
; Digit 8 mask 080H
; Digit 9 mask 090H

MOV B,#10
DIV AB
MOV STORE_1,B
MOV B,#10
DIV AB
MOV STORE_2,B
MOV STORE_3,A
RET

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DELAY SUBROUTINE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

44

DELAY_900_11:
_150_12:

DELAY_12KHz:
Y_12KHz:

MOV DELAY_REG1,#02
MOV DELAY_REG2,#168
DJNZ DELAY_REG2,_150_12
DJNZ DELAY_REG1,_150_12
RET

MOV DELAY_REG1,#18
DJNZ DELAY_REG1,Y_12KHz
RET

END

45