Professional Documents
Culture Documents
EM TESTED
EM TESTED
TED
EM TES
MUDIT AGGARWAL
A tachometer (also called a revolution-counter,
rev-counter, or RPM gauge) is an instrument that
measures the rotation speed of a shaft or disk, as in
a motor or other machine. The device usually
displays the revolutions per minute (RPM).
Tachometers on automobiles, aircraft, and other
vehicles show the rate of rotation of the engine's
crankshaft, and typically have markings indicating
a safe range of rotation speeds. This can assist the
driver in selecting appropriate throttle and gear
settings for the driving conditions. Prolonged use at
high speeds may cause excessive wear and other
damage to engines. This is more applicable to
manual transmissions than to automatics. This
article describes how to build a contact -less
tachometer (device used to count the revolutions
per minute of a rotating shaft) using a PIC16F72
microcontroller and a proximity Sensor. As the
name implies, what makes this device special, is
that it can very accurately measure the rotational
speed of a shaft without even touching it. This is very
interesting when making direct contact with the
rotating shaft is not an option or will reduce the
velocity of the shaft giving faulty readings. This
device is built on an PIC16F72 microcontroller,
and Common Cathod Seven Segment display and
and a proximity sensor to detect the rotation of the
shaft whose speed is being measured. Pin diagram
of seven segment common cathode display is
shown in figure 1.
The idea behind tachometers, is a micro-controller,
used to count the pulses coming from a sensor or
any other electronic device. In the case of this
tachometer, the counted
a
pluses will come from
f g b
g f C a b
O
proximity
sensor, which
M
e
C
Dot
will detect any reflective
d
element passing i
nfront
of it, and thus, will
C
O
e d M c
give an output pulse for
each and every rotation
Fig. 1:Pin Diagram of Seven
of the shaft, as show in
Segment Display
IR Transmitter
&MUDIT
Receiver AGARWAL
Tachometer
Rota
ssed
IR Pa
haft
ting S
Reflective Disk
IR Transmitter
& Receiver
IR Reflected
Tachometer
IR Pa
ssed
Reflective Disk
Rota
haft
ting S
CONSTRUCTION
g f
a b
g f
a b
g f
a b
e d
e d
e d
+
+5 V DC
20
18
17
16
15
14
13
12
VDD
4.7K
1
MCLR
2.2K
2.2K
2.2K
2.2K
2.2K
2.2K
2.2K
2.2K
25
24
23
PIC16F72
22pf
4MHZ
9
28
10
22pf
GND
Count
19 GND
11
+ +5 V DC
+ +5 V DC + +5 V DC
10K
IR Diode
IR LED
5
1K
8
7 4.7K
Lm358
10K
LED
10K
Bc547
2.2K
12V Transformer
+5 V DC
230V
A.C.
D1
1N4007
D3
D4
1
1000uf
.1uf
7805
2
D2
.1uf
Software
list p=16f72
#include pic116f72
__CONFIG
_MCLRE_OFF & _CPD_OFF &_CP_OFF &
_PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT &
_BODEN_OFF
cblock 0x20
count1
count2
count3
count4
Transo
buff
LO_count
HI_count
blank
contor
endc
CONSTRUCTION
2.2k
2.2k
2.2k
2.2k
2.2k
2.2k
2.2k
2.2k
Count
12V AC
DIGIT1
DIGIT2
DIGIT3
2.2k
LED
PIC16f72
4mhz
+
+
.1uf
J1
.1uf
J2
22pf 22pf
1 23
7805
Ir Diode
a
4.7k
+
10k
Ir LED
Bc547
2.2k
LED1
Lm358
1
10K
IR LED
1k
1n4007
14n007
14n007
10k
1000uf/25v 14n007
+
4.7k
movfcount3,W
subwfHI_count,W
btfssSTATUS,C
gotoconv_end
btfssSTATUS,Z
gotoconv_low
movfcount2,W
subwfLO_count,W
btfssSTATUS,C
gotoconv_end
conv_low:
movfcount3,W
subwfHI_count,F
movfcount2,W
subwfLO_count,F
btfssSTATUS,C
decfHI_count,F
incfcount1,F
bsfblank,0
gotoconv_high
conv_end:
movlw0xB0
addwfcount1,W
btfssblank,0
movlw0xA0
movwfbuff
callpush_led
return
led_home
call act
movlw0x74
callact
movlw0x80
callact
movlw0x02
callact
return
push_led:
movlw0x74
callact
movlw0x40callact
movfbuff,W
callact
return
set_timer:
clrfT1CON
clrfTMR1L
clrfTMR1H
clrfINTCON
bsfSTATUS,RP0
clrf PIE1
bcf STATUS,RP0
clrf PIR1
movlw 0x03
movwf T1CON
return
led_ini:
movlw0x74
callact
movlw0x00
callact
movlw0x01
callact
movlw0x21
callact
movlw0xA0
callact
movlw0x07
callact
CONSTRUCTION
movlw0x24
callact
movlw0x0F
callact
movlw0x06
callact
calliict
movlw0x74
callact
movlw0x80
callact
movlw0x40
callact
movlw0x40
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x00
callact
movlw0x74
callact
movlw0x00
callact
movlw0x30
callact
movlw0x01
callact
movlw0x0C
callact
calliicp
return
act:
movwf transo
Movlw 0x08
movwf count3
vbitbcfsclk
callpause
btfsc transo,7bsfsdta
btfss transo,7
bcfsdta
callpause
bsfsclk
call pause
bcfsclk
call pause
rlftranso,f
decfsz count3,f
gotovbit
callackp
return
iicpbcfsdtacallpause
bsfsclk
callpause
bsfsdta
callpause
bcfsclk
callpause
return
iictbsfsdta
bsfsclk
callpause
bcfsdtacallpause
bcfsclk
callpause
return
ackpbsfsclkcallpause
bcfsclk
callpause
return
timpcalliict
movlw0x74
callact
movlw0x40callact
movlw0xC2callact
movlw0xE1
callact
movlw0xFA
callact
movlw0xE1callact
movlw0xBAcallact
movlw0xB0
addwfcontor,Wcallact
movlw0xF3
callact
calliicp
callhaltb
btfscsetu
gototset
tset1movlw0x01
subwfcontor,W
btfssSTATUS,Z
gototset6
movlw0x06
movwfcontor
calliict
movlw0x74
callact
movlw0x80
callact
movlw0x1C
callact
movlw0x1C
callact
calliicp
callpause
calliict
movlw0x74
callact
movlw0x40callact
movlw0xB0
addwfcontor,Wcallact
calliicp
gototset
tset6
movlw0x01
movwfcontor
calliict
movlw0x74
callact
movlw0x80
callact
movlw0x10
callact
calliicp
callpause
calliict
movlw0x74
callact
movlw0x40callact
movlw0xB0
addwfcontor,Wcallact
calliicp
tsetcallhaltb
btfsssetu
gototset1
callhaltb
btfsssetu
gototset1
callhaltb
btfsssetu
gototset1
return
Pausemovlw0x10 movwfcount2
d2decfszcount2,Fgoto d2 return
haltbmovlw0xFA
movwfcount1
j1movlw0xFA movwfcount2
j2nop
decfszcount2,Fgoto j2decfszcount1,Fg o t o
j1return
Haltamovwfcount4
r4movlw0x04
movwfcount3
r3movlw0xFA
movwfcount1
r1movlw0xFA movwfcount2
r2nop
decfszcount2,Fgoto r2decfszcount1,Fg o t o
r1decfszcount3,F goto r3 d e c f s z
count4,F goto r4
return
End