Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

RE: [AVR-Chat] AVR Tachometer

2004-01-01 by Larry Barello

You don't need the schmitt trigger: all AVR input pins are schmitt triggers!

200krpm = 3.3k/s  You could use the ICP function on timer1 with 16us (8 mhz
clock/128) resolution and measure from 18 ticks/pulse (~200k) to 65000
ticks/pulse (~60 rpm).  Is that enough range?  Heck, make it really simple
and interrupt on the pulse leading edge and calculate the RPM every
interrupt, stuffing the string-o-digits somewhere for your foreground task
to display.  The time between even the fastest RPM is plenty for lots and
lots of calculations.  you could even do it in floating point and have
cycles to spare.

Calculation is easy: 62500 * 60 /(Current Timer - Previous timer) = RPM.

Make sure you declare current and previous timer as unsigned int.

If you want finer resolution at the top end, use a 1us clock and your range
will be about 1krpm to 3.2mrpm.

Cheers!

-----Original Message-----
From: Al Welch [mailto:alwelch@axxiomchromatography.com]

William,

Perhaps you may want to run your phototransistor output through a schmitt
trigger such as an 74ls14 chip which will make the pulses cleanly toggle
between digital one and zero. Otherwise there could be a slow rise and fall
shape to the output which could confuse your counting.

Seems like you could then use an external interrupt input to interrupt when
the input pulses, add one each time. Then setup a  timer to provide your one
second window. The display could run in the foreground to post answers from
the timer.

Al Welch

-----Original Message-----
From: William Nachefski [mailto:slaphappysamy@yahoo.com]

Hello All!
I am just getting started into AVR's.  I am seeking help on a
circuit.  I need to build a tachometer with opitcal pick up.  The max
RPM to be counted will be around 200,000 RPM.  I was told that pretty

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.