Contact Less Digital Tachometer: Mini Project On
Contact Less Digital Tachometer: Mini Project On
CONTACT LESS
DIGITAL
TACHOMETER
BY:
1) Mayur Chandak (Roll No. 03)
2) Ketan Kalantri (Roll No. 09)
ACKNOWLEDGMENT
-Mayur Chandak
-Ketan Kalantri
2 Page
-Kapil Chandak
3 Page
INDEX
1. Abstract………………………………………………….5
2. Introduction……………………………………………..6
3. Features………………………………………………….7
4. Specifications……………………………………………8
5. Principle of Operation…………………………………..9
6. Block Diagram & its Description………………………10
7. Module Wise Design…………………………………….12
a. Proximity Sensor………………………………….12
b. Microcontroller…………………………………...14
c. LCD………………………………………………..17
8. Circuit Diagram & Description………………………. 20
9. List of components…………………………………...…25
10. PCB Design……………………………………………26
11. Software Section………………………………………29
a. Algorithm…………………………………………..29
b. Flow Chart…………………………………………31
c. Code ………………………………………………33
12. Application…………………………………………….40
13. Bill of Materials.............................................................41
14. Results & Conclusions………………………………..42
15. References……………………………………………..43
16. Datasheets……………………………………………..44
4 Page
ABSTRACT
5 Page
INTRODUCTION
6 Page
FEATURES
Digital Readout.
Contactless measurement.
Instantaneous measurement.
User friendly.
7 Page
SPECIFICATIONS
9v Battery.
8 Page
PRINCIPLE OF OPERATION:
In the case of this tachometer, the counted pluses will come from
IR proximity sensor, which will detect any reflective element
passing in-front of it, and thus, will give an output pulse for each
and every rotation of the shaft, as show in the picture. Those pulses
will be fed to the microcontroller and counted.
BLOCK DIAGRAM:
9 Page
Reflective
strip
DIGITAL TACHOMETER
IR Microcontroller Alphanumeric
Proximity P89C51RD2Hxx LCD
sensor
Power Supply 6 V
DISCRIPTION:
IR Proximity Sensor:
Here the proximity sensor used is IR proximity
sensor.
Microcontroller(8051):
It is the most important part of the design,
it processes the input obtained from IRproximity sensor
& produces output which
is displayed on the LCD.
With a few support chips and a program stored in memory, one can use the
P89C51RD2Hxx-BASIC to sense, measure, and control processes, events, or
conditions.
It has ability to display numbers, characters & graphics .It displays speed &
distance even at night.
The 14 pins needed for control, the main controller is built in the module.
POWER SUPPLY:
As it is a portable device, power to the whole circuitry can be provided with
9V battery supply.
11 P a g e
MODULE WISE DESIGN
1. LOW RANGE IR PROXIMITY SENSOR :
IR IR Pulse
Trans. Receiv Generator
Principle of Operation:
An IR proximity sensor works by applying a voltage to a pair of IR light emitting
diodes (LED’s) which in turn, emit infrared light. This light propagates through the air
and once it hits an object it is reflected back towards the sensor. If the object is close, the
reflected light will be stronger than if the object is further away. The sensing unit (for
this experiment a TSOP 1738 will be used), in the form of an integrated circuit (IC),
detects the reflected infrared light, and if its intensity is strong enough, the circuit
becomes active. When the sensing unit becomes active, it sends a corresponding signal
to the output terminal which can then be used to activate any number of devices. For the
purpose of this exercise, a small green LED will turn on when the sensor becomes active.
As shown in above block diagram Proximity sensor consist of three parts namely :
1) IR Transmitter
2) IR Receiver &
3) Pulse Generator
1) IR Transmitter:
It simply consist of an Simple IR Transmitter LED, which is biased
through a resistor R, which controls its intensity.
2) IR Receiver:
Similar to IR transmitter it also simply consist of an IR Receiver
Module i.e. TSOP 1738 which also biased similar to IR Transmitter.
3) Pulse Generator:
12 P a g e
The pulse generator consist of Timer IC NE555, which is
biased in monostable multivibrator mode & which is triggered
when –ve pulse is applied at pin2, which is pulled high with a
resistor. The IR Transmitter module is connected to the pin2 of
timer. When IR light falls on the Receiver module pin2 is shorted
to ground via the Receiver module & thus Timer is Triggered
generating a +ve pulse at the output (pin 3).
5 CTRL Control voltage allows access to the internal voltage divider (2/3 VCC)
6 THR The threshold at which the interval ends (it ends if the voltage at THR is at least 2/3
VCC)
7 DIS Connected to a capacitor whose discharge time will influence the timing interval
8 V+, VCC The positive supply voltage which must be between 3 and 15 V
DESCRIPTION
As the name implies, the sensor is always ON, meaning that the IR led is
constantly emitting light. this design of the circuit is suitable for counting
13 P a g e
objects, or counting revolutions of a rotating object, that may be of the order
of 15,300 rpm or much more. However this design is more power consuming
and is not optimized for high ranges. in this design, range can be from 1 to 10
cm, depending on the ambient light conditions.
Components positioning:
The correct positioning of the sender LED, the receiver with regard to each
other. First, we need to adjust the position of the sender LED with respect to the
receiver , in such a way they are as near as possible to each others , while
preventing any IR light to be picked up by the receiver before it hit and
object and returns back. The easiest way to do that is to put the sender(s)
LED(s) from one side of the PCB, and the receiver LED from the other side.
MICROCONTROLLER(8051):
The Intel 8051 is a Harvard architecture, single chip microcontroller (µC) which was
developed by Intel in 1980 for use in embedded systems. Intel's original versions were popular in
the 1980s and early 1990s, but has today largely been
superseded by a vast range of faster and/or functionally
enhanced 8051-compatible devices manufactured by more than
20 independent manufacturers including Atmel, Infineon
Technologies (formerly Siemens AG), Maxim Integrated
Products (via its Dallas Semiconductor subsidiary), NXP
(formerly Philips Semiconductor), Nuvoton (formerly
Winbond), ST Microelectronics, Silicon Laboratories (formerly
Cygnal), Texas Instruments and Cypress Semiconductor. Intel's
official designation for the 8051 family of µCs is MCS 51.
Intel's original 8051 family was developed using NMOS technology, but later versions,
identified by a letter C in their name (e.g., 80C51) used CMOS technology and were less power-
hungry than their NMOS predecessors. This made them more suitable for battery-powered
devices.
Important features and applications
14 P a g e
On-chip ROM - 4k/16k/32k/64k Byte (program memory)
Four byte bi-directional input/output port
UART (serial port)
Two/Three 16-bit Counter/timers
Two-level interrupt priority
Power saving mode
Common features included in modern 8051 based microcontrollers include built-in reset
timers with brown-out detection, on-chip oscillators, self-programmable Flash ROMprogram
memory, bootloader code in ROM, EEPROM non-volatile data storage, I²C, SPI, and USB host
interfaces, CAN or LIN bus, PWM generators, analog
comparators, A/Dand D/A converters, RTCs, extra counters and timers, in-circuit debugging
facilities, more interrupt sources, and extra power saving modes.
MEMORY ARCHITECTURE
The 8051 has four distinct types of memory - internal RAM, special function registers,
program memory, and external data memory.
Internal RAM (IRAM) is located from address 0 to address 0xFF. IRAM from 0x00 to
0x7F can be accessed directly, and the bytes from 0x20 to 0x3F are also bit-addressable. IRAM
from 0x80 to 0xFF must be accessed indirectly, using the @R0 or @R1 syntax, with the address
to access loaded in R0 or R1.
Special function registers (SFR) are located from address 0x80 to 0xFF, and are accessed
directly using the same instructions as for the lower half of IRAM. Some of the SFR's are also
bit-addressable.
Program memory (PMEM, though less common in usage than IRAM and XRAM) is
located starting at address 0. It may be on- or off-chip, depending on the particular model of chip
being used. Program memory is read-only, though some variants of the 8051 use on-chip flash
memory and provide a method of re-programming the memory in-system or in-application.
Aside from storing code, program memory can also store tables of constants that can be accessed
by MOVC A, @DPTR, using the 16-bit special function register DPTR.
External data memory (XRAM) also starts at address 0. It can also be on- or off-chip;
what makes it "external" is that it must be accessed using the MOVX (Move eXternal)
instruction. Many variants of the 8051 include the standard 256 bytes of IRAM plus a few KB of
XRAM on the chip. If more XRAM is required by an application, the internal XRAM can be
disabled, and all MOVX instructions will fetch from the external bus.
15 P a g e
Block diagram of internal architecture of
p89c51rd2hXX
Instruction set
The 8051 instruction set offers several addressing modes, including
17 P a g e
monochrome. The earliest discovery leading to the development of LCD
technology, the discovery of liquid crystals, dates from 1888.[1] By 2008,
worldwide sales of televisions with LCD screens had surpassed the sale of CRT
units.
Resolution: The horizontal and vertical screen size expressed in pixels (e.g.,
1024×768). Unlike CRT monitors, LCD monitors have a native-supported
resolution for best display effect.
Dot pitch: The distance between the centers of two adjacent pixels. The smaller
the dot pitch size, the less granularity is present, resulting in a sharper image.
Dot pitch may be the same both vertically and horizontally, or different (less
common).
Viewable size: The size of an LCD panel measured on the diagonal (more
specifically known as active
display area).
Response time: The minimum time
necessary to change a pixel's color
or brightness. Response time is also
divided into rise and fall time. For
LCD monitors, this is measured in
18 P a g e
btb (black to black) or gtg (gray to gray). These different types of
measurements make comparison difficult.[2]
Refresh rate: The number of times per second in which the monitor draws the
data it is being given. Since activated LCD pixels do not flash on/off between
frames, LCD monitors exhibit no refresh-induced flicker, no matter how low
the refresh rate.[3] High-end LCD televisions now feature up to 240 Hz refresh
rate, which allows advanced digital processing to insert additional interpolated
frames to smooth up motion, especially with lower-framerate 24p material like
the Blu-ray disc. However, such high refresh rates may not be supported by
pixel response times, and additional processing can introduce considerable
input lag.
Matrix type: Active TFT or Passive.
Viewing angle: (coll., more specifically known as viewing direction).
Color support: How many types of colors are supported (coll., more specifically
known as color gamut).
Brightness: The amount of light emitted from the display (coll., more
specifically known as luminance).
Contrast ratio: The ratio of the intensity of the brightest bright to the darkest
dark.
Display applications
The applications for the LCD’s are endless, Some of them are:
Television and digital television
Liquid crystal display television (LCD TV)
Digital signage
LCD projector
Computer monitor
Aircraft instrumentation displays (see glass cockpit)
HD44780 Character LCD, a widely accepted protocol for small LCDs
Various medical equipment.
Mobile Phone Displays.
19 P a g e
CIRCUIT DIAGRAM
The circuit is divide into two parts :
1) MAIN CIRCUIT
2) SENSOR CIRCUIT
(Proximity sensor)
20 P a g e
MAIN CIRCUIT
21 P a g e
SENSOR CIRCUIT
22 P a g e
23 P a g e
CIRCUIT DIAGRAM DISCRIPTION
A) Main circuit:
MAIN CIRCUIT diagram given above shows the interfacing
of microcontroller with LCD, LED’s & the switch.
The microcontroller is P89C51RD2Hxx (Phillips
Semiconductor). P89C51RD2Hxx is a 40pin member of 8051
microcontroller family, with 64Kb of on chip ROM &1KB of on chip
RAM with 3 timers & 3 interrupt inputs. It is biased with 5V regulated
DC supply & 11.0592Mhz crystal. LCD is interfaced to the
microcontroller at ports 1 & port 3. Port 1 acts as 8bit input data bus to
the LCD & the RS, R\W & EN pins of LCD are Connected to P3.1, P3.7
& P3.6 respectively which in turn controls the LCD.
Switch SW is connected at P2.0 pin of port2., where as LED1 &
LED2 are connected to pin P2.1 & P2.6 respectively. LED2 remains on.
At P3.4(Timer0 input) the input from the sensor is connected.
When switch “Start_count” is pressed, P2.0 pin of port2 goes low &
Timer 0 starts which counts the pulses applied at P3.4 for 1 sec. In
duration when microcontroller counts the pulses, LED1 is turned on &
LED2 is turned off.
24 P a g e
B) SENSOR CIRCUIT:
Sensor circuit comprises of three parts, Transmitter , Receiver &
pulse generator.
Transmitter circuit consist of an IR transmitter LED which is
simply forward biased through resistor R5. It emits IR beam of moderate
intensity continuously.
As shown in above the Receiver & Pulse Generator circuit
comprises of timer NE555, which is configured as a monostable
multiviabrator whose time period depends upon combination of resistor
R1 & capacitor C2, given by the equation:
25 P a g e
LIST OF COMPONENTS
Sr no. Name of Component Quantity
1. Microcontroller P89C51RD2 1
2. 16 by 2 LCD 1
3. IR Receiver 1
4. IR Transmitter 1
5. Crystal-11.0592 MHz 1
6. Push Button 3
7. IC Regulator-7806, 7805 2
8. NE555 1
9. Transistor-2N2222 1
10. LED’s 3
11. Battery – 9Volt 1
12. Resistors -150 Ω, 220 Ω, 10
470Ω, 820Ω, 1k,10k.
13. 1K Resistor Bank 1
14. Capacitors – 33pF, 0.1uF, 10
1uF, 100uF
15. Connectors & wires 1m
16. IC ZIP 1
17. PCB’s 2
26 P a g e
PCB Design
The PCB for the above circuit is designed in
DIPTRACE software, because it has the following
features:
1. Dip-Trace software is basically used for designing of a circuit diagram and
generating PCB layout.
2. It has different device libraries , which is used for the designing of a schematics
of a circuit diagram.
3. From this available component list, we choose the required component and
design the circuit on PC which we have already done on paper before
implementing.
5. After that we update it, from it we find any error of wrong footprint given to
faulty connection.
7. Manual routing is useful when circuit is complex. For this circuit , we have to
use both first auto routing and then manual routing for modifying the tracks
which makes the layout simpler and easy for manufacturing.
27 P a g e
Main Circuit pcb
28 P a g e
sensor Circuit pcb
29 P a g e
SOFTWARE SECTION
The software i.e. program for counting RPM and displaying it on LCD is
written in Assembly Language of 8051 microcontroller. It is complied &
assembled in KEIL μVISION.3 compiler & hex file is created. The Hex file is
downloaded in the microcontroller IC with help of FLASH MAGIC software.
ALGORITHM:
1. Equate (assign each pin of microcontroller the corresponding name.)
2. Start
10.Make P2.0 input port i.e. set P2.0 for switch input
14.When switch is pressed, start counter (Timer 0), make LED1 on & LED2 off.
30 P a g e
19.Display MSG4: ‘Counting Finished’
21.If A≠0 convert the contents of Accumulator to BCD format, Multiply each
number by 6 & adjust carry of next no.
22.Convert these BCD numbers to ASCII codes(add 30H to each) & save them in
registers from R0-R4.
25.Stop.
31 P a g e
FLOW CHART
Start
Initialize LCD
No Is
switch
pressed
? Yes
32 P a g e
Make LED1 on & LED2 off A
Is
A=0 Call subroutine ‘OUT’
?
Stop
33 P a g e
ASM CODE FOR COUNTING & DISPLAYING
RPM
DB0 BIT P1.0 ;Equate DB0 By P1.0
DB1 BIT P1.1 ;Equate DB1 By P1.1
DB2 BIT P1.2 ;Equate DB2 By P1.2
DB3 BIT P1.3 ;Equate DB3 By P1.3
DB4 BIT P1.4 ;Equate DB4 By P1.4
DB5 BIT P1.5 ;Equate DB5 By P1.5
DB6 BIT P1.6 ;Equate DB6 By P1.6
DB7 BIT P1.7 ;Equate DB7 By P1.7
EN BIT P3.1 ;Equate P3.1 By Enable of LCD
RS BIT P3.7 ;Equate RS By P3.7
RW BIT P3.6 ;Equate Write of LCD By P3.6
DAT EQU P1 ;Equate Port-1 By data I/p of LCD
SW BIT P2.0 ;Equate P2.0 by start button
LED1 BIT P2.1 ;Equate P2.1 by LED1
LED2 BIT P2.6 ;Equate P2.6 by LED2
TIM0 BIT P3.4 ;Equate P3.4 by T0(counter input)
ORG 0000H ;Start Execution
LJMP MAIN ;Jump to MAIN
ORG 000BH ;Timer 0 interrupt vector table
LJMP OUT ;Jump to OUT
RETI
ORG 0030H ;Main Program
MAIN:
SETB LED2 ;Make LED2 on
CLR LED1 ;Make LED1 off
;Initialize LCD
MOV DPTR,#MYCOM
C1: CLR A
34 P a g e
MOVC A,@A+DPTR
JZ NEXT0
LCALL COMMAND ;Call command subroutine
INC DPTR
SJMP C1
NEXT0: NOP
START:
JB SW,START ;Stay in loop, until switch is pressed(SW=1)
SETB LED1 ;Make LED1 on
CLR LED2 ;Make LED2 off
MOV TL0,#00H ;Load TL0 with 00
SETB TR0 ;Turn on Counter
LCALL CLEAR_LCD ;Clear LCD
MOV DPTR,#MSG3 ; Point DPTR to MSG3
LCALL LCD_MSG ;Write MSG3 to LCD
LCALL DELAY1 ;Wait for 1 sec.
MOV A,TL0 ;Check counter & copy it into Acc.
JNZ NEXT5
35 P a g e
CLR TR0 ;Stop counter
SETB LED2 ;
LCALL DELAY1 ;
NOP ;
LCALL DELAY1 ;
NOP ;
LCALL DELAY1 ;Wait for 5 seconds
NOP ;
LCALL DELAY1 ;
NOP ;
LCALL DELAY1 ;
NOP ;
LJMP MAIN ;Jump to main again
NEXT5: NOP
CLR TR0 ;Stop counter
NOT_EQ1:
JC NEXT
MOV A,#01
ADD A,R5
MOV R5,A
MOV A,R2
SUBB A,#0AH
MOV R2,A
NEXT: NOP
;Multiply MSB by 6
MOV A,R1
MOV B,#06
MUL AB
MOV B,#010
DIV AB
MOV R0,A
MOV A,B
ADD A,R5
MOV R1,A
CJNE R1,#09, NOT_EQ2
SJMP NEXT1
NOT_EQ2: JC NEXT1
MOV A,#01
ADD A,R0
MOV R0,A
MOV A,R1
SUBB A,#0AH
MOV R1,A
NEXT1: NOP
37 P a g e
MOV A,R3
ADD A,#30H
MOV R3,A
MOV A,R2
ADD A,#30H
MOV R2,A
MOV A,R1
ADD A,#30H
MOV R1,A
MOV A,R0
ADD A,#30H
MOV R0,A
OUT:
LCALL CLEAR_LCD ;Clear LCD
MOV DPTR,#MSG6 ; Point DPTR to MSG6
LCALL LCD_MSG ;Write MSG6 to LCD
RET
38 P a g e
COMMAND:
LCALL WAIT_LCD
MOV DAT,A
CLR RS
CLR RW
SETB EN
LCALL DELAY
CLR EN
RET
WAIT_LCD:
SETB DB7 ; Make P1.7 input port
CLR RS ;It’s a command
SETB RW ;It’s a read command
;Read Command register and check busy flag
BACK: CLR EN
LCALL DELAY
SETB EN
JB DB7,BACK
LCALL DELAY
CLR EN
CLR RW
RET
WRITE_DATA:
LCALL WAIT_LCD
MOV DAT,A
SETB RS
CLR RW
SETB EN ;Clock out command to LCD
CLR EN ;Finish command
RET
LCD_MSG:
CLR A ;Clear Index
MOVC A,@A+DPTR ;Get byte pointed by DPTR
JZ LCD_MSG9 ;Return if found the zero (end of string)
LCALL WRITE_DATA ;It was data, write it to LCD
LCALL DELAY ;Give LCD some time
INC DPTR ;Point to the next byte
SJMP LCD_MSG ;Go get next byte from string
LCD_MSG9: RET ;Return to Caller
39 P a g e
CLEAR_LCD:
LCALL WAIT_LCD
MOV DAT,#01H
CLR RS
CLR RW
SETB EN
LCALL DELAY
CLR EN
RET
DELAY:
MOV R6,#10
D1: MOV R7,#255
D2: DJNZ R7,D2
DJNZ R6,D1
RET
ORG 400H
MYCOM: DB 38H, 0EH, 01, 06, 84H, 0 ;Commands & Null
MSG0: DB "RPM Counter", 0 ; data and null
MSG1: DB "TE Electronics", 0 ; data and null
MSG2: DB "Want To Count ", 0 ; data and null
MSG3: DB "Counting RPM", 0 ; data and null
MSG4: DB "Counting Finished", 0 ; data and null
MSG5: DB "RPM of Machine is", 0 ; data and null
MSG6: DB "RPM out of range", 0 ; data and null
END
40 P a g e
APPLICATIONS:
42 P a g e
Bill OF Materials
43 P a g e
REFRENCES
44 P a g e
DATASHEETS
1) NE555N
2) 2N2222A
3) TSOP1738
4) P89C51RD2Hxx
5) 16 by 2 LCD (Hitachi)
6) LM7805
45 P a g e