Searching \ for '[PIC]: speed sensor interface' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=sensor
Search entire site for: 'speed sensor interface'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: speed sensor interface'
2001\07\18@162706 by Gary Neal

picon face
Hello,

       I'm relatively new to the PIC scene.  I want to use a PIC16F870 to measure
the rpm of a rotating shaft (0-15,000rpm).  There is a passive speed sensor
in the shaft that puts out a sine wave whose frequency is proportional to
shaft rpm.  The amplitude of the signal increases with increasing
speed.  The max. voltage of this signal is 70V peak-peak.
       I'm using PIC Basic Pro to program my PIC.  I'm thinking about counting
the number of pulses over a specified amount of time (measured using
TIMER0) and converting to rpm.  Of course I'll have to do some averaging
and stuff like that.  Extreme accuracy is not important.  +/- 5% would be fine.
       I'm assuming putting a 70Vp-p signal to one of the digital I/O pins would
be bad?  How do I get around that?  Just a simple voltage divider?  What's
the voltage range the I/O pins can handle and still register as a HIGH or LOW?
       Any comments on potential pit falls or better ways to do this would be
appreciated.

Thanks,

Gary

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\07\18@164529 by Dale Botkin

flavicon
face
On Wed, 18 Jul 2001, Gary Neal wrote:

> Hello,
>
>         I'm relatively new to the PIC scene.  I want to use a PIC16F870 to measure
> the rpm of a rotating shaft (0-15,000rpm).  There is a passive speed sensor
> in the shaft that puts out a sine wave whose frequency is proportional to
> shaft rpm.  The amplitude of the signal increases with increasing
> speed.  The max. voltage of this signal is 70V peak-peak.
>         I'm using PIC Basic Pro to program my PIC.  I'm thinking about counting
> the number of pulses over a specified amount of time (measured using
> TIMER0) and converting to rpm.  Of course I'll have to do some averaging
> and stuff like that.  Extreme accuracy is not important.  +/- 5% would be fine.
>         I'm assuming putting a 70Vp-p signal to one of the digital I/O pins would
> be bad?  How do I get around that?  Just a simple voltage divider?  What's
> the voltage range the I/O pins can handle and still register as a HIGH or LOW?
>         Any comments on potential pit falls or better ways to do this would be
> appreciated.

Yeah, a 70V pk-pk signal into a PIC pin would be a bad thing.  It has been
proposed that you could get away with this by using a large series current
limiting resistor, but I wouldn't do it on a dare.

What's the lower limit of signal amplitude?  If it varies from, say, 2 to
70V, a rsistive divider would only work above a certain RPM when the
amplitude got high enough.  A divider will reduce small signals just
the same as large ones.  I'd look at something like a Zener and resistor
arrangement to clip the signal, or maybe some sort of op amp AGC thing
that one of our more analog-oriented bretheren could recommend.

You can figure RPM just fine using a timer and counting pulses during a
known time period, or measuring the length of a pulse.  I used the second
method, with a very nice filtering method suggested (IIC) by Olin Lathrop.
Look in the list archives back earlier this year for a thread about
filtering...  I'll look for the subject line if you have trouble finding
it.  Works great, uses very little memory and code space.  Ihave some code
to do the job, but it's C...  I could post more of the details if you
like, not sure how much good it would do for your particular application.

Dale
--
A train stops at a train station.  A bus stops at a bus station.
On my desk I have a workstation...

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\07\18@210716 by Olin Lathrop

face picon face
>         I'm relatively new to the PIC scene.  I want to use a PIC16F870 to
measure
> the rpm of a rotating shaft (0-15,000rpm).  There is a passive speed
sensor
> in the shaft that puts out a sine wave whose frequency is proportional to
> shaft rpm.  The amplitude of the signal increases with increasing
> speed.  The max. voltage of this signal is 70V peak-peak.

I've done this sort of thing a few times before.  First, you have to decide
what the minimum shaft speed you need to detect is.  That tells you the
worst case voltage and frequency of the sine wave you have to deal with.  It
also tells you how long you have to count pulses for to get to the desired
accuracy (5% in your case).  If this time is too long, then you need to
measure period and invert.  This is actually pretty easy with the CCP module
in capture mode.  All my tachometer-like applications have ended up doing it
this way.  You get quicker and more accurate updates which are also easy to
filter without requiring much memory.

Anyway, back to the pulse.  The sensor is probably a coil, which will have
an open circuit output voltage proportional to the frequency.  The worst
case is the low frequency end when the signal is smallest.  Design the
circuit to have enough gain to create a 0-5V square wave from the signal at
the smallest incoming amplitude.  There is always noise, so use hysterisis,
which gets you the square wave output for free.  I would set the hysterisis
to be about 25% to 50% of the minimum signal size, depending on how
confident you are that you really know what the minimum will be accross part
variations, temperature, etc.  Since your signal has an amplitude
proportional to f, you can apply a simple passive single pole filter with
1/f rolloff at or slightly above the minimum frequency.  This will help with
noise immunity at the higher frequencies because the hysterisis will stay a
roughly constant fraction of the signal amplitude.  You also want to avoid
overdriving the opamp or whatever.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, spam_OUTolinTakeThisOuTspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...