Searching \ for 'Auto tach output sensing' 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/ios.htm?key=output
Search entire site for: 'Auto tach output sensing'.

Truncated match.
PICList Thread
'Auto tach output sensing'
1999\06\09@124537 by JScarfon

flavicon
face
Hello all.

I'm using a 16F84 to sample the tach output from a late model Honda.  This
output is supposed to be a square wave with 2 pulses per revolution of the
engine.  When I count the pulses, the frequency I'm getting is twice what I
would expect.  I've noticed a similar result when I measure the output with
a Fluke 87.  The frequency is twice what I expect.  Only if I put the meter
on the 400V setting are the frequency measurements what I expect.

I don't have a scope so I can't really see what I'm dealing with here.  The
signal is supposed to go between 0v and 12v but there must be some ringing
or something.  What advice would you have for sampling this signal
accurately?

Currently, the signal is just coming in (via 4.7k resistor) to the RA4 pin
where I have it hooked in to TMR0.  RA4 is Schmitt triggered I believe.

~j

1999\06\09@125537 by Chris Eddy

flavicon
face
([Gasp!])  Are you connecting up the coil line itself to the RA pin?  I
strongly suggest that you go through an NPN with suitable R's and C's to shape
the wave into a usable square wave.  You should also get a scope on the darned
thing to see what is happening.  The coil line does have a fair amount of ring
to it, as the coil is a well designed coil for back EMF effects.  I would not
attempt to clean up the coil line with a diode or whatnot, as the ignition
system would be affected.  Just try cleaning up the signal with a transistor.
Also, the tach work that I have done ran the tach into the RB0 pin, so that the
interrupts can accurately time the pulses.

Chris

JScarfon wrote:

{Quote hidden}

1999\06\09@134109 by Roland Andrag

flavicon
face
Perhaps stick the signal through an RC low pass filter, although the range
of frequencies involved is probably too large....

{Original Message removed}

1999\06\09@171212 by Mike Montalvo

flavicon
face
There is a lot of ringing on the line.  There are also a lot of transients.
I strongly suggest you use an opto-isolator. I have used them in the past
for the same purpose with great success.  Get one with a Schmidt trigger
output.

As far as the frequency being wrong, what are the numbers your seeing?

If the car is idling at 1000 rpm, you should see a coil frequency of
33.33hz.

1000rpm/ 60sec/min=16.66 rps
16.66 rps * 2 coil triggers per rev= 33.33 coil triggers per sec.

This is assuming that your Honda is a 4 cylinder.  If its a 6cyl, replace,
the 2 coil triggers per sec with 3 coil triggers per sec.

Remember that its a four stroke engine.  For every 2 revolutions of the
crank, all the cylinders fire. So for every single revolution, only half the
cylinders fire.




-----------------------------------------
                Mike Montalvo
         G-FORCE Motorsports
http://www.g-forcemotorsports.com
               516-794-0858

1999\06\09@232911 by Tjaart van der Walt

flavicon
face
Mike Montalvo wrote:
>
> There is a lot of ringing on the line.  There are also a lot of transients.
> I strongly suggest you use an opto-isolator. I have used them in the past
> for the same purpose with great success.  Get one with a Schmidt trigger
> output.

It sounds like the first ringing pulse that doubles the
frequency. He could use a debounce time slightly shorter
than the minimum firing time (highest revs) to take it out.

Some real protection on that pin will also be useful...

--
Friendly Regards          /"\
                         \ /
Tjaart van der Walt        X  ASCII RIBBON CAMPAIGN
spam_OUTtjaartTakeThisOuTspamwasp.co.za  / \ AGAINST HTML MAIL
|--------------------------------------------------|
|  Cellpoint Systems SA    http://www.cellpt.com   |
|--------------------------------------------------|
|     http://www.wasp.co.za/~tjaart/index.html     |
|             WGS84 : -26.0124 +28.1129            |
|             Voice : +27 (0)11 2545100            |
|--------------------------------------------------|

1999\06\10@092657 by JScarfon

flavicon
face
Chris Eddy <.....ceddyKILLspamspam@spam@NB.NET> wrote ...

>([Gasp!])  Are you connecting up the coil line itself to the RA pin?  I
>strongly suggest that you go through an NPN with suitable R's and C's to
shape
>the wave into a usable square wave.  You should also get a scope on the
darned
>thing to see what is happening.  The coil line does have a fair amount of
ring
>to it, as the coil is a well designed coil for back EMF effects.  I would
not
>attempt to clean up the coil line with a diode or whatnot, as the ignition
>system would be affected.  Just try cleaning up the signal with a
transistor.
>Also, the tach work that I have done ran the tach into the RB0 pin, so that
the
>interrupts can accurately time the pulses.

>Chris

Chris:

Well, I'm going from the external tach connector.  Most late model cars have
them I believe.  In my car this comes from the ignition control module not
directly from the coil so I ASSumed I'd get a fairly clean signal.  I'm not
sure what goes on in the ignition control module as far as processing the
signal coming from the coil though.

I guess the purpose of the transistor as far as cleaning up the signal would
be that it is somewhat slow to react and will smooth out the irregularities?
I'm guessing also that another purpose would be to sort of isolate the
signal I'm modifying (with R and C) from the original so the car can't see
what I'm doing?  Thanks.

~j

1999\06\10@100408 by JScarfon

flavicon
face
Mike Montalvo <gotboostspamKILLspamOPTONLINE.NET> wrote...

>There is a lot of ringing on the line.  There are also a lot of transients.
>I strongly suggest you use an opto-isolator. I have used them in the past
>for the same purpose with great success.  Get one with a Schmidt trigger
>output.

Will the optoisolator smooth out the signal?  I just thought they isolated.
Or are you counting on the Schmitt trigger to do the work here?  I know next
to nothing about these things.  I'm already using RA4 which is supposed to
be Schmitt triggered on the PIC.

{Quote hidden}

the
>cylinders fire.


Yeah, four cyl, 2 pulses per rev.  I think my math is right.  My first
simple test was a little counter program.  I set the PIC up to simply count
pulses.  TMR0 was set up as 1:1 (prescaler set to WDT).  When TMR0 rolled
over, I toggled an LED.  At idle (~700  rpm) I was seeing a little over five
seconds on the LED.  I should expect about eleven I think.

700 (rev/min) * 2 (p/rev) / 60 (sec/min) = 23.33 p/sec

1 / 23.33 (sec/p) * 256 (p) = 10.97 sec

Last night I wrote another program that would time the gaps between the
leading edges of the tach signal.  When a button was pressed:

1) I'd wait for a low signal, wait for a high signal
2) TMR0 would start counting (tied to instruction counter 2:1).  TMR0
overflows would interrupt and increment a memory location giving me a 16 bit
counter.  There is a check for the high byte wrapping around.
3) When a leading edge was detected I would save off TMR0 and output both
the high byte and saved TMR0 to an LCD.

As I expected (noisy signal), sometimes I would get a very short pulse,
sometimes a long pulse but the shorts and longs were pretty consistent in
magnitude.

For example, at idle I was getting some timings around 0xC000 or (49152).
On a 10Mhz PIC that's:
49152 increments * 2 (ins / increment) * (4 x 10(-7)) (sec / ins) = .0393
sec which is pretty close.

The short pulses were in the 0x900 (2304) range (noise).

With this counter setup, I should be able to measure just below idle speed
all the way up to redline (7400).

Thanks.

~j

1999\06\10@103859 by Michael Rigby-Jones

flavicon
face
       <snip>

This is wierd, I wrote almost the same routine a few weeks back.  I found
that my problem was too much resolution, the RPM was never stable.
Measuring down to 1 rpm is just not sensible, an engine is continuously
varying in speed by a small amount.  In the end I fitered the rpm value with
simple digital filter and only displayed to 10 RPM resolution.  Even that
was borderline, the display was changing far too often.  Most comercial
digital tachometers measure only to a resolution of 100RPM for this reason.

I gave up with the LCD in the end and used software PWM to drive a
conventional analogue meter movement from an old tachometer.  The software
PWM was only 8 bit which gave a resolution of just over 30 RPM with a
maximum of 8000 RPM (hopefully I won't be seeing too much action in this
area!!) .  I had the pre-scaler assigned to TMR0 with (I think) a 4:1
pre-scale, and the PIC was running at 4MHz.  The only problem with measuring
period to  get the frequency is the ugly division that you have to do,
although I did it in C so pretty easy for me.

The software incorporated max rpm storage and a shift light.  It's still not
quite working properly, I may dump the software PWM and use a proper
(serial) DAC.

I took my signal from the coil -ve and had to filter it with and R-C network
and some clamping diodes  to get a suitable signal for the PIC.

Regards

Mike Rigby-Jones

{Quote hidden}

1999\06\10@121430 by Chris Eddy

flavicon
face
JScarfon wrote:

>
> Well, I'm going from the external tach connector.  Most late model cars have
> them I believe.  In my car this comes from the ignition control module not
> directly from the coil so I ASSumed I'd get a fairly clean signal.  I'm not
> sure what goes on in the ignition control module as far as processing the
> signal coming from the coil though.
>
> I guess the purpose of the transistor as far as cleaning up the signal would
> be that it is somewhat slow to react and will smooth out the irregularities?
> I'm guessing also that another purpose would be to sort of isolate the
> signal I'm modifying (with R and C) from the original so the car can't see
> what I'm doing?  Thanks.

The transistor acts to allow a high (12V and briefly much higher) signal to be
converted to a TTL level pulse with no great currents or loads.  Whenver a diode
clamp to VCC is used (or the substrate of a processor) there is usually a
compromise, such as exceeding VCC by 0.6V or so.  The transistor is also a
convenient place to add the RC filtering as well.  Picture two R's in front of
the NPN, one in series and one from base to emitter.  The emitter goes to
ground.  The Collector goes to VCC through a 4.7K resistor.  You can add a
filter cap from the base to emitter.  Or if you are brave, add the capacitor
between the coil line and the base of the trans.  Add some further thought if
you do.

Chris

1999\06\10@152447 by JScarfon

flavicon
face
Chris Eddy <.....ceddyKILLspamspam.....NB.NET> wrote...
>The transistor acts to allow a high (12V and briefly much higher)
>signal to be converted to a TTL level pulse with no great currents
>or loads.

Got it.  Use a possibly higher voltage to switch (in this case) +5V.

..snip..
>The transistor is also a convenient place to add the RC filtering
>as well.  Picture two R's in front of the NPN, one in series and
>one from base to emitter.  The emitter goes to ground.  The
>Collector goes to VCC through a 4.7K resistor.  You can add a
>filter cap from the base to emitter.

Sorry, I recognize this...

              ---/\/\/---+5
             /
12+ --/\/\/--/
            \
             \    <= emitter
              |
              -
             ---

...but I don't think I'm catching the R and C from base to emitter.  They
would be in parallel?  I'd have a resistor going to ground and a cap going
to ground off the right side of the resistor on the left?  I'll have to
think about that.

>Or if you are brave...

I'm not.

>...add the capacitor between the coil line and the base
>of the trans.  Add some further thought if you do.

This would be in series?  I think that any thought I might add would
approach zero.  I'm really just a software guy but I'll think on it a while.
Thanks again.

>Chris

~j

1999\06\10@165139 by Chris Eddy

flavicon
face
JScarfon wrote:

> ...but I don't think I'm catching the R and C from base to emitter.  They
> would be in parallel?  I'd have a resistor going to ground and a cap going
> to ground off the right side of the resistor on the left?  I'll have to
> think about that.
>

Now we have arrived at the serious stuff.  The base emitter bleeds any slight
charge current solidly to ground.  It takes nary little current to turn a
transistor on, and I have had transistors without the second resistor false
trip, or possibly partial trip, like the buzzer I was driving once that would
buzz ever so slightly.  Base emitter resistor kept it from bleeding on and
buzzing.  The capacitor goes there just as a convenient place to slow down the
turn on and off, thus knocking the fast spikes and slivers off of the line.

> >...add the capacitor between the coil line and the base
> >of the trans.  Add some further thought if you do.
>
> This would be in series?  I think that any thought I might add would
> approach zero.  I'm really just a software guy but I'll think on it a while.
> Thanks again.
>

If you add this cap in series, it will allow just enough charge to turn on the
base for a millisecond or so.  If you are triggering an interrupt, that is
frequently just enough.  The plus is that you can withstand an amazing range of
voltages on the dirty side, where a resistor will dissipate more and more as the
voltage drop rises.  The thought part as I mentioned comes in with two diodes on
the right side of the cap where the base is that go to the power supply rails to
protect the part from real high voltages (that only get in when a very rapid
rate of change is presented).  The diodes can sop it up, because only a finite
amount of energy can get through the cap.



Chris

1999\06\11@050444 by Mark Crankshaw

flavicon
picon face
I was facing this problem a short time ago and after a web search found a
circuit on the PicNPoke pages (thanks). It's titled as a points to
microcontroller interface but it's all the same.

http://www.picnpoke.com/projects/points.html

I found that it worked fine though putting my 'scope on the output to pic
showed that the rising edge was very defined but the falling edge was
poor. I used it on RB0 of a 'F84 for an interrupt and so long as it was
configured to trigger on the rising edge it worked fine.

Chris, how do you think this compares to your description as there are
common features but slightly rearranged?

Mark.

1999\06\11@100336 by Chris Eddy

flavicon
face
Mike;

It looks like a pretty good circuit.  I question the need for all of the
clamping on the front end.  If it overshoots well before the transistor, who
cares?  It was there on the ignition already..  If you see a slow decay, you
might just omit the capacitor, or put a much lower value in it's place.  When
the points close, that diode holds the charge on the cap, which has to bleed
through the 4.7K and base.  That takes time, and the transistor goes linear
for a while.  When the cap reaches 0.65V, the base voltage, I suspect that it
hangs out on the edge of on for a while too.  There ain't nothing to pull it
off. Better yet, take that third diode out altogether.

Chris Eddy

Mark Crankshaw wrote:

{Quote hidden}

1999\06\11@125829 by JScarfon

flavicon
face
Thanks for all the basic electronics support.  I think I'm going to try
something like this as a starter:

                                    4.7K
                                 --/\/\--- +5
                                 |
        100                      --------------------- RA4
 +12 --\/\/--|<|---             /
                  |            / <- emitter (PNP)
tach ------------------/\/\-----|
                  |    10K      \
   0 --\/\/--|>|---              \
        100                      --
                                ----


I thought I could use a PNP so that I didn't have to invert the pin logic.
I was concerned though about base-collector breakdown if my base voltages
have huge spikes so I put the diodes in.  I'm not sure if my concern is
valid or not -- or my "solution".  If anyone sees anything really wrong with
this, please let me know.  I plan to add some filtering if needed and try an
optoisolator once I get ahold of one.  Thanks again for all the tips.

~j

1999\06\11@135432 by Chris Eddy

flavicon
face
I does got one problem with your circuit, the choice of a PNP.  You have
connected it up in an emitter follower config.  When the input is 12V, the part
is driven to 5V out.  When the input is 0V, you drive about 0 out.  But as a
follower, any voltage waveforms between 0 and 5V coming in will be reflected,
spikes, slopes, sags, and all into the output of the circuit.  A follower will
amplify a signal straight through.  A common emitter will drive hard through a
switching point into either on or off.  The up side is that it will probably
work fine, since RB0 will trigger on slope.  But if you get some form of ring in
between 0 and 5 on the ignition line, you might get multiple interrupts!

Try an NPN with the emitter in the ground..??

Chris Eddy

JScarfon wrote:

{Quote hidden}

1999\06\11@142733 by JScarfon

flavicon
face
Chris Eddy <EraseMEceddyspam_OUTspamTakeThisOuTNB.NET> wrote...

>I does got one problem with your circuit, the choice of a PNP.
>You have connected it up in an emitter follower config.  When
>the input is 12V, the part is driven to 5V out.  When the input is
>0V, you drive about 0 out.  But as a follower, any voltage
>waveforms between 0 and 5V coming in will be reflected,
>spikes, slopes, sags, and all into the output of the circuit.
>A follower will amplify a signal straight through.  A common
>emitter will drive hard through a switching point into either on
>or off.

Hmm, I thought I was just reversing the polarity by using the PNP.
I can't see right now why the NPN wouldn't act the same exact
way (as an amp).  I'll study it.

>The up side is that it will probably work fine, since RB0 will
>trigger on slope.  But if you get some form of ring in between
>0 and 5 on the ignition line, you might get multiple interrupts!

Well, probably not because I'm not using RB0 but RA4.  I'm
using interrupts to increment the high byte of my 16bit
counter.  The mainline is looking at the signal highs and lows.

>Try an NPN with the emitter in the ground..??

I'll do that and rewrite the code with the logic reversed.

{Quote hidden}

1999\06\11@143154 by Michael Rigby-Jones

flavicon
face
I'd be tempted to put the 10K resistor before the diode clamps.  As is is
you have very little to current limit any spikes, and as you have the 100R
resistors in series with the diodes, a large spike could still swing the
base enough to cause breakdown.

Is the input 12v or 5v logic?  If it's the former then you definately need
some resistance before the diodes.  If it's a 5volt swing, does the input
definately go all the way to 5 volts?  If not the PNP will never be switched
off.  In that case another resistor from base to Vcc might be a solution.

just a thought...

Mike Rigby-Jones

> {Original Message removed}

1999\06\13@190401 by Tony Nixon

flavicon
picon face
See http://www.picnpoke.com/projects/points.html for a simple points to
PIC interface circuit. It's been used for quite a while and works.


--
Best regards

Tony

'The Engine' - Design your own programmer.

http://www.picnpoke.com
Email picnpokespamspam_OUTcdi.com.au

1999\06\13@191235 by Tony Nixon

flavicon
picon face
Chris Eddy wrote:
>
> cares?  It was there on the ignition already..  If you see a slow decay, you
> might just omit the capacitor, or put a much lower value in it's place.  When
> the points close, that diode holds the charge on the cap, which has to bleed

The cap is there to provide a small amount of points debounce to the
circuit. This can be omitted, and software can do the debouncing.

I've used 800uS as a debounce constant in PIC software and have had no
problems thus far. Assuming a V8 upto about 7000RPM, about 37% of duty
cycle.

--
Best regards

Tony

'The Engine' - Design your own programmer.

http://www.picnpoke.com
Email @spam@picnpokeKILLspamspamcdi.com.au

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