General Recommendations For Zeroing And Calibrating Sensors?


Recommended Posts

On this topic, I already have some general ideas, but thought it wise to ask for recommendations here.

 

Situation #1) involves six linear potentiometers used to measure distance.  Of course, the Pot will act like a voltage divider, so I don't need to worry much about the calibration of the resistance.  But, I will need to zero it out.  In other words, I will position the linear pot on the object, and perhaps obtain an analog voltage reading of 1 volt.  Then, I need to set each of these channels to read "zero" distance when I press a "Zero" button that I create on the display.  This would happen before I begin recording data. So, I will just create a global variable, and a separate conversion equation for each of these potentiometer channels. The "Zero" button will write the voltage into those variables and each of the conversions will be written to use the appropriate variable.  But, I am guessing there may be a way to write a single conversion, and have it refer to the channel # and so automatically refer to the correct variable if I name the variables consistently.  E.g. Zero_Voltage_Channel1, Zero_Voltage_Channel2, etc.

 

Situation #1) involves thermistors.  These have a variable resistance, and to use them I will apply a voltage, and then use a precision resistor to form a voltage divider.  Of course, there is a tolerance to both my thermistor and precision resistor.  So, ideally I would need to calibrate each individual temperature channel.

 

Situation #3) Sensors outputting 4-20ma, and I will be using a shunt resistors to convert them to be a voltage.  Again, this will be a precision resistor, but I may want to calibrate these channels as well.

 

For the calibration issues #2 & 3, I am sure I don't want to hard-code the calibration figures.  Is there perhaps a common approach to doing this?  I suppose I could just create an additional page with the calibration numbers, and manually type them in there.

 

Any general advice?

 

-Joe

Link to comment
Share on other sites

Unfortunately you'll have to create a conversion for each channel since the constants will be different.  The only way around this would be to read everything in script.  You'll need two variables for each, assuming they are all linear, the slope and intercept.  You can either make a screen to enter in the numbers, or have buttons that take the current reading and use that for whatever number the button is associated with. Just remember to back out the conversion first.

 

As for situation #1 + #2, they are also dependent on the supply voltage, so you'll probably want to measure the supply voltage on a separate channel and use that in your conversion.

Link to comment
Share on other sites

I'm facing a similar problem and thought about creating a function such as GetCalibFactor() that would look up a persistent variable value based on the channel. Then the conversion would look something like: (value + GetCalibFactor()) / 4095 * 100. I'm not clear on how to reference the current channel to use in  the GetCalibFactor() function. So maybe this would not work. The GetCalibFactor() function would have a companion SetCalibrateFactor() function the operator would use to set the calibration. I'm not sure what by the Channel variable for a channel refers to. What do you get when you do MyChannel.Channel? For referencing maybe you would need both DeviceNumber and Channel.

Link to comment
Share on other sites

You can't reference the channel name from within a conversion.  Everything in the conversion is global scope, except the keyword "Value" which inserts the value coming from the input.  It'd be an interesting idea to enhance conversions to allow for this sort of thing, so please add a request to the feature request forum.

 

As to Joe's question:

 

If you are calibrating, you always want to calibrate against the raw reading of the device.  If you have a Conversion applied, than you won't see the raw reading, and adjusting your variables in your conversion will just be wrong.  So you have to back out the conversion by dividing by the slope and offsetting the opposite of the intercept.  Basically invert your conversion.

Link to comment
Share on other sites

So you have to back out the conversion by dividing by the slope and offsetting the opposite of the intercept.  Basically invert your conversion.

 

Yeah, I discovered the issue with not working with the raw data, but eventually found a solution for the "zeroing out" issue. I simply subtracted the "zero point".  But, I think your slope and intercept approach was focused on calibrating, rather than zeroing-out.  Is that correct?

 

-Joe

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.