Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Acknowledgement ....................................................................................................................................... 1
INTRODUCTION....................................................................................................................................... 2
WORKING PRINCIPLE AND DETAILED THEORY ......................................................................... 3
CIRCUIT DESCRIPTION AND DESIGNS .......................................................................................... 15
RESULT AND ANALYSIS ...................................................................................................................... 20
CONCLUSION ......................................................................................................................................... 24
REFERENCES .......................................................................................................................................... 25
Individual Assignment
Page 1 of 25
Acknowledgement
This assignment is about Digital Temperature Sensor using the 8051 microcontroller. This
assignment has helped me to have a great command over electronic device and 8051 micro
controller. I humbly thank my institution, Asia Pacific Institute of Information and Technology,
who organized such an acknowledging and fundamental based assignment.
I would like to thank my module lecturer Mr. Akhil Gupta who spared his valuable time for
explaining us the assignment and pointing out our mistakes that we committed while making the
assignment.
I am also thankful to my friends and classmates. They have helped me in understanding the
conditions and the assignment.
Level 2
2015
Individual Assignment
Page 2 of 25
INTRODUCTION
The project aims at designing a digital temperature sensor with the help of 8051 whose hardware
and software have to be integrated in order to simulate the circuit in such a way that it would
sense the rise and fall of temperature and hence display it on the two seven segment display.
Other than the microcontroller, temperature sensor is also one of the important component that
has be used in the project. The commonly used sensor vary from simple ON/OFF thermostatic
devices which control a domestic hot water heating system to highly sensitive semiconductor
types that can control complex process control furnace plants. Generally, there are two types of
temperature sensor
1. Contact temperature sensor
2. Non-contact temperature sensor
Microcontroller plays the part of integrating the hardware and software. Basically it is a small
computer on a single integrated circuit containing a processor core, memory and programmable
input/output peripherals. The first microprocessor was the 4-bit intel 4004 which was released in
1971 and other more capable microprocessors becoming available over the next several years.
Inside the microcontroller there is a central processing unit (CPU), program memory, data
memory, I/O ports, serial communication interface (USART), etc. In general, no external
interfacing is necessary with memory or I/O device to make any microcontroller based circuit
working. In most cases, any external quartz crystal (for system clock), a reset circuit working. In
most of cases, an external quartz crystal (for most of system clock) and a DC power supply
(sometimes even from batteries) are sufficient to make such a unit operation.
Digital temperature sensors provide high measurement accuracy accompanied by low power
consumption and user friendly system integration capability. They are ready-to-use with factoryset calibration coefficients which makes them an ideal replacement of complex circuitries for
temperature sensor conditioning.
Level 2
2015
Individual Assignment
Page 3 of 25
Level 2
2015
Individual Assignment
Page 4 of 25
Component Description
RESISTOR
It is a two terminal electrical components that is passive in nature and provides electrical
resistance in circuits in other words regulates the flow of current in the circuit.
Figure 2: - Resistor
Types of resistors: 1. Metal film resistors: - These are also known as metallized resistor in which the resistive
element is made up of a metal, metal oxide or alloy. The alloy is then deposited on an
insulating substrate such as ceramic. They have excellent operational characteristics,
including low noise and minimal drift.
2. Foil resistors: - A foil resistor is made up of special foil having thickness few micrometres. It
has the best precision and stability of any available resistor.
3. Carbon film resistors: - It is made up of an insulating substrate and a helix is cut to create a
narrow resistive path. A wide range of resistance values can be provided with the help of
varying shapes which is coupled with the resistivity of amorphous carbon.
4. Fuse resistors: - It is a low value resistor which is used as fuse and is utilized for protecting a
circuit, device or system when power is applied for the first time.
5. Precision wire wound: - It is an electrical passive component that limits current in which the
resistive element is on the outer surface of the insulated metallic wire wounded around a core
of nonconductive substance. The material used in wire is of high resistivity and is made up of
alloys namely manganin and nichrome. Ceramic, plastic and glass are the common core
material used. It has good accuracy and has excellent properties for low resistance values and
high power ratings.
Level 2
2015
Individual Assignment
Page 5 of 25
6. Fixed resistors: - It has fixed and defined electrical resistance which cannot be adjusted.
7. Variable resistors: - It is used to vary the amount of current flowing in a circuit. The working
is done on a sliding a wiper terminal across a resistive material which is mainly chunk of
carbon or a wire made of tungsten alloys.
CAPACITOR
A two terminal electrical component which stores electrical energy in an electric field. In its
simplest form it consists of two conducting plates separated by an insulating material known as
dielectric. The capacitance of a capacitor is dependent on to the surface area of plates which is
directly proportional to it and inversely proportional to the separation between plates. Dielectric
medium in between them also has an important role to play.
Classification of capacitor: On the basis of physical construction there are two types of capacitors: 1. Fixed capacitor: - Such capacitors whose values cannot be varied mechanically or with
the
help of any external means like thermal or any other physical stresses is known as fixed
capacitor. Such capacitors have dielectric permanently placed in between the plates.
2. Variable capacitor: - The value of the capacitor can be varied according to conditions. It
consists of several plates in two stacks in which one is fixed while other can be moved. With
the help of it the overlapping area can be altered thus varying the capacitance. There are two
types of variable capacitor namely tunning and trimmer capacitor.
On the basis of dielectric used: 1. Non-Electrolytic capacitor: - Dielectric used in this type of capacitor is paper, ceramic or
mica.
There are two types of Non-electrolytic capacitor:
1.1. Paper capacitor: - Kraft paper is sandwiched between two aluminium foils which acts as
a conducting parallel plates. Then it is rolled to form a cylinder. The whole unit is
covered with wax coating when the external connectors are soldered on to the two foils.
Level 2
2015
Individual Assignment
Page 6 of 25
1.2. Ceramic capacitor: - Ceramic is used as a dielectric material in the given capacitor. It
can be of any size and shape usually disk, bead and tubular structure.
2. Electrolytic capacitor: - In this type of capacitor electrolyte works as a dielectric. When two
electrodes is immersed in an electrolytic solutions they form the plates if the capacitor. Due
to chemical reaction, a thin oxide film is generated around one of the electrodes and thus the
film acts as a dielectric for the capacitor.
Types of electrolytic capacitor:
2.1. Polarized electrolytic capacitor: - In this capacitor the oxide film is highly polarized.
2.2. Non-polarized electrolytic capacitor: - It is used in AC application where capacitors
having large values are required and DC polarization value is not available.
2.3. Tantalum electrolytic capacitor: - The capacitors anode is made by pressing tantalum
powder to form a solid cylinder then it is baked at high temperature to form a highly
porous solid unit.
Figure 3: - Capacitor
BATTERY
It is an electrical device which consist of electrochemical cell that are used for converting the
stored chemical energy into electrical energy. Cells have positive terminal known as cathodes
and negative terminal known as anode. The electrolyte in the cell allows ions to move in between
the terminals so as to start current flow and help battery perform its work.
Battery can further be divided into two types:
Level 2
2015
Individual Assignment
Page 7 of 25
1. Primary batteries: - They irreversible in nature and transforms chemical energy into
electrical energy. Once the reactants supplies are exhausted then energy cannot be
resorted to the battery.
2. Secondary batteries: - They are rechargeable in nature and the chemical reactions in them
can be reversed so as to reuse the energy stored.
Battery cell types:
1. Galvanic cells
2. Electrolytic cells
3. Fuel cells
4. Flow cells
5. Wet cells
6. Dry cells
7. Molten salt
8. Reserve cell
PCB
It supports mechanically the connection of electronic components with the help of conductive
tracks and other features that are etched from copper sheets laminated onto a non-conductive
substrate. It can be single sided, double sided or multi-layer. They are manufactured with the
help of Laminates, Copper-clad laminates, Resin impregnated B-stage cloth or copper foil. It
used to place components and provides means for connecting. They are inexpensive, reliable and
can be easily mass produced. For the accomplishment of circuit patterns additive and subtractive
methods are used.
Level 2
2015
Individual Assignment
Page 8 of 25
MICROCONTROLLER
A microcontroller is device, which contains all the device necessary to form working system, in
a single chip. Therefore, inside the microcontroller we find a central processing unit (CPU),
program memory, data memory, I/O ports, serial communication interface (USART), etc. In
general, no external interfacing is necessary with memory or I/O device to make any
microcontroller based circuit working. In most cases, any external quartz crystal (for system
clock), a reset circuit working. In most of cases, an external quartz crystal (for most of system
clock) and a DC power supply (sometimes even from batteries) are sufficient to make such a unit
operation.
A microcontroller is a device which is capable of continuously fetching and exciting data
instruction after instruction, as long as its switch is not off. These instructions are electronic
instruction generally represented by a group of bits. Fetching denotes bringing these instructions
from their storage area, which is designated as memory. The term execution means performing
athematic, logical or control operations. With respect to the human, the speed of human world,
the speed of execution is very fast. The fastest human may tape a computer key, says, five times
in second. On other hand, processor is capable of executing a million of instruction within
second. To negotiate between very fast and superbly slow operation of these two entities, some
special mechanism is necessary. The mechanisms or device are designed to input or output ports,
depending upon their function, or simply ports.
The key features of microcontrollers include:
High Integration of Functionality
Level 2
2015
Individual Assignment
Page 9 of 25
Microcontrollers sometimes are called single-chip computers because they have on-chip
memory and I/O circuitry and other circuitries that enable them to function as small
standalone computers without other supporting circuitry.
Field Programmability, Flexibility
Microcontrollers often use EEPROM or EPROM as their storage device to allow field
programmability so they are flexible to use. Once the program is tested to be correct then
large quantities of microcontrollers can be programmed to be used in embedded systems.
Easy to Use
Assembly language is often used in microcontrollers and since they usually follow RISC
architecture, the instruction set is small. The development package of microcontrollers
often includes an assembler, a simulator, a programmer to "burn" the chip and a
demonstration board. Some packages include a high level language compiler such as a C
compiler and more sophisticated libraries.
Most microcontrollers will also combine other devices such as: A Timer module to allow the microcontroller to perform tasks for certain time periods.
A serial I/O port to allow data to flow between the microcontroller and other devices such
as a PC or another microcontroller.
An ADC to allow the microcontroller to accept analogue input data for processing.
The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited
to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short and
Standard chips are often available in DIP (dual in-line package) form, but the Extended 8051
models often have a different form factor, and are not "drop-in compatible". All these things are
called 8051 because they can all be programmed using 8051 assembly language, and they all
share certain features (although the different models all have their own special features).
Feature of 8051
1. 8 kb programmable flash.
2. 4kb on chip program memory.
3. 128 bytes on chip data memory (RAM).
4. 16 bit address bus.
5. 16 bit program counter.
Level 2
2015
Individual Assignment
Page 10 of 25
Figure 6: - MICROCONTROLLER
2015
Individual Assignment
Page 11 of 25
maximum of 255. The step size can be adjusted by setting the reference voltage at pin9. When
this pin is not connected, the default reference voltage is the operating voltage, i.e., Vcc. The step
size at 5V is 19.53mV (5V/255), i.e., for every 19.53mV rise in the analog input, the output
varies by 1 unit. To set a particular voltage level as the reference value, this pin is connected to
half the voltage. For example, to set a reference of 4V (Vref), pin9 is connected to 2V (Vref/2),
thereby reducing the step size to 15.62mV (4V/255).
ADC0804 needs a clock to operate. The time taken to convert the analog value to digital value is
dependent on this clock source. An external clock can be given at the Clock IN pin. ADC 0804
also has an inbuilt clock which can be used in absence of external clock. A suitable RC circuit is
connected between the Clock IN and Clock R pins to use the internal clock.
Level 2
2015
Individual Assignment
Page 12 of 25
determined by the data on D0 to D3. When LE goes HIGH, the last data present on D0 to D3 is
stored in the latches and the segment outputs remain unchanged. When LT is LOW, all of the
segment outputs are HIGH independent of all other input conditions. With LT HIGH, a LOW on
BL forces all segment outputs LOW. The inputs LT and BL do not affect the latch circuit. It
operates over a recommended VDD power supply range of 3 V to 15 V referenced to VSS
(usually ground). Unused inputs must be connected to VDD, VSS, or another input.
Feature
1. Fully static operation 5 V, 10 V, and 15 V parametric ratings
2. Standardized symmetrical output characteristics.
3. Specified from 40 C to +85 C and 40 C to +125 C.
Figure 8: - BCD
7 SEGMENT DISPLAY
A seven-segment display can be used to display the decimal numbers 0-9 and some alpha
characters. A Seven-Segment Display (SSD) is simply a figure eight grouping of LEDs {some
include a decimal point (DP)}.
SSDs are available in two configurations
1. Common Cathode (all LED cathodes are connected)
2. Common Anode (all LED anodes are connected)
Level 2
2015
Individual Assignment
Page 13 of 25
CRYSTAL OSCILLATOR
An electronic circuit or electronic device that is used to generate periodically oscillating
electronic signal is called as an electronic oscillator. The electronic signal produced by an
oscillator is typically a sine wave or square wave. An electronic oscillator converts the direct
current signal into an alternating current signal. The radio and television transmitters are
broadcasted using the signals generated by oscillators. The electronic beep sounds and video
game sounds are generated by the oscillator signals. These oscillators generate signals using the
principle of oscillation.
An electronic circuit that is used to generate an electrical signal of precise frequency by utilizing
the vibrating crystals mechanical resonance made of piezoelectric material. There are different
types of piezoelectric resonators, but typically, quartz crystal is used in these types of oscillators.
Hence, these oscillator electronic circuits are named as crystal oscillators.
Level 2
2015
Individual Assignment
Page 14 of 25
LM 35
LM35 is a precision IC temperature sensor with its output proportional to the temperature
(in oC). The sensor circuitry is sealed and therefore it is not subjected to oxidation and other
processes. With LM35, temperature can be measured more accurately than with a thermistor. It
also possesses low self-heating and does not cause more than 0.1 oC temperature rise in still air.
The operating temperature range is from -55C to 150C. The output voltage varies by 10mV in
response to every oC rise/fall in ambient temperature,i.e., its scale factor is 0.01V/ oC.
Figure 11: - LM 35
Level 2
2015
Individual Assignment
Page 15 of 25
Block C ADC0804: Then the ADC converts the received analog signal into digital for and then it is sent to the
microcontroller.
Level 2
2015
Individual Assignment
Page 16 of 25
Block B Microcontroller: The work of the micro controller is to further send the signal in a controlled manner it acts
according to the instructions embedded in to it. It sends the signal to BCD.
Block D Decoder & Display: The BCD does the work of decoding as it converts the binary digital signal in to decimal form
and then it is displayed on the 7 segment accordingly.
Level 2
2015
Individual Assignment
Page 17 of 25
Hardware circuit
Front view of working circuit
Level 2
2015
Individual Assignment
Page 18 of 25
Source code
# include <reg51.h>
sbit R0=P3^0;
sbit R1=P3^1;
sbit R2=P3^2;
sbit R3=P3^3;
sbit R4=P3^4;
sbit R5=P3^5;
sbit R6=P3^6;
sbit R7=P3^7;
sbit R=P1^6;
sbit CS=P1^7;
//
sbit W=P1^5;
sbit INTR=P1^4;
void delay();
// delay function
adc_read();
void delay(int b)
// delay function
{
int j;
Level 2
// Defining variable.
Asia Pacific Institute of Information Technology
2015
for(j=0;j<b;j++);
Individual Assignment
Page 19 of 25
}
adc_read()
{
CS=0;
R=1;
W=0;
W=1;
while(INTR!=0)
CS=0;
R=0;
}
main ()
{
unsigned char j,x,y; // defining character
P2=0;
P0=0;
while(1)
// infinite loop
{
adc_read();
j=P3;
x=(i)*1/10;
y=(i)*1%10;
P2=y;
P0=x;
delay(10000); //Delay Function.
}
Level 2
2015
Individual Assignment
Page 20 of 25
Temperature
Pin -A
Pin-B
Pin-C
Pin-D
Pin-E
Pin-F
Pin-G
1.50V
1.50V
0V
1.50
1.50V
1.50
1.50V
0V
1.50V
1.50V
1.50V
1.50v
1.50v
0V
0V
1.50V
0V
1.50V
1.50V
0V
0V
1.50V
1.50V
1.50V
0V
1.50V
1.50V
1.50V
1.50V
1.50V
Temperature
Pin -A
Pin-B
Pin-C
Pin-D
Pin-E
Pin-F
Pin-G
1.39V
1.450V
0.1V
0.1V
0V
0V
1.40
1.46V
0V
1.48V
1.38V
0V
1.29V
1.50V
1.50V
1.30V
1.50v
0V
0V
1.49V
0.3V
1.470V
1.50V
0V
0V
1.48V
1.40V
1.50V
0V
1.50V
1.50V
1.50V
1.50V
1.50V
Level 2
2015
Individual Assignment
Page 21 of 25
Temperature
Port3.0
Port3.1
Port3.2
Port3.3
Port3.4
0.02
0.02V
0.02V
0.02
0.02
0.02
0.02V
4.99V
0.02V
0.02V
0.02
4.99V
4.99v
4.99v
0.02V
0.02V
4.99V
0.02V
0.02V
0.02V
0.02V
0.02
4.99V
4.99V
0.02V
Temperature
Port3.0
Port3.1
Port3.2
Port3.3
Port3.4
0.01
0.01V
0.01V
0.01V
0.01V
0.01
0.02V
4.90V
0.01V
0.01V
0.01V
4.89V
4.35v
4.34v
0.01V
0.02V
4.56V
4.87V
4.78V
4.88V
0.01V
0.01V
4.78V
4.67V
0.01V
100
0.020.0119
0.02
100
Percentage error =6 %
Level 2
2015
Individual Assignment
Page 22 of 25
Graph: 40
30
31
32
33
0.3
0.31
0.32
0.33
35
Temperature
30
27
28
29
0.27
0.28
0.29
34
35
36
0.34
0.35
0.36
25
20
15
10
5
0
Observation: Observation table of Output value of LM35 at different temperature: Practical Value: Table1: Observation table of output voltage of LM35
S.No.
Temperature
1.
25
0.25
2.
26
0.26
3.
27
0.27
4.
28
0.28
5.
29
0.29
6.
30
0.30
Level 2
2015
Individual Assignment
Page 23 of 25
S.No.
Temperature
1.
25
0.249
2.
26
0.259
3.
27
0.269
4.
28
0.278
5.
29
0.2.89
6.
30
0.298
100
0.250.24
0.25
100
Level 2
2015
Individual Assignment
Page 24 of 25
CONCLUSION
The project was based on the study of temperature sensor, microcontroller and basic coding in
Keil microvision. This project involves the knowledge of digital as well as analog electronics
with the implementation of basic c language.
Firstly, a working design of circuit was made on the proteus according the need of the project
and then a hardware part was made to see its working and implementation in real world. The
working of the circuit involved certain steps like sensing of temperature by the temperature
sensor which gave the output in the form of analog signal which was then converted into digital
signal with the help of ADC. The ADC generated digital signal then sent to microcontroller
which have instructions embedded on it and thus further signal is sent according to the
instruction provided. The signal is then decoded by BCD into binary form which is then
displayed on the seven segment.
The project was interesting and hard involved studying of research papers and consulting books
it was a good practical experience.
Level 2
2015
Individual Assignment
Page 25 of 25
REFERENCES
A. 8051microcontrollers.com, (2015). Interfacing-LM35-Temperature-Sensors-8051Microcontrollers | Interface-lm-35-89S51-89S52-Microcontrollers. [Online]. 2015.
Available from: http://www.8051microcontrollers.com/interfacing-8051-a/interfacingsensor-8051-microcontroller-lm35-temperature-sensor-j-6. [Accessed: 14 November
2015].
B. Circuitstoday.com, (2012). Digital thermometer using 8051. LM35 temperature sensor
and ADC0804 analogue to digital converter. [Online]. 2012. Available from:
http://www.circuitstoday.com/thermometer-using-8051. [Accessed: 14 November 2015].
C. Electronics Hub, (2015). Celsius Scale Thermometer using AT89C51 and LM35.
[Online]. 2015. Available from: http://www.electronicshub.org/celsius-scalethermometer-using-at89c51-and-lm35/. [Accessed: 14 November 2015].
D. Embedded Lab, (2010). A Digital temperature meter using an LM35 temperature sensor Embedded Lab. [Online]. 2010. Available from: http://embedded-lab.com/blog/?p=916.
[Accessed: 14 November 2015].
E. Engineersgarage.com, (2015). ADC0804 Datasheet | ADC 0804 Pin Diagram &
Description - EngineersGarage. [Online]. 2015. Available from:
http://www.engineersgarage.com/electronic-components/adc0804-datasheet. [Accessed:
14 November 2015].
F. George, L. (2012). Digital Thermometer using PIC Microcontroller and LM35. [Online].
2012. electroSome. Available from: https://electrosome.com/thermometer-picmicrocontroller-lm35/. [Accessed: 14 November 2015].
G. MIcrocontroller Projects, (2015). Measuring room temperature using 89c51
microcontroller. [Online]. 2015. Available from: http://www.microcontrollerproject.com/room-temperature-with-89c51-microcontroller.html. [Accessed: 14
November 2015].
H. MyClassBook, (2014). Digital Thermometer using 8051 microcontroller - mini project MyClassBook. [Online]. 2014. Available from: http://www.myclassbook.org/digitalthermometer-using-8051-microcontroller-mini-project/. [Accessed: 14 November 2015].
Level 2
2015