KEMBAR78
A Temperature Data Logger Using Pic Eeprom: 4 Year - Report in Distributed Control System | PDF | Computer Memory | Computer Engineering
0% found this document useful (0 votes)
102 views15 pages

A Temperature Data Logger Using Pic Eeprom: 4 Year - Report in Distributed Control System

This document describes a temperature data logger project using a PIC microcontroller EEPROM. The project involves designing a circuit to measure temperature using a sensor, record the temperature readings to the PIC's EEPROM at set time intervals, and transfer the recorded data to a computer. The circuit uses a single PIC chip, temperature sensor, EEPROM, switches and LED. Temperature is measured and stored periodically until memory is full, at which point data can be sent to a PC via serial interface.

Uploaded by

Haider
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views15 pages

A Temperature Data Logger Using Pic Eeprom: 4 Year - Report in Distributed Control System

This document describes a temperature data logger project using a PIC microcontroller EEPROM. The project involves designing a circuit to measure temperature using a sensor, record the temperature readings to the PIC's EEPROM at set time intervals, and transfer the recorded data to a computer. The circuit uses a single PIC chip, temperature sensor, EEPROM, switches and LED. Temperature is measured and stored periodically until memory is full, at which point data can be sent to a PC via serial interface.

Uploaded by

Haider
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Republic of Iraq

Ministry of Higher Education


& Scientific Research
AL-Nahrain University
Information Engineering College
Systems Engineering Department

A Temperature Data Logger Using


PIC EEPROM

4th year - Report


in
Distributed control System

By
Haider Hashim Dkhikh

Supervised by
Dr. Ali Alrawi

July 2020
Abstract

In this report, Data Logger Using PIC EEPROM will be explained and how

to link with the temperature sensor and then explain how the temperatures are

recorded and saved in the EEPROM. the controller will read the values from the

sensor on regular interval basis and stores them in its EEPROM. By using a serial

interface, we can transfer the recorded temperatures to a computer.

Haider Hashim 2|Page


1. Introduction
A data logger (also data logger or data recorder) is an electronic device
that records data over time Using PIC EEPROM (Electrically Erasable
Programmable Read-Only Memory, this memory is non-volatile, which means
that the data doesn’t get erased when the board loses power) or in relation to
location either with a built in instrument or sensor or via external instruments and
sensors. Increasingly, but not entirely, they are based on a digital processor (or
computer). They generally are small, battery powered, portable, and equipped
with a microprocessor, internal memory for data storage, and sensors. [1] Some
data loggers interface with a personal computer, and use software to activate the
data logger and view and analyze the collected data, while others have a local
interface device (keypad, LCD) and can be used as a stand-alone device. [2]

Data loggers vary between general purpose types for a range of measurement
applications to very specific devices for measuring in one environment or
Temperature 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 data loggers have replaced chart
recorders in many applications.

One of the primary benefits of using data loggers is the ability to automatically
collect 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 a comprehensive, accurate picture of
the environmental conditions being monitored, such as air temperature and
relative humidity. [3]

An external EEPROM is useful when trying to store data. In addition to storing


much more data than is available on the PIC, an EEPROM stores the data even
when power is removed and can then be collected at a later time. Storing large

Haider Hashim 3|Page


amounts of data over time is especially beneficial once communication can be
made between the PIC and Matlab. Using the serial function in Matlab, the data
can be obtained and then analyzed. [4]

2. Problem statement

The problem is needed to measure temperatures by temperatures sensor and


store data that is measured at specified time intervals using PIC EEPROM. the
application (data logger or data recorder) efficiently solves this problem.

3. Objective
The aim of the report is to explain use a Microchip PIC microcontroller, a
serial EEPROM and a thermistor to create a temperature recorder. The
temperature is measured and stored at user programmable intervals; this can be
from 1 second to 256 seconds. The time interval is set by programming it and the
start time into the EEPROM.

4. Application
Applications of data logging Using PIC EEPROM include [5]:

• Unattended weather station recording (such as wind


speed direction, temperature, relative humidity, solar radiation).
• Unattended hydrographic recording (such as water level, water depth, water
flow, water pH, water conductivity).
• Unattended soil moisture level recording.
• Unattended gas pressure recording.
• Offshore buoys for recording a variety of environmental conditions.

Haider Hashim 4|Page


• Road traffic counting.
• Measure temperatures (humidity, etc.) of perishables during shipments: Cold
chain.
• Measure variations in light intensity.
• Measuring Temperature of Pharmaceutical products, Medicines and
Vaccines during storage
• Measuring Temperature and Humidity of Perishable products during
transportation to ensure cold chain is maintained
• Process monitoring for maintenance and troubleshooting applications.
• Process monitoring to verify warranty conditions
• Wildlife research with pop-up archival tags
• Measure vibration and handling shock (drop height) environment of
distribution packaging.
• Deformation monitoring of any object with geodetic or geotechnical sensors
controlled by an automatic deformation monitoring system.
• Environmental monitoring.
• Vehicle Testing (including crash testing)
• Motor Racing
• Monitoring of relay status in railway signaling.
• For science education enabling 'measurement', 'scientific investigation' and
an appreciation of 'change'
• Record trend data at regular intervals in veterinary vital signs monitoring.
• Load profile recording for energy consumption management.
• Temperature, humidity and power use for heating and air conditioning
efficiency studies.
• Water level monitoring for groundwater studies.
• Digital electronic bus sniffer for debug and validation

Haider Hashim 5|Page


5. Temperature Data Logger Using PIC EEPROM
Methodology

A data logger using PIC EEPROM is a device that records measurements over
time. The measurements could be any physical variable like temperature,
pressure, voltage, humidity, etc. [6] This project describes how to build a mini
logger that records surrounding temperature values. It has following features:

• Uses just one 8pin chip, so very compact size circuit.


• Temperature range: 0 to +125°C.
• Can store up to 254 measurements.
• Sampling interval options: 1 sec, 1 min, 10 min
• Reset feature to clear all previous measurements.
• Serial transfer of recorded measurements to a PC
• Three tactile switches for user inputs and a LED indicator.

Haider Hashim 6|Page


5.1 Description of Application
The beauty of this application is that it uses just a single chip for logging.
It is PIC12F683, an 8pin microcontroller from Microchip. PIC12F683 has six
general purpose I/O (GP0GP5, GP3 is input only) pins, and 2K x 14 Flash
program memory with 256 bytes of internal EEPROM.Temperature will be
measured with a DS1820 temperature sensor. DS1820 is a one wire digital
temperature sensor from Dallas Semiconductor (now MAXIM). The operating
temperature range of the device is -55°C to +125°C with an accuracy of
±0.5°Cover the range of -10°C to +85°C. The temperature sensor output is 9-bit
Celsius temperature measurement, and so the temperature resolution corresponds
to the least significant bit, and which is 0.5°C. But in this project we will use only
the most significant eight bits. Therefore, the temperature resolution will be 1°C.
The measured temperatures will be recorded into the internal EEPROM memory
of PIC12F683.The first location of the internal EEPROM will store the sampling
interval of data logger. Sampling interval defines the time gap between two
successive measurements. This project will have 3 options for sampling time: 1
sec, 1 min, and 10 min. These are user selectable. The second location of
EEPROM will store the number of measurements recorded so far. And the
remaining 254 EEPROM locations will store 8bit temperatures. So, using 10 min
sampling interval, 254 bytes of EEPROM will provide data logging for 42 hours.
The recorded measurements can be sent to PC at any time through a serial link at
9600 bauds.

Haider Hashim 7|Page


5.2 User inputs
There will be three tact switches for user inputs, namely Start, Stop, and
Send/Reset. The three switches will be able to accept the following 4 user
requests. Start: When ‘Start’ button is pressed, data logging starts. Stop: Once the
‘Stop’ button is pressed; data recording will stop. Send: Transfer data to PC
through serial port. Reset: Holding the ‘Send’ button for 2 sec or more clears the
internal EEPROM memory.

5.3 Sampling time selection


The sampling interval can be selected as 1 sec, 1min, or 10 min using the
same three switches. Suppose if we need 1 min sampling time, first turn OFF the
power, then hold the ‘Stop’ button, turn the power ON, and wait till the LED
glows. Once the LED glows, release the button, and the sampling interval will be
set to 1 min. The new set sampling time will be updated to EEPROM location 0
so that in case of power failure, the previous sampling time will be restored.
Similarly, use ‘Start’ and ‘Send’ buttons for 1 sec, and 10 min sampling intervals
respectively. LED Indicator Every time the user presses input buttons, LED glows
for a moment to indicate that the input is accepted. It also blinks thrice every time
EEPROM Write operation takes place. It also blinks at the beginning when the
power is turned ‘ON’. It also glows when the EEPROM memory is full.

Haider Hashim 8|Page


5.4 Circuit diagram
The complete circuit diagram for this project is shown below.

5.5 List of components

• PIC12F683 microcontroller
• DS1820 temperature sensor
• BC557 NPN transistor
• Resistors: 10K (4), 4.7K (2), 470 Ohm (1)
• Capacitor: 10uF, 50V (1)
• LED (1)
• Tact switches (3)

Haider Hashim 9|Page


5.6 Serial Interface to PC
Transferring data to PC through serial port requires a voltage translation
circuit to convert the TTL logic levels from PIC12F683 to appropriate RS232
voltage levels. A regular PNP transistor with few other passive components can
do this job. The RS232 standard uses a -3 to -12 V for Logic 1 and +3 to +12 V
for Logic 0. The required negative voltage is stolen from the TX pin of the RS232
port on PC’s side which is unused as there won’t be any data transfer from the
PC to PIC12F683. Under idle condition the TX pin on PC’s side is held high (-
12 V). The two figures below describe the operation of converting TTL levels for
1 and 0 to corresponding RS232 levels. The positive terminal of the 10 uF
capacitor is grounded because its negative terminal has to deal with a more
negative voltage.

Haider Hashim 10 | P a g e
5.7 Software of application
The firmware for PIC12F683 is developed in C using mikroC Pro for
PIC compiler from mikroElektronika. PIC12F683 doesn’t have built-in hardware
UART module for serial communication but the mikroC compiler has built-in
library routines to implement software UART through any digital I/O pin of PIC
microcontroller. Due to wide use of DS18B20 sensor for temperature
measurements, mikroC also provides 1-wire library routines for controlling the
operation of this sensor. The built-in functions for communicating with a 1-wire
sensor are:
▪ Ow_Reset is used for reseting sensor.
▪ Ow_Read is used for receiving data from sensor.
▪ Ow_Write is used for sending commands to sensor.

MikroC also provides EEPROM library for read and write operations to internal
EEPROM locations. The overall programming is made much easier with the
help of these built-in library functions of mikroC.

The configuration bits setup for PIC12F683 can be done through Edit Project
window in mikroC. The figure below shows the required settings for this project.

Haider Hashim 11 | P a g e
Programming sequence
When the circuit is powered on, the LED blinks for 3 times that shows the
data logger is turned on and being initiated. The program checks for any key
pressed for setting sampling interval. If yes, it identifies the key and store the
appropriate sampling interval information to EEPROM location 0. The LED is
turned on to indicate that the sampling interval has been set and it’s time to release
the pressed key. The program is now inside the main loop. The three switches
(Start, Stop and Send/Reset) operate in Interrupt-on-change mode, which means,
any time the button is pressed, an interrupt is generated. Pressing the Start button
begins data recording. Each time a temperature sample is recorded in to the
EEPROM, the LED blinks to indicate that the logging process is going on.
Pressing the Stop button will interrupt this process, while Send will initiate the
serial transfer of recorded samples through GP1 pin (6). If the Send button is
pressed for more than 2 sec, the entire EEPROM locations will be cleared.

On PC’s side, the hyperterminal program is used to receive logged temperature


data from PIC12F683. The rate of data transfer is set to 9600 bauds on both end.
The figure below shows the hyperterminal settings for this project.

Haider Hashim 12 | P a g e
5.8 Flowchart of the data logger system application

Haider Hashim 13 | P a g e
6. Discussion

Temperature sensors have been interfaced with the microcontroller

successfully and the EEPROM have been successfully interfaced to the

microcontroller. So that EEPROM is successfully storing the logged data with

the time and date tag. The sensor data has been displayed on monitor and LCD

module. A simple GUI has been designed with the help of that we are capable to

store a logged data to a text file so that it can be analyzed further.

7. Conclusions and Result

The data logger system Using PIC EEPROM to read the values from the

sensor on regular interval basis and stores them in its EEPROM is an inexpensive

and simple solution to the collection of temporal and spatial field data for

numerous research and educational endeavors. It can be integrated with a large

array of available sensors. The schematics, circuit board layouts, parts list,

suppliers, PIC and host software.

Haider Hashim 14 | P a g e
References
[1] Watanabe, Mikio, Akira Aoki, and Osamu Saito. "Memory card management
system for writing data with usage and recording codes made significant." U.S.
Patent No. 5,590,306. 31 Dec. 1996.

[2] Rajavignesh, G. H., and B. Rajasekar. "Data Logging of Boiler Temperature


Using Real Time Operating System." (2006).

[3] Pfender, Marion, and Heinrich Villinger. "Miniaturized data loggers for deep
sea sediment temperature gradient measurements." Marine Geology 186.3-4
(2002): 557-570.

[4] Garner, Richard P. "Method for releasing space in flash EEPROM memory
array to allow the storage of compressed data." U.S. Patent No. 5,337,275. 9 Aug.
1994.

[5] Bartholow, John M. Stream temperature investigations: field and analytical


methods. No. 13. US Fish and Wildlife Service, 1989.

[6] Daniel K, Fisher, and Gould Peter J. "Open-source hardware is a low-cost


alternative for scientific instrumentation and research." Modern
instrumentation 2012 (2012).

Haider Hashim 15 | P a g e

You might also like