AsimpleWayRarelyPROMO.jpg

A Simple Way to Measure Temperature Using One GPIO Digital Interface

Welcome to the first entry in the ‘Rarely Asked Questions” blog series. Measuring temperature with a single GPIO is the matter at hand that kicks it off.

Question: How can I make an analog measurement if I only have a single GPIO left on the FPGA/microprocessor for my system?

Answer: A voltage-to-frequency converter can be used instead of an analog-to-digital converter.

As the need for sensing capabilities becomes more prevalent in modern applications focused on machine health and other Internet of Things (IoT) solutions, so does the need for simpler interfaces with fewer I/Os and smaller device footprints. The density of devices connected to a single microprocessor or FPGA is continuing to increase, while application space—and as a result, the number of I/O pins—can become constrained.

In an ideal world, all applications would have an ASIC providing a small integrated solution. However, ASIC development is time-consuming, costly, and doesn’t provide the flexibility to be repurposed for other uses. As a result, more and more applications are using microprocessors or small-form-factor FPGAs to get product development done in a timely and cost-effective manner.

In this article, we will explore a temperature-to-frequency converter that can provide accurate temperature results while only using a single GPIO pin. It will also demonstrate how using a voltage-to-frequency converter can be adapted to a variety of sensing applications.

Motivation

Some sensor measurements, such as temperature, humidity, and barometric pressure, are inherently dc and don’t change at rates fast enough—nor do they require resolutions accurate enough—to warrant an ADC and the design considerations that go along with it. Most ADCs require fast, accurate clock generation and timing, a stable voltage reference, a reference buffer with very low output impedance, and analog front-end circuitry to properly signal condition a transducer output before it can be digitally quantized and used by the system monitoring it.

In the case of sensing ambient temperature, a discrete application might use a thermistor in a Wheatstone bridge whose output would then be gained up by an instrumentation amplifier and then fed into an ADC. This design is over-engineered and requires more space, power, and computation cycles necessary for an application where the measurement might only need to be made once every 15 seconds.

What alternative measurement solution can be used to reduce the number of components and complexity associated with an ADC signal chain, but still measure an analog voltage? One solution is a voltage-to-frequency converter, such as the LTC6990. Configured in voltage-controlled-oscillator (VCO) mode, it can be used to measure an analog voltage without an ADC. In this example, the AD8494, a precision thermocouple amplifier, is configured as an ambient temperature sensor whose output voltage serves as the input to the LTC6990, resulting in a temperature-to-frequency converter signal chain (Fig. 1).

raq-issue-169-fig-01.png

1. The AD8494 precision thermocouple amplifier is configured as an ambient temperature sensor, resulting in a temperature-to-frequency converter signal chain.

How to Convert a Temperature Input to a Frequency Output?

Today, many modern electronic appliances require an on-board temperature-monitoring system. The method of converting analog signals to pulse-width-modulated signals or digital signals is well-documented. However, if the measurement solution would require an ADC, there are drawbacks associated with cost, accuracy, and speed. Typically, the more accurate the measurement, the more expensive the solution. The circuit in Figure 1 delivers a low-cost and easily interfaceable solution whose accuracy can vary as determined by the needs of the temperature measurement system.

Though it’s a precision thermocouple amplifier, the AD8494 can be used as an ambient temperature sensor by shorting its inputs to ground. The output is then defined as:

raq-issue-169-eq-01.png

In this circuit, where a unipolar supply is used, –VS = ground (0 V) and an offset voltage must be applied to the REF pin of the AD8494 to bias the output voltage above ground, even if ambient temperatures are negative. The output voltage of the temperature sensor, VOUT, is defined as:

raq-issue-169-eq-02.png

In VCO mode, the LTC6990 frequency output is defined as:

raq-issue-169-eq-03.png

Since the output voltage of the AD8494 is VCTRL to the LTC6990, Equation 1 can be substituted for VCTRL in Equation 2, and setting RSET = RVCO yields:

raq-issue-169-eq-04.png

From here, Tambient can now be solved for. The voltage units cancel out, which yields Equation 5:

raq-issue-169-eq-05.png

Okay, I Have a Frequency Output. How is this Useful?

The beauty of a frequency output is that you can use a single GPIO pin to get a sensor measurement. If the synchronous counter circuit in Figure 2 is used, then the rising edge of a clock will always be observed at its CLK_IN input. If the FOUT of the LTC6990 is used as the input clock, then the counter will increment every time a rising edge on FOUT is detected, creating a period counter. If the time interval between each measurement is constant, then the number of periods within a given time interval can be counted and frequency can be determined either by using floating-point math or a lookup table.

raq-issue-169-fig-02.png

2. The 4-bit synchronous counter contains LTC6990 output as its clock input.

By dividing the acquisition time Tacquisition by the number of periods counted, we get the period of FOUT. Taking the inverse of this relationship results in Equation 6:

raq-issue-169-eq-06.png

The example Verilog code (Fig. 3) shows a function that can be used to count the number of periods by using a single GPIO input on an FPGA. The larger the acquisition period, the more accurate the measurement. In the case of this code, a 16-bit counter is used to provide additional resolution. It also assumes the logic that controls the measurement acquisition time is performed at a higher level in the architecture.

raq-issue-169-fig-03.png

3. This example Verilog code can count the number of periods by using a single GPIO input on an FPGA.

raq-issue-169-fig-04.png

4. The above outlines the transfer function of the temperature-to-frequency converter.

Conclusion

In this application, a new type of temperature-to-frequency converter is discussed. It provides an accurate, low-cost method to measure temperatures. If the temperatures exceed the industrial range of –40 to +125°C, a thermocouple can be installed at the inputs of the sensor.

raq-issue-169-fig-05.png

5. This plot shows temperature error of the measurement system.

As a conclusion, the plot in Figure 5 shows the error of the measurement system. It demonstrates the linear relationship between the ambient temperature and the output frequency as well as the accuracy of the system. While this solution may not provide a very fine temperature resolution result, for applications where roughly ±2°C error is acceptable, this provides a cheap and simple interface for measuring temperature. In addition, the concept of using a voltage-to-frequency converter can be adapted to measure other types of transducer outputs without the need for an ADC.

Chau Tran works in the Instrumentation Amplifier Products (IAP) Group, and Naveed Naeem is a product test development engineer at Analog Devices Inc.

References

Fundamentals of the Electronic Counters.” Hewlett Packard, 1997.

Johansson, Staffan. “New Frequency Counting Principle Improves Resolution.” Proceedings of the 2005 IEEE International Frequency Control Symposium and Exposition, 2005.

Kamal, Ibrahim. “5 Hz to 500 kHz Frequency Meter.” IKA Logic, April 2008.

Synchronous Counter. ElectronicsTutorials, 2019.

SourceESB banner with caps

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish