INTRODUCTION The tachometer also called revolution counter is an instrument used to measure the rotation speed of a shaft or disk, as with electric motors. Generally these measurements are rated in round per minute (R.P.M). The word is formed from Greek roots tachos, meaning speed and metron, meaning measure. The traditional tachometer is laid out as a dial, with a needle indicating the current reading and marking safe and dangerous levels. Recently, digital tachometers giving a direct numeric output have become more common. In its most familiar form, a tachometer measures the speed at which a mechanical device is rotating. A common example is the tachometer found on automobile dashboards. The traditional tachometer requires physical contact between the instrument and the device being measured. In applications where this is not feasible for technical or safety reasons, it may be possible to use a contactless tachometer to take measurements from a distance. A contactless tachometer can be a permanent part of the system, or it can be handheld for occasional spot measurements. This device is built on an AT89C2051 microcontroller, a 7-segment display and a phototransistor to detect the rotation of the shaft whose speed is being measured. 1
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
INTRODUCTION
The tachometer also called revolution counter is an instrument used to
measure the rotation speed of a shaft or disk, as with electric motors. Generally these
measurements are rated in round per minute (R.P.M). The word is formed from Greek
roots tachos, meaning speed and metron, meaning measure. The traditional
tachometer is laid out as a dial, with a needle indicating the current reading and
marking safe and dangerous levels. Recently, digital tachometers giving a direct
numeric output have become more common. In its most familiar form, a tachometer
measures the speed at which a mechanical device is rotating. A common example is
the tachometer found on automobile dashboards. The traditional tachometer requires
physical contact between the instrument and the device being measured. In
applications where this is not feasible for technical or safety reasons, it may be
possible to use a contactless tachometer to take measurements from a distance. A
contactless tachometer can be a permanent part of the system, or it can be handheld
for occasional spot measurements.
This device is built on an AT89C2051 microcontroller, a 7-segment display
and a phototransistor to detect the rotation of the shaft whose speed is being
measured.
The idea behind most digital counting device, frequency meters and
tachometer, is a microcontroller, used to count the pulses coming from a sensor or any
other electronic device. In the case of this tachometer, the counted pulses will come
from phototransistor, 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.
The pulses picked up by the phototransistor are sensed by the internal
comparator of AT89C2051 and, through software, each pulse representing one
rotation of the object is detected. By counting the number of such pulses, on an
average per minute basis, the RPM is evaluated.
1
Just point the light-sensitive probe tip atop the spinning shaft towards the
spinning blade, disk or chuck and read the rpm. The only requirement is that you first
place a contrasting colour mask. A strip of white adhesive tape is ideal on the
spinning object. Position it such that the intensity of light reflected from the object’s
surface changes as it rotates. Each time the tape spins past the probe, the momentary
increase in reflected light is detected by the phototransistor. The signal processor and
microcontroller circuit counts the increase in the number of such light reflections
sensed by it and thereby evaluates the rpm, which is displayed on the 4-digit, 7-
segment display. The phototransistor is kept inside a plastic tube, which has a convex
lens fitted at one end. A convex lens of about 1cm diameter and 8-10cm focal length
is a common item used by watch repairers and in cine film viewer toys. It can be
obtained from them to set up the experiment. The phototransistor is fixed on a piece
of cardboard such that it faces the lens at a distance of about 8 cm. The leads from the
phototransistor are taken out and connected.
2
Literature Review:
2.1. Working of Tachometer
Benfield, A. E. in Sep 1949 [1] .This paper appears in the Proceedings of the
IEEE.Volume: 20 , Issue: 9 Page(s): 663-667
The theory and operation of a simple tachometer are described, in which a
direct electrical e.m.f. is generated by attaching a magnet to the rotating member. It is
shown how the position and orientation of the magnet affect the magnitude of the
generated e.m.f., and suggestions are made for further increasing the e.m.f. generated
per rate of revolution.
2.2. Induction type digital tachometer
Ahmad, M. in Aug 1984 This paper appears in the Proceedings of the IEEE.
Volume: 72 , Issue: 9 Page(s): 1096
An induction-type digital tachometer in which the number of pulses is
proportional to the speed is described. Even for very low speeds the number of pulses
is high, making it very suitable for extremely low speed measurement.
LEDs are also used in the remote control units of many commercial products
including televisions, DVD players, and other domestic appliances.
4.7.9. Phototransistor (L14F1):
A phototransistor is in essence a bipolar transistor encased in a transparent
case so that light can reach the base-collector junction. It was invented by Dr. John N.
Shive (more famous for his wave machine) at Bell Labs in 1948, but it wasn't
announced until 1950. The electrons that are generated by photons in the base-
collector junction are injected into the base, and this photodiode current is amplified
by the transistor's current gain β (or hfe). If the emitter is left unconnected, the
phototransistor becomes a photodiode. While phototransistors have a high
erresponsivity for light they are not able to detect low levels of light any better than
photodiodes.[ Phototransistors also have significantly longer response times.
. Figure no. 4.8
Photo transistors are operated in their active regime, although the base
connection is left open circuit or disconnected because it is not required. The base of
the photo transistor would only be used to bias the transistor so that additional
collector current was flowing and this would mask any current flowing as a result of
the photo-action. For operation the bias conditions are quite simple. The collector of
an n-p-n transistor is made positive with respect to the emitter or negative for a p-n-p
transistor. The light enters the base region of the phototransistor where it causes hole
electron pairs to be generated. This mainly occurs in the reverse biased base-collector
junction. The hole-electron pairs move under the influence of the electric field and
provide the base current, causing electrons to be injected into the emitter.
20
Characteristics:
Phototransistor has a high level of gain.
phototransistor has a much lower level of noise.
4.7.10. 7-Segment Display:
A seven segment display is the most basic electronic display device that can
display digits from 0-9. They find wide application in devices that display numeric
information like digital clocks, radio, microwave ovens, electronic meters etc. The
most common configuration has an array of eight LEDs arranged in a special pattern
to display these digits. They are laid out as a squared-off figure ‘8’. Every LED is
assigned a name from 'a' to 'h' and is identified by its name. Seven LEDs 'a' to 'g' are
used to display the numerals while eighth LED 'h' is used to display the dot/decimal.
Figure no. 4.9
A seven segment is generally available in ten pin package. While eight pins
correspond to the eight LEDs, the remaining two pins (at middle) are common and
internally shorted. These segments come in two configurations, namely, Common
cathode (CC) and Common anode (CA). In CC configuration, the negative terminals
of all LEDs are connected to the common pins. The common is connected to ground
and a particular LED glows when its corresponding pin is given high. In CA
arrangement, the common pin is given a high logic and the LED pins are given low to
display a number.
21
The seven elements of the display can be lit in different combinations to
represent the arabic numerals. Often the seven segments are arranged in
an oblique (slanted) arrangement, which aids readability. In most applications, the
seven segments are of nearly uniform shape and size, though in the case of adding
machines, the vertical segments are longer and more oddly shaped at the ends in an
effort to further enhance readability. The numerals 0,1,6, 7 and 9 may be represented
by two or more different glyphs on seven-segment displays. The seven segments are
arranged as a rectangle of two vertical segments on each side with one horizontal
segment on the top, middle, and bottom. Seven-segment displays may use a liquid
crystal display (LCD), arrays of light-emitting diodes (LEDs), or other light-
generating or controlling techniques such as cold cathode gas discharge,
A vacuum fluorescent, incandescent filaments, and others.
4.7.11. CAPACITOR:
Capacitor essentially consists of two conducting surface separating by a
layer of an insulating medium called dielectric. The conducting surface may be in the
form of either circular or rectangular plates or be of spherical or cylindrical shape.
The purpose of a capacitor is to store the electrical energy by electrostatic stress in the
dielectric (the word condenser is a misnomer since a capacitor does not condense
electric as such it merely stores it). The property of a capacitor to store electricity may
be called its capacitance. A capacitors ability to store energy, its capacitance is
dependent on three factors (a) the surface area of the plates of which it is composed
(b) the thickness of the insulating material (c) the material of which the dielectric is
composed of. Essentially a system in which two or more metal plates (conductor) are
placed in close proximity to each other & are separated by an insulating material
called the dielectric. When the plates of the capacitor are connected to a voltage
source there will be a surplus of electrons on the plate connected to the negative side
and a shortage of electron on a plate connected to the positive side of the voltage
source. The surpluses of electrons on the negative plate will repel the electrons on the
other plate driving them back toward the positive plate will attract electrons from the
negative plate of the voltage source. The electron flow will continue until the
negative and positive charges on the capacitor plates are equal to the Voltage source.
22
When the condition exists the capacitor is said to be charged. When the voltage
source is disconnected the condition of unbalance that has been setup on the capacitor
plates will remain thus providing a means of storing electricity in the capacitor ratio
between the magnitude of the charge on the plates and the voltage difference between
the plate is called the capacitance ‘c’.
Types of Capacitor:
There are a very, very large variety of different types of capacitors:
Dielectric Capacitor
Film Capacitor
Ceramic Capacitors
Electrolytic Capacitors
In this project, electrolytic & ceramic capacitors are used:
Ceramic Capacitors:
Ceramic Capacitors or Disc Capacitors as they are generally called, are made
by coating two sides of a small porcelain or ceramic disc with silver and are then
stacked together to make a capacitor. For very low capacitance values a single
ceramic disc of about 3-6mm is used. Ceramic capacitors have a high dielectric
constant (High-K) and are available so that relatively high capacitances can be
obtained in a small physical size.
Ceramic Capacitor
Figure no. 4.10
23
They exhibit large non-linear changes in capacitance against temperature and
as a result are used as de-coupling or by-pass capacitors as they are also non-polarized
devices. Ceramic capacitors have values ranging from a few picofarads to one or two
microfarads but their voltage ratings are generally quite low.Ceramic types of
capacitors generally have a 3-digit code printed onto their body to identify their
capacitance value in pico-farads.
Electrolytic Capacitors:
Electrolytic Capacitors are generally used when very large capacitance values
are required. Here instead of using a very thin metallic film layer for one of the
electrodes, a semi-liquid electrolyte solution in the form of a jelly or paste is used
which serves as the second electrode (usually the cathode). The dielectric is a very
thin layer of oxide which is grown electro-chemically in production with the thickness
of the film being less than ten microns. This insulating layer is so thin that it is
possible to make capacitors with a large value of capacitance for a small physical size
as the distance between the plates, d is very small.
Figure no. 4.11
The majority of electrolytic types of capacitors are Polarised, that is the DC
voltage applied to the capacitor terminals must be of the correct polarity. Electrolytic
Capacitors are generally used in DC power supply circuits due to their large
capacitances and small size to help reduce the ripple voltage or for coupling and
decoupling applications.
24
4.7.12. RESISTOR:
Resistors are the electronic components used to control the current passing
through the circuit. They are calibrated in ohms. In other word resistance are circuit
elements having the function of introducing electrical resistance into the circuit.
There are three basic types :( a) Fixed resistor (b) Rheostat (c) Potentiometer
A fixed resistor is a two terminal resistor whose electrical resistance is constant.
A rheostat is a resistor that can be changed in resistance value without opening the
circuit to make adjustment.
A potentiometer is an adjustable resistor with three terminals, one at each end of the
resistor element and third movable along its length.
4.8. PCB Layout:
The PCB layout of the project is:-
Figure no.4.12
25
4.9. Working:
The tachometer comprises AT89C2051 microcontroller, ULN2003 high-
current Darlington transistor array, CA3140 operational amplifier, common-anode 7-
segment (4-digit multiplexed) display and its four anode-driving transistors. The
AT89C2051 is a 20-pin, 8-bit microcontroller of Intel’s 8051 family made by Atmel
Corporation. Port-1 pins P1.7 through P1.2, and port-3 pin P3.7 are connected to input
pins 1 through 7 of ULN2003. Port-1 pins are pulled up with 10-kilo-ohm resistor
network RNW1. They drive all the seven segments of the display with the help of
internal inverters. Port-3 pins P3.0 through P3.3 of the microcontroller are connected
to the base of transistors T1 through T4, respectively, to select one digit out of the
four at a time and to supply anode-drive currents to the common anode pin of
respective digit. When pin P3.0 of microcontroller IC1 goes low, it drives transistor
T1 into saturation, which provides the drive current to anode pin 6 of 4- digit, 7-
segment, common-anode display DIS1. Similarly, transistors T2 through T4,
respectively, provide supply to common-anode pins 8, 9 and 12 of DIS1. Thus
microrocontroller IC1 drives the segment in multiplexed manner using its port pins.
This is time-division multi-plexing process. Segment data and display-enable pulse
for display are refreshed every 5ms. Thus, the dis-play appears to be continuous even
though it lights up one by one. Switch S1 is used to manually reset the
microcontroller, while the power-on-reset signal for the microcontroller is given by
C1 and R6. A 12MHz crystal is connected to pins 4 and 5 of IC1 to generate the basic
clock frequency for the microcontroller. The circuit uses a 6V battery for power
supply or alternatively mains derived low voltage supply.
4.9. Software:
The software is written in Assembly language and assembled using 8051
cross-assembler. It is well commented and easy to understand. It uses AT89C2051’s
internal timer for measuring the period of one cycle of the rotation in units of 100
microseconds. Thus if the speed is 1500 rpm, it is 25 rps, and the time taken for one
cycle is 40 ms. The timer uses an interrupt to count overflows every 100
microseconds and so the number counted by the timer program in this case will be
‘400.’ This is divided by ‘600,000’ (so many 100/µs present in a minute), giving a
result of ‘1500.’ This gives the rpm. These digits are displayed on the 4-digit, 7-
26
segment display. To perform the division, subroutine UDIV32 is employed, which is
a standard subroutine available for 8051 family for 32-bit number by 16-bit number
division. It has an accuracy of 5 rpm in a 6000rpm count. The software for this
project is given below;
Program burned in microcontroller
$mod51ORG 0H AJMP 30HORG 0BH; TIMER 0 INTERRUPT VECTORAJMP TIMER0ISR; Timer 0 Interrupt service routine addressORG 30H MOV SP,#60H ;set stack pointer MOV P3,#0FFH ;set all port 3 bits high to enable inputs also MOV P1,#03 ;set port 1 to all zeros expect bits 0,1 MOV TMOD,#01100001B ;TIMER 1 - MODE 2COUNTER,TIMR-0 TO 16 bit timerBEG: MOV TH0,#0ffH ;TIMER REG.0 IS SET TO 0,GIVES 64ms MOV TL0,#-99 ; timer low reg. is also so setb et0 setb ea mov 44h,#0 mov 45h,#0 acall delay ajmp lowsigdelay: mov r2,#10 djnz r2,$ ;wait 20 us retlowsig: jb p3.6,lowsig call delay jnb p3.6,$ setb tr0 ; start timer mov c,p3.6 ;high begins mov p3.5,c acall delay jb p3.6, $ mov c,p3.6 ;low now mov p3.5,c acall delay jnb p3.6,$ mov c,p3.6 ;high begins again mov p3.5,c clr tr0 ;stop timer clr et0 ;and interrupt by timer mov r3,#0 ;number 600000 or 927c0 hex as Dividend
27
mov r2,#09h ; 9 mov r1,#27h ;27 mov r0,#0c0h ; c0 mov r5,45h ;divisor is time for one cycle mov r4,44h call UDIV32 ;divide 60000/t mov 40h,r0 mov 41h,r1 mov r1,41h mov r2,40h CALL HEX2BCD mov 50h,#0FFH call refreshdisp: call refresh1 djnz 50h,disp ; so many times for a visible time limit jmp beg;16 Bit Hex to BCD Conversion for 8051 Microcontroller;This routine is for 16 bit Hex to BCD conversion;;Accepts a 16 bit binary number in R1,R2 and returns 5digit BCD in ;R7,R6,R5,R4,R3(upto 64K ) Hex2BCD: ;r1=high byte, r7 most significant digit, R2= LSByte MOV R3,#00D MOV R4,#00D MOV R5,#00D MOV R6,#00D MOV R7,#00D MOV B,#10D MOV A,R2 DIV AB MOV R3,B ; MOV B,#10 ; R7,R6,R5,R4,R3 DIV AB MOV R4,B MOV R5,A CJNE R1,#0H,HIGH_BYTE ; CHECK FOR HIGHBYTE SJMP ENDDHIGH_BYTE: MOV A,#6 ADD A,R3 MOV B,#10 DIV AB MOV R3,B ADD A,#5 ADD A,R4 MOV B,#10 DIV AB MOV R4,B ADD A,#2 ADD A,R5
28
MOV B,#10 DIV AB MOV R5,B CJNE R6,#00D,ADD_IT SJMP CONTINUEADD_IT: ADD A,R6CONTINUE: MOV R6,A DJNZ R1,HIGH_BYTE MOV B, #10D MOV A,R6 DIV AB MOV R6,B MOV R7,AENDD: retDISP1:REFRESH:; content of 18 to 1B memory locations areoutput on LEDs ; only numbers 0 to 9 and A to F are valid data inthese locations MOV 18H,r3 ; least significant digit MOV 19H,r4 ; next significant digit MOV 1AH,r5 MOV 1BH,R6 ; most significant digit (max:9999) RETrefresh1: MOV R0,#1bh ; 1b,1a,19,18, holds values for 4 digits MOV R4,#8 ; pin p3.3_ 0 made low one by one startswth 18 mov r7,#2 ; decimal pt.on 3rd digit from left (2 ndfromright)PQ2: CALL SEGDISP dec R0 mov a,r4 rrc a mov r4,a jnc pQ2 PV3:RETSEGDISP:mov dptr,#ledcode MOV A,@R0 ANL A,#0FH MOVC A,@A+dptrsegcode:MOV R5,A ORL A,#03H ; WE WANT TO USE PORT 1 BITS 0AND 1 FOR INPUT ANLOG ; so retain them high S3: MOV P1,A ; SEGMENT_PORT MOV A,R5 ;we use p3.7 for the segment ‘a’ of display RRC A ;so get that bit D0into carry rrc a mov p3.7,c ;segment ‘a;
29
S1: MOV A,R4 ; get digit code from r4 00001000 cpl a ;11110111 rrc a ;11111011-1 mov p3.0,c ; output to drive transsitors for digit light-ing rrc a ;11111101-1 mov p3.1,c rrc a ;11111110-1 mov p3.2,c rrc a ;1111111-0 yes low makes left most digit showmsdigitmov p3.3,cS5:S4: ACALL DELAY1 ; let it burn for some time MOV A,#0ffH ; extinguish the digit after that time MOV P3,A ; to prevent shadow s6: RETledcode:DB 7EH,0CH,0B6H,9EH,0CCH,0DAH,0FAH ;these are code for the numbers 0 to 9 and A to F DB 0EH,0FEH,0CEH,0EEH,0F8H,72H,0BCH,0F6H,0E2H DELAY1:MOV 55h,#0ffH ; 1ms N: NOP DJNZ 55h,N RETTIMER0ISR:mov th0,#0ffh mov tl0,#-90 ; in 100 us steps push acc mov a,#1 clr c add a, 44h ;count time btwn pulses mov 44h,a mov a,#0 addc a,45h ;add carry to most sign. byte mov 45h,a pop acc reti; subroutine UDIV32;32 bit /16 bit to 32 bit quotient and remainder un-signed;input r3,r2,r1,r0 = dividend X;input r5,r4 = divisor y;output r3-r0 = quotient Q of X/Y;r7,r6,r5,r4 =remainder;alters acc, flagsUDIV32: push 08 ;save reg. bank 1 push 09 push 0AH push 0BH push 0CH
30
push 0DH push 0EH push 0Fh push dpl push dphpush Bsetb RS0 ;select reg.bank 1mov r7,#0mov r6,#0mov r5,#0mov r4,#0mov B,#32 ;set loop countdiv_lp32:clr RS0 ;selet reg.bank 0clr Cmov a,r0 ;shift highestbit of Xrlc amov r0,amov a,r1 ;shift next bit of Xrlc amov r1,amov a,r2 ;shift next bit of Xrlc amov r2,amov a,r3 ;shift next bit of Xrlc amov r3,asetb rs0 ;reg. bank 1mov a,r4 ;lowest bit of remainderrlc amov r4,amov a,r5 ;shift next bit of remrlc amov r5,amov a,r6 ;shift next bit of remrlc amov r6,amov a,r7 ;shift next bit of remrlc amov r7,amov a,r4clr Csubb a,04mov dpl,amov a,r5subb a,5mov dph,amov a, r6subb a,#0mov 06,amov a,r7