Correcting Potentiometer Nonlinear Using a Lookup Table

Linear potentiometers have deadband at the extremes of rotation. Also, when loaded, they don’t behave like simple voltage dividers. Without correction, the dial markings will deviate significantly from the voltage as measured by a PLC or microcontroller. For example, the potentiometer in Figure 1 was driven by a 10 VDC supply and set to midpoint. The dial says 5 yet the measured output voltage is 4.1 VDC. We will see that this is not a simple offset - it’s a non-linear position dependent output.

This engineering brief describes how to construct a lookup table (one-time calibration) which may then be used in a microcontroller or PLC. This is the second of three articles:

  • Part 1 explains the nonlinearity using a 10 kΩ potentiometer driving a PLC with a 11.7 kΩ input impedance. It is focused through the lens of the Thévenin equivalent voltage and resistance which change as the potentiometer changes position.

  • Part 3 describes system-level installation of the potentiometer in a PLC system with emphasis on a dedicated 10 VDC power supply. It also describes the benefit of using ratiometric techniques for immunity to power supply variations.

Figure 1: Image of the Crouzet PLC installed on a Phase Dock trainer. The 22 mm Schneider potentiometer is visible on the switch plate.

Graph of Potentiometer Nonlinearity

Part 1 of this series assumes that resistance changes linearly with rotational position. While this is true for the chosen Schneider Electric XB4BD912R10K potentiometer, it is incomplete. To understand, we must look deeper and recognize that the Schneider part incorporates a Vishay P11S series potentiometer.

The green line in Figure 2 highlights the actual response of the linear taper potentiometer described in the Vishay datasheet. This reveals a common misconception and a limitation of the linear potentiometer. A linear potentiometer is only linear for 270 out of 300-degree rotation.

Figure 2: The green line presents the actual response of the linear potentiometer while the red line shows our erroneous full-range assumption.

A classic mistake is to assume a linear change in resistance over the full 300 degrees of travel as represented by the red line in Figure 2. This is a significant error when compared to the true green line. We see that the lines cross (zero error) at the potentiometer’s midpoint. The error grows increasingly large as we approach the ends.

To be clear, the linear potentiometer is not linear. It suffers from:

  • A 15-degree deadband at either end

  • Deviation from novice expectation (red) and actual resistance (green).

The experienced (once bitten) engineer knows to discard the last ~15°. The novice will attempt to linearize over the full 300° with an across-the-board error due to the incorrectly chosen slope. These new facts compound the Thévenin errors described in Part 1.

Use a Spreadsheet to Construct the Lookup Table

As described in Part 1, we can use Thévenin equivalent circuit calculations to identify the potentiometer’s output voltage with consideration of the PLC’s loading effect. To this, we add deadband correction from Figure 2. We recognize the potentiometer’s deadband edges and adjust the mapping accordingly by changing our 0% to 100% frame to a 5% to 95% rotational frame. An example is included in the spreadsheet as shown in Figure 3.

Download here:

Table.xlsx (39.8 KB)

Figure 3: Portion of spreadsheet used to construct the lookup table.

Tech Tip: The spreadsheet is written for the integer math of the Crouzet PLC. The physical 0 to 10 VDC input is mapped to a 1 to 1000 representation. This power-of-ten scaling technique allows us to retain a level of resolution without resorting to floating point numbers.

How is the lookup table used?

The spreadsheet is constructed to predict the measured PLC value for a given potentiometer position. For example, setting the 10 kΩ potentiometer to its 50% position yields physical voltage of 4.12 VDC which is then scaled up to 412 inside the Crouzet PLC.

To use the lookup table, we reverse the process. In this example, the value of 412 is mapped to 500. The result is that the PLC properly maps a 5 to 95% physical rotation to a 1 to 1000 scaled value. Note that this scaling factor is used to eliminate reliance on floating-point numbers. The input and output table columns are on the right of Figure 3.

Figure 4: Representative Crouzet PLC program (function block with textual connections). The input values are scaled from 0 to 1000 and then linearized using the Y = F(X) block shown in the lower left corner.

Tech Tip: Lookup tables such as the Crouzet Y = F(X) Transfer Function block shown in Figure 4 (lower left) do not require all 1000 values. Instead, they perform a linear interpolation using the two closest values in the table. In this example, 100 lines are sufficient for the entire 0 to 1000 scaled range.

Empirical Verification

After the PLC is programmed, we can verify the validity of the lookup table by setting the potentiometer and then verifying the PLC. The system response shows a good match for dial settings between 1 and 9. The original 4.1 midpoint setting now yields 500. Errors at the lowest and highest dial settings are a natural result on the potentiometer’s construction.

Tech Tip: The errors about zero may be undesirable for your application. While not an ideal solution, we could physically move the potentiometer to an off-scale 1 to 9 position. The PLC could then “subtract 1” placing the new zero in what was previously the dial 1 position. This practical solution assumes we do not need to reach dial position 10.

Lookup Table Alternatives

  • Equation: Both the lookup table and equation are effective methods used to linearize a system. The lookup table may have a slight advantage in terms of accuracy. It may also have a slight advantage from the maintenance perspective as people may perceive it as the simpler solution. Either way, the designer must understand the data and document the design.

  • Buffer Amplifier: A buffer amplifier could be added to isolate the potentiometer from the 11.7 kΩ input impedance of the PLC. However, this adds cost and complexity. As described in this article, the lookup table is a natural and convenient method for the PLC.

Parting Thoughts

The linear potentiometer seems like such a simple application for an industrial control system. Now that we are two articles deep, we see that it is very deceptive. Stay tuned as we explore how to accommodate the PLC’s 10 VDC input within a 24 VDC system.

Looking forward to the continued conversation. Please leave your comments and suggestions in the space below.

Be sure to read part 3 describing how to connect and power the potentiometer.

Best wishes,

APDahlen

About this author

Aaron Dahlen, LCDR USCG (Ret.), serves as an application engineer at DigiKey. He has a unique electronics and automation foundation built over a 27-year military career as a technician and engineer which was further enhanced by 12 years of teaching (interwoven). With an MSEE degree from Minnesota State University, Mankato, Dahlen has taught in an ABET-accredited EE program, served as the program coordinator for an EET program, and taught component-level repair to military electronics technicians. Dahlen has returned to his Northern Minnesota home and thoroughly enjoys researching and writing articles such as this.