Vehicle Tach Signal Noise and Spike Help

Discussion in 'The Projects Forum' started by ¡MR.AWESOME!, Aug 18, 2010.

  1. ¡MR.AWESOME!

    Thread Starter Member

    Aug 15, 2010
    33
    0
    Hey hey. I want to read a tach signal from a vehicle with a PIC microcontroller. I need a pin to go low once the RPM's exceed a set point. It's basically the same as a remote start module that shuts off the starter once the car is running on it's own. The software isn't the problem, though; it's the signal that I need to read. It's got a big spike and then stays high and then goes low and then goes sort of high and then the big spike again and repeat. You can see the attached pics.

    I would like to know what I need to do to get the signal readable by the mcu. I know I need to get rid of that big spike. I know that I need to get the voltage down. I don't know what I need to do to that sort-of-high section of the signal. I think an RC filter would be good for the spike. I would also like to keep the signal being read intact. I believe that I would use a unity-gain buffer for that.

    The last criteria that the solution must meet is to work in other vehicles. The general waveforms will be the same (rectangular), but the spikes and noise will be different. I also don't know about that sort-of-high section. I have to hook up the o-scope to some other vehicles to see if that is common or not.

    This is my first delve into the world of waveforms, so any help/info would be sweet.

    [​IMG]
    You can see the overall waveform here.

    [​IMG]
    Here it's a bit zoomed in and you can see the sort-of-high part.

    [​IMG]
    And here you can see how large the spike is.
     
  2. ¡MR.AWESOME!

    Thread Starter Member

    Aug 15, 2010
    33
    0
    Ok, for the life of me I cannot figure out how to edit my post.

    Let me clarify the criteria of being able to work in different situations. I just don't want any solution that will use the pulse width or the spike voltage or anything else that will be engine specific in the calculations.
     
  3. gootee

    Senior Member

    Apr 24, 2007
    447
    50
    First of all, Photobucket sucks.

    Second, you need to know exactly how the information that you want to extract is encoded in the waveform. And then you need to tell US. Or perhaps you could post scope displays for both 1000 RPM and 2000 RPM.

    Third, how do you/we know that all other automotive tachometer waveforms use the same encoding scheme, and that they do so in a make/model-independent way?

    You will also need to know how to protect your electronics from automotive electrical transients. So download the following PDF file:

    http://www.radiocad.com/_downloads/LoadDumpPaper-final.pdf

    and then go to mouser.com or wherever and buy some 5KP28A TVS (transient voltage suppressor) diodes, to strap across the DC input terminals of your system.
     
  4. ¡MR.AWESOME!

    Thread Starter Member

    Aug 15, 2010
    33
    0
    I hope you didn't mean to be, but I feel like your post is a-hole-ish and a bit condescending.

    Why do you dislike photobucket? I'm just trying to save bandwidth for this forum.

    I'm confused on what you mean by "encoding scheme." no information is being encoded. The pulses simply arise from the ignition coil providing power to the spark plug wires. All I need is a low to high transition, or a high to low. The transition will occur with a frequency that is proportional to the rpms of the engine. All vehicles have some way of getting a repeating high to low or low to high rectangular-ish signal.

    I'm well aware of the transients caused by relays opening and have used TVS diodes in those situations. I'm also aware of the transients in automotive applications. I have used the National Semi LM9076 in a past project as the power supply for the mcu without any problems, but that article you posted seems like it will be of great use to me in making more robust circuits.
     
    Last edited: Aug 19, 2010
  5. ¡MR.AWESOME!

    Thread Starter Member

    Aug 15, 2010
    33
    0
  6. gootee

    Senior Member

    Apr 24, 2007
    447
    50
    Actually, I did mean it to be, but not as strongly as you apparently perceived it. I thought that your original post contained an irritating lack of information. And I think that the first paragraph of the post I am now quoting is far more rude than my post to you.

    I'm sure that your intentions were good. But at the time I was using an old and slow computer with a 56Kb connection, which enabled me to see the myriad of unrelated URLs and tracking sites that clicking on one of your photos was dragging me through.

    Maybe it's not "encoding" in the way that you would normally think of it. But if no information were encoded in the waveform, then it would be useless, since it would contain "no information". So the first bit that should have been explicitly stated was that each of the sets of pulses simply corresponds to one pulse of the ignition system.

    But extracting a single, uniform "pulse occurred" timing pulse from what appear to be multiple positive- and negative-going edges per pulse event doesn't look like it will be quite as simple as we would like it to be.

    The simplest implementation might be to have a variable trigger-voltage level. That would work if there was always one pulse that had a higher amplitude than all of the others, during a single ignition pulse event's multiple received pulses and spikes. That way, with the trigger level adjusted to "see" only the single largest voltage peak, the downstream circuitry would have only one signal per ignition pulse, to deal with.

    If you didn't want to use a trigger-level type of circuit, you could use a positive-going or negative-going edge-detection circuit, and would only need to set the number of such edges that should be seen for each ignition pulse. Then, downstream, you could have a binary counter or equivalent that would emit one pulse each time the set number of edges had occurred.

    That second type of scheme would also work in the "pathological" cases when there were multiple pulses/spikes/voltage-excursions received for each single ignition pulse, but all had (nearly) the same amplitude, whereas the adjustable trigger-level scheme might then fail, or at least be problematical.

    Both schemes should enable the circuit to be adjusted for different tachometer signal characteristics of different vehicles.

    Both schemes would probably require some minimal pre-detection signal-conditioning components or circuits and maybe also some minimal post-detection pulse-forming and maybe pulse-shaping/standardizing circuitry.

    Downstream, you would also need another binary counter with a settable number of counts that corresponded to one engine revolution and reset the counter, to account for different numbers of cylinders in different vehicles.

    I'm sure there are many ways of accomplishing the needed processing of the signals. Maybe someone else will chime in with something more simple and elegant. (Actually, maybe you could do most of it in software.)

    The type of transient that I would be most worried about is commonly called a "load dump", and is not usually seen during normal automotive operation. In an automotive environment, a load dump pulse can occur when the alternator is producing current and a significant load is suddenly disconnected. The current in the windings basically has "nowhere to go" and a large-amplitude voltage pulse results, for which a common testing standard is 65V to 87 V in a 12-Volt system, or 123V to 174V in a 24-Volt system, which is above 10% of its peak voltage for 40 to 400 ms. That type of pulse will damage many types of electronic systems, unless they are purposely protected from it.

    A load dump pulse can occur, for example, when the battery is disconnected while the engine is running. That seems like an uncommon type of event. BUT, it does commonly occur when jump-starting a vehicle "the wrong way", i.e. with the "good" vehicle's engine running. Typically, people will do it that way. And then after the dead vehicle is able to be started, the jumper/booster cables are disconnected with both vehicles still running. Bang! For the almost-still-dead vehicle, this amounts to disconnecting the battery while the engine is running. (FYI, the recommended method is to connect the cables between the batteries, _without_ the donor vehicle's engine running, and wait for the dead vehicle's battery to charge sufficiently.)

    Cheers,

    Tom
     
    Last edited: Aug 19, 2010
  7. ¡MR.AWESOME!

    Thread Starter Member

    Aug 15, 2010
    33
    0
    I don't think the variable trigger-voltage idea will work due to the fact that some vehicles have a nice clean square wave signal from the vehicle's computer that will be used. So there isn't necessarily one spike that's bigger than the rest.

    Could we clip off the biggest fluctuation (the one at the very beginning of the o-scope period) and then smooth out the other rapid fluctuations to give a constant rising or falling edge (low pass filter)? The way I picture it, the resulting signal would have a pretty quick rise followed by a little tiny dip down followed by a rising hump followed by another little dip and then a pretty quick fall. I really don't know much about the different kinds of filters. I've read a bit on simple RC filters.

    Next, I would need a way to lower the amplitude to a safe voltage to work with the PIC. I liked the solution that was in the link I posted. It used a clamping circuit to bring the voltage way down which then turned on some transistors which then provided the PIC with a 5V square wave. The only problem I see with that solution is that if our filter smooths things out too much, the resulting signal will not have nice edges.

    I plan on doing all of the pulse counting (including settings for different pulses per revolution) within software, so once I have a signal that has a decently sharp rising or falling edge, I should be set.

    Btw, any input on how to keep the original signal intact when reading it?

    Thanks for the help so far.
    Andrew
     
  8. gootee

    Senior Member

    Apr 24, 2007
    447
    50
    You can't really get away from using a trigger-voltage level, in some form, since you won't want to count low-level noise as a pulse. So, at some point, your circuit will have to decide what is large-enough to be a signal and what is not. But you will then still also need the edge-counting scheme. (Even regular or Schottky diodes in series with the signal conductor could be used to get rid of the low-level "noise". But never mind that because the pulse-forming comparator circuit mentioned below will take care of that automatically.)

    You will probably want to low-pass filter, as you said. And you will probably also want some zener diodes and/or TVS-type zener diodes, to limit the waveform's voltage excursions to always be within a reasonable range, first.

    You will then probably want to use a comparator IC to turn any large-enough "humps" in the waveform into nice, rectangular pulses. (An op amp can also be wired to act as a comparator, in a pinch.)

    At some point, someone will have to decide what voltage threshold would turn the comparator's output on and off.

    You could make the comparator's voltage threshold manually variable, and later might even be able to make it controllable from your PIC, if that would be useful.

    The voltage level might need to be massaged, so that it would be within the comparator's range and so that it would be 5 Volts when it got to your PIC. It depends on what voltage range you might need to accommodate in order to "see" enough of the input waveform. Probably after a series resistor, you could limit the waveform to a desired max level with anti-parallel zeners to ground (and probably should also use TVS diodes for better protection) right at the input. You might want an op amp buffer amplifier, so your circuit wouldn't load down whatever was giving you the waveform. And you could then (or first) lower that max level with a voltage divider (aka an attenuator, i.e. two resistors to ground with the output taken from between them), or with a less-than-unity-gain op amp amplifier (if you used an amplifier there, anyway). A capacitor to ground from between the two resistors of the attenuator would make it double as a passive low-pass filter. And any op amp amplifier could be made to also act as an active low-pass filter. Eventually, by the time the waveform got to the comparator, it should be limited to be within the right range for the comparator's threshold and its maximum output voltage. And if the comparator had to run on more than 5V, you could just have a two-resistor voltage divider after the output, to make the pulses be 5 Volts.
     
    Last edited: Aug 21, 2010
  9. ¡MR.AWESOME!

    Thread Starter Member

    Aug 15, 2010
    33
    0
    So I've been doing a lot more reading. I have a question about op-amp saturation that I can't find an answer to. If it is saturated, will damage occur? I'm thinking it would be pretty nice to use the op-amp as a buffer and a clipper. The only problem is that the voltage spikes up to 200 something volts and I don't know what will happen to the op-amp. I'm thinking I would clip it to 12V and then go from there.

    So yea, what happens when I saturate an op-amp? Damage, excessive power consumption (too much heat), nothing?
     
  10. gootee

    Senior Member

    Apr 24, 2007
    447
    50
    I don't think any damage will occur due to saturation, unless the load impedance is too low and excessive output current results. The output just goes to one of the power rails, or as close as it can get (which depends on the particular opamp).

    But if you're talking about letting the input voltage accept 200 Volt spikes and having the opamp clip them down to the 12 Volt power rail level, that would not be a good idea. But you can just put some anti-parallel zener diodes between the input and ground, to take care of the spikes. And I would also suggest some TVS zener diodes ahead of everything else.

    Remember that you can also use simple two-resistor voltage dividers to lower all of the voltage levels by the same factor, anywhere you want.

    The worst downside that I remember hearing about, when saturating an opamp, is the delay that can be caused when it tries to un-saturate. Some opamps are pretty sluggish about doing that.

    That's one of the reasons why people use comparators, instead of opamps with very high gain or positive feedback, when they want to turn analog levels into crisp, clean pulse trains.

    The comparator is like an opamp except it is designed especially for snapping to and from both fully on and fully off. A couple of resistors usually sets the voltage level at which they snap on. And they are blindingly fast, compared to most opamps.

    The only real difference is that most common comparators' outputs can only sink current, not source it (i.e. they're like a switch connected to ground). So you have to stick a resistor between their output and one of the DC power rails, in order to get a voltage to appear there when they switch on.
     
  11. marshallf3

    Well-Known Member

    Jul 26, 2010
    2,358
    201
    Why do you dislike photobucket?

    I'm in agreement, inorder to utilize their "free" service a viewer is bombarded with ads and pop-ups. Their method of displaying a picture kind of sucks too. I'm not so sure any of the others are any better though, it would all be trial and error.

    I liked the old days when a lot of places offered a small amount of free hosting space and some ISPs still do if you have an account with them. I gave up and just got a domain name since, due to all the viruses and hackers becoming a problem, most ISPs turned off the capability of hosting from your home PC.

    Some of these forums offer free space as well on a limited image size basis.
     
  12. DonQ

    Active Member

    May 6, 2009
    320
    11
    A couple of suggestions:

    Your waveform, with a couple of slight variations (e.g. I don't really know why there is a delay between the rise from the small dip and the start of the high voltage pulse) it looks a lot like the low-tension side of the distributor. The voltage goes to zero when the "points" close, the current in the coil rises, the points open and the voltage immediately goes back to 12V. Then the inductive kick of the coil causes a hv pulse in the primary, and an even larger pulse in the secondary. Spark!

    (points is in quotes because newer solutions use some form of electronics to do the same effect without points.)

    This is a fairly standard interface problem, but fairly difficult to solve.

    First off, don't just throw some surge suppressor across it. If you do, you are liable to loose the spark to your engine, or whatever else this connects to.

    Next, enter through a fairly large value resistor, 10s of K at least, so that anything you do after that will have almost no effect on your low-tension circuit.

    An aside... saturation does more than just slow down some op-amps. Some, especially some of those used by experimenters, will latch up when saturated, and only work again after a power-down cycle. Also, hundreds of volts is not considered "saturating" an op-amp, it is usually called "blowing it up". You will be wanting a comparator, but these voltages are no good for nobody.

    Once you are suitably resistor isolated from your low-tension circuit, a simple diode to 12V will limit the unwanted high voltage pulse and let you concentrate on the more coherent signal, the one between 0 and 12V. Input, through a proper biasing circuit, to a comparator, will let you read the pulse. There are some other tricks you should use here (like parallel the clamp diode with a small value cap), but this is the meat of it.

    A final point. Auto electronics are always a bit of a problem. That spark-coil inductive kick, along with generator noise, solenoids (some fairly high current) clicking on and off, and all sorts of other stuff going on, will send gremlins racing around anything you try to do. When you start off bringing the noisiest of all these signals directly onto your board, you will have trouble unless you take adequate precautions to stop radiated noise from propagating across your circuit.
     
  13. ¡MR.AWESOME!

    Thread Starter Member

    Aug 15, 2010
    33
    0
    I like that way of doing it Don. It turns out real nice in SPICE. My next concern is how much current do I need for the input of the comparator? I looked at some data sheets and got a little confused. The only reason I care is so that I know what the biggest resistor is I can use up at the front. The datasheet for an LT1017 gives me the impression that the input current for this comparator is in the nanoamp range.
    http://cds.linear.com/docs/Datasheet/10178ff.pdf
    That would be great cause then I could use a resistor in the megaohm range which would barely affect the main circuit. Right?

    Another question I have is for the 12V source that the diode connects to. Do you think that source needs to be regulated, or should I just protect it from surges? I don't think it needs regulation because all it does is cut the top off of the spike from the tach signal and it's not too big of a deal if it goes over 12V. I think a bidirectional TVS diode with a breakdown voltage of ~14V would be fine. How about you?

    Thanks for the help so far guys. I'm learning a lot.
     
Loading...