0% found this document useful (0 votes)
49 views18 pages

Microprocessors and Microcontrollers Submission P

Uploaded by

dakshmanchanda30
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)
49 views18 pages

Microprocessors and Microcontrollers Submission P

Uploaded by

dakshmanchanda30
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

WINTER SEMESTER – 2024/25

B-TECH ELECTRONICS AND COMMUNICATION


ENGINEERING
MICROPROCESSORS AND MICROCONTROLLERS
BECE204L

PROJECT TITLE
TEMPERATURE ALARM SYSTEM USING THE 8051
MICROCONTROLLER

PRESENTED BY –
DAKSH MANCHANDA
22BEC0421
UNDER THE GUIDANCE OF-
DR. RAGUNATH G
PROJECT ABSTRACT

With the help of an 8051 microcontroller, this project aims to help detect and
notify when the temperature reaches a certain value. The temperature threshold
is user-defined and can be set to any specific value based on the requirement,
making the system flexible for different use cases. In this instance, the
temperature to be detected is set as 100. On detection, the microcontroller will
turn the LED, connected to one of its ports, on (or set to a high state).

The microcontroller receives temperature data from a sensor through an analog-


to-digital converter (ADC), which converts the analog signal from the sensor
into a digital form that the microcontroller can process. This real-time digital
temperature data is constantly monitored against the set threshold.

To enhance functionality and make the system more user-friendly and versatile,
several additional components have been integrated:

 A buzzer is used to provide an audible alert when the threshold


temperature is reached, ensuring immediate attention.
 An LCD display is used to show the current temperature and system
status messages, enabling real-time monitoring directly from the system.
 Through UART (Universal Asynchronous Receiver-Transmitter), the
microcontroller can communicate the temperature readings and alert
messages to external devices such as computers or serial terminals for
remote monitoring or logging.
 A relay module is added for controlling external loads (like fans, heaters,
or alarms). When the temperature crosses the defined limit, the relay is
activated or deactivated automatically to manage the connected device,
thereby enabling automated safety or control responses.

This system is ideal for applications in industrial safety, laboratory automation,


smart home environments, and any setup where temperature control and
monitoring are critical. The combination of visual, audible, and electronic
responses ensures a reliable and multi-modal alert system. The flexibility to set
any desired temperature threshold and the integration of load handling and
communication capabilities make this a robust and scalable embedded solution.
THEORY

Temperature monitoring and control systems are a crucial part of


modern automation and embedded technologies. These systems are
designed to sense temperature levels in an environment, process the
data, and take appropriate action based on predefined conditions.
They form the foundation of numerous applications across industries
such as manufacturing, healthcare, agriculture, consumer electronics,
and home automation.

At the heart of such systems lies the concept of sensor interfacing,


where a temperature sensor (such as LM35, thermistor, or RTD) is
used to detect temperature variations. These sensors typically produce
analog signals proportional to the temperature being measured. Since
microcontrollers cannot process analog signals directly, the use of an
Analog-to-Digital Converter (ADC) becomes essential. The ADC
converts the analog signal into a digital value that the microcontroller
can understand and process.

Microcontrollers play a central role in such systems. They are


compact, programmable devices capable of reading inputs, executing
instructions, and controlling outputs. Microcontrollers continuously
monitor the digital temperature readings and compare them with a
preset threshold or user-defined value. Based on this comparison,
specific outputs can be triggered—such as activating alarms,
controlling fans, or sending notifications—thus automating the
decision-making process.

To make these systems user-friendly and functional, additional


peripherals are often integrated. LEDs can be used to indicate
warning states visually. Buzzers provide audible alerts. LCD
displays or other interfaces offer real-time feedback to users. UART
communication allows the system to transmit data to external devices
like PCs or other microcontrollers for further processing, monitoring,
or logging. Relay modules are widely used for switching high-
voltage devices based on the microcontroller's decisions, allowing the
system to control external loads safely.

The relevance of such systems has increased significantly with the


rise of smart environments and industrial automation. They enhance
safety by detecting abnormal temperature conditions, improve energy
efficiency by regulating heating or cooling devices, and ensure the
longevity of sensitive equipment by maintaining optimal temperature
conditions.

In real-life applications, temperature control systems are


everywhere—from air conditioners and refrigerators in homes to
boilers and engines in industries. In agriculture, such systems help
monitor greenhouse conditions. In medical environments, they ensure
the correct storage temperature of vaccines and medicines. In
electronics, they prevent overheating of components like processors
and power supplies. These systems are also widely used in
environmental monitoring, food processing, and fire detection.

In summary, the theory behind temperature monitoring systems


involves sensing, digitization, processing, and controlled output. By
combining sensors, microcontrollers, communication modules, and
actuators, these systems form intelligent solutions that respond
dynamically to environmental changes. They exemplify how
embedded systems can bring real-time automation, safety, and control
to both industrial and everyday applications. Understanding this
theory provides a solid foundation for designing responsive, adaptive,
and efficient systems in a wide range of engineering domains.
COMPONENTS USED

•-8051 Microcontroller (P89V51RD2)


•-ADC 0804
•-LED - LM35
•-Temperature Sensor Software Used:
•-Kiel uVision
•-Proteus

FLOWCHART
BLOCK DIAGRAM

WORKING MODEL

The temperature monitoring and alert system is designed using the


8051 microcontroller as the central unit. A temperature sensor, such
as the LM35, is used to sense the ambient temperature in real time
and provide a corresponding analog voltage as output. This analog
voltage is continuously fed into an analog-to-digital converter (ADC),
which converts the signal into an 8-bit digital value. The ADC is
interfaced with the microcontroller using ports P1 and P2—port P1
handles the digital data lines, while control signals like ALE, START,
EOC, and OE are managed via port P2. The 8051 microcontroller
sends control pulses to initiate conversion and then reads the digital
temperature value from the ADC. Once the digital value is received,
the microcontroller compares it to a predefined threshold temperature
value, which can be set by the user to detect any specific temperature
level based on the application.
If the current temperature remains below the set threshold, the system
indicates normal operating conditions. In this state, the LED
connected to pin P3.0 remains turned off, the buzzer stays silent, the
relay is inactive, and the LCD displays a message indicating that the
system is functioning within safe temperature limits. Additionally, no
data is sent via the UART port, ensuring the system operates silently
during normal conditions. However, if the sensed temperature reaches
or exceeds the user-defined limit, the microcontroller triggers several
alert mechanisms. The LED connected to P3.0 is turned on to visually
indicate an over-temperature condition. Simultaneously, the buzzer is
activated to provide an audible warning signal. A relay connected
through a driver transistor is energized to control or shut down an
external load such as a fan, heater, or alarm system, depending on the
need of the application.

The LCD, a 16x2 alphanumeric module, displays the real-time


temperature and status messages such as "Overheat Detected" or
"High Temp Alert" to inform the user. Meanwhile, the UART module
sends a serial alert signal to a connected PC, serial monitor, or
wireless device, providing remote notification of the event. This setup
allows the system to be monitored and managed from a distance,
adding convenience and safety. A software delay is included in the
microcontroller code to ensure visibility of the status changes and to
prevent rapid flickering of the indicators. The entire process is coded
using Embedded C in the Keil µVision IDE, compiled into a hex file,
and then simulated using Proteus software for circuit verification and
virtual testing. Proteus also allows the use of a virtual potentiometer
to simulate varying temperature values during testing.

This project runs in an infinite loop, constantly checking for


temperature changes and responding accordingly, ensuring real-time
operation. The system is highly scalable and can be enhanced further
with features like wireless data logging, mobile notifications, keypad
input for threshold setting, and multi-zone temperature monitoring.
This combination of hardware control, real-time data processing, and
alert mechanism makes it suitable for practical applications such as
industrial automation, server room monitoring, smart agriculture, and
household safety systems.
PROTEUS SCHEMATIC

KEIL CODE

ORG 0000H

;-------------------------
; LCD + UART setup
;-------------------------
MOV SCON, #50H ; Serial mode 1, REN enabled
MOV TMOD, #20H ; Timer 1 Mode 2 (Auto-reload)
MOV TH1, #0FDH ; Baud rate 9600 (11.0592 MHz)
SETB TR1 ; Start Timer 1
; LCD Initialization
ACALL LCD_INIT
ACALL LCD_CLR
ACALL LCD_HOME
MOV DPTR, #MSG_WELCOME
ACALL LCD_PRINT

;-------------------------
; Main loop
;-------------------------
MAIN:
ACALL RX_CHAR ; Wait for character
MOV A, R7
CJNE A, #'O', MAIN
ACALL RX_CHAR ; Expect 'N' or 'F'
MOV A, R7
CJNE A, #'N', CHECK_OFF

; "ON" received
SETB P2.0 ; Relay ON (via transistor)
SETB P1.0 ; Buzzer ON
ACALL DELAY
CLR P1.0 ; Buzzer OFF
MOV DPTR, #MSG_ON
ACALL LCD_CLR
ACALL LCD_PRINT
SJMP MAIN

CHECK_OFF:
CJNE A, #'F', MAIN
ACALL RX_CHAR
MOV A, R7
CJNE A, #'F', MAIN

; "OFF" received
CLR P2.0 ; Relay OFF
MOV DPTR, #MSG_OFF
ACALL LCD_CLR
ACALL LCD_PRINT
SJMP MAIN

;-------------------------
; Subroutines
;-------------------------
LCD_INIT:
; Add LCD initialization steps here (function set, display ON, etc.)
RET

LCD_CLR:
MOV A, #01H
ACALL LCD_CMD
ACALL DELAY
RET
LCD_HOME:
MOV A, #02H
ACALL LCD_CMD
ACALL DELAY
RET

LCD_CMD:
MOV P3, A
CLR P3.2 ; RS = 0
CLR P3.3 ; RW = 0
SETB P3.4 ; EN = 1
ACALL SHORT_DELAY
CLR P3.4 ; EN = 0
RET

LCD_DATA:
MOV P3, A
SETB P3.2 ; RS = 1
CLR P3.3 ; RW = 0
SETB P3.4 ; EN = 1
ACALL SHORT_DELAY
CLR P3.4 ; EN = 0
RET

LCD_PRINT:
CLR A
MOVC A, @A+DPTR
JZ END_PRINT
ACALL LCD_DATA
INC DPTR
SJMP LCD_PRINT
END_PRINT:
RET

RX_CHAR:
JNB RI, RX_CHAR
CLR RI
MOV R7, SBUF
RET

DELAY:
MOV R2, #200
D1: MOV R1, #255
D2: DJNZ R1, D2
DJNZ R2, D1
RET

SHORT_DELAY:
MOV R1, #50
D3: DJNZ R1, D3
RET

;-------------------------
; Data Section
;-------------------------
MSG_WELCOME: DB "Relay Ctrl Ready", 0
MSG_ON: DB "Relay is ON", 0
MSG_OFF: DB "Relay is OFF", 0

END

KEIL NO ERRORS
KEY FEATURES

The system is designed to provide real-time temperature monitoring


using an LM35 analog temperature sensor. This sensor continuously
measures the ambient temperature and provides an analog voltage
proportional to the current temperature. The readings are updated in
real-time, making the system suitable for scenarios where immediate
temperature changes must be tracked and responded to.

A threshold-based alert system is implemented where the


microcontroller is programmed to detect a temperature of 100°C.
Once the sensor reading exceeds this value, the system triggers a
visual alert by turning on an LED. This threshold-triggered approach
provides a basic but effective early warning mechanism for over-
temperature conditions.

An 8051 microcontroller forms the processing core of the system. It


efficiently handles all logical operations, including receiving data
from the ADC, making decisions based on threshold comparison,
activating output devices like the LED and relay, and communicating
with the user interface components such as the LCD and UART
terminal. This makes the design simple, low-cost, and highly effective
for embedded temperature monitoring.

Analog-to-digital conversion is achieved using the ADC0804 chip.


Since the LM35 provides an analog output and the 8051 cannot
directly process analog signals, the ADC0804 is used to convert the
analog temperature data into a digital form that the microcontroller
can understand and process.

To provide a clear visual indication of system status, an LED is turned


ON when the temperature exceeds the preset threshold. This ensures
that even without a display or external monitor, the user is made
aware of any critical temperature conditions.
The entire system is compact and consumes very little power. It uses
only essential components and is optimized for use in embedded
environments. The minimal power requirements make it ideal for
battery-powered or portable applications.

NOVELTIES

One of the most important enhancements made to the system is the


addition of a relay driver circuit. This allows the microcontroller to
control high-power external loads such as fans or heaters based on the
temperature readings. The relay is triggered through a transistor
switch and offers an automated response to over-temperature
conditions, making the system capable of not only monitoring but also
acting in real time.

The project now includes UART-based serial communication,


allowing users to connect the system to a PC or terminal emulator.
This enables the transmission of temperature readings to the terminal
and also provides a way to send control commands like ―ON‖ or
―OFF‖ to manually operate the relay, offering both automated and
user-controlled modes of operation.

A 16x2 LCD display has been incorporated into the design to show
the current temperature and relay status. This makes the system user-
friendly and completely standalone, removing the need for an external
display or computer during normal operation.

Additionally, an audible buzzer alert has been added, which


activates when the temperature exceeds the threshold. This provides
an immediate audio signal to nearby users, complementing the visual
indicators such as the LED and LCD.

Together, these enhancements transform the basic temperature


monitoring system into a more robust, interactive, and responsive
embedded control solution.
LIMITATIONS

Dependence on Power Supply:


The system depends entirely on a stable external 5V DC power supply
for operation. In the event of a power failure, all system
functionalities—including temperature monitoring, LCD display,
relay switching, and alert mechanisms—cease immediately. There is
no provision for a backup power source such as a rechargeable battery
or supercapacitor, which means the system cannot provide fail-safe
operation during outages. This makes it less suitable for critical
applications like fire detection, industrial safety, or hospital
equipment where uninterrupted monitoring is essential.

Limited Accuracy of the Temperature Sensor:


The LM35 sensor, while cost-effective and simple to use, provides a
typical accuracy of ±0.5°C under optimal conditions. This margin of
error may be significant in high-precision applications such as
medical diagnostics, laboratory experiments, or environmental control
systems where even small variations matter. Furthermore, factors like
electrical noise, improper sensor placement, and long analog wiring
can introduce additional inaccuracies unless proper shielding and
filtering are applied.

Lack of Environmental Protection or Casing:


The current hardware setup does not include any physical casing or
environmental protection for the components. Sensors,
microcontroller circuits, and connections are fully exposed, making
the system vulnerable to dust, moisture, and accidental damage. In
real-world conditions, this can lead to corrosion, short circuits, or
inaccurate readings due to environmental interference. Without proper
enclosures or conformal coatings, the system is best suited for
controlled lab environments rather than rugged or outdoor use.

REFERENCES AND RELATED PAPERS

 Majed Kamil Qetheth & D. Karuna Sagar


Title: Temperature Sensor Using Microcontroller
Summary: This paper discusses how microcontrollers can be used for
temperature sensing applications. It focuses on the integration of
LM35 sensors and their efficiency in providing accurate readings for
various real-time applications.

 Reetam Mondal & Sagarika Pal


Title: Microcontroller Based Temperature Monitoring and Closed
Loop Control to Study the Reaction of Controlled Variable with
Respect to Load Changes
Summary: The study presents a temperature control and monitoring
system using an 8051 microcontroller. It highlights the importance of
closed-loop control in dynamic load conditions and real-time
temperature response.

 Texas Instruments
Title: LM35 Precision Centigrade Temperature Sensors Datasheet
Summary: This datasheet provides detailed specifications and
performance parameters for the LM35 temperature sensor. It includes
information on output characteristics, linearity, accuracy, and
interfacing methods.

 Texas Instruments
Title: ADC080x 8-Bit, µP-Compatible, Analog-to-Digital Converters
Datasheet
Summary: This document offers technical information about the
ADC0804, a microprocessor-compatible ADC. It covers input voltage
ranges, resolution, timing, and interfacing with 8051 microcontrollers.

 Circuit Digest
Title: Digital Thermometer using LM35 and 8051 Microcontroller
Summary: This article describes the construction of a digital
thermometer using LM35 and the 8051 microcontroller. It explains
the role of ADC0804 in converting analog temperature data to a
digital format and displaying it on an LCD.

 Scribd – Anonymous Contributor


Title: Digital Thermometer Using 8051 Microcontroller – Project
Report
Summary: A complete project report outlining the methodology,
circuit design, code, and practical implementation of a digital
thermometer based on 8051 and LM35. It includes discussions on
ADC interfacing, relay control, and temperature threshold logic.

 ResearchGate – Various Authors


Title: LM35 Based Digital Room Temperature Meter: A Simple
Demonstration
Summary: This paper presents a simple demonstration of building a
digital temperature meter using LM35, highlighting ease of
calibration, display integration, and accuracy within domestic
conditions.

You might also like