Re: PIC16F628 Tachometer


Mar 9, 2002

 


----------------------------

#302 Mar 9, 2002

Anybody got a copy of EPE magazine Dec 1996 featuring a PIC

tachometer circuit?



Please respond at aknovaman@...



----------------------------

#307 Mar 10, 2002

I don't have the article but I have done a tach circuit using a PIC.  It is part of a expletive deleted> motor controller we are doing for NASA. If you need help I would be will to assist.





Alan the Rocket Scientist

Reality is for those who can't handle Science Fiction.

hometown.aol.com/aseesf4/myhomepage/newsletter.html



----------------------------

#431 Sep 3, 2002

Dear friends:

Iam looking for a tachometer schematics and source for gasoline car

engine.



THANKS IN ADVANCE: EDUARDO



----------------------------

#2921 Oct 13, 2003

Has anyone tried this? I am looking for examples of this project. And

can anyone recommend any LCD and driver I should use. Any codes

available?



Thanks



----------------------------

#3003 Oct 22, 2003

--- In piclist@yahoogroups.com, "ramtec73" anilram@e...> wrote: > Has anyone tried this? I am looking for examples of this project.

And > can anyone recommend any LCD and driver I should use. Any codes

> available?

>

> Thanks



ramtec73 said :"16F84 for tachometer?"



Are you trying to make a tachometer for your car? what type of

tachometer are we talking about? What exactly is it that you want to

measure. Measuring the speed of your transmision is kind of hard but

measuring the speed of a bicycle wheel or a robot motor is not that

hard? Before I can give an answer I have to knwo exactly what you

want.



Refereing to the LCD. If you are lucky you can get a leftover one

from an old rado or electronic equipment. If not then it will all

have to depend of what options you want on it. For example in

jameco.com they sell a 1 line 16 character LCD for $13. if you want a

2 line then thats going to cost you extra. If you want graphics like

bars and what not then I would recomend you buy one specifically for

that purpose and its going to cost you extra. There are even ones

that have 4 lines 40 characters per line. I know I'm being kind of

vague here but we( I ) need to know what exactly is it you want. If

is just for experimentation purposes then buy the cheapest one. a 1

line LCD or the more comon 2 line LCD.



----------------------------

#5477 Apr 10, 2004

Hi all,

I have been trying to get a tach to work, but with no luck.

If anyone out there has an example code to help me out, that would be

cool. I am trying to build something that at 1200RPMs a pin goes high.



Please help!!!

TIA..



GT



----------------------------

#5491 Apr 11, 2004

I was considering to use an LM2917 Frequency to Voltage converter,

then use the A/D input on the PIC. This is intended for an

automotive app, and the input signal is so noisy. Here is the data

sheet, with some sample circuits:



www.national.com/ds/LM/LM2907.pdf



Don





--- In piclist@yahoogroups.com, "greg_torres" greg_torres@y...>

wrote: > Hi all,

> I have been trying to get a tach to work, but with no luck.

> If anyone out there has an example code to help me out, that would

be > cool. I am trying to build something that at 1200RPMs a pin goes

high. >

> Please help!!!

> TIA..

>

> GT



----------------------------

#5493 Apr 11, 2004

Greg - how many pulses per revolution on your RPM sensor?

Is the sensor magnetic or is it a optical pickup?

(If it's magnetic, the LM2917 looks like a good idea...)

If you can get a clean signal from your pickup, you might be able to

time the

pulses in software... especially if you only get 1 or 2 pulses per

revolution.

- Don



d1camero wrote:

>I was considering to use an LM2917 Frequency to Voltage converter,

>then use the A/D input on the PIC. This is intended for an

>automotive app, and the input signal is so noisy. Here is the data

>sheet, with some sample circuits:

>

>www.national.com/ds/LM/LM2907.pdf

>

>Don

>

>

>--- In piclist@yahoogroups.com, "greg_torres" greg_torres@y...>

>wrote:

>

>

>>Hi all,

>>I have been trying to get a tach to work, but with no luck.

>>If anyone out there has an example code to help me out, that would

>>

>>

>be

>

>

>>cool. I am trying to build something that at 1200RPMs a pin goes

>>

>>

>high.

>

>

>>Please help!!!

>>TIA..

>>

>>GT

>>

>>

>

>

>

>

>to unsubscribe, go to www.yahoogroups.com and follow the instructions

>Yahoo! Groups Links

>

>

>

>

>

>

>



----------------------------

#5495 Apr 11, 2004

This is an easy problem once you stop to think about it, I've done

probably a dozen different kinds of tachometers for commercial products

and more or less re-use the same basic design.



Take your input signal, condition it to give as clean a 5V square wave

as you can.



Connect your signal to the CCP input of the PIC.



Pick an edge (rising or falling, it really doesn't matter -- usually

one edge is the "start" of the sensor output and is more consistent in

it's repetition). Set up the capture module to capture and interrupt on

this edge. Set your timer prescalar to accomodate the resolution you

want -- i.e. the lower the timer prescalar, the better the RPM

resolution possible but with less range for lower RPM values (higher

timer counts).



At each interrupt, calculate the period (timer value) since the last

edge. Your RPM's will be some mathematical reciprocal of this count

(time).



Note that you may have to process timer overflows if the period of your

RPM input is longer than the maximum 16 bit timer value. You also may

(probably) have to filter the timer period due to input signal jitter.

This can be simple averaging or a more complex median filter, depending

on what your input signal looks like.



After you have a timer count, do the math to convert a period to an

RPM. If your RPM is greater than your alarm value (1200 RPM) set your

output bit as necessary.



I can't send you any code (most all the tachometer code I have is for

commercial products and is proprietery client data). It's really not

that hard when you break it down into the different pieces that need to

work and the math involved. Once you have the basics working, you'll

find this method is very fast and very accurate.



Matt Pobursky

Maximum Performance Systems

On Sun, 11 Apr 2004 00:48:07 -0000, greg_torres wrote:

>.Hi all,

>.I have been trying to get a tach to work, but with no luck.

>.If anyone out there has an example code to help me out, that would be

>.cool. I am trying to build something that at 1200RPMs a pin goes high.

>.

>.Please help!!!

>.TIA..







----------------------------

#5497 Apr 11, 2004

Thanks Matt,

This will help me out. You make it sound so simple. I am new to Pic

programming, I got a program called CH Flash that I use. It has a lot

of help files, and the first day I got it I had simple programs

running (blinking LEDs). I also use MPLab IDE, with this I can debug

and watch my program run. Thanks, I hope I can put something together

with the information you have given me...



Thanks,

GT



--- In piclist@yahoogroups.com, Matt Pobursky ccsuser@m...> wrote:

> This is an easy problem once you stop to think about it, I've done

> probably a dozen different kinds of tachometers for commercial

products

> and more or less re-use the same basic design.

>

> Take your input signal, condition it to give as clean a 5V square

wave

> as you can.

>

> Connect your signal to the CCP input of the PIC.

>

> Pick an edge (rising or falling, it really doesn't matter -- usually

> one edge is the "start" of the sensor output and is more consistent

in

> it's repetition). Set up the capture module to capture and

interrupt on

> this edge. Set your timer prescalar to accomodate the resolution you

> want -- i.e. the lower the timer prescalar, the better the RPM

> resolution possible but with less range for lower RPM values (higher

> timer counts).

>

> At each interrupt, calculate the period (timer value) since the last

> edge. Your RPM's will be some mathematical reciprocal of this count

> (time).

>

> Note that you may have to process timer overflows if the period of

your

> RPM input is longer than the maximum 16 bit timer value. You also

may

> (probably) have to filter the timer period due to input signal

jitter.

> This can be simple averaging or a more complex median filter,

depending

> on what your input signal looks like.

>

> After you have a timer count, do the math to convert a period to an

> RPM. If your RPM is greater than your alarm value (1200 RPM) set

your

> output bit as necessary.

>

> I can't send you any code (most all the tachometer code I have is

for

> commercial products and is proprietery client data). It's really not

> that hard when you break it down into the different pieces that

need to

> work and the math involved. Once you have the basics working, you'll

> find this method is very fast and very accurate.

>

> Matt Pobursky

> Maximum Performance Systems

>

> On Sun, 11 Apr 2004 00:48:07 -0000, greg_torres wrote:

> >.Hi all,

> >.I have been trying to get a tach to work, but with no luck.

> >.If anyone out there has an example code to help me out, that

would be

> >.cool. I am trying to build something that at 1200RPMs a pin goes

high.

> >.

> >.Please help!!!

> >.TIA..



----------------------------

#5506 Apr 12, 2004

--- In piclist@yahoogroups.com, "greg_torres" greg_torres@y...>

wrote: > Hi all,

> I have been trying to get a tach to work, but with no luck.

> If anyone out there has an example code to help me out, that would

be > cool. I am trying to build something that at 1200RPMs a pin goes

high. >

> Please help!!!

> TIA..

>

> GT

Hi , try the low tech, use a PLL like LM567 is very ease to use two

caps and a resistor and when your noisely signal is close to 1200

rmp you get a clean "lock" signal to interrup you PIC .....



----------------------------

#5515 Apr 12, 2004

Well, I don't think I am ready to build a Tachometer program. I have

tried, but can seam to get the math part right. I can capture the

pulses on the CCP pin. But after that, I can't seam to get anything

to work. At one time I thought I had it, but I didn't. If anyone out

there has an example code, and is willing to share the information,

send it to greg_torres@...



Thanks to all for the help so far...

GT



----------------------------

#5516 Apr 12, 2004

A quick Googling turned up this:



www.microchip.com/1010/suppdoc/appnote/all/an592/index.htm

homepages.nildram.co.uk/%7Estarbug/files/revcount.zip

homepages.nildram.co.uk/%7Estarbug/files/picgen.zip



-Mike





--- In piclist@yahoogroups.com, "greg_torres" greg_torres@y...>

wrote: > Well, I don't think I am ready to build a Tachometer program. I

have > tried, but can seam to get the math part right. I can capture the

> pulses on the CCP pin. But after that, I can't seam to get anything

> to work. At one time I thought I had it, but I didn't. If anyone

out > there has an example code, and is willing to share the information,

> send it to greg_torres@y...

>

> Thanks to all for the help so far...

> GT



----------------------------

#6909 Aug 20, 2004

I am building a optical tachometer for a gas turbine. I would like

to try my hand at PIC programing. I have programed AVRs in the past

and feel its time to try microchip's line (mainly because I got some

samples from them ;-) I already designed my board layout and intend

to use a back lit LCD display. My RPM limit will be about 150,000RPM

with 1 pulse input per rotation of the turbine shaft. Any pointers

on the what my code should look like? The accuracy of this device

does not have to be that good, really. + or - 100 rpm is quite fine.

Look forward to hearing some suggestions.

William







----------------------------

#6912 Aug 30, 2004

Generically it'll look like this:



1) Wait for pulse.

2) Start timer.

3) Use next pulse to stop timer.



Elapsed time is the period. Invert to get frequency, then multiply

by 60 to get RPMs.



Or, you could have a sample window and count the pulses:



1) Start timer.

2) Count pulses until timer stops.



Frequency is pulses divided by timer interval.



Lots of code out there for frequency counters. This one is even for

the 16F628:

www.qsl.net/dl4yhf/freq_counter/freq_counter.html> Then all

you have to do is multiply by 60 for RPM.



Mike





--- In piclist@yahoogroups.com, "William Nachefski"

slaphappysamy@y...> wrote: > I am building a optical tachometer for a gas turbine. I would like

> to try my hand at PIC programing. I have programed AVRs in the

past > and feel its time to try microchip's line (mainly because I got

some > samples from them ;-) I already designed my board layout and

intend > to use a back lit LCD display. My RPM limit will be about

150,000RPM > with 1 pulse input per rotation of the turbine shaft. Any pointers

> on the what my code should look like? The accuracy of this device

> does not have to be that good, really. + or - 100 rpm is quite

fine. > Look forward to hearing some suggestions.

> William


S
e
n
i
o
r
T
u
b
e
.
o
r
g