Experiment 3 - Resistive Sensors I

For this experiment, it is not necessary to use your own laptop (other than to take notes).

1. Context of the Experiment

After understanding the mechanical measurement importance and motor power measurement, we can start with sensors. One usual type of sensors is resistive sensor. This type of sensors can be used to measure physical quantities like temperature, displacement, and acceleration. It is used because the resistance of a transducer can be changed due to the effects of the environment.  Then by measuring the resistance change, the physical quantities e.g. displacement or temperature can be calculated. The method of difference in resistance is extensively used within industrial applications.

2. Learning Goals of this Experiment

  • Knowing: changing resistance, different potentiometers, temperature dependent resistors

  • Abilities: Measuring voltage, changing voltage output, measuring current, calculating resistances and calculating scales

  • Understand: The impact of resistance on the potentiometer output, temperature dependent resistors

3. Literature

Articles and Books

[1]. Hering, Ekbert, and Gert Schönfelder. Sensoren in Wissenschaft und Technik. Wiesbaden: Vieweg+ Teubner Verlag, 2012.

[2]. Lin, Youn-Long, et al., eds. Smart sensors and systems. Cham, Switzerland: Springer International Publishing, 2015.

[3]. Thorsten A. Kern, Hatzfeld, Christian, and Alireza Abbasimoshaei. Engineering haptic devices. Springer London Limited, 2022.

[4]. Measurement Technology lecture slides

4. Basics/Fundamentals

What is a Potentiometer and how does it work?

A potentiometer is defined as a 3-terminal variable resistor that controls the flow of electric current by a variable resistance. A simple Potentiometer has three connectors. The nominal Resistance is between the outer connections. Between the wiper connection and one of the other pins a variable resistance can be set. All three connections form a voltage divider.

Figure 1: Symbols for Potentiometers. Left: IEN60617 standard used in Europe, Right: ANSI standard used in USA.

The wiper position can be moved mechanically usually by rotating or by linear sliding. It changes the resistance between the wiper contact and the other contacts by varying the position of a sliding contact across a uniform resistance (see Figure 2). By doing so, it can sense the physical variable that should be measured.

Figure 2: Mechanism of two types of potentiometers. Left: Linear Potentiometer Right: Rotary Potentiometer.

There are also different types in therms of the connection between resistance and wiper position. The relationship can be linear or logarithmic. The logarithmic scale can be useful for example in volume control of audio amplifiers, the linear scale can be useful in position sensing. Examples of Potentiometers are shown in Figure 3.

Figure 3: Left: rotatory potentiometer [5], Right: linear potentiometer [6].

If the potentiometer is conneced to a Voltage supply as shown in Figure 4, the voltage can be measured.

Figure 4: Circuit of a potentiometer connected to a voltage source.

With this measured voltage the resistance can be calculated with the formula: . Because the resistance   depends on the wiper position, it is possible to calculate the location of the wiper. To calculate the position a function is needed that brings the position of the wiper and the resistance or into relation. For a linear potentiometer we assume that the equation that describes this relation is as follows: . I introduced as the slope of the line and as the offset since the zero position of the potentiometer is not always zero. You can try that by yourself if you set the multimeter to Resistior measurement and play around with the linear potentiometer.

Figure 5: Data points and a linear curve that is fittet into the points.

To get this equation a linear regression with minimizing least squares error can be done. To do so we have to measure different points of the potentiometer as shown in figure 5. We will store the resistor values in the vector , the corresponding distances in the vector and the errors for each point (distance from the point to the function line) in the vector . Additionally the parameters and are stored in the vector .

.

Now we can see that the linear equation system for all points has the form: :

or

.

Now the least squares technique can be performed by trying to minimize the sum of the squared errors: . Usually there are more data points than parameters , that means the system is overdetermined. There are a few possible ways to solve this problem. Multipling from left to both sides to yields: . Now is a square matrix and has a full rank and is non-singular., which means, we can build a inverse and multiply the inverse from the left: . This equation is called the normal equation. Inverse problems can cause problems when computed numerically. Due to that other methods like QR decomposition are usually the choice.

Matlab and Numpy have functions already that can do a least square or linear fit. For solving the Vip questions make sure that they are based on the least squares optimization:

Matlab:

p = polyfit(x,y,n) %with n = 1 for only x^1

Python:

numpy.polyfit(x, y, deg) %with deg = 1 for only x^1

 

Temperature measurement with a NTC Thermistor

Temperature measurements can be done with so called NTC (Negative Temperature Coefficient Thermistor) on the other side there are PTCs (Positive Temperature Coefficient). NTCs have lower resistance at higher temperatures. A lot of applications use NTCs and PTCs for temperature measurements. For example temperature sensors, or temperature compensation of electrical circuits.

Figure 6: Symbol for thermistors. IEN60617 standard used in Europe.

The relation between temperature and resistance of NTCs depend on fabrication parameters, which are usually given in the datasheet of the sensor. The approximate equation is:

material constant that can be found in the datasheet

material constant that can be found in the datasheet

Resistance at Temperature

Temperature

nominal Temperature (often 25°C or 298.15K)

nominal Resistance at nominal Temperature

5. Preparations of the measurement

Experiment 3.1 and 3.3 have to be done on the testbench connected to a computer in the WorkingLAB. Please start with experiment 3.2 and write down your values. Then perform the experiment 3.1 and 3.3 on a testbench.

Start with Experiment 3.2 and note your results.

Experiment 3.1: Linear potentiometer with reference sensor

Materials:

Step 1:

Place the potentiometer in the testbench as shown in Figure 7. Then make sure that you can move the potentiometers slider with the rotary knob at the testbench.

Figure 7: This shows how the potentiometer should be placed inside the testbench. The two wires (yellow and black) should be on the left side.

Step 2:

Now you can start the communication with the micocontroller inside the testbench. To do so press the orange button as shown in figure 8. This can take a while, just wait.

Figure 8: Press that button after you connected the USB. This can take a while, just wait.

Next verify your testbench number printed on the testbench and displayed in the app, see figure 9. That is important for calibration of the reference sensor and good for us to know if something is wrong. For that the button next to the connect button is now enabled to enable the GUI press that button.

Figure 9: After connecting successfully the testbench number is shown. If that is correct press the orange button.

Step 3:

Connect the potentiometer to the power supply. The circuit is shown in figure 10. The potentiometer contacts are shown in figure 11. (red: +, yellow: wiper: black: GND)

A 1k Ohm resistor is soldered at the one side of the potentiometer to prevent students to burn the potentiometer by creating a short circuit. Please connect the voltmeter like this. (yellow - black)

Figure 10: Connect the multimeter like this to measure the voltage at the wiper to ground.

 

Figure 11: Contacts of the potentiometer.

Step 4:

Measure the voltage at five different points of the potentiometer and enter them to the app. The reference sensor will be automatically measured if you press the button shown in figure 12. Connect the multimeter in voltage measure mode to the circuit.

It is best to start with 0mm and end with 15mm. It does not really matter what distance values you choose also the potentiometer is longer than the 15mm. Do not choose the same distance multiple times and put them a few millimeters away from each other. Try to make it evenly distributed (e.g. 0mm, 3.3mm, 6mm, 9.5mm, 12mm, 15mm). Use the slider in the app to toggle the position. You will see the values in the table updating every time you press the button. Additionally you will see two plots of linear fits next to the table. You will get the data points in the table sent by e-mail. Now fill the whole table. If you made a mistake just go back to the position and toggle the slider and do it again with new values. The values will be replaced depending on the slider position.

In short: Measure voltage at position 1 (eg. 0mm), fill textfields, press button and position one is filled with your data and the reference sensor value, move the slider to positon 2, move the testbench to position 2 (e.g. 3mm) repeat the process four more times until table is full and you see nice plots.

Figure 12: How to control experiment 3.1.

Experiment 3.2: Rotary potentiometer

Materials:

Step 1:

Take the rotary potentiometer with the resistor soldered to it. This resistor is a shunt resistor to prevent the potentiometer from burning if a short circuit is produced. Connect the multimeter to the black wire as shown in the circuit figure 13. The +5V from the power supply should be connected to the resistor. Now measure the current, check the correct input pins of the multimeter and also check the range you expect really low currents to see them make the right settings in the multimeter bevore turning on power.

Figure 13: How to control experiment 3.1.

Step 2:

Rotate the Potentiometer to zero scale. you can hear it by the click. After the click it is necessary to turn the potentiometer slighty back until you hear a second click. Now the potentiometer has a low resistance between the wiper and the input pin. Since figure 13 shows a serial circuit the resistance should be around and therefore the current should be approximately . Now move the potentiometer to approximately half scale, you can ask for some tape and glue it to the knob to see the angle. Then measure the current. Write down the value, you will be asked to enter it to the MT App. In a second step turn the potentiometer to full scale and measure the current. Write down this value as well, you will also be asked to write it to the MT App, see figure 14.

Figure 14: Where to enter the values. You can do this experiment without the app. Write down the values and enter them later if you do experiment 3.1 and 3.2

Experiment 3.3: Temperature dependend resistors NTC

Materials:

Step 1:

Make sure that you are still connected. Check out the arduino case (The one on the testbench. It is in a 3d printed box. Not the one in the red box). There is a label: NTC. The NTC is internally connected to a resistor and a voltage source of as shown in figure 15. The system measures the voltage between the clamps 1 and 2 if you press the button in the GUI as shown in figure 16. First measure room temperature, then measure the again while you hold the sensor between your two fingertips. You should see a change in the voltage. You can try the button multiple times until you see a few millivolt change.

Figure 15: This circuit shows what voltage is measured and how the thermisor is connected to the circuit. If you press the buttons for this experiment

Figure 16: Just press the buttons to measure the voltage .

7. Evaluation of Experiment Results

You end the experiment by pressing the button shown in figure 17. You will get an E-Mail with all the data you measured in this experiment. The stucture and a few examples of how to work with matlab tables is shown in chapter 7.

For solving the vips task you probably need the datasheets of the potentiometer and the NTC:

F2031-NN0SC2B10K

ntcle350e4


Additionally the *mat file we will send you will contain a struct called “all_evaluation_data_3” if you import the file and open the struct that appears in the workspace you will see something like it is shown in figure 17.

Figure 17: Example struct with the data you entered to the matlab app.


The header of the table of results_1_1 is as follows: “measurement”, “approximate_position”, “position_teststand”, “voltage_potentiometer”, “resistance_reference_sensor” with the same units as you entered them in the MT App.

Header name

Unit

Header name

Unit

measurement

number

approximate_position

percent

position_teststand

Millimeter

voltage_potentiometer

Volt

resistance_reference_sensor

Ohm

To give you some ideas when working with Matlab to solve the vips task here is some example code to read the mat file and get the values out of the stuct and table:

 

% Clear all existing variables in the workspace clear all % Load data from your *.mat file load("123_3.mat") % Access the table of question one from the loaded data table_question_1 = all_evaluation_data_3.results_3_1; % Access the 'position_teststand' variable from the table % Note: This will give you the positions from your measurements in a 5x1 array positions = table_question_1.position_teststand; % Display the measured positions disp("Your measured positions in mm are:") disp(positions) % If you want to retrieve all values from the table, you can use .Variables % Note: This will give you a 5x5 matrix of all values inside the table all_values = table_question_1.Variables; % Displaying a table of measured currents disp("Your answers of experiment 3.2 are:") table_question_2 = all_evaluation_data_3.results_3_2; % Display the table of measured currents disp(table_question_2) % Accessing a specific value in the table (second answer of task 2) specific_current_value = table_question_2.answer(2); disp("Specific current value (task 2, second answer):") disp(specific_current_value) % Displaying a table of measured voltages disp("Your answers of experiment 3.3 are:") table_question_3 = all_evaluation_data_3.results_3_3; % Display the table of measured voltages disp(table_question_3)

 

If you want to work with python you can aslo load the matlab file. But unfortunately tables cannot be loaded, arrays work well. It is better practice to save the tables as *.csv files with matlab and then load it to a pandas dataframe with python. Then just perform the mathematical operations. You can use numpy and pandas to do for example element wise operations on your data point vector and then you can perform the linear fit to get the results of vips question one to four. Its all very similar to matlab.

8. Vips questions:

The following values should be entered to vips in Stud.ip. Please note that only 30 minutes are available for entering values in vips, after which the vips entry is automatically terminated. The test is only to hand in the final values, so be prepared and have all values ready and at hand!

Matriculation number is needed. For all calculations assume that the voltage source was constant at the value you set it.

  1. Consider the equation for the the resistance of reference sensor. Based on your measurement results calculate in Ohm/mm. Use a least squares optimization and use the five data points from your *.mat file.

  2. Consider the equation for the resistance of reference sensor. Based on your measurement results calculate in Ohm. Use a least squares optimization and use the five data points from your *.mat file.

  3. The testbench can only move approximately . What would be the resistance of the reference sensor if the testbench is build a little bigger and you would move the wiper to . Use the results from tasks one and two. It is okay if the resistance is out of the bounds of the reference potentiometer, this should just be a theoretical value which you are not able to measure at all.

  4. Consider the equation for the resistance of the slider potentiometer as shown in figure 21. Based on your measurement results calculate in Ohm/mm. Use a least squares optimization and use the five data points from your *.mat file. You can assume that the shunt resistor is exactly . Additionally, check the datasheet of the potentiometer you can also assume that the total resistance in the datasheet is exactly the value that is stated.

Figure 21: This circuit shows what side of the potentiometer should be calculated for in the tasks 4 and 5.

  1. Consider the equation for the resistance of the slider potentiomter as shown in figure 21. Based on your measurement results calculate in Ohm. Use a least squares optimization and use the five data points from your *.mat file. You can assume that the shunt resistor is exactly . Additionally, check the datasheet of the potentiometer you can also assume that the total resistance in the datasheet is exactly the value that is stated.

  2. Sometimes it can happen that is negative, why?

  3. You measured two values with the rotary potentiometer: half scale and full scale, additionally you can assume that the potentiometer has a really low resistance in zero scale. Based on that values what qualitative curve matches the potentiometers resistance depending on the rotary angle? You can assume that the shunt resistor is exactly .

  1. Based on your voltage measured at the NTC, What is the resistance of the NTC at room temperature in Ohm? You can assume that the series resistor is exactly .

  2. Based on your voltage measured at the NTC, what is the temperature value in degree celsius? The resistor name is NTCLE350E4103FHB0. It has a resistance at . Check the datasheet of the NTC and find the B-Value.

  3. Calculate the temperature in celsius for the case, when you touched the NTC with your fingers. The resistor name is NTCLE350E4103FHB0. It has an resistance at . Check the datasheet of the NTC and find the B-Value. You can assume that the series resistor is exactly . Don’t worry, when i did this for the solutions equations my body temperature says I would be dead. But that depends on how long you touched the sensor and other factors. We will check our results based on the voltage, not on real human body temperature.

Institut für Mechatronik im Maschinenbau (iMEK), Eißendorfer Straße 38, 21073 Hamburg