Intro
Variability in device performance is an unfortunate aspect of engineering. Even within a single component many factors can cause distinguishable variability to exist. Production methods for electrical components aim to reduce error and variability, but some sources of variation are impossible to completely alleviate through production practices. Amongst the biggest culprits of inevitable variation is temperature. In integrated circuits, this can cause a circuit to differ in characteristics such as switching speeds due to the change in electron mobility. Temperature can change the expected behavior of discrete components and sensors, which can cause a microcontroller or IC to misread (or not read at all) a crucial signal. For these reasons many systems can benefit from adding a temperature monitoring module to the design. A temperature correction/monitoring module must, in most cases, be small and low cost. Sensors have various sizes, and a universal error correction module should not be big enough to cause a considerable change in the system’s size. In the Internet of Things (IoT) domain this is particularly important, since most IoT devices are already quite small and cannot spare much extra space. Similarly, an expensive solution would be infeasible for most projects and would likely warrant simply buying a cheaper competing module. GreenPAK devices are an optimal solution, since they are small, low cost, and consume very little quiescent current, which prevents the temperature correction module from substantially affecting battery life. This application note explores the use of a GreenPAK IC in conjunction with a digital potentiometer, passive components, and an op-amp to measure the temperature change on a system. The GreenPAK IC will monitor the change in voltage compared to a calibration point and will adjust the digital potentiometer to counteract the change in voltage. The number of pulses (up or down) will be stored in the GreenPAK and will be available for an I2C signal to read. Several key design choices will be laid out and further applications using the methodology will be hypothesized.
The complete design file is available here. It was created in the GreenPAK Designer software, a part of the Go Configure™ Software Hub.
Theory
Changes in temperature can be measured using a voltage divider between a typical resistor and a resistor that is highly sensitive to temperature, aka a thermistor. If this resistor has a Negative Temperature Coefficient (NTC) the resistivity will lower with temperature, causing VOUT in Figure 1 to be a lower voltage. Figure 1 also shows a digital potentiometer in series with the NTC thermistor. This will be the balancing potentiometer required to satisfy a constant VOUT across temperature. The output voltage equation is shown below:
Therefore, if the NTC thermistor resistance falls, the digital potentiometer resistivity must increase and vice versa. An important note is that the resistance of a thermistor is nonlinear across temperature. Figure 2 shows typical NTC behavior.
Thus, if an application would like to monitor a large temperature range the system should be designed to account for this nonlinearity, either through additional circuitry or through software.
System DesignCircuitry
The system design is shown in Figure 3:
In most applications R1 should be very large. This is beneficial since it increases the linearity of voltage change from the digital potentiometer and thermistor. If R1 is very small, then the temperature variation of the NTC voltage divider will be very small:
Alternatively, if R1 is chosen to be very large, temperature change will greatly dictate the relative change in voltage:
However, a caveat to this is that, even if the voltage variation is more reliant upon temperature, the output voltage will always be very small. An op-amp is incorporated to increase the absolute voltage variation across temperature. The op-amp is used in a non-inverting amplifier configuration, which causes the gain of the system to be:
n this application the resistors are biased at R1 = 2.25 MΩ, R2=18 kΩ and R3=1 kΩ. The MCP4013 digital potentiometer ranges from 0 to 50 kΩ and the bead thermistor has a room temperature resistivity of 50 kΩ.
Design Output
A necessity of this application is that the GreenPAK must be capable of relaying potentiometer information back to a processor. Therefore, the GreenPAK needs to know the potentiometer value at any given time. It can accomplish this by calibrating the potentiometer to a known value, such as the max or min resistance, then keeping track of the change from the given count. Most digital potentiometers have volatile memory, meaning that the potentiometer might need to be recalibrated at every break in power. The design assumes a digital potentiometer or rheostat has a 64-step (6 bit) wiper configuration, but other options can be added by changing the counters via ISP. The design will be able to output an I2C value containing a count value of the current step. This can be used to interpret the amount of resistivity needed to compensate for the change in temperature. The general formula for potentiometer resistivity is 𝑅𝐴𝑊 = 𝑅𝐴𝐵𝑁 63 + 𝑅𝑊, where RAW is the potentiometer resistance, RAB is the rail-to-rail voltage, N is the step size and RW is the resistance of the wiper. This can be likened to the compensated resistance of the thermistor, which can be used to determine the equivalent temperature. For example, if our I2C value is at 7 out of 64 possible steps after calibration we can determine the resistance will be:
Plugging this into the circuit equation with our chosen components we get:
Hence, the temperature being measured in this example would be slightly colder than room temperature, since the NTC thermistor has a slightly higher resistivity than the nominal resistance of 50 kΩ. It should be noted that if the NTC value is known at the calibration point the calculation becomes much simpler. The change in potentiometer resistance will approximately cancel out the NTC difference. Therefore, if the potentiometer increases value by 3.125 kΩ then the NTC thermistor has dropped by approximately the same value.
GreenPAK DesignThe output voltage of the SLG88103 is interpreted by the GreenPAK design. In the example application the threshold of the comparator is VDD/2; when either Temp_EN or Calibration_EN turn high the digital potentiometer will be manipulated to change the output of the SLG88103 to be equal to VDD/2. The current value of the digital potentiometer will be stored in a counter that is readable via I 2C.
Pin Description
Pin 3, Input Voltage
The output of the SLG88103, which is compared to VDD/2. This is the input to the comparator used to detect whether the correct threshold has been met.
Pin 4, Calibration_EN
Enable signal for calibration. Calibration is used to force the digital potentiometer to its max value, then decrement to find the correct resistance. This is necessary to calibrate the potentiometer at startup, since the initial value of the potentiometer is not known. Without calibration the temperature correction circuit would not be confident that the readable I2C value is correct.This application assumes a 64-step potentiometer, but other values can be chosen. It is also important to note that the potentiometer in this application does not “loop-around” at the 64th step; if it did, then this method of calibration would not work.
Pin 5, Temp_EN
Checks temperature by incrementing or decrementing the potentiometer to get VDD/2 at the SLG88103 output. Temp_EN uses the running potentiometer counter and assumes that the system has been properly calibrated. If calibrated, the Temp_EN pin is preferred over the Calibration_EN since the system doesn’t need to spend the time incrementing to the max potentiometer value. For example, if the potentiometer is one bit away from the correct value recalibrating could take up to 120 times longer!
Pin 12, nCS
Stands for “Not Chip select”. This is an active_low signal that is used to either increment or decrement. It is a necessary signal for the potentiometer employed in this app note and may behave differently for other applications.
Pin 13, Up
Increments or decrements on the rising edge of the pulse, assuming nCS is low. If Up is high when nCS falls low the potentiometer will increment. If Up is low when nCS falls low, then the potentiometer will decrement.
Pin 15, OOB
Pin 15 stands for “Out of Bounds”. It is used to indicate that the potentiometer has met its resistive limit (ether high or low) and cannot continue correcting for the difference in voltage. This is a useful signal to communicate to the user that the temperature correction is falling outside the system’s specifications.
GreenPAK Design Description
The overarching function of the GreenPAK design is to monitor whether the voltage input is above or below the threshold of VDD/2. If either enable signal is triggered the nCS signal will drop low and the UP value will cause the potentiometer to increment or decrement. An edge detect is connected to the comparator that will halt the potentiometer once the comparator changes signal. Figure 4 shows the GreenPAK Design:
The system is enabled either by I2C virtual outputs or pins 4 and 5. Temp_EN and Calibration_EN are mutually exclusive; calibration has priority. DFF3 and DFF6 set the enable signal for clocking the output Up and dropping low the output nCS. Calibrate_enable (3-bit LUT2) and the edge detect are used to disable these signals once the comparator changes value. In Figure 4 the topmost portion of the design focuses on counting the number of pulses sent to the potentiometer. The direction up/down is moderated by 2-L2. If VDD/2 is larger than the input the counter will increment. However, if Calibration_EN is enabled a different signal will override the direction with a one-shot CNT1/DLY1 trigger. CNT1/DLY1 forces the potentiometer to reach its maximum resistance by clocking 63 pulses. CNT1/DLY1 will also set CNT0/DLY0/FSM0 to the max value via a rising edge detect on the high-level reset of CNT0/DLY0/FSM0. If neither Temp_enable or Calibrate_enable are active, then Up will match the polarity of the comparator. CNT4/DLY4 is a 1.5ms edge delay, which is used to hold the Up/Down information for the nCS to record whether the potentiometer should increment or decrement (described in the Up pin description). “Pot counted” (3-bit LUT11) is used as the clock for “Running position count” (CNT0/DLY0/FSM0). It will count either up or down depending upon the value of “Count Direction” (3-L5). The running position count will trigger the OOB pin when the value of the counter goes below 0. However, if left uninterrupted, the counter will continue past 63 and only send an output pulse after it cycles through all 16 bits. To prevent this, the “Positive overflow” counter will trigger the out of bounds point if it notices the counter has attempted to increment over 63 times without passing an edge.
Results were obtained using a breadboard and the setup described in section 4. Figure 5 shows the calibration of the circuit to room temperature and, once the NTC begins to heat up, the Temp_EN signal is pressed and the output voltage stabilizes back to VDD/2.
Yellow channel: VSLG88103
Blue channel: nCS
Pink channel: Up
The I2C value was read at every stage: 63 at calibration, 7 at first stabilization, 18 at second stabilization. The potentiometer used in the application only relied on the rising edge to increment steps. If the minimum high and low timing values were maintained any duty cycle could be used. Consequently, the design has been made so that incrementing and decrementing have inversely proportional duty cycles. This allows the Up output to be directly counted by a processor if the processor is not I2C compatible. Figure 6 shows the output voltage decrementing after the Temp_EN button has been pressed. Notice that the duty cycle for decrementing is quite small.
Yellow channel: VSLG88103
Blue channel: nCS
Pink channel: Up
The resolution of the temperature sensor was found to be roughly +- 15 mV. However, much of this depends upon the step size of the potentiometer and the noise immunity of the system; the resolution of the comparator is spec’d down to 5 mV.
Further ApplicationsThough this application focuses on temperature correction the basic principle can be applied to many different sensors; vary resistance based upon a parameter, measure the difference in respect to a reference and keep track of the potentiometer value compensating for the resistance change. This concept can be applied to a myriad of resistive sensors, such as photoresistors, strain gauges, alcohol gas resistors and more. Further improvements can be made to the temperature sensing applications as well. As stated in the theory section, nonlinearity can be a problem for a temperature sensor built to work across a large range. Circuitry can be added to further alleviate this problem. Additionally, a PWM output can be derived from the current potentiometer count; this could be used in applications such as heating and cooling devices, such as fans and heaters.
ConclusionKnowing how temperature may be affecting sensors or modules is critical for many applications. The GreenPAK due to its size, configurability, and price is an excellent approach to monitoring the temperature change by dynamically configuring a digital potentiometer to compensate for a NTC thermistor. The GreenPAK can give an I2C digital value correlating to temperature variation, which can be read by a processor to obtain compensated sensor measurements or to relay temperature data to a user, such as with a thermometer. This application gives a broad approach to temperature correction and can be applied to other sensor factors (light, pressure, gas concentration…) as well.
Comments