Before someone suggests a shaft-mounted Hall effect sensor and an LM2917 I should explain that on a diesel fire-fighting water pump there is neither alternator tach pulse nor access to the driveshaft, which goes directly from the engine into the pump.

Although I'm piloting this on my home water pump, there are other applications for this solution, not least of which is as a no-wire tach sensor for use in cabin-mount vehicle telemetry systems. I was trying to avoid making disparaging public comments about the apparent inability of my employer's installers to find a tach pulse behind the dash, but I think Peter Bennet's otherwise reasonable comment deserves an answer.

I'm interested in using a microphone or similar transducer that measures vibration in the 0 < f < 1kHz range.

As pointed out by Andy, RPM != Hz. The single cylinder diesel waterpump fires once for every two revolutions of the crank, so running at 3000RPM the frequency of detonation is only 25Hz. This point gave me considerable pause. However, engines do not produce a pure tone. Firstly, the entire engine block functions as a bell. If I remember my bell theory that should produce at least five tones of reasonable power (it starts off pretty loud!). Secondly, the exhaust baffle works by inducing a complicated series of reflections with deliberate refraction. The resultant wave has many times the frequency of the base harmonic. To get a reliable answer I'll have to use a spectrum analyser. Happily there's one at work and while I don't really know how to use it, I have colleagues who do. This should prove interesting.

My first experiment was a Jaycar kit that provides life-support for an LM2917. It worked well for detecting a frequency threshold, but what I want to do now is convert the dominant frequency to a voltage.

FFT is not a load I care to place on an embedded CPU that's already busy, but if there is a spectrum analyser on a chip, that would be superb so long as it isn't thirsty or ridiculously expensive.

Investigation of the aforementioned LM2917 reveals that it can be configured as a frequency to voltage converter, which is exactly what is required as the input for an ARM SoC.

Broadly speaking (if I've understood the docs correctly) it's a charge-pump arrangement inside the LM2917 with some op-amp cleverness to produce an output voltage linearly correlated with frequency.

Figure 33 of the app notes in the TI documentation for the LM 2917 is titled "Frequency to Voltage Converter with 2-pole Butterworth Filter to Reduce Ripple" which is pretty much exactly what I wanted. The output is linearly scaled from Gnd to Vcc with the range governed by the drain-to-ground resistance on pin 3, so now I guess the question has mutated into...

What's involved in using a microphone to supply f(in) of an LM2917?

A little digging reveals that an electret microphone is an assembly with a capacitor where the distance between the plates changes according to air pressure and the tiny change in C is converted to a signal by an embedded op-amp. You have to supply power, and the output voltage range is determined by the supply voltage.

The problem to which Andy alluded is that these frequencies are so low that signal integration won't work so well. My whole strategy really depends on being right about the harmonics. Stay tuned (sorry, couldn't resist it).

  • \$\begingroup\$ It's been a long time so I don't have a reference off hand, but a 'maximum entropy' or 'all poles' algorithm can quickly find one or two dominant frequencies, a lot faster than an FFT. \$\endgroup\$ Jul 22 '13 at 2:26
  • 2
    \$\begingroup\$ When thinking about computational load, remember that while you have to collect the data at "fully speed" you only have to process it at a rate determined by how often you want a new answer. If that's only a few times a second (if you are driving an indicator, not closing a control loop) then you have a lot of time in computer terms. \$\endgroup\$ Jul 22 '13 at 2:39
  • \$\begingroup\$ Tinytach (tinytach.com) makes diesel tachometers that use a sensor that clamps on a fuel injector line, and apparently senses injection pulses. Perhaps they could help you. \$\endgroup\$ Jul 22 '13 at 3:13
  • 2
    \$\begingroup\$ 20kHz converts to a rotational speed of 1.2 million rpm. Are you sure you have got this right? It's all about filtering the mic to only allow those frequencies through which are in the likely range of REAL rpm. \$\endgroup\$
    – Andy aka
    Jul 22 '13 at 7:08
  • 1
    \$\begingroup\$ Regarding microcontrollers doing FFT, please see this thread on the Arduino forums: From the linked post, "... you're going to be as shocked as I was with how fast the FFT runs.. in my implementation, not only is our little Arduino doing the sampling and FFT's, it's also generating composite video, completely in code, thanks to the TVout library. ... it's updating (which means a sample/process/display pass) the screen at around 10 times per second." \$\endgroup\$ Jul 22 '13 at 9:39

Do both ends of the crankshaft disappear into inaccessible things? Is there no way whatsoever to get to any rotating part - the pump impeller, injection pump, cam belt/chain/gear, starter gear...?

Writing off any sort of variable reluctance or hall sensor on any rotating part (which seems far fetched, but for the sake of argument...) there are also other potentially easier ways to sense RPM than microphone - although automotive knock sensors are tuned microphones and you could get lucky with one of those.

You could sense pulses from fuel injectors, exhaust manifold, injection pump. I'm assuming you have no alternator or rotating electrics at all, otherwise the ripple/AC from any of those is an easy win.

The LM2917 circuit is a very old one, and I don't really see why it's useful today - converting RPM to a voltage doesn't seem like a useful thing to do; If you are displaying it on a standard RPM gauge, then you want to be capturing the dominant/target frequency and filtering/conditioning it to suit the RPM gauge, which will expect pulses. If you are capturing the data with a microprocessor for transmission or logging etc. then the micro can count pulses just as happily as it can read an ADC, but the error will be much lower if you're just filtering the pulse train rather than doing a relatively vague f-to-v conversion.

  • \$\begingroup\$ It really is a minimalist machine. In that sense it's almost a work of art, though only an engineer might think so! One end terminates inside an oil channel with a clever groove serving to pump oil into the bearing adjacent, then there's the counterbalanced thingummy with a pin through the conrod, then another bearing, then through a seal into the pump chamber terminating inside the impeller (lubricated by water). The injector is completely mechanical. \$\endgroup\$
    – Peter Wone
    Jul 22 '13 at 10:28
  • \$\begingroup\$ So there's quite a few rotating bits that a VR or hall sensor might pick up? \$\endgroup\$
    – John U
    Jul 22 '13 at 12:32
  • \$\begingroup\$ I take your point, but are you suggesting I drill a hole in the flywheel and glue a magnet into it? All the places where there is moving steel are inside cast aluminium housings. One's full of hot oil and the other's full of dirty water. Quite apart from that, one of my objectives is to avoid having to install a sensor and run a cable. I know it would work well here but it wouldn't help me compensate for the shortcomings of installers. \$\endgroup\$
    – Peter Wone
    Jul 22 '13 at 22:50
  • \$\begingroup\$ VR sensors require no magnet, just any lumpy ferrous thing passing by them - so they could sense flywheel teeth, timing pulley/gear teeth or casting features, shaft keyways, chain passing by, even a crankshaft counterweight coming & going. Flywheel teeth would give a very high resolution reading, you could easily detect a single-cylinder misfire by the tooth timings (although without an indexing pulse/tooth of some sort you can't say which one it is). Look up Ford EDIS system operation for a good VR system. \$\endgroup\$
    – John U
    Jul 23 '13 at 9:53
  • \$\begingroup\$ Thanks, John, I'll do that. In fact I just did, and learnt something. Essentially this variable reluctance sensor is a metal detector, and the teeth going past produces field distortion (variations in reluctance) that can be measured. How about that, you learn something new every day... \$\endgroup\$
    – Peter Wone
    Jul 23 '13 at 12:01

I came back to this recently and I finally have a cheap and reliable solution. There is a commercial vibration sensor called the SW-420 which can be had on ebay for about a dollar. It uses a ball-cage tilt switch, a charge-pump into a capacitor with a drain-back resistor and an op-amp to detect a threshold voltage. It's all set up on a tiny board and there's a potentiometer in one leg of a voltage divider, to set the threshold.

Obviously it works or they wouldn't be producing the whole thing as a commodity item, but in practice there isn't enough hysteresis for my application, and it's not practical to fit a bigger SMT capacitor.

The solution was to poll it and compute a sliding window value. The value is a UINT16. We increment on vibration and decrement on no-vibration, with capping at zero and some upper bound. When the value reaches the upper bound, sustained vibration is detected. Zero indicates sustained quiescence.

The upper bound determines the degree of hysteresis. Using the largest possible bound of 0xFFFF, state change detection takes about 3 seconds. It completely ignores transient knocks, yet detects the gentle sustained vibration of an electric drill at half speed (didn't even need an eccentric weight during testing).

For even more "inertia" you could use a long and a bigger threshold. In my application, the start cycle fits into three seconds but larger engines might need longer to spin up.

Ran into a problem in similar gear: my shock mounting is too good and the vibration energy is at the low end of what the sensor can reliably detect. Once again it is a hostile environment and I don't care to put the sensor outside the enclosure.

The solution was the same hysteresis logic but sensing vibration using the SPL output of a Freetronics vibration module which does this with the audio signal

Freetronics SPL

As you can see it feeds the signal to a charge pump with a drain back resistor. I think the purpose of IC1B is to prevent this from degrading MIC output.

SPL is hooked to one of the Arduino analog inputs. This particular module has no noise rejection on its power rail and amplifies any ripple. The solution was to crank supply voltage up slightly and power everything via the Arduino's built-in linear regulator which thoughtfully clips off the ripple.

  • \$\begingroup\$ Brilliant! Thanks for sharing and marking your question as answered. \$\endgroup\$
    – winny
    Jul 29 '20 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.