
         12 September 1993    MGJ



FOR EXPERT HARDWARE DESIGNERS ONLY
----------------------------------

Don't read this unless you're an expert.   ESPECIALLY don't read
this and then ask a beginner's question.  PARTICULARLY don't
read the two preceding sentences and _then_ ask a beginner's
question.






The prototype unit was built over a weekend using parts obtained
from local retail stores in Mountain View, California.  No store
carried the LM311, so an alternative design was used while we
waited for the Digi-Key supplies to arrive via UPS.

The alternative design is in many ways inferior, but it does have
two virtues: it uses cheaper, and more common, chip types.
I DO NOT ADVOCATE THE USE OF THIS ALTERNATIVE DESIGN.
When my LM311 arrived, I tore apart the alternative design and
replaced it with the LM311.

But, I figured, maybe somebody might be interested in it for
educational purposes.  As long as I make it clear that the LM311
design is preferred, why not show both?  What's the harm?

So, here goes.



The LM331 is a precision voltage-to-frequency converter.  But a
(less precise) v-to-f is found in every phase locked loop chip
you can buy: namely a VCO, Voltage Controlled Oscillator.  It so
happens that the CD4046 Phase Locked Loop chip is dirt cheap
and easily available.  It is also ferociously temperature sensitive,
  **supply sensitive** (believe it or not), and its legal range
of Vcontrol is small and limited by on-chip process parameter
variations.  Still, when it's Saturday afternoon and you're mad as
hell about the roasting office and you need to build something
Right Now and a 4046 is all you've got, it can be made to work.


The Tricks
----------

First, the 4046's output frequency is linearly proportional to (1/VDD).
So you need to feed it a stable VDD (+5V) supply.  Hence you absolutely
must use a 78L05 regulator.

Second, the 4046 doesn't respond to control voltages below about
1.5V on pin 9 (1.5V == the NMOS threshold voltage of transistors
inside the chip).  So you need to install gain between the LM34
temperature sensor and the VCO of the 4046.  I used an opamp
designed for +5V-only operation (LM358) and a gain of 3 in
noninverting configuration.  NOTE: temperatures below about 50
degrees Farenheit will therefore give an opamp output below 1.5V.
So the 4046 circuit cannot measure temperature below 50 F.
Fortunately my office in California didn't ever get that cold,
while I waited for the LM331 to arrive.

Third, I shifted the origin of the 4046's f-vs-V (called in the datasheet
"frequency offset") by installing R2 = 47Kohms on pin 12.  In combination
with R1 = 10Kohms (pin 11) and C1 = 0.068uF mylar (pin 6 to pin 7), this
gave a frequency range the SPARCstation can deal with.

Fourth, beware of floating inputs.   You MUST ground pin 5 (Inhibit);
if you let it float, the VCO will turn on and off randomly.  Similarly,
ground pins 3 and 14.

Fifth, the 4046's output is a nice 50% squarewave.  So just apply
the 100-to-1 attenuator and feed into your SPARCstation.

Sixth, in this circuit, calibration is everything.  So take a lot of
measurements in parallel with your reference thermometer.


      --- Mark Johnson
