In a vehicle, not all data can be cast into a simple 1/0 value. Temperature for example can have infinite values within a range and the scope of analog channels is to display this kind of data in a convenient way. Variable resistance sensors are used to monitor physical quantities like temperature, pressure, position, light, and much more.
Turning into practical, sensors we can hook up to Y-Dash analog channels are:
- thermistors (temperature sensors)
- oil pressure sensors
- air pressure sensors
- linear and rotational position sensors
All resistive sensors have 2 wires, one to be connected to the analog channel, one to ground. They vary their resistance when the measured quantity changes. Each channel can be configured to work with different sensors by uploading a configuration file to the unit that specifies the sensor behaviour across the measuring range.
Understanding the Breakpoint
The resistance variation and the measured quantity of a resistive sensor are usually not tied by a formula. This means the output value cannot be computed directly, because it follows a curve specific to each sensor. A convenient way to get useful data from such a sensor, is to approximate its curve with a series of breakpoints. A breakpoint contains a known output value at a given resistance of the sensor. Values between breakpoints are computed using linear interpolation. As an example, we will examine a temperature sensor’s datasheet:
The table is made by the manufacturer, and shows the resistance vs temperature correspondence every 5 Celsius degrees. Each row contains the values required to create a breakpoint for our configuration file, ohm and temperature (the first two columns) but Y-Dash can store up to 16 breakpoints per channel, so we must strip down the total count. The goal, is to have more breakpoints in the range in which the sensor will be used at most.
For this example we want to use this sensor to measure ambient air temperature, so we’ll get rid of the impossible to reach values to reduce the number of breakpoints. Output value will be constrained by the extreme breakpoints, so we’ll start to add 16 points to our selection starting from the -15 Celsius row. The measuring range will be -15 C° / + 60 C°.
Creating the configuration file
The creation of the configuration file at this point, is just a matter of filling these data within the app tool. To start a new file, in settings go to “input channels” → “analog channels” and choose the + in the top bar. If you want to edit or start from an existing file, long press a file row within the chooser. By pressing the “cloud” icon, some ready made sensors are downloaded from the server and stored in memory. Let’s start a new file, choose a name and long press on it. The top menu will expand, showing the edit icon.
The breakpoints list is empty, and the information fields contains default data. Filling in the values from the table, and some extra info, the result should look like this:
Information fields are used as personal reference, and should contain data like form factor, material etc…
Once you are happy with your file, connect the unit and start the upload by tapping it within the files chooser. A dialog will ask you the destination channel before the upload starts. Upload takes few seconds, the file will be saved in Y-Dash internal memory and cannot be retrieved later.
Custom sensor calibration
A datasheet for a sensor is not always available. If we are going to use automotive sensors they are often already installed or recycled from other vehicles, and don’t have a documentation. Manual calibration consists in creating a table of breakpoints, by measuring the sensor resistance in different points of the working area. A multimeter and basic knowlodge of it is required for this operation.
Example 1 – fuel level sensor
Almost all mechanical fuel level sensors belong to the same scheme, a float connected to a potentiometer trough a metal rod. As the fuel level changes the resistance also changes, giving the unit information about its position. There is more than one option to create the calibration file in this case.
The first one consists in creating 2 breakpoints, one for the minimum and one for the maximum level. The sensor resistance is measured when the tank is empty, and when it’s full. Alternatively the sensor unit can be taken out of the tank, and the float moved by hand to min and max positions, while it is measured. The breakpoints will have 0 and 100 as output values, and the unit is percent. The gauge will indicate 100% when full, and 0% when empty. When the gauge is created in Y-Dash Builder, its min and max values will have to be set to 0 and 100.
The second method relies on a higher precision solution. The first breakpoint is created measuring the sensor when the tank is empty, setting the output value to 0. Some liters of fuel are then added, and the measurement is repeated. After each add a new breakpoint is created using the resistance value and the number of liters added as output value. This procedure is repeated until the tank is full. A step of 10 liters is usually fine, just keep in mind that breakpoints can’t be more than 16, so if you choose a step of 5 liters, you may reach the 16 breakpoints count before the tank is full if you have a large tank. On a motorcycle, the step can be much smaller, 1 or 1,5 liters. When creating the gauge in Y-Dash Builder, use as top scale value, the value of the highest breakpoint in the list. This method allow to linearize the output value in odd-shaped tanks, giving real information on the fuel volume left. The example can be applied to other volume units, like gallons, just change the output values accordingly.
Example 2 – coolant temperature sensor
In this example we will calibrate a OEM coolant temperature sensor mounted on a Nissan engine. In this case we can’t test it over the whole range when it’s installed on the vehicle, because this would mean heating the engine up to 120 Celsius degrees, and this could damage our engine, so the sensor must be removed and bench tested. The goal is to heat the sensor at a known temperatures, measure the resistance and create the breakpoints based on these readings. In this case a thermometer is required, over a multimeter. Many multimeters have temperature reading capability, if you own one you can both measure resistance and temperature with the same device.
The test bench consists in plunging the sensor in cooking oil within a pan, slowly heat the oil and measure the temperature and resistance, from ambient temperature up to say 120 C°. A 5 C° increment will be fine to create a table, a selection of the values that will be used for the breakpoints creation will be done at a later stage. The reason water is not used, is that it boils at 100 C°, while oil boils at higher temperature. Water in the engine, can reach higher temperatures without boiling due to the pressurization of the cooling system. At each heating step, turn off the heating source and allow the sensor to fully reach the oil temperature before measuring the resistance. If you use Fahrenheit degrees, just create your table with F° values, and fill breakpoints fields accordingly.
We put the measured data in a spreadsheet, and highlighted the values that we’ll use to create the breakpoints, as all won’t fit in memory. The selection criteria aims to keep high precision in the engine working temperature range, so we’ll create 15 breakpoints exploiting all the data in the 50C° – 120C° range. This leaves us with 1 unused breakpoint, that will be placed at ambient temperature (20C°). This method has the benefit of having a wide range of temperature swing (20C° – 120C°) and a good precision in the engine temperature working range. The 20C° – 50C° range is more approximated, because values are interpolated.
Analyzing the data
We wanted to compare the measurements with the brekpoints list in a chart. We used Open Office to plot a chart based on these data:
The blue curve contains the whole measurement data set, the red curve is created with breakpoints data. It’s easy to see the loss of precision of the red curve in the 20C° – 50C° range, where the lines don’t overlap. The maximum error is at about 35C°, where the temperature indicated will be about 38C°. The spreadsheet file is available for the download at the bottom of the page.