The Classroom

The LM2917

Frequency to Voltage Converter

Daniel Koch

Issue 56, March 2022

A niche IC which fills a certain purpose very well, and makes some microcontroller projects easier. - by Daniel Koch

The LM2917 Frequency to Voltage converter is something of a versatile Integrated Circuit (IC) when it comes to measuring frequency. While on its own it is used as an independent switch, this IC can also be used to do the job of a section of code, enabling a microcontroller to simply check an analog pin rather than constantly monitor and count in order to obtain a result.

The LM2917 is a dedicated IC, whose sole job is to turn the frequency on its inputs into a voltage output. It is a monolithic IC, which comes from the Greek works ‘Monos’, meaning singular, and ‘Lithos’, meaning stone. The term originally meant one single big stone in English, but has come to mean any large, singular item. Its use in ICs is a reflection of that, although the scale is micronised. Monolithic ICs are built on a single wafer or crystal of silicone, with every component involved etched onto it. There are no separate components in the device. This is also known as a ‘Planar’ device. This contrasts to some other IC types, which are made with several crystals or even other ways of making components, all internally connected and encased. This makes an IC more reliable, as there are no physical connections between components. It can reduce susceptibility to noise and temperature effects as well, as all components have commonality.

GENERAL OVERVIEW

The IC is designed to require a minimum number of external components. It operates on the charge pump principle, which requires at least one external capacitor. We’ll discuss what a charge pump is shortly. It is available as an 8-pin device or a 14-pin device. It has tachometer inputs which accept the frequency pulses, and feed them to a comparator. In the 8-pin devices, this is fixed as a ground-referenced op-amp, while in the 14-pin version, both inputs are available. When there is a zero input, the output swings to ground. The charge pump is fed to a second op-amp, set up as a voltage follower which drives a bipolar junction transistor (BJT) output.

The BJT has both collector and emitter terminals available, and is fully floating, so a ground- or supply-referenced load can be driven, up to 50mA. That’s enough to run a small relay or the gate of a MOSFET. Because it is floating, the collector may be supplied with a voltage up to 28V, regardless of what the IC power supply is. The IC is designed to require a minimum number of external components. It has an internal Zener shunt regulator for stability.

LAYOUT AND SPECIFICATIONS

While the LM2917 is available in both 8-pin and 14-pin DIP packages, we didn’t find any 8-pin devices on the retail shelves, in store or online. Commercial suppliers and a couple of the unverifiable online sellers had them, but everyone known and recognised has the 14-pin version. Thus, this is what we will look at.

Paramater

Value

Unit

Max Supply Voltage

28

V

Max Collector Voltage

28

V

Max Collector Current

50

mA

Max Supply Current (Zener)

25

mA

Input Differential Voltage

28

V

Input Hysteresis

30

mV

Zener Resistor Range

400 - 600

Ω

Max Source Current

10

mA

Charge Pump Output Current

140 to 240, 180 typ.

µA

USING IT

The LM2917 operates on the charge pump principle, which requires at least one external capacitor. We’ll discuss what a charge pump is shortly. The inputs to the differential comparator, TACH+ and TACH- are used to feed the frequency to the op-amp. In the 8-pin devices, the - input is fixed to ground, meaning that the + input must cross zero to register.

That’s fine for magnetic pickups and other such inputs which generate an AC signal, but not so good for DC signals. However, in the 14-pin devices available on the retail market, both tachometer inputs are available. This means that a maker can connect the - input to a voltage divider, and set a threshold at which an output change occurs in the input op-amp. The hysteresis built-in stays even in this mode, so there is good noise rejection at the input.

It is critical, however, that some input resistance be included if the input will ever go below ground, as the 14-pin devices, to allow both inputs to be used, have no protection against this eventuality.

The use of the controllable input threshold with both op-amp inputs accessible allows different waveforms to be used. For the charge pump to give an accurate voltage, a square wave at the output of the op-amp is assumed. However, if the threshold was set such that only the peaks of a sine way triggered the op-amp, then the on time would be much shorter than it should be for an accurate representation of the waveform.

After the tachometer turns the input frequency into a square wave, it is fed to a charge pump. Three external components are needed for this. A timing capacitor is the basis, C1. Internal circuitry ensures linear (constant current) charging and discharging of the timing capacitor.

It charges between two levels, the difference between them being half of the supply voltage. This section functions in conjunction with an RC network on the other output of the charge pump. The charging current into the capacitor C1 is replicated on the other output, through a resistor with a capacitor in parallel. The end result is this equation:

VO = VCC x fIN x C1 x R1 x K

Where VO is the voltage out in Volts (V) at the junction of the RC network, fIN is the frequency in Hertz (Hz), C1 is the value of the timing capacitor in Farads (remember to convert), R1 is the resistance of R1 on Ohms, and K is the gain constant, typically given as 1 but sometimes differing in ways beyond the scope of this article. Those situations are unlikely to affect many makers.

C1 should be larger than 500pF, as recommended by the manufacturer’s datasheet. The value of R1 also has some limitations. Because the output current of the charge pump is limited to a nominal 180µA internally, if R1 is too large, it ends up being a large portion of the output impedance of this section of the circuit, which affects its linearity. The recommendation is for VO ÷ R1 to remain below the value of the output current.

Notice that the formula does not mention C2. Its value is less critical. However, too big, and it slows the response time and may even not charge/discharge within a cycle. Too small, and too much ripple comes through.

OPERATION

From the information above, some people will have gathered what is going on, but a clear explanation is in order. The comparator has a square wave output that relates to the frequency of the incoming waveform on the tachometer inputs, no matter what shape that waveform originally was.

This square wave is fed to the charge pump, which here is a constant current source charging an external capacitor. On every positive half cycle of the square wave, the capacitor charges with the fixed output current which is nominally 180µA. It does so until the voltage on the capacitor has increased by half of Vcc. That means that the charge pump is more sophisticated than some, because it measures an increase and not a threshold.

The timing capacitor stays at this voltage until the negative half cycle of the square wave. The capacitor is then discharged at the same 180µA current until the voltage across it has fallen by half of Vcc. This value is also now maintained until the next half cycle.

The thing is, the charge pump has a lot more going on
inside it. It reproduces both current pulses in the timing capacitor C1 on its other output, where R1 and C2 are connected in parallel. However, it produces them both as positive pulses, despite the fact that the pulses in the timing capacitor are one positive and one negative. The capacitor C2 filters these pulses and results in an average voltage that becomes VOUT.

THE OTHER OP AMP

Strictly speaking, the voltage output at Pin 3, the output of the charge pump, is the useful voltage. However, it would not take much to affect the voltage here by changing its impedance by making connections. For this reason, a voltage-following buffer is provided.

In the 8-pin device, the + input is internally tied to the charge pump output at the R1/C2 junction. However, in the 14-pin devices, it is left free. In most uses, the user will connect it to the charge pump, but having both inputs free allows such things as input biasing. It is possible to configure this op-amp as a comparator or switch with both pins available, but it can also be connected as a voltage follower as in the 8-pin device, in which case the output reflects the input without affecting the impedance or values at the charge pump.

The BJT is used as the output device. Driven by the buffer, it can simply have a resistor connected to it as a load, for voltage sensing, or it can directly drive a load.

PRACTICAL USES

To see some of this in practice, let’s take a look at some of the example circuits from the datasheets. The first is for a Zener-regulated Frequency to Voltage Converter. Five external components are needed, as the Zener regulator needs a resistance to work and the output transistor also needs a load. The other three are, of course, C1, R1, and C2.

The 470Ω resistor provides current limiting to the input, and so the Zener regulator becomes useful. This creates very stable outputs regardless of fluctuations in input voltage. Remember, all of the charge pump functions relate to Vcc. You can also see that the negative input of the tachometer op-amp is tied to ground, while the negative input of the output op-amp is tied to the emitter of the BJT, providing some feedback. The positive input of the tachometer input is used for the input signal, and the positive input of the output op-amp is wired to the output of the charge pump. Output is 66Hz per volt.

The other circuit here is a frequency switch. In the datasheets, it is shown controlling a resistive load such as a relay coil, but we have it here driving a PNP transistor to give a 5V signal to a microcontroller. The datasheets say 6V to 24V as the supply but 5V should work. If not, because the BJT output is floating and we have added the second PNP transistor anyway, you could tie the PNP high side to the microcontroller’s 5V rail.

This circuit supplied no values, so you would need to use the formulas presented earlier to find values for your given frequency range. In fact, the same applies to the frequency to voltage converter above, as 66Hz/V may not suit your application at all. This circuit shows the use of the negative input of the output op-amp with a voltage divider, in this case, formed by a potentiometer, to alter the output behaviour.

SAVING CODE

We expect the biggest value of the LM2917 to the maker to be in avoiding possibly complex or resource-consuming code.

Of course, in something like a Raspberry Pi or Arduino Mega, you’ll hardly be short of program space or processor speed. On smaller micros, however, sometimes things are not so easy. Having a loop running all the time in the background to monitor the frequency on, say, a digital input, and decide when it has gone above or below a certain value, can be consuming.

It can also challenge less experienced coders, who often struggle with loops like that which need to run without missing a beat while other things happen, and which need to interrupt all else when a parameter occurs.

When using the frequency to voltage converter, all that is needed is to monitor an analog input. The LM2917 can run all the time, do the work, and give a voltage proportional to frequency that can be read with nothing more than an ‘analogRead’ or the like. No background counting, or anything like that.

Similarly, using the LM2917 as a frequency switch means only monitoring a digital pin. In some situations, this is even easier to implement, and would mean that something as small as the 6-pin ATtiny10 Liam looks at elsewhere in this issue may be capable of running a more complex circuit that would have otherwise been the case.

Hopefully, the LM2917, old though it is, can continue to do its specific job into the future as makers find new ways to do things. The use of a self-contained circuit to process an input signal has value to those who have encountered such a need, and is something to keep in mind for those who have not yet found the problem.

Of course, all of this depends on what coding language, development environment, and platform you use. Skilled coders with the right hardware and development environment might be reading this and asking themselves: "How is that hard or difficult?" The answer is, it may not be for you. However, if you are someone with less advanced skills, or a language which does consume resources to do a job like this, then you probably get exactly what we mean!

HANDS ON

Parts Required:IDJaycarAltronicsPakronics
1 x Solderless Breadboard-PB8820P1002DF-FIT0096
1 x Packet Breadboard Wire Links-PB8850P1014ASS110990044
2 x Plug-to-Plug Jumper Wires*ProbesWC6024P1016SS110990029
1 x 1.5kΩ ResistorR1RR0576R7562-
3 x 10kΩ ResistorR4, R5, R6RR0596R7582SS110990043
1 x 100kΩ ResistorR3RR0620R7606SS110990043
1 x 10kΩ Linear (B) 16mm PotentiometerR2RP7510R2225-
1 x 10nF MKT CapacitorC3RM7065R3013BDF-FIT0118 #
1 x 100nF MKT CapacitorC2RM7125R3025BDF-FIT0118 #
1 x 1µF MKT CapacitorC4RM7170R3037B-
1 x 1µF Electrolytic CapacitorC1RE6032R5018DF-FIT0117
1 x NE555IC1ZL3555Z2755-
1 x LM2917IC2ZL3930Z2640-

Parts Required:

Updated schematic thanks to feedback from glitch_n_grind via Instagram. Glitch also suggests 1µF caps on the signal outputs to clean up transients on the edges.

We tried for quite some time to come up with a build for this IC that would demonstrate its function in a meaningful way. The trouble is, there are so many different uses where frequency could be monitored, that we decided instead to build a frequency source rather than use, say, a motor. The result is two circuits on the breadboard. One is based around an NE555 and is an equal mark/space astable circuit with a variable resistor, while the other is the LM2917 set up as a modified minimum component tachometer from the datasheet example.

The example circuit from TI’s datasheet uses the 8-pin version, so we have introduced a few changes. Many sensors for monitoring rotational speed in industrial and automotive situations are some form of variable-reluctance magnetic pickup. In some form or other, they involve either a magnet attached to the shaft, and a coil sensor and supporting circuit monitoring for electromagnetic induction, or they rely on a biassing magnetic field in the sensor to detect the presence or lack of metal, such as a gear tooth counter.

These are a bit less practical for many makers, who will opt for either an optical sensor in a notched wheel, a reflective sensor with a very similar circuit, or a hall effect IC. These present issues when used with the 8-pin device. As noted earlier, in its basic configuration, the operational amplifier in the tachometer input stage has to sense a crossing of 0V at the non-inverting input, because in the 8-pin device, the inverting input is internally connected to ground.

However, with the 14-pin device, the inverting input is accessible. In this circuit, we have provided it with a voltage divider so that ‘zero crossing’ for the op amp occurs at half the supply voltage. This is very important for optical sensors such as an IR LED and photodiode, as there will only ever be a voltage of supply (or whatever comes out of the sensor for a high) or 0V. With the hall effect IC, the most common choice will be a UGN3503, because it is readily available at retail levels. This device has a 2.5V output as its mid point, and will swing below or above that depending on the magnetic interaction.

We are using the component values from the datasheet example, but the quoted figure of 67Hz/V output will no longer be valid. In fact, you will need to use a multimeter to measure the voltages, because any change in the voltage divider affects the output figure. However, that’s the point of this build: To use a multimeter to visualise the output. If you have an oscilloscope, measuring the output of the NE555 circuit will be informative too, but don’t stress if you don’t have one. Many multimeters now will give a reasonable frequency measurement. If you don’t have one, the minimum value with just the fixed 1500Ω resistor is around 43Hz, and the maximum is around 322Hz, both depending on component tolerance.

Build by following the Fritzing and schematic, and we recommend building and testing the NE555 section first. Then you can assemble the LM2917 section. If you have a multimeter with crocodile clip probes, or the slide-on accessory for the same, testing this circuit will be a lot easier. All you need to do once powered, is to connect the multimeter probes to the ends of the relevant jumper wires, and watch the output voltage change as you turn the potentiometer at the NE555 circuit. ■