You are on page 1of 4

CONSTRUCTION

PIC 16F72 Based


Contactless Tachometer

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

the picture. Those pulses will be fed to the


microcontroller and counted. A tachometer is a
digital transducer and is used to measure the speed
of the rotating device. The number of revolution per
minute is an impotent paramete for a rotating
device.This is an easy contactless RPM meter which
uses photoelectic phenomenon. Here an IR LED
and IR Diode is used as transmitter and receiver.
Place the rotationg disk in front of this proximity
sensor and make a cut in the disk so that light can
pass from it and the place where is no cut on the
rotating disk reflect light, this light which is reflected
is received by the IR diode.
This signal is amplified by OP amp and applied to a
pin of microcontroller, microcontroller count the
number of pulses and displyed on seven segment
display. There is a button for RPM measurement. It
can measures maximnum value 0999 RPM. The
switch SW1(DWN),is used to start the
measurement(60 second) or the counting process.
When the switch is pressed, the device measures
the RPM of the shaft under test, and constantly
updates the reading on the Seven Segment LED
display.
Circuit diagram of PIC16F72 Based
Contactless Tachometer is shown in figure 2.
Component Layout of PIC16F72 Based
Contactless Tachometer is shown in figure 3 and

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

Fig.2. Circuit diagramPIC16F72 Based Contactless Tachometer

PCB layout of PIC16F72 Based


Contactless Tachometer is shown in figure 4.

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

#DEFINE setu PORTB.F2


#DEFINE sclk PORTB.F3
#DEFINE sdta PORTB.F4
org0x00
goto init
org0x04
init:
Bcf STATUS,RP0
clrf GPIO
movlw 0x07
movwf CMCON
bcf INTCON,GIE
bsf STATUS,RP0
movwf OSCCAL
movlw 0xF8
movwf TRISIO
bcf STATUS,RP0
Movlw 0x01
movwf contor
call led_ini
loop
call act
movlw 0x74
call act
movlw 0x40
call act
movlw 0xD2
call act
movlw 0xD0
call act
movlw 0xCD
call act
movlw 0xBA
call act
call pause
call set_timer
movf contor, W
call halta
bcf T1CON,0
movf TMR1L,W
movwf LO_count
movf TMR1H,W
movwf HI_count
bcf blank,0
movlw 0x27
movwf count3
movlw 0x10
movwf count2
call convb
movlw 0x03
movwf count3
movlw 0xE8
movwf count2
call convb
clrf count3
movlw0x64
movwfcount2
callconvb
clrfcount3
movlw0x0A
movwfcount2
callconvb
clrfcount3
movlw0x01
movwfcount2
bsfblank,0
callconvb
call led_home
call timp

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

Actual size Components layout

Actual size PCB layout


goto loop
clrfcount1

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

You might also like