Académique Documents
Professionnel Documents
Culture Documents
M.Pavani (15P61A04A2)
CERTIFICATE
The resultsembodied in this project report have not been submitted to any other
University/Institution for the award of any Degree.
CANDIDATE DECLARATION
D.Priyanka (15P61A04B6)
M.Pavani (15P61A04A2)
K.Karthik Reddy (15P61A0466)
(Accredited by NAAC, New Delhi)
ACKNOWLEDGEMENT
At the outset,I sincerely thank to the management and department of ECE for providing
concurrent support for my mini project to complete in stipulated time.
Firstly, I would thank the Management for providing constant support throughout the
completion of project. Secondly, I sincerely thank our beloved Principal,Dr. G. AmarendarRao
and Head of the Department,Dr. Y Srinivas, for their kind cooperation and encouragement for the
successful completion of project report and providing the necessary facilities.
I sincerely express thanks to our parents who have been a motivating factor during the
present stay in the college campus.
D.Priyanka(15P61A04B6)
M.Pavani(15P61A04A2)
K.KarthikReddy (15P61A0466)
ABSTRACT
Acknowledgement i
Abstract i
List of Figures iv
Abbreviations v
CHAPTER1: INTRODUCTION 1
1.1 Project Overview 1
1.2 Information Transfer 1
1.3 Components Overview 1
1.3.1 Microcontroller 2
1.3.2 LCD 2
1.3.3 ADC 0804 2
1.3.4 Temperature sensor 3
1.3.5 L293D IC 3
1.4 System Operation 3
3.1.6.1 enable 23
3.1.6.4 DC motor 25
3.2.1 keil C 27
CHAPTER6: TESTING
6.1 Validity Check & Display 37
6.2 Results 38
REFERENCES 41
APPENDIX 42-46
LIST OF TABLES
• Table 3.1 10
• Table 3.2 11
• Table 3.3 17
• Table 3.4 19
• Table 3.5 23
• Table 3.6 25
LIST OF FIGURES
• Figure 2.1 4
• Figure 2.2 5
• Figure 3.1 7
• Figure 3.2 8
• Figure 3.3 16
• Figure 3.4 18
• Figure 3.5 20
• Figure 3.6 21
• Figure 3.7 26
• Figure 3.8 28
• Figure 3.9 28
• Figure 3.10 29
• Figure 3.11 29
• Figure 3.12 30
• Figure 3.13 30
• Figure 4.1 32
• Figure 4.2 34
• Figure 6.1 37
• Figure 6.2 38
ABBREVATIONS
CHAPTER 1: INTRODUCTION
In this the information transfer is carried out in four stages, first the temperature
is detected by temperature sensor and is transferred to ADC where the information is
converted to digital form. The digital output from the ADC is send to microcontroller in
which the operations are performed and the resultant output is displayed on the LCD
based on which the DC fan rotates.
1.3.1 Microcontroller
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).
1.3.2 LCD
The temperature controlled dc fan uses JHD 16*2A LCD for displaying the text
data. It is 16character x 2 line display module. But in practice, it should be replaced by
the large multiline, multicolor commercial display units.
The command register stores the command instructions given to the LCD. A
command is an instruction given to LCD to do a predefined task like initializing it,
clearing its screen, setting the cursor position, controlling display etc. The data register
stores the data to be displayed on the LCD. The data is the ASCII value of the character
to be displayed on the LCD.
1.3.3 ADC0804
The ADC0804 family are CMOS 4-Bit, successive approximation A/D converters
which use a modified potentiometric ladder and are designed to operate with the 8080A
control bus via three-state outputs. These converters appear to the processor as memory
locations or I/O ports, and hence no interfacing logic is required. The differential analog
voltage input has good common- mode-rejection and permits offsetting the analog zero-
input voltage value. In addition, the voltage reference input can be adjusted to allow
encoding any smaller analog voltage span to the full 8 bits of resolution.
1.3.5 L293D IC
L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act
as current amplifiers since they take a low-current control signal and provide a higher-
current signal. This higher current signal is used to drive the motors.
L293D contains two inbuilt H-bridge driver circuits. In its common mode of
operation, two DC motors can be driven simultaneously, both in forward and reverse
direction. The motor operations of two motors can be controlled by input logic at pins 2
& 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01 and
10 will rotate it in clockwise and anticlockwise directions, respectively.
1.4 SYSTEM OPERATION
The operation of the system is very simple. In this the information transfer is
carried out in four stages, first the temperature is detected by temperature sensor and is
transferred to ADC where the information is converted to digital form. The digital output
from the ADC is send to microcontroller in which the operations are performed and the
resultant output is displayed on the LCD based on which the DC fan rotates.For
developing this we need to have some common peripherals including
ADC,microcontroller, LCD (Liquid crystal display) temperature sensor, DC fan, power
supply and some connecting wires.
Electronic devices produce heat by daily usage then afterwards for a certain length of
time, damages its main components and causes its malfunction.
Objectives:
● To use microcontroller in controlling the speed of a DC fan
● Reduce overheating problem
● To provide an effective low cost device
● GND Ground
Port 0:
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high
impedance inputs.
Port 0 can also be configured to be the multiplexed low order address/data bus
during accesses to external program and data memory. In this mode, P0 has internal pull
ups.
Port 0 also receives the code bytes during Flash programming and outputs the code
bytes during program verification. External pull ups are required during program
verification.
Port 1:
Port 1 is an 8-bit bidirectional I/O port with internal pull ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are
pulled high by the internal pull ups and can be used as inputs. As inputs, Port 1 pins that
are externally being pulled low will source current (IIL) because of the internal pull ups.
Table 3.1
Port 2:
Port 2 is an 8-bit bidirectional I/O port with internal pull ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are
pulled high by the internal pull ups and can be used as inputs. As inputs, Port 2 pins that
are externally being pulled low will source current (IIL) because of the internal pull ups.
Port 2 emits the high-order address byte during fetches from external program
memory and during accesses to external data memory that use 16-bit addresses (MOVX
@ DPTR). In this application, Port 2 uses strong internal pull ups when emitting 1s.
During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2
emits the contents of the P2 Special Function Register.
Port 2 also receives the high-order address bits and some control signals during
Flash programming and verification.
Port 3:
Port 3 is an 8-bit bidirectional I/O port with internal pull ups. The Port 3 output buffers
can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high
by the internal pull ups and can be used as inputs. As inputs, Port 3 pins that are
externally being pulled low will source current (IIL) because of the pull ups.
Port 3 also serves the functions of various special features of the AT89S52, as
shown in the following table. Port 3 also receives some control signals for Flash
programming and verification.
Table 3.2
RST:
Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device. This pin drives High for 96 oscillator periods after the
Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to
disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is
enabled.
ALE/PROG:
Address Latch Enable (ALE) is an output pulse for latching the low byte of the
address during accesses to external memory. This pin is also the program pulse input
(PROG) during Flash programming.
If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH.
With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise,
the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the
microcontroller is in external execution mode.
PSEN:
Program Store Enable (PSEN) is the read strobe to external program memory.
When the AT89S52 is executing code from external program memory, PSEN is activated
twice each machine cycle, except that two PSEN activations are skipped during each
access to external data memory.
EA/VPP
This pin also receives the 12-volt programming enable voltage (VPP) during
Flash programming.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
XTAL2:
A map of the on-chip memory area called the Special Function Register (SFR).
Note that not all of the addresses are occupied, and unoccupied addresses may not be
implemented on the chip. Read accesses to these addresses will in general return random
data, and write accesses will have an indeterminate effect.
User software should not write 1s to these unlisted locations, since they may be
used in future products to invoke new features. In that case, the reset or inactive values
of the new bits will always be 0.
Timer 2 Registers:
Control and status bits are contained in registers T2CON (shown in Table 2) and
T2MOD (shown in Table 3) for Timer 2. The register pair (RCAP2H, RCAP2L) are the
Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode.
Interrupt Registers:
The individual interrupt enable bits are in the IE register. Two priorities can be
set for each of the six interrupt sources in the IP register
MCS-51 devices have a separate address space for Program and Data Memory.
Up to 64K bytes each of external Program and Data Memory can be addressed.
Program Memory:
If the EA pin is connected to GND, all program fetches are directed to external
memory. On the AT89S52, if EA is connected to VCC, program fetches to addresses
0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H
through FFFFH are to external memory.
Data Memory:
The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes
occupy a parallel address space to the Special Function Registers. This means that the
upper 128 bytes have the same addresses as the SFR space but are physically separate
from SFR space.
Instructions which use direct addressing access of the SFR space. For example,
the following direct addressing instruction accesses the SFR at location 0A0H (which is
P2).
Instructions that use indirect addressing access the upper 128 bytes of RAM.
For example, the following indirect addressing instruction, where R0 contains 0A0H,
accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H).
Note that stack operations are examples of indirect addressing, so the upper 128 bytes of
data RAM are available as stack space
Pin diagram:
Pin
Function Name
No
1 Activates ADC; Active low Chip select
Input pin; High to low pulse brings the data from internal
2 Read
registers to the output pins after conversion
3 Input pin; Low to high pulse is given to start the conversion Write
4 Clock Input pin; to give external clock. Clock IN
5 Output pin; Goes low when conversion is complete Interrupt
6 Analog non-inverting input Vin(+)
7 Analog inverting Input; normally ground Vin(-)
Analog
8 Ground(0V)
Ground
9 Input pin; sets the reference voltage for analog input Vref/2
10 Ground(0V) Digital Ground
11 D7
12 D6
13 D5
14 D4
8 bit digital output pins
15 D3
16 D2
17 D1
18 D0
19 Used with Clock IN pin when internal clock source is used Clock R
20 Supply voltage; 5V Vcc
2 Analog output There will be the increase in 10mv for raise of every
1ºC can range from -1v(-55ºC) to 6V (150ºC)
3.1.4 L293D
L293D is a typical Motor driver or Motor Driver IC which allows DC motor to
drive on either direction. L293D is a 16-pin IC which can control a set of two DC motors
simultaneously in any direction. It means that you can control two DC motor with a
single L293D IC.
It works on the concept of H-bridge. H-bridge is a circuit which allows the
voltage to be flown in either direction. As you know voltage need to change its direction
for being able to rotate the motor in clockwise or anticlockwise direction, Hence H-
bridge IC are ideal for driving a DC motor.
In a single L293D chip there are two h-Bridge circuit inside the IC which can
rotate two dc motor independently. Due its size it is very much used in robotic
application for controlling DC motors. Given below is the pin diagram of a L293D mot
or controller.There are two Enable pins on l293d. Pin 1 and pin 9, for being able to drive
the motor, the pin 1 and 9 need to be high. For driving the motor with left H-bridge you
need to enable pin 1 to high. And for right H-Bridge you need to make the pin 9 to high.
If anyone of the either pin1 or pin9 goes low then the motor in the corresponding section
will suspend working. It’s like a switch.
There are 4 input pins for l293d, pin 2,7 on the left and pin 15 ,10 on the right as
shown on the pin diagram. Left input pins will regulate the rotation of motor connected
across left side and right input for motor on the right hand side. The motors are rotated on
the basis of the inputs provided across the input pins as LOGIC 0 or LOGIC 1.
In simple you need to provide Logic 0 or 1 across the input pins for rotating the motor.
1. Declining prices.
2. Ability to display numbers, characters and graphics.
3. Incorporation of a refreshing controller into the LCD.
4. Ease of programming.
2 Pin VCC Source Pin This is the supply Connected to the supply
2 voltage pin of LCD pin of Power source
6 Pin Enable Control Pin Must be held high Connected to MCU and
6 to perform always held high.
Read/Write
Operation
The EN line is called "Enable." This control line is used to tell the LCD that you
are sending it data. To send data to the LCD, your program should make sure this line is
low (0) and then set the other two control lines and/or put data on the data bus. When the
other lines are completely ready, bring EN high (1) and wait for the minimum amount of
time required by the LCD datasheet (this varies from LCD to LCD), and end by bringing
it low (0) again.
The RS line is the "Register Select" line. When RS is low (0), the data is to be
treated as a command or special instruction (such as clear screen, position cursor, etc.).
When RS is high (1), the data being sent is text data which should be displayed on the
screen. For example, to display the letter "T" on the screen you would set RS high.
The RW line is the "Read/Write" control line. When RW is low (0), the
information on the data bus is being written to the LCD. When RW is high (1), the
program is effectively querying (or reading) the LCD. Only one instruction ("Get LCD
status") is a read command. All others are write commands--so RW will almost always be
low. Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation
selected by the user). In the case of an 8-bit data bus, the lines are referred to as DB0,
DB1, DB2, DB3, DB4, DB5, DB6, and DB7.
The LCD panel's Enable and Register Select is connected to the Control Port.
The Control Port is an open collector / open drain output. While most Parallel Ports have
internal pull-up resistors, there is a few which don't. Therefore, by incorporating the two
10K external pull up resistors, the circuit is more 18 portable for a wider range of
computers, some of which may have no internal pull up resistors.
We make no effort to place the Data bus into reverse direction. Therefore, we hard
wire the R/W line of the LCD panel, into write mode. This will cause no bus conflicts on
the data lines. As a result we cannot read back the LCD Internal busy flag is noticed if the
LCD has accepted and finished processing the last instruction. This problem is overcome
by inserting known delays into our program.
The 10k Potentiometer controls the contrast of the LCD panel. Nothing fancy
here. As with all the examples, I've left the power supply out. You can use a bench power
DC motors were the first type widely used, since they could be powered from
existing direct-current lighting power distribution systems. A DC motor's speed can be
controlled over a wide range, using either a variable supply voltage or by changing the
strength of current in its field windings. Small DC motors are used in tools, toys, and
3.2.1 Keil C
Keil development tools for the 8051 Microcontroller Architecture support every
level of software developer from the professional applications engineer to the student just
learning about embedded software development.
The industry-standard Keil C Compilers, Macro Assemblers, Debuggers, Real-
time Kernels, Single-board Computers, and Emulators support all 8051 derivatives and
help you get your projects completed on schedule.
The Keil 8051 Development Tools are designed to solve the complex problems facing embedded
software developers.
• When starting a new project, simply select the microcontroller you use from the
Device Database and the µVision IDE sets all compiler, assembler, linker, and
memory options for you.
• Numerous example programs are included to help you get started with the most
popular embedded 8051 devices.
• The Keil µVision Debugger accurately simulates on-chip peripherals (I²C, CAN,
UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM
Modules) of your 8051 device. Simulation helps you understand hardware
configurations and avoids time wasted on setup problems. Additionally, with
simulation, you can write and test applications before target hardware is available.
When you are ready to begin testing your software application with target
hardware, use the MON51, MON390, MONADI, or FlashMON51 Target Monitors, the
ISD51 In-System Debugger, or the ULINK USB-JTAG Adapter to downlad and test
program code on your target system.
The Keil C51 C Compiler for the 8051 microcontroller is the most popular 8051
C compiler in the world. It provides more features than any other 8051 C compiler
available today.
The C51 Compiler translates C source files into relocatable object modules which
contain full symbolic information for debugging with the µVision Debugger or an in-
circuit emulator. In addition to the object file, the compiler generates a listing file which
may optionally include symbol table and cross reference information.
Features:
CHAPTER 5: IMPLEMENTATION
LM35
LCD:
• RS : P0
• RW : P0
• EN : P0
• Data Lines : P2
ADC:
• RD : P0
• WR : P0
• INTR : P0
• Output : P1
Temperature Sensor:
Output of Temp sensor – Vin+ (6)
• In this project I have used only one enable pin i.e. E1 to operate only one DC
motor (at 9v).
• The input pins (pin 2 and pin 7) of L293D are connected to pin P1^1 and P1^2 of
AT89S52 respectively.
• The output pins (pin 3 and pin 6) of L293D will serve as the negative and positive
terminals for the motor to drive.
• In the coding part “Mn” and “Mp” denote the negative and positive terminals of
the motor
• The IC 7805 voltage regulator provides a step down from 9V to 5V (ideal voltage
for AT89S52)
The Crystal provides the desired 11.0592 MHz frequency for the microcontroller to work
upon.
CHAPTER 6: TESTING
6.2 RESULTS
Snapshots
7.1 ADVANTAGE
• Speed varies automatically, so that it controls the speed with out using it manually
● It is helpful to disabled people
● It is very easy to install in houses, offices, etc.
● Save energy by slowing down its speed in low temperature
7.2 DISADVANTAGES
7.3 APPLICATIONS
● Temperature controlled DC fan can be used to control the temperature of devices
,rooms, electronics components etc, by monitoring the temperature.
● The circuit can be used in CPU to reduce the heat
● Can be extended to PWM based output, where the speed of the fan can be varied
according to the duty cycle of the PWM signal.
FUTURE SCOPE
The goals of this project were purposely kept within what was believed to be attainable
within the allotted timeline.as such, many improvements can be made upon this initial
design. That being said ,it felt that this design represents a functioning miniature scale
method which could be replicated to a much larger scale .
The following recommendations are provided as ideas for future expansion of this project
REFERENCES
• “The 8051 Microcontroller and Embedded Systems : Using Assembly and C”
by Muhammad Ali Malzidi
This book focuses on 8051 microcontroller. The book also specifies the
software and hardware specifications for 8051 microcontroller. The chapters in
the book provide basic architecture of microcontrollers using assembly languages.
The chapters illustrate how microcontroller interfaces with necessary devices
using C and assembly languages. The microcontroller uses C and assembly
languages to interact with devices like LCDs, keyboards, sensors and stepper
motors. The other topics presented in the book are real time clock chips,
optoisolators.
• “Advanced Microprocessors and Peripherals by A K Ray and K M
Bhurchandi”
This Book integrates basics ,theory,design and real life applications
related to advanced microprocessors .this book provides a good foundation for
advanced microprocessors,principles and practices.the book enables the students
to write efficient programs in assembly level language of 8086 family of
processors the book is updated with topics like ARM architecture ,serial
communication standard USB,8051 microcontrollers,instruction set and
peripheral interfacing along with project design
• "ISO 4335: 1987", Information processing systems — Data Communication —
High-level data link control elements of procedures.
● "ISO 8877: 1987", Information processing systems — Interface connector and
contact assignments for ISDN basic access interface located at reference points
S and T
APPENDIX
#include <reg52.h>
#include <string.h>
#define ldata P2
void lcddata(unsigned char *str);
void lcdcmd(unsigned char cmd);
void msdelay(unsigned int itime);
void convert_display(unsigned char);
void datawrt(unsigned char );
unsigned char adc();
void fanon();
void fanoff();
unsigned char conv;
sbit rs=P0^0;
sbit rw=P0^1;
sbit en=P0^2;
sbit rd_adc =P0^3;
sbit wr_adc =P0^4;
sbit intr_adc =P0^5;
sbit fanP = P0^6;
sbit fanN = P0^7;
void main()
{
unsigned char get_value;
unsigned char x1,x2,x3;
ldata =0x00;
rs=rw=en=0;
intr_adc=1;
rd_adc=0;
wr_adc=0;
fanP = 0;
fanN = 0;
x1=x2=x3=0;
lcdcmd(0x38);
lcdcmd(0x0e);
lcdcmd(0x06);
lcdcmd(0x01);
lcdcmd(0x0c);
lcdcmd(0x80);
lcddata("Welcome...");
msdelay(1000);
lcdcmd(0x01);
msdelay(100);
lcddata("Temp:");
msdelay(100);
lcdcmd(0xC0);
msdelay(10);
fanon();
msdelay(2);
fanoff()
msdelay(10);
while(1)
{
get_value = adc();
lcdcmd(0x87);
msdelay(10);
x1=(get_value/100)+48;
datawrt(x1);
x2=((((get_value)/10)%10)+48);
datawrt(x2);
x3=(get_value%10)+48;
datawrt(x3);
datawrt(0x60);
datawrt('C');
msdelay(10);
if(( x2 >= 0x33) )
fanon()
else
fanoff()
}
}
void fanon()
{
fanP = 0;
fanN = 1;
msdelay(2000);
}
void fanoff()
{
fanP = 0;
fanN = 0;
msdelay(2000);
}
unsigned char adc()
{
wr_adc=0;
rd_adc=1;
wr_adc=1;
while(intr_adc==1);
rd_adc=0;
conv=P1;
return conv;
}
void datawrt(unsigned char y)
{
ldata =y;
rs=1;
rw=0;
en=1;
msdelay(1);
en=0;
}
void lcddata(unsigned char *str) //LCD data Function
{
while(*str != '\0')
{
ldata = *str;
rs=1;
rw=0;
en=1;
msdelay(1);
en=0;
str++;
}
}