DIGITAL CONTACTLESS TACHOMETER B. Tech. Mini Project Final Report Submitted in partial fulfillment for the award of the Degree of Bachelor of Technology in Electrical and Electronics Engineering by AVINESH VASUDEVAN B080307EE MANOJ M CHERIAN B080105EE RONY J KOONTHANAM B080048EE Under the guidance of Dr.K.S. Sivanandan
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
DIGITAL CONTACTLESS TACHOMETER
B. Tech. Mini Project Final Report
Submitted in partial fulfillment for the award of the Degree ofBachelor of Technology in Electrical and Electronics Engineering
by
AVINESH VASUDEVAN B080307EEMANOJ M CHERIAN B080105EERONY J KOONTHANAM B080048EE
Under the guidance of
Dr.K.S. Sivanandan
Department of Electrical Engineering
NATIONAL INSTITUTE OF TECHNOLOGY CALICUT NIT Campus P.O., Calicut - 673601, India
2011
CERTIFICATEThis is to certify that the report entitled “DIGITAL CONTACTLESS
TACHOMETER” is a bonafide record of the mini project done by AVINESH VASUDEVAN (Roll No.B080307EE), MANOJ M CHERIAN (Roll No. B080105EE) and RONY J KOONTHANAM (Roll No. B080048EE) under my supervision and guidance, in partial fulfillment of the requirements for the award of Degree of Bachelor of Technology in Electrical & Electronic Engineering from National Institute of Technology Calicut for the year 2010-11.
Dr.K.S. SIVANANDAN Dr. R. SREERAM KUMAR (Guide) (Head of the Department)Professor ProfessorDept. of Electrical Engineering Dept. of Electrical Engineering
Place: NIT CalicutDate:4/5/2011
ACKNOWLEDGEMENT
We would like to express our sincere gratitude to our guide, Dr. K S Sivanandan,
Professor, Department of Electrical Engineering, National Institute of Technology Calicut, for
allowing us to undertake this project and for his valuable suggestions, guidance and support
during the course of work.
We also want to thank Mr. Ananthakrishnan, Faculty in charge (mini projects- EED),
Dr. Jeevamma Jacob, our evaluator and Dr. Sreeram Kumar, HOD-EED for giving us a
chance to carry out this project.
Finally, we thank God for enabling us to carry out our work without hassles.
ABSTRACT
In the present era, control system is an area of utmost importance. Keeping
this in mind our mini-project aims to fabricate a device which can be used to measure
the rotating speed of a machine without coming in contact with the machine itself.
With this technique, sensing the speed of a machine becomes relatively easy.
Our aim is to create a device to sense a series of pulses sent by an infra-red
transmitter, making use of the output from the infra-red receiver, decoding it by using
a PIC Microcontroller to find the speed of the system, which can be used in numerous
programmed control applications. A secondary objective of this device is to reduce
the error sustained in sensing the speed by way of using an effective algorithm to
compute the speed.
The output from this device can be used as input for any process or can even
be used as a feedback for that machine itself. As the device is of non-contact type, we
can use it as a portable speed detector itself. Due to the output of the device being
digital it can be used in conjunction with digital control systems. We have made a
model of this concept, displaying the output on a Liquid Crystal Display.
LIST OF ABBREVIATIONS
LCD - LIQUID CRYSTAL DISPLAY
RPM - ROTATIONS PER MINUTE
IR - INFRA-RED
PCB - PRINTED CIRCUIT BOARD
ASCII - AMERICAN STANDARD CODE FOR INFORMATION
INTERCHANGE
LIST OF SYMBOLS
kHz - kilo Hertz
V - Volts
A - Ampere
mA - milli Ampere
µA - micro Ampere
µF - micro Farad
Ω - Ohm
LIST OF FIGURES
FIGURE NO NAME PAGE NO
FIG 2.1 EQUIVALENT CIRCUIT DIAGRAM OF CAPACITOR CHARGING IN IC555
10
FIG 2.2 EQUIVALENT CIRCUIT DIAGRAM OF CAPACITOR CHARGING IN IC555
11
FIG 2.3 INTERNAL BLOCK DIAGRAM OF IC555 12
FIG 2.4 EXTERNAL CONNECTION DIAGRAM OF IC555 13
FIG 2.5 CAPACITANCE VS FREQUENCY GRAPH 13
FIG 2.6 OUTPUT & THRESHOLD PIN WAVEFORMS 13
FIG 3.1 CIRCUIT OF IC555 TIMER CIRCUIT AS AN ASTABLE MULTIVIBRATOR
16
FIG 3.2 INTERNAL BLOCK DIAGRAM OF TSOP 1738 17
FIG 3.3 PIN DIAGRAM OF PIC18F452 MICROCONTROLLER 18
FIG 3.4 PIN DIAGRAM OF 16x2 LCD 19
FIG 3.5 9V BATTERY AND CONNECTER 20
FIG 5.1 BLOCK DIAGRAM OF A CONTACTLESS IR
TACHOMETER
23
FIG 5.2 POWER SUPPLY CONNECTION OF PIC18F452 24
FIG 5.3 SIMULATION CIRCUIT OF DIGITAL TACHOMETER 25
CONTENTS
Chapter No Title Page No
1 INTRODUCTION 8
2 THEORY AND EQUATIONS 10
2.1 ASTABLE MULTIVIBRATOR OPERATION
10
2.2 INFRARED REFLECTION
14 3 COMPONENTS
15
3.1 INFRA-RED TRANSMITTER
15
3.2 INFRA-RED RECEIVER MODULE
17
3.3 PIC MICROCONTROLLER:
18
3.4 16X2 LIQUID CRYSTAL DISPLAY:
19 3.5 POWER SOURCE
20
4 CONCEPT AND CONSTRUCTION
21
5 STAGES OF IMPLEMENTATION 23
5.1 DESIGN DEVELOPMENT
23
5.2 PROCUREMENT OF COMPONENTS
24
5.3 CIRCUIT ASSEMBLY
24
5.4 MICROCONTROLLER PROGRAMMING
25
5.5 LCD SETUP
26
6 PROGRAM (CODE) 27
7 IMPLEMENTATION OBSTACLES 31
7.1 RESULTS AND DISCUSSIONS
31
7.2 DRAWBACKS 31
8 FUTURE ENHANCEMENTS 32
9 REFERENCES 33
CHAPTER 1INTRODUCTION
A tachometer also called a revolution-counter or RPM gauge is an instrument
that measures the rpm of a shaft or disk, as in a motor or other machine. The device
usually displays the revolutions per minute (RPM) on a calibrated analogue dial, but
digital displays are now being used.
A conventional tachometer works as a transducer which converts the
mechanical energy into proportional electrical energy. The tachometer shaft rotates
along with that of the machine and thereby generating a voltage which is calibrated in
terms of rpm of the machine.
With the advent of electronics it has become possible to scale down
tachometer into a small and portable device. These tachometers have the distinct
advantage that they don’t need to be in contact with the rotating body. The proposed
electronic digital tachometer works on the principle that the count is obtained from the
reflected rays of a strip pasted on the shaft or flywheel of the rotating device. The
reflected pulse is nothing but that of the reflection of the infrared rays (whose
emission is well controlled) transmitted from a transmitter mounted on the
tachometer.
They have various applications like in Automobiles (shows the rate of
rotation of the engine's crankshaft by measuring the spark rate of the ignition system),
Light Rail Vehicles (the rotational speed of the axle), Analog audio recording
(measures the speed of audio tape as it passes across the head) etc. Tachometers fitted
to cars, aircraft, and other vehicles typically have markings indicating a safe range of
speeds at which the engine may be operated.
The transmitter circuit uses an IC555 timer circuit. The output of this circuit is
connected to an infra-red transmitter diode, the TSAL6200. The diode emits waves in
the infra-red spectrum at the pulse rate specifies by the timer circuit. This can be
suited to our preference by choosing appropriate resistance values in the timer circuit.
The pulses sent by the transmitter diode reflect off the surface of the machine.
The presence of a reflective strip helps as it would create a difference in the pattern of
reflection of the pulses from the surface. The strip being of lighter colour than the
surface of the machine will reflect more of the pulses than the surface. This change is
noticable to the infrared receiver.
The infrared receiver used in this device is the TSOP1738. It is a miniaturized
receiver that is used to detect frequencies near a certain range. The range of
frequencies for which each receiver works is different. The range for the receiver used
here, the TSOP1738 is 38 kHz with 5% tolerance either way. Therefore the timer
circuit has to be designed such that it oscillates inside the frequency range specified
by the receiver. The receiver gives a high output when it is not receiving pulses within
this range and gives a low output when it receives a pulse that is inside this range.
This output of this receiver is given to the microcontroller. The
microcontroller used here is the PIC18F452. The PIC processes the output from the
receiver and computes the speed of the machine by using a timer programming
algorithm. This value found is averaged for many time periods and is thus closer to
the real value of the speed. This averaging is done so that any errors that may have
appeared by way of the device may be negated.
The speed computed by the microcontroller is given to a 16x2 LCD system to
display the output.
CHAPTER 2
THEORY AND EQUATIONS
2.1 ASTABLE MULTIVIBRATOR OPERATION
An astable timer operation is achieved by setting up and configuring the
circuit as shown on Fig 2. In the astable operation, the trigger terminal and the
threshold terminal are connected so that a self-trigger is formed, operating as a
multivibrator. When the timer output is high, its internal discharging Transistor turns
off and the VC1 increases by exponential function with the time constant (RA+RB)*C.
When the VC1, or the threshold voltage, reaches 2Vcc/3, the comparator output
on the trigger terminal becomes high, resetting the Flip-flop and causing the timer
output to become low. This in turn turns on the discharging Transistor and the C1
through the discharging channel formed by RB and the discharging Transistor. When
the VC1 falls below Vcc/3, the comparator output on the trigger terminal becomes high
and the timer output becomes high again. The discharging Transistor turns off and the
VC1 rises again.
In the above process, the section where the timer output is high is the time it
takes for the VC1 to rise from Vcc/3 to 2Vcc/3, and the section where the timer output
is low is the time it takes for the VC1 to drop from 2Vcc/3 to Vcc/3. When timer
output is high, the equivalent circuit for charging capacitor C1 is as follows:
FIG 2.1 EQUIVALENT CIRCUIT DIAGRAM OF CAPACITOR CHARGING IN
IC555
The equivalent circuit for discharging capacitor C1, when timer output is low is, as
follows:
FIG 2.2 EQUIVALENT CIRCUIT DIAGRAM OF CAPACITOR CHARGING
IN IC555
Since the duration of the timer output low state (tL) is the amount of time it takes for
the VC1 (t) to reach Vcc/3,
Since RD is normally RB>>RD although related to the size of discharging
Transistor,
tL = 0.693RBC1 (10).
Consequently, if the timer operates in astable, the period is the same with
because the period is the sum of the charge time and discharge time. And since
frequency is the reciprocal of the period, the following applies.
FIG 2.3
INTERNAL BLOCK DIAGRAM OF IC555
FIG 2.4 FIG 2.5 EXTERNAL CONNECTION DIAGRAM CAPACITANCE VS
FREQUENCY OF IC555 GRAPH
FIG 2.6 OUTPUT & THRESHOLD PIN WAVEFORMS
2.2 Infrared reflection
It is common knowledge that darker colours are better absorbers of light and
thereby become better radiators of heat. So the reverse is applicable for lighter
colours. They turn out to be bad absorbers and bad radiators. Due to these properties it
is found that they are good reflectors.
The colour of an object depends on the wavelengths of colours reflected
from the object. A red apple is red because red wavelengths in white light are
reflected and other wavelengths are absorbed. In fact, if a red apple were to be
illuminated by light that had no red wavelengths, the apple would appear almost
black.
When a black object is illuminated by white light, all wavelengths are
absorbed and none are reflected. That is why the object appears black. So when light
is absorbed by a black object, the energy carried by the light doesn't just disappear.
Rather, it raises the energy of the object doing the absorbing. The object, in turn,
releases the absorbed energy by emitting longer wavelength, lower energy infrared
(heat). This transformation of light into heat is the key to understanding the process
because it accounts for the law of conservation of energy. Light just doesn't disappear
when it strikes a black object, it is transformed into another kind of radiation that is
either radiated from or retained within the black object.
The darker the object, the better its emission of heat because it is a better
absorber of light. So vice versa, the lighter the object the better reflector it is. This is
the principle which we use to find the revolutions per minute. As the white strip is a
better reflector, the receiver module gets more reflected rays when it passes through.
The darker surrounding surface is less of a reflector and so doesn’t provide that much
reflected rays to the receiver module. So every time the reflective strip passes in front
of the transmitter diode the receiver encounters an increase in rays incident upon it.
This sudden increase in infrared rays is used to detect the completion of one
revolution and the beginning of the next.
CHAPTER 3
COMPONENTS
1. IC 555
2. ASAL6200 IR transmitter diode
3. TSOP1738 IR receiver module
4. PIC18F452 Microcontroller
5. 16x2 LCD display
6. IN4148 Diode
7. LM 7805 Voltage Regulator
8. Power Source
9. PCB, Resistors, capacitors and oscillators of required ratings
3.1 Infra-red Transmitter:
The transmitter consists of an IC 555 timer circuit (astable multivibrator) with
an IR LED at the output. The IC 555 timer circuit is designed to produce a pulse of
frequency 33 kHz .The pulse produced triggers ‘on’ the transistor which in turn
forward biases the IR diode. A resistor is kept in series to limit the current through the
semiconductor devices. When the IR diode is forward biased during the on-time of the
pulse, it emits infra-red rays.
IC 555 and Astable Multivibrator circuit:
The 555 Timer IC is an integrated circuit (chip) used in a variety of timer,
pulse generation and oscillator applications. The IC was designed by Hans R.
Camenzind in 1970.The LM555 is a highly stable controller capable of producing
accurate timing pulses. With an astable operation, the frequency and duty cycle are
accurately controlled by two external resistors and one capacitor.
In astable mode, the 555 timer puts out a continuous stream of rectangular
pulses having a specified frequency. Resistor RA is connected between VCC and the
discharge pin (pin 7) and another resistor (RB) is connected between the discharge pin
(pin 7), and the trigger (pin 2) and threshold (pin 6) pins that share a common node.
Hence the capacitor C is charged through RA and RB, and discharged only through RB,
since pin 7 has low impedance
to ground during output low intervals of the cycle, therefore discharging the capacitor.
In the astable mode, the frequency of the pulse stream depends on the values
of RA, RB &C:
The high time from each pulse is given by High =ln(2).(RA+RB).C
and the low time from each pulse is given by Low =ln(2).RB.Cwhere RA and RB are the values of the resistors in ohms and C is the value of the
capacitor in farads.
To achieve a duty cycle of less than or equal to 50% ,a diode can be added in
parallel with RB towards the capacitor. This bypasses RB during the high part of the
cycle so that the high interval depends only on RA and C.
FIG 3.1CIRCUIT OF IC555 TIMER CIRCUIT AS AN ASTABLE MULTIVIBRATOR
3.2 Infra-red Receiver Module:
For detection purposes a commercially available infra-red receiver module is
used. The receiver module we use is TSOP1738 which has a carrier frequency of 38
kHz (This is the reason for creating an astable multivibrator at the emitter side). This
module consists of photo-detector, amplifier and band pass filter, which convert the
electro-magnetic input into a measurable potential difference. Band pass filter is to
filters out the noise due to diffused infra-red rays from the surrounding light sources,
as it only allows only the transmitted 38 kHz to pass. The reflective strip on the
machine reflects more of the infra-red rays than the surrounding areas of the machine.
The receiver module will be triggered only if the rays from the reflective strip fall on
it.
This module has three pins –
Vcc pin- The supply voltage is provided to the module through this pin. The
supply voltage provided is usually 5 volts.
Ground pin- The grounding for the device is provided using this pin.
Vout pin- In most cases this pin gives high level output when it is not
triggered. Low level output is given when it is triggered by the infra-red rays
from the reflective strip.
FIG 3.2INTERNAL BLOCK DIAGRAM OF TSOP 1738
3.3 PIC Microcontroller:
The microcontroller used is the PIC18F452. The Vout pin of the receiver
module is connected to an analog pin of the microcontroller. The high and low inputs
of the receiver module are detected by the microcontroller through this analog pin. To
deduce an RPM reading in less than second, while constantly refining the reading's
accuracy, a timer is used. They are part of the internal features of a microcontroller
and they can be easily configured through programming.
The timer is used to precisely feed the timer value that occurs between two
consecutive detections of reflected pulses from the machine surface. Therefore now
we know the time taken between two consecutive reflected pulses from the machine
surface. From this value the frequency of rotation can be computed. Then all that
remains is to convert the frequency value into a rotation per minute value.
FIG 3.3PIN DIAGRAM OF PIC18F452 MICROCONTROLLER
3.4 16x2 Liquid Crystal Display:
The LCD is used to display the rpm reading of the machine. It consists of 16 pins-
Vss- This is the Ground pin of the display.
Vdd- The supply voltage is provided to this pin
VEE- This pin is used to adjust the contrast of the LCD by changing the input
voltage at this pin. This is done by using a potential divider.
RS(Register Select)pin-There are 2 very important registers in LCD
1. Command Code register
2. Data Register
If RS=0, Instruction command Code register is selected, allowing user to send
command. If RS=1, Data register is selected allowing to send data that has to
be displayed.
R/W (Read/Write) pin-R/W input allows the user to write information to LCD
or read information from it. The data that is being currently displayed will be
stored in a buffer memory DDRAM. This data could be read if necessary. If
R/W=0, it is in Reading mode and if R/W=1, it is in Writing mode.
E (Enable) pin-The enable Pin is used by the LCD to latch information at its
data pins. When data is supplied to data pins, a high to low pulse must be
applied to this pin in order for the LCD to latch the data present in the data
pins.
Data Bus- D0-D7- the data or command from the microcontroller is sent to
these pins.
FIG 3.4PIN DIAGRAM OF 16x2 LCD
3.5 Power Source:
A DC power source was used in the project - 9V battery with 900mAh
capacity. The 9V source is used for the working of IC’s. As all the IC’s required 5V
for working, a 5V linear regulator LM7805 was used to supply the regulated power.
FIG 3.59V BATTERY AND CONNECTER
CHAPTER 4
Concept and Construction
Step 1
The suitable resistances are selected for the IC555 circuit such that the output
oscillates at a frequency of 33 kHz. The output of this circuit is connected to the
infrared transmitter diode. Therefore the diode transmits infrared rays at the rate at
which the circuit output oscillates.
Step 2
The pulse reflects off the surface of the machine. The machine surface has a
white reflective strip. The reflective strip being white in colour reflects more than the
surrounding areas. Since the reflective strip reflects more, a change in reflective
pattern occurs whenever the incident infrared rays strike upon this strip. Due to this
change in pattern we can understand that it is this strip that is reflecting and not the
surrounding areas. As this change in pattern can occur only once in one revolution we
can keep this as a count for how many revolutions take place in a given time period.
Step 3
The receiver module is kept in such a position so that the reflected infrared
rays from the surface are incident upon the receiver module. When the receiver
module detects a signal with pulse rate within its frequency range (33 kHz + 5%), its
normal high output goes to a low state.
Step 4
The output pin from the receiver module is connected to the PIC
microcontroller. This change of state is detected by the microcontroller. Now we
know that the reflective strip has passed by once. This change of output from high to
low is used to trigger a timer. Now the microcontroller checks whether the output of
the receiver module has gone from low state to high state. In this way we can make
sure that it is the surrounding surface that is now reflecting. When the output changes
from high to low it will be due to the appearance of the reflective strip. At this point
the timer is stopped and the value inside the timer is stored. This value is the time that
has elapsed between two appearances of the reflective strip, ie. the time taken for one
revolution. From this we can find the frequency of rotation of the machine and hence
find the rpm value of the machine.
Step 5
This value is sent to the LCD so that it can be displayed.
CHAPTER 5
STAGES OF IMPLEMENTATION
5.1 Design Development
The functional block diagram of the basic design is shown in figure given
below. The infra-red signal from the transmitter is reflected from the rotating machine
and is received by a sensor circuit which, in turn sends the corresponding output to a
microcontroller. The microcontroller processes the signal and sends the rpm value to
the LCD display.
FIG 5.1BLOCK DIAGRAM OF A CONTACTLESS IR TACHOMETER
5.2 Procurement of components
The IC555, a bread board, a plain circuit board, LM7805 and the other
components for the microcontroller circuit were procured from Calicut. A receiver
module and an LCD display were purchased from Chennai. The transmitter-receiver
module was obtained from a senior.
5.3 Circuit Assembly
The above figure shows the power supply circuit for the PIC18F4520. Also
shown is the external oscillator circuit for the microcontroller. A 9V battery is
connected to a LM7805 voltage regulator which steps down the voltage to 5V. This
5V is given to the supply and MCLR (reset) pins of the PIC. The external oscillator
crystal decides the time taken per instruction and so determines the speed of the
microcontroller processes.
FIG 5.2
POWER SUPPLY CONNECTION OF PIC18F452
FIG 5.3SIMULATION CIRCUIT OF DIGITAL TACHOMETER
The exact pin configuration is shown in the above figure. The input from the
infrared receiver is given to pin 15. The LCD is connected to the port B of the PIC.
The data is sent to the LCD using parallel connection. This means that each of the 4
data pins in the LCD is connected to one pin of the PIC.
5.4 Microcontroller programming
The microcontroller used for this project is PIC18F452.The microcontroller
was programmed to detect the pulse from the IR receiver and to count the time
between two pulses. The microcontroller code was written in C/C++ language in
PICC compiler and converted to HEX file. The code was burned to the
microcontroller using universal programmer.
Six pins of microcontroller are used to give input to the LCD display. The data
to LCD display is given in ASCII code.
5.5 LCD setup
The output from the PIC18F4250 microcontroller goes to the LCD. The data
pins of the LCD are connected to pins 34 to 37. The RS and E pins of the LCD are
connected to the pins 40 and 39 respectively. The RW pin of the LCD is grounded as
we always write to the LCD. There is no situation in which we will need to read from
the LCD. The commands to the LCD are given via the PIC microcontroller. This is
possible due to the LCD interfacing which is a highly useful feature of the
microcontroller.
CHAPTER 6PROGRAM (CODE)
#include "E:\Studies\national institute of technology calicut\sixth\mini project\piccproj\main.h" //file containing microcontroller information #include "lcddisp.c" // file for lcd display int16 k=0, p;int h, m, n, o;void main () setup_adc_ports (NO_ANALOGS|VSS_VDD); //initial states setup_adc (ADC_OFF|ADC_TAD_MUL_0); setup_psp (PSP_DISABLED); setup_spi (SPI_SS_DISABLED); setup_wdt (WDT_OFF); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256); //initializing timer 0 setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_timer_3(T3_DISABLED|T3_DIV_BY_1); setup_comparator(NC_NC_NC_NC); setup_vref(FALSE);set_tris_c(1); //portc as input portlcd_init(); //initializing function for lcddelay_ms(1000);while(1) while(1) if(!input(PIN_C0)) //checking for a low in input set_timer0(0); //starting timer with value zero break;
while(!input(PIN_C0)) //if input high it exits this loop
while(1) if(!input(PIN_C0)) //if input again low k=get_timer0(); //getting timer count for one revolution break; p=234360/k; //constant divided by value to get directly rpm h=p%10; p=p/10; //extracting digits from units place m=p%10; p=p/10; n=p%10; p=p/10; o=p%10; p=p/10; n=n-o; printf(lcd_putc,"%u",o); //displaying it in the correct order printf(lcd_putc,"%u",n); printf(lcd_putc,"%u",m); printf(lcd_putc,"%u",h); delay_ms(1000); lcd_putc('\f');
//lcddisp.c (external file written only for lcd display)