tachometer -16F877

Thread Starter

xw0927

Joined Dec 19, 2010
114
hi,i am newbie to microcontroller,so i am not quite understnading how to write the code.this is my first time mini project,basically the project is relate about a tachometer,and when we move it,a tachometer will sense the pulse and then record by using counter,and display in lcd-speed and distance.BUt how we can built own encoder?HAve any schematic for encoder?
 

wayneh

Joined Sep 9, 2010
17,496
BUt how we can built own encoder?HAve any schematic for encoder?
One easy option is a prebuilt optical sensor pair, an IR diode and detector facing each other across a narrow gap. You turn a disc thru the gap, and holes or gaps in the disc edge generate a signal. Does that sound like what you need? FWIW, old VCRs often contain some of these.
 

Markd77

Joined Sep 7, 2009
2,806
Most pedal cycle tachometers have a magnet on the wheel and a reed switch on the frame. Not very high tech but simple.
Old fashioned computer mice (with the ball) have at least 2 of the encoders that wayneh mentioned. The optical mice that I've taken apart have one for the scrollwheel.
 
Last edited:

wayneh

Joined Sep 9, 2010
17,496
That reminds me - a cheap bicycle computer can be adapted to a wide variety of similar timing tasks. All the "hard stuff" is done for you in a small, cheap, low-power device. All you need is to interface it appropriately, for instance by using a frequency divider to bring your signal into range, less than 10Hz or so.
 

Thread Starter

xw0927

Joined Dec 19, 2010
114
I had discussed with my lecture,due to the deadline of my project is next two weeks,he asked me just buy an encoder and used it in my project,but now the problem is I dont know how to use encoder,and the program how to write in pic to measure the speed???here is the atttachment of my schemtatic and the program-source code.View attachment tach-.zip
 

absf

Joined Dec 29, 2010
1,968
There's a mistake in your PIC oscillator circuit. The capacitors are 1000uF and it wont be able to oscillate. Change them to 22pF will do.;)

You dont need a hw encoder/decoder to convert RPM to voltage for your analog input AN1. You can setup the PIC to count pulses using interrupts and some simple maths to convert them to RPM.

But if you want to go the HW way you'll need a LM2917 F-V converter and you can refer to the LM2917 datasheet. Good luck with your project.:D

Allen
 
Top