BASIC CONCEPT:
The fan located on the shaft of the motor will rotate due to the force of the oncoming wind,
causing it to rotate about its axis at a speed which is proportional to the speed of the wind.
Thus the greater the wind the faster the fan will rotate. By rotating it, a disc with slits in it
cuts the optical switch corresponding to the motion of the rotor, generating pulses. The
frequency of these pulses is proportionally changing with the wind speed. These pulses are then
fed to the pin 3.5 of the 8051 microcontroller which is the timer 1 pin via 74LS14 Schmitt trigger
IC. A software program is designed and loaded onto the microcontroller to count these pulses,
process them and generate corresponding values of wind speed in km/h. The 8051
microcontroller is interfaced with LCD which displays the wind speed in a digital format.
HARDWARE DESIGN
BLOCK DIAGRAM:
FAN
Attached to the shaft
of the motor to
rotate due to the
force of the
oncoming wind
SCHMITT TRIGGER
74LS14
It transforms a slowly changing
OPTICAL SENSOR input signal to a fast changing,
8051
jitter free output.
Connected to the shaft of
the motor; Generates
MICROCONTROLLER
pulses and sends this Receives digital data from the optical
digital signal to the sensor via Schmitt trigger;
microcontroller port pin programmed such that it sends the
data to LCD
The following table shows the various pins and their connections in this project:
PIN# SYMBOL FUNCTION CONNECTED TO
1 P1.0 I/O PORT 1 PIN 0 NC
2 P1.1 I/O PORT 1 PIN 1 NC
3 P1.2 I/O PORT 1 PIN 2 NC
4 P1.3 I/O PORT 1 PIN 3 NC
5 P1.4 I/O PORT 1 PIN 4 NC
6 P1.5 I/O PORT 1 PIN 5 NC
7 P1.6 I/O PORT 1 PIN 6 NC
8 P1.7 I/O PORT 1 PIN 7 NC
9 RST RESET RESET CIRCUIT
10 (RXD)P3.0 I/O PORT 3 PIN 0 (RECEIVE DATA) NC
11 (TXD)P3.1 I/O PORT 3 PIN 1 (TRANSMIT DATA) NC
12 (INT0)P3.2 I/O PORT 3 PIN 2 (INTERUPPT 0) NC
13 (INT1)P3.3 I/O PORT 3 PIN 3 (INTERRUPT 1) NC
14 (T0)P3.4 I/O PORT 3 PIN 4 (TIMER 0) NC
15 (T1)P3.5 I/O PORT 3 PIN 5 (TIMER 1) PIN FROM SCHMITT
TRIGGER
16 (WR)P3.6 I/O PORT 3 PIN 6 (WRITE) NC
17 (RD)P3.7 I/O PORT 3 PIN 7 (READ) NC
18 XTAL2 CRYSTAL OSCILLATOR 11.0952MHz CRYSTAL
19 XTAL1 CRYSTAL OSCILLATOR 11.0952MHz CRYSTAL
20 GND GROUND GROUNDED
21 P2.0(A8) I/O PORT 2 PIN 0 ( ADDRESS LINE 8) NC
22 P2.1(A9) I/O PORT 2 PIN 1 ( ADDRESS LINE 9) NC
23 P2.2(A10) I/O PORT 2 PIN 3 ( ADDRESS LINE 10) NC
24 P2.3(A11) I/O PORT 2 PIN 4 ( ADDRESS LINE 11) NC
25 P2.4(A12) I/O PORT 2 PIN 5 ( ADDRESS LINE 12) NC
26 P2.5(A13) I/O PORT 2 PIN 6 ( ADDRESS LINE 13) PIN 6 LCD
27 P2.6(A14) I/O PORT 2 PIN 7 ( ADDRESS LINE 14) PIN 5 LCD
28 P2.7(A15) I/O PORT 2 PIN 0 ( ADDRESS LINE 15) PIN 4 LCD
29 PSEN PROGRAM STORE ENABLE NC
30 ALE ADDRESS LATCH ENABLE NC
31 EA EXTERNAL ACCESS +5V
32 P0.7(AD7) I/O PORT 0 PIN 7 (MULTIPLEXED AD LINE 7) DATA BUS LCD BIT 7
33 P0.6(AD6) I/O PORT 0 PIN 6 (MULTIPLEXED AD LINE 6) DATA BUS LCD BIT 6
34 P0.5(AD5) I/O PORT 0 PIN 5 (MULTIPLEXED AD LINE 5) DATA BUS LCD BIT 5
35 P0.4(AD4) I/O PORT 0 PIN 4 (MULTIPLEXED AD LINE 4) DATA BUS LCD BIT 4
36 P0.3(AD3) I/O PORT 0 PIN 3 (MULTIPLEXED AD LINE 3) DATA BUS LCD BIT 3
37 P0.2(AD2) I/O PORT 0 PIN 2 (MULTIPLEXED AD LINE 2) DATA BUS LCD BIT 2
38 P0.1(AD1) I/O PORT 0 PIN 1 (MULTIPLEXED AD LINE 1) DATA BUS LCD BIT 1
39 P0.0(AD0) I/O PORT 0 PIN 0 (MULTIPLEXED AD LINE 0) DATA BUS LCD BIT 0
40 VCC POWER SUPPLY +5V POWER SUPPLY
2
16X2 BIT LCD:
Liquid Crystal Display (LCD) is very simple to interface
with the microcontroller as well as cost effective.
The most commonly used alphanumeric displays
are 1x16 (single line & 16 characters), 16X2 (double
line & 16 character per line) &4x20 (four lines &
twenty characters per line). In our project we have used the JHD162A SERIES 16X2 LCD.
Pin connections for the LCD in this project are shown in the table below:
PIN # SYMBOL FUNCTION CONNECTED TO
1 VSS GROUND GROUND
2 VCC POWER SUPPLY +5V POWER SUPPLY
3 VEE CONTRAST SETTING 10K POTENTIOMETER
4 RS REGISTER SELECT P2.7 OF 8051
5 R/W READ/ WRITE P2.6 OF 8051
6 E ENABLE P2.5 OF 8051
7 DB0 DATA BUS BIT 0 P0.0 OF 8051
8 DB1 DATA BUS BIT 0 P0.1 OF 8051
9 DB2 DATA BUS BIT 0 P0.2 OF 8051
10 DB3 DATA BUS BIT 0 P0.3 OF 8051
11 DB4 DATA BUS BIT 0 P0.4 OF 8051
12 DB5 DATA BUS BIT 0 P0.5 OF 8051
13 DB6 DATA BUS BIT 0 P0.6 OF 8051
14 DB7 DATA BUS BIT 0 P0.7 OF 8051
15 LED+ Vcc FOR BACKLIGHT +5V POWER SUPPLY
16 LED- GROUND FOR BACKLIGHT GROUNDED
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
3
Vss Vcc Vee RS R/ E DB0 DB1 DB DB3 DB4 DB5 DB DB7 LED LED-
W 2 6 +
Hex Inverter with Schmitt Trigger DM74LS14
Function Table
Y A H HIGH Logic Level
L LOW Logic Level
INPUT OUTPUT
A Y
L H
H L
This IC contains six independent gates each of which performs the logic INVERT function.
4
Each input has hysteresis which increases the noise immunity and transforms a slowly
changing input signal to a fast changing, jitter free output. In our project only one gate is
used.
CONCEPTUAL DESIGN
5
Fan
SCHEMATIC DIAGRAM +5V
6
+5V Vcc
+5V
EA P 2.5 E 16
P 2.6 R/W 15
10 uF P 2.7 RS +5V
LCD
RESET P 0.0 D0 16X2 VCC
P 0.1 D1
P 0.2 D2
P 0.3 D3 VEE
8.2 K P 0.4 D4
P 0.5 D5
8051 P 0.6 D6 VSS
P 0.7 D7
P 3.5 (T1)
XTAL 2
XTAL 1
GND
Vcc
74LS14 +5V
P5 P6 GND Optical switch
H42B6
THEORY:
7
COMPONENT S USED:
8051 microcontroller chip
16X2 LCD
Compressor fan
Optical sensor
Wires
Werra board
Resistors(330Ω,10K Ω, 8.2KΩ)
Capacitors (10µF,150 pF,30pF)
10 K potentiometers
11.0592 MHz oscillator crystal
Ports
EQUIPMENT REQUIRED:
Soldering Iron
Solder Wire
Solder Paste
Cutting Pliers
Wire Stripper
Flat faced Screw driver
Digital multimeter
Oscilloscope
PROCEDURE:
The above mentioned components and equipment were used to build the hardware of the project. The
components were soldered on the Veroboard according to the schematic. The crystal frequency was
checked after connection which was 11.592 MHz as desired.
CALCULATIONS for Wind Speed:
FORMULA:
Speed= (n x d x 3600) / (t x 1000 x 100) Km/h
Where
n = number of pulses in time t
d (cm) = length of a single optical disk slit (2 x Pi x 2.3/1000 = 0.0144 cm)
t (seconds) = time
8
If we take (d x 3600) / (t x 1000 x 100) =1 in the above Formula, and Calculate the time (t) required for it, as all
other parameters remain constant, then the number of pulses (n) in that time (t) would be the Speed measured
in Km/h.
The time Calculated comes out to be 520 Micro-Seconds, this is the time after which the number of pulses stored
in the Tl1 register are displayed on the LCD.
9
10
SOFTWARE DESIGN
THEORY :
Software is designed to program the 8051 such that it takes the input from the optical
sensor via the Schmitt trigger IC and send it to display on LCD. The conceptual design of the
software is discussed in this section. The use of timer as a counter is explained. Also a brief
explanation of various important pins of various chips used in the project is given
below. Explanation of instructions used in the program is also given for reference.
USE OF TIMER 1 PIN (T1):
8051 has two timers, timer 0 and 1.
DESCRIPTION OF PINS:
Description of various important control pins of LCD is described below to
understand their usage in the program.
LCD:
RS:
It is to select register. When RS = 0 command code register is selected, while when RS=1
data register is selected
R/W:
R/W=0 when reading and 1 when writing data on the LCD
E:
Enable pin, a high to low pulse must be sent to this pin in order for the LCD to latch in the
data present at the data pins.
11
PROGRAM FLOW CHART
START
SETTING UP LCD AS 5x7 MATRIX
CLEARING LCD
Counting the number of
pulses
Converting the number of pulses
counted to ASCII Code
SENDING WIND SPEED TO LCD FOR
DISPLAY
END
12
EXPLANATION OF INSTRUCTIONS:
Various instructions used in the program are explained below:
MOV
This instruction copies a byte of source location to the destination.
MOVC
This instruction copies the source bit to the destination bit.
CJNE
The magnitudes of the source byte and the destination bytes are compared. If they are
not equal, it jumps to the target address.
JNC
This instruction examines the CY flag, and if it is zero it will jump to the target address.
JNB
This instruction monitors a given bit and if the bit is low it will jump to the target address.
SETB
This instruction makes the indicated bit high.
CLR
This instruction is used to clear the contents of the register indicated i.e. all bits are set to
0.
ACALL
ACALL stands for absolute call. It calls a subroutine with a target address within 2K bytes
from the current program counter (PC).
RET
This instruction is used to return from a subroutine previously entered by instructions
LCALL or ACALL.
SJMP
SJMP is an Unconditional short jump. It is a 2 byte instruction. Therefore, in this jump the
target address must be within -128 to +127 bytes of the PC of the instruction after the
SJMP.
DJNZ
In this instruction a byte is decremented, and if the result is not zero it will jump to target
address.
ANL
ANL performs logical AND for byte variables.
ORL
ORL performs logical OR for byte variables
13