Anda di halaman 1dari 13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

Embedded Lab

Embedded Systems tutorials, projects, and more

HOME

NETDUINO

PRODUCT REVIEWS

ARDUINO PROJECTS
CHIPKIT

STM32

PIC PROJECTS

AVR XMEGA

PIC TUTORIALS

TIVA C
ESP8266

TIPS AND TRICKS


ABOUT US

HOW TO MAKE A CONTACT-LESS DIGITAL


TACHOMETER USING IR-LIGHT REFLECTION
TECHNIQUE
Posted on April 21, 2011

by R-B

PRODUCTS

Search...

38 comments |

Tachometer is a device that measures the rotational speed of any


shaft or disc. The unit of the measurement is usually revolutions
per minute or RPM. The traditional method of measuring RPM of
a rotating shaft was based on velocity feedback concept where a
dc generator is hooked to the rotating shaft so that the voltage
induced across the generators terminals is proportional to the
speed of the shaft. Today, we are going to make a digital
tachometer based on a PIC microcontroller that requires no
physical contact with the rotating shaft to measure its rotational
speed. The physical contact is avoided by using an optical
detection technique that requires an infrared light emitting diode
in conjunction with a photo detecting diode. StartUSB for PIC
from mikroElektronika is the main controller board used in this
project. To read more about this board, visit my article Getting
started with PIC18F Microcontrollers. This tachometer can
measure speeds up to 99960 RPM with the resolution of 60 RPM.
The result is shown on a 162 character LCD display.

CHIPKIT TUTORIALS AND


PROJECTS

http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

1/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

chipKIT is an open source


embedded development
environment that uses
powerful 32-bit PIC
processors for hardware.
Check out these free
comprehensive tutorials
and DIY projects that are
intended to facilitate the
learning of chipKIT
interfacing and
programming.

Contact-less digital tachometer using StartUSB for PIC and optical sensors

Theory
The contact with the rotating shaft is avoided with an optical
sensing mechanism that uses an infrared (IR) light emitting diode
and a photo detecting diode. The IR LED transmits an infrared
light towards the rotating disc and the photo detecting diode
receives the reflected light beam. This special arrangement of
sensors is placed at about an inch away and facing towards the
rotating disc. If the surface of the disc is rough and dark, the
reflected IR light will be negligible. A tiny piece of white paper
glued to the rotating disc is just enough to reflect the incident IR
light when it passes in front of the sensor, which happens once

SUBSCRIBE

per rotation (shown below).

ABOUT ME

Raj Bhatt
Electronics
enthusiast
and
founder of
Embedded
Lab
Read More
Rotating disc with a reflector

If the entire disc surface is bright and reflective, use a piece of


black paper instead so that the IR light will be absorbed by this

Follow
@EmbeddedLab

portion once per rotation. In either case, a pulse will be


generated at the output of the signal conditioning circuit for each
http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

2/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

complete rotation of the disc. The circuit diagram for the sensor

Subscribe through email

part is shown below.


Sign Up

Read Our Privacy Policy!

IR sensors and signal conditioning circuit

When the IR Tx pin is pulled high, the BC547 transistor (NPN)


conducts and infrared light is transmitted. This is controlled
through RA3 pin of PIC18F255o, and is turned on for 1 sec during
which the number of reflected pulses received by the photo
detecting diode are counted. The pulses appears at the collector
of the BC557 transistor (PNP) goes to RA4/T0CKI pin of
PIC18F2550. It is the external input pin for Timer0 module which

CATEGORIES

counts the external pulses arriving at this pin. Under normal


condition, the resistance of photo detecting diode is very high
and therefore, the BC557 transistor is almost cut-off. The output
at its collector is pulled to ground. When the photo detecting
diode receives the reflected IR light, its resistance drops and
BC557 conducts, and the collector output goes high. Thus, this
simple circuit converts the reflected IR light from the white mark
on the rotating disc into a pulse.
Timer0 Module in PIC18F2550
The Timer0 module in PIC16F series is 8-bit but in case of
PIC18F2550, it is software selectable for 8- or 16-bit mode. Its
operation is controlled by T0CON register; the function of each bit
in the T0CON register is shown below.

http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

555 Timer
Analog
Arduino
ARM projects
AVR Projects
AVR Tutorials
BeagleBone
chipKIT
Display
dsPIC
Electric Imp
Embedded Lab Projects
Embedded Labs
Embedded Lessons
ESP8266
FPGA
Hack
Intel Edison
Internet of Things
LED display
littleBits
MCU develeopment
tools
Microcontroller
Programmers
MSP430 Launchpad
Netduino
Open-source
3/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

T0CON register

PIC Projects
PIC Tutorials
PIC18F
PIC32
Power Supply
Processing
Product Review
Products
Raspberry Pi
Robotics
Sensors
STM32
Tech News
Texas Instruments
TI
Tips and Tricks
Tiva C
Uncategorized
wireless
XMega

For our purpose, the Timer0 module will be configured as a 16-bit


counter to count the number of pulses arriving at RA4/T0CKI
input pin. The counter will be active for 1 sec and the number of
pulses arrived during this interval will be recorded, and later
multiplied by 60 to get the RPM of the disc. Without an overflow,
the Timer0 in 16-bit mode can count up to 65535, that
corresponds to 3932100 RPM. However, in this project, we will
limit the range up to 99960 RPM. To serve our need, we will clear
T08BIT (16-bit mode) and T0SE (increment on high-to-low
transition on T0CKI pin) bits, and set T0CS (counter mode) and
PSA (no prescaler) bits.
Circuit setup
As I mentioned earlier, I am using StartUSB for PIC board for
demonstration of this technique, and therefore, I am not
providing the detail circuit diagram of this project. Rather, I will
be showing the connections of LCD and the sensor unit
(described above) to the board, as shown below. LCD data bits
D4-D7 (11-14) are driven through RB4-RB7 pins, whereas the
control pins, RS (4) and E (6) are connected to RC6 and RC7 pins
of PIC18F2550. The transmission of infrared light is controlled by
RA3 pin, whereas the reflected pulses are fed to the T0CKI pin.
The microcontroller runs at 48.0 MHz using its internal PLL. The
circuit diagram for the board itself can be found here.

http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

4/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

LCD and sensor module connections to StartUSB for PIC board

Complete circuit setup

IR light emitting and photo-detecting diodes with a blocker in between

http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

5/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

Software
As usual, I used my favorite mikroC compiler from
mikroElektronika for programming the PIC. No external
programmer is required with StartUSB board as the on-board PIC
has pre-programmed with mikroElektronikas fast USB
bootloader. Those who are not familiar with StartUSB for PIC
board, read my previous article Getting started with PIC18F
Microcontrollers. The programming part is not very tough for
this. It involves the initialization of I/O ports and Timer0 control
register. The LCD interfacing part uses mikroCs built-in LCD
library functions, read my article How to interface a character
LCD with PIC if you are new to this.
Download mikroC project files
Once the program is loaded into the microcontroller, reset the
StartUSB board and wait for 5 sec till it comes out of bootloader
mode and starts running the application for your contact-less
tachometer.

Tachometer in action

Conclusion
A digital tachometer based on an infrared light reflection
technique has been demonstrated successfully. Its major
advantage is that it doesnt require any physical contact with the
rotating shaft to measure its speed. This project can be extended
further by adding data logging feature to it. This is required in
certain applications where the RPM of a rotating shaft is needed
to be monitored. The data logger will keep the records of varying
RPM over time, and those records can be later transferred to a PC
through the USB interface.

EasyEDA: Free Circuit Design Tool &


Low Cost PCB Prototype
http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

6/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

10 pcs 2 layers only $10, register to get $5 Cash


Coupon.
www.easyeda.com

Related Posts:
1. Programmable digital timer switch using a PIC
Microcontroller
2. LM386 based stereo audio amplifier with digital volume
control
3. Voltage monitor for cars battery and its charging system
4. Digital timer relay using PIC18F4620

tagged with PIC Projects, RPM counter, StartUSB for PIC,


tachometer
Embedded Lab Projects

PIC Projects

PIC18F

Tech News

38 COMMENTS
tyty123

January 23, 2016 4:09 am

I found a little mistake in code.


T0CON = 0b01101000; // TMR0 as 16-bit counter original
T0CON = 0b00101000; //this is the correct one
From datasheet -PIC18F2455/2550/4455/4550
bit 6 T08BIT: Timer0 8-Bit/16-Bit Control bit (from datasheet)
1 = Timer0 is configured as an 8-bit timer/counter
0 = Timer0 is configured as a 16-bit timer/counter
Nice project by the way.
Reply
Alireza

December 12, 2015 5:02 pm

Hi Guys,
Id like thank you for your info,
Im trying to find some contact less speed detectors for
production line such as pipe production line,
Ill be thankful if provide me solution.
Reply
Sonali jadhav

April 13, 2015 10:44 am

http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

7/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

Nice project and i m also working on it.i want future scope and
any advance technoloy for futher research.thank u.
Reply
mahmoud

March 4, 2015 4:38 pm

Thank you very much for the design >>>


i just want to ask about the IR sensing circuit it is not
completely obvious.
what is the diode between 1.8k resistor and 1k resistor at RX subcircuit.
Thank you
Reply
tycs

September 26, 2015 6:35 am

hi were you able to get what diode was used ?


Reply
greg haa

February 10, 2015 6:16 pm

I would like to do something similar to this. Although instead of


displaying the RPMs, I would like to keep track of time. If a tape
has 60 minutes of play, I want to use this to know where exactly I
am in the tape. 00:43:27 HH:MM:SS for example. Would that be
possible?
Reply
Nitin Patil

March 13, 2015 2:08 am

I am trying to contact with you but it is not possible


so provide your contact details
Reply
iwan sarifudin

July 29, 2014 1:59 am

I love this project , in stores in my area no PIC 18F2550 , whether


it can be replaced with a PIC 18F4550 ?
Thank you
Reply
Ashok kumawat

May 26, 2014 1:09 pm

please send me the code configuration of this code for the


burning of of the pic18f2550 by the use of universal code burner.
please send this as soon as possible;Its urgent.
Reply
http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

8/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

Ashok kumawat

May 26, 2014 12:49 pm

Sir,
Please tell me about the configuration which u are using in
writing a code.
Reply
Mukesh Pakhare

March 24, 2014 5:25 am

contactless tachometer is good project


Reply
ronald

December 29, 2013 11:30 pm

hi, i am interested on this project. however i would like to make


revisions but i dont know how. will it be possible to create an
alarm circuit wherein if the motor stopped running, an alarm will
be triggered?
thanks
Reply
Richard Bauman

August 31, 2013 12:11 am

I am very interested in three kits that are pre-assembled, the


microsoftware is and ready to go. The emitter/sensor needs to be
on cable 24-30 long. Otherwise I can not see the LCD screen. I
need to record the day over 24 to 48 hours and have each data
point be date/time tagged. I have an old laptop with both a serial
port and a USB1.1 port. I will need software for the USB
interface/both sides and software for the laptop record the data.
It would be heaven if the laptop software included an alarm
program that if RPM went above a max or below a min set by the
user something would be triggered and the computer made
noise. I am within reason willing to help fund development of this
software if it does not exist.
Richard Bauman
BaumanRP@SWBell.net
Reply
brian keith

April 30, 2013 2:20 pm

Would it be possible to hook the sensor to a smart phone and


create an app to handle the counting of pulses?
Reply
Bigabbs

March 15, 2013 11:57 am

http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

9/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

Hi I like your unit does it come as a kit, I am looking to use it in


South Africa in Wet and Dirty conditions that said can the shaft
sensor be changed for a magnet type sensor as the shaft get
rather muddy can you let me know on bigabbs1@sky.com with
price and availability
Thanks
Bri
Reply
Pingback: contact less Infra Red digital tachometer | Wiring
Diagram Circuit
navas

February 2, 2013 4:46 am

i need kit for doing contactless digital tachometer pls tell me


how to purchase the kit
Reply
Marc P.

October 27, 2012 5:50 pm

What if i don`t use the StartUSB for pic? do i have to change the
settings in MikroC PRO for Pic?
thank you!
marC:)
Reply
sujit

April 17, 2012 9:21 pm

Sir,
It has been a great contribution from your end. The DigiTach(as I
named it) works just fine and your design has been of great help
to me. It was a fabulous experience working on the same and
preparing its report as well. Keep me posted.
Thanks a ton again,
Sujit
Reply
Pingback: manage service provider
imran

March 1, 2012 5:43 am

hi guys, i want to drive led,s direct (without limit resistor)with


pic16f54portb.can someone help me.
Reply
Pingback: Just asking for a high speed sensor..
Pingback: Contact-less Infrared Digital Tachometer | PyroElectro News, Projects & Tutorials
http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

10/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

Marmok

August 30, 2011 7:25 pm

Hi !
This project is very good.
But the measurement isnt very accurate because if you have lets
say 5 and a half pulses you will get only 300 RPM instead of 330
RPM.
Regards George.
Reply
haziqchi

August 24, 2011 3:07 pm

i really interested in this project. so can you give me suggestion


for the data logger that i can use to combined it with this
project?? how to connect this circuit to the data logger so it can
store the data over time. please help me since i am doing this
project for my final year project. hope you can help me since i
dont have much time left to complete the project. i really
appreciate if you can reply asap. thank you.
Reply
Pingback: some questions motor speed monitoring - Page 5
ZarMaxim

July 20, 2011 4:59 am

Hi Guys,
Great project!
I would like to use the code for a weather vane, so I was
wondering if there were any pointers on how to go about
converting the RPM to windspeed ?
Regards
Michael
Reply
R-B

July 20, 2011 8:32 am

@Michael,
I would say that information could be found from the
specification of the wind sensor. They provide the
characteristic transfer function to convert the frequency of
pulses into wind speed. For example,
http://www.vaisala.com/Vaisala%20Documents/Brochures%20
and%20Datasheets/WM30-Datasheet-B210384EN-B-LoRes.pdf
Reply
chandana

May 16, 2011 3:45 am

great
http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

11/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

Reply
Pingback: contact less Infra Red digital tachometer | How Circuits
Anas

May 3, 2011 4:41 pm

I tried this project with 16f887. I used Timer1 and changed the
LCD pins to portD instead of PortC. the results i got is not
accurate!!!? when the number of pulses is more than 220 pulse
per second, the results are unstable and largely changed from
second to second. for values under 220pulse per second, the
accuracy is good. any suggestions? dose the implementation with
18f2550 suffer from similar effect?
Reply
R-B

May 3, 2011 4:58 pm

Anas,
How much do the readings change from second to second,
can you give numbers? Try using a wider reflective portion so
that you will have a longer reflective pulse. Since the RPM is
high, a small timing error could give you inaccurate result. Use
TMR1ON bit for enabling and disabling the timer sharply.
Make sure you are clearing TMR1H and TMR1L registers
before every measurement. You should use both TMR1H and L
registers to obtain the true value of RPM, as TMR1L overflows
after 256 counts.
I dont have anything that fast to test my circuit.
Reply

Pingback: Electronics-Lab.com Blog Blog Archive How to make


a contact-less digital tachometer using IR-light reflection
technique
Pingback: Simple IR Bounce Tachometer | House of Mods
Pingback: Simple IR Bounce Tachometer - machine quotidienne
sarath

April 22, 2011 9:46 pm

Nice
It is too helpful for me.
Reply
tReg

April 22, 2011 4:27 pm

I am trying to do something similar, and have not yet received


every part. I wander if the transistor is really needed since some
pins on the pic have schmidtt trigger input.

http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

12/13

8/6/2016

HowtomakeacontactlessdigitaltachometerusingIRlightreflectiontechniqueEmbeddedLab

Do you know if some the pcb can be made simpler (I am very low
on space for this project
)
regards,
treg.
Reply
Pingback: Simple IR Bounce Tachometer - Hack a Day

LEAVE A REPLY
Your email address will not be published. Required fields are
marked *
Name *

Email *

Website

Comment

Post Comment

2016 Embedded-Lab. All Rights Reserved.


Go

to Top| Contact Us | Privacy Policy | Log In

http://embeddedlab.com/blog/howtomakeacontactlessdigitaltachometerusingirlightreflectiontechnique/

zeeDynamic Theme

13/13

Anda mungkin juga menyukai