- Pressure, what it is, and how to measure it
- A/D signal conversion intro
- Overview on sensor design and construction
- Test setup and methodology
- Interfacing pressure sensors to Raspberry Pi using Python
- Timing and output resolution tests
- Filtering and averaging tests
- Temperature / power supply dependency test
- Calibration test
- Summary & Conclusion
Unlike digital electronics and Internet space real world is based on many complex analogue-type universe laws. Everything interacting, changing and constantly evolving, from microscopic atoms to galaxy-sized events in space. Today’s advancement in science and technology brought us powerful computers, mighty measurement tools and many comprehensive methods to learn. This all to help us analyze different aspects of world around us, study and better understand underlying rules. And often vital interface, crucial link between abstract math and theory with the actual matter is some set of sensors. Engineers and scientists have sensors and tools to detect electric charge and flow, air or liquid parameters, temperature, light intensity, objects mass and time, and much more. Field of science, that ensures accuracy of all these measurement sensors is called metrology.
Regular readers may find number of articles and experiments around common electrical values, such as voltage or resistance presented in previous xDevs.com publications. Many of them focus on quantities like voltage, current, temperature and time. However, world of physics does not end here, and to expand a bit further, today will talk about pressure.
Redistribution and use of this article or any images or files referenced in it, in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of article must retain the above copyright notice, this list of conditions, link to this page (https://xdevs.com/article/pressure/) and the following disclaimer.
- Redistributions of files in binary form must reproduce the above copyright notice, this list of conditions, link to this page (https://xdevs.com/article/pressure/), and the following disclaimer in the documentation and/or other materials provided with the distribution, for example Readme file.
All information posted here is hosted just for education purposes and provided AS IS. In no event shall the author, xDevs.com site, or any other 3rd party be liable for any special, direct, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortuous action, arising out of or in connection with the use or performance of information published here.
If you willing to contribute or have interesting documentation to share regarding pressure measurements or metrology and electronics in general, you can do so by following these simple instructions.
Pressure, what it is, and how to measure it
Common definition for pressure is force per unit area that a media volume exerts on its surroundings. As result, pressure P is a function of force F and area A.
P = F/A
The SI unit for pressure is the Pascal, but other common units of pressure also include pounds per square inch (psi), atmosphere (atm), bar, inches of water (inH2O), inches of mercury (inHg), and millimeters of mercury (mmHg) and few others. 1 Pascal is equal to pressure exerted by one newton of force, perpendicularly upon one square meter area.
1 Pa = 1 N/m2
A pressure measurement can be static or dynamic. Static pressure measurement apply for zero motion of the objects (e.g. pressure of still water to the bottle walls), while dynamic pressure measurement shows amount of force produced in moving systems (e.g. water flow in the pipe). Depending on type of pressure measurement methods and sensors can vary, to better fit specific task requirements.
Pressure is exactly the force that makes hot teapot whistle. When water boils into steam, internal teapot’s volume pressure push harder on teapot walls. As there is only one tiny teapot connection with lower pressure space, nose exit, most of excessive steam pressure escapes this way creating the air flow and high-pitch sound we all can hear. When teapot cold, there is no excessive pressure, and no sound. For same reason if teapot left open, no whistle will be possible, as pressure cannot build without cap sealed.
Device to transform pressure level into electrical signal, such as voltage or current change is called pressure sensor, or pressure transducer. Modern pressure sensors have sensing element that changes its property with pressure change. This element can act as variable resistance or capacitance to produce electric current or field change with pressure application. Change of electric property can be then measured, and it will tell us what is the applied pressure to sensor. If main interest is dynamic pressure, such sensor output need to have fixed value offset removed, and provide only small change to detect small pressure changes.
Common and well-known method and circuit to measure these small resistance changes accurately is by using Wheatstone bridge. Invented in Samuel Hunter Christie in 1833, the bridge circuit was later studied by another scientist, Charles Wheatstone. Wheatstone made circuit widely known and public, and this bridge arrangement was called after his name, as result.
Image 1: Wheatstone resistor bridge circuit
The principle of the circuit is that if three resistances R1, R2, R3 are known, and the current in the cross branch C-B is nulled out to zero, and the fourth unknown resistance can be calculated. The measurement can be made very accurately since zero current detection can have very good accuracy.
Bridge null voltage VZ, measured between nodes CB can be calculated as:
VZ = VIN * [ RX / (R3 + RX) – R2 / ( R1 + R2 ) ],
Where VIN is excitation voltage supplied at bridge nodes A and D, and RX is unknown resistance. Here is handy real-time calculator for RX from measured VZ to get better idea, working by this very same formula. Just enter your known resistance values, and browser will calculate unknown resistance.
Resistance calculated: Ω
If special resistors that change their value under pressure are used, such bridge circuit can be used to convert physical pressure force into electrical signal. MEMS piezoelectric pressure sensor implements exactly such resistive elements, that change resistance value from applied mechanical stress. Stress to sensor introduced from pressure differential on a thin silicon membrane. Cavity under membrane can be hermetically sealed (for absolute pressure measurement) or have other pressure as reference (atmosphere for gauge sensors, second pressure port for differential measurement). Most of pressure sensors use four or more piezo-resistive elements, fabricated on the same silicon die.
As result of input pressure difference from the internal cavity pressure, the very thin silicon die membrane will get slight deformation, resulting change the resistance of sensor elements. Larger pressure stress deform element more, also changing output in predictable way. Elements typically connected in a Wheatstone bridge configuration with resistors R1 and R4 showing increased resistance with input pressure increment and resistors R2 and R3 showing resistance decrement. This provide doubled sensitivity of the sensor die to the pressure change, making measurement easier. Differential pressure sensors work same way, but using second port to open cavity to measure pressure difference between the ports. Such sensors commonly used for flow measurement, be it airflow or liquid flow. Differential pressure sensor act as pressure comparator.
Desired pressure range of the sensor is realized by variation in membrane rigidity or physical thickness/area. Sensors for higher pressure would have less stress transferred to bridge resistors, resulting lower output signal sensitivity.
A/D signal conversion intro
All this sounds great and wonderful, but how to actually design a system that converts electrical signal from sensor bridge silicon die into digital data-stream, which can be further processed, stored or displayed in user application?
Conversion of such analog voltage signal to a digital code is required. Core component for this interface between analog physical world and digital information domain is analog to digital convertor or ADC. Opposite conversion of digital code into analog signal also possible, by the DAC or digital to analog converter*, which for purpose of this article is omitted.
ADC converts input analog signal, such as voltage into a digital code determined in relation to second known signal, the reference voltage. As result sole purpose of ADC is to work as a comparator of unknown signal to known reference, with result provided in digital code. Very same idea as operation of weighing balance, to obtain ratio between two quantities, one of which is known.
Also due discrete nature of digital code, all ADCs apply quantization to input signal to obtain finite number of digital codes. Because analog signal has infinite amount of steps, it would need infinite size digital code to represent 100% of the signal. As result limiting input scale to some predetermined levels, and splitting it to small steps is required to represent input signal with close approximation. Common definition for minimum digital code step size for specific ADC is Resolution, and it is represented in bits. Ideal 1-bit ADC will generate “1” when input analog signal larger than 50% of the range, and “0” if less. 8-bit ADC have 28 = 256 steps, thus able to determine 100% / 256 = 0.390625% change of the range. If we make our range limits between 0.0V and 10.0V, then such ADC can resolve input analog signals with 39.0625 mVDC per 1 bit of digital code output.
Increased resolution reduces this minimal step size. In same example of 10.0V range ADC, 16-bit solution will provide 10.0V / 216 = 10.0V / 65536 = 152.588 µV/bit.
Simplest ADC system without any additional amplifiers or attenuators have its input range equal to known reference voltage signal. Many modern ADCs have also integrated amplifiers and front end circuits to allow multiple ranges from single known reference voltage. More details on this are covered in chapter below.
Keywords and terms, commonly used in A/D and D/A conversion applications
Bandwidth – difference between the upper and lower signal or process frequency. It is essentially a whole set of frequencies, which can carry valuable signal information of interest. Bandwidth represented in Hertz (Hz). For example, A/D system with bandwidth 0-10 kHz able to measure any signals between DC and 10 kHz. There are different challenges present in designing very accurate slow DC level converters, or high-bandwidth fast converters.
Accuracy – difference between the actual digital output and expected digital output for a known analog input signal. ADC accuracy shows how many bits from total resolution carry useful and true information about the input signal. Two ADCs with equal resolution can have very different accuracy specifications.
Calibration – measurement of ADC/system error against known accurate input signal, to determine accuracy. Calibration data can be used to perform further processing ADC’s output data to compensate for measurement errors and improve total system accuracy.
Compensation – correction process of ADC errors, based on calibration results and design constrains knowledge. Compensation can be done in digital domain (math correction of raw converted samples) or analog domain (special circuit provide error signal to adjust front-end parameters). Typical examples of compensation are using temperature sensor for thermal gain/offset errors correction, or using sensor current value to account for self-heating effects.
Standard deviation – span size of data samples variation present in the dataset. Typically, variation combines noise of the measurement/conversion system, non-linearity and other offset/gain errors. Smaller standard deviation allows to obtain better uncertainty from the dataset and higher confidence in accuracy.
Noise – voltage or current fluctuations on the signal, which can be picked up from surrounding components/environment (such as switching signal noise, RF/EMI radiation, charge pickup) or generated internally by component physical effects (such as thermal noise, present in every electronic device, even passive resistors). Noise limits the useful sensitivity of the design, essentially limiting possible conversion resolution.
Transfer function – function of relationship between input signal and output digital code. Ideal transfer function have zero INL/DNL error, no offset or gain errors. On graphical representation it looks like straight line from 0V (all bits are zero) to full scale voltage (all bits are ones).
Linearity – deviation of ideal to actual converter transfer function. Can have differential (DNL) type, which shows deviation between near code bits or integral (INL) which shows total maximum overall deviation. This deviation is very difficult to remove, as it would need accurate measurement of input signal and related digital code on all possible ADC points. INL/DNL are often used as key merit of total ADC’s conversion accuracy for any possible input signals.
Reference voltage, VREF – known voltage signal, to which input signal will be compared, or referenced. Can be either DC or AC, depending on application purposes. Using same reference voltage to feed resistance bridge allows true ratiometric measurements, reducing importance of reference voltage stability. For absolute measurements stable reference is a key component of the converter, as reference performance (noise, stability) defines meaningful resolution. Some of these aspecs were covered in better detail here, during design of ultra-stable solid-state voltage reference module.
LSB size – minimal voltage step size for each code, equal to Reference voltage / 2N.
Important note on resolution numbers
Resolution of the ADC often confused and mistaken with accuracy, but actually these two parameters are almost unrelated. Higher resolution does not provide better accuracy, it only provides smaller digital step size. Together with input signal range resolution provide sensitivity of the ADC.
Image 2. Accuracy versus Resolution representation
Case (a) represents low resolution and low accuracy, with samples all over the place. We cannot clearly see what is true signal value. Improvement on both resolution and accuracy will get sample distribution like on case (b). This is high resolution with high accuracy. Now if we still use high resolution, but system accuracy is low, results will be case ©. That’s why calibration often more important than resolution for high-precision equipment, as even if we have high precision, it does not provide good accuracy as well.
There are many cases, when 24-bit ADC provide worse accuracy than better 16-bit device. So resolution provides theoretical sensitivity level, in terms of smallest digital code difference, while accuracy is derived from complex mix of many actual ADC design parameters, such as front end stability, temperature coefficients of amplifiers/voltage references, calibration and compensation correction and noise isolation from other components of the system.
As example, using 0-10 V range 8-bit and 16-bit theoretical ADCs, let’s convert 5.000 V analog signal into digital code, but this time with one extra variable. In case A voltage reference (known voltage against which ADC compare input signal) is precisely 10.0000 V, while in second case B there is 100 mV error in voltage reference, so true reference voltage is 10.1000 V.
|8-bit “A” ADC||8-bit “B” ADC||16-bit “A” ADC||16-bit “B” ADC|
|Input signal, VIN||5.0000 V||5.0000 V||5.0000 V||5.0000 V|
|1 bit step size||0.0391 V||0.0391 V||0.0001525 V||0.0001525 V|
|Reference signal, VREF||10.0000 V||10.1000 V||10.0000 V||10.1000 V|
|Reference error||0||0.1000 V||0||0.1000 V|
|Conversion result||28 * (VIN / VREF)||28 * (VIN / VREF)||216 * (VIN / VREF)||216 * (VIN / VREF)|
|Output digital code||0×80 or 1000 0000’b||0×7E or 0111 1110’b||0×8000||0×7EBB|
|Output error||0||2 bits or 0.1562 V||0||650 bits or 0.09912 V|
Table 1. Reference error impact on 8-bit and 16-bit ADC
As this example shows, error in reference signal cause output digital code error, unrelated how many bits of resolution is available have. There are multiple sources of errors, many of which reside in analog domain, and affected by input signal properties, operation temperature, proximity to other devices on the board, power delivery quality and even mechanical stress to the board.
Important to keep reference voltage only slightly higher than maximum expected input signal level. To illustrate this condition, imagine use of 8-bit ADC from example above with 10.0000 VDC reference voltage, when input signal levels are 0 to 0.1V. This is only 1% of the actual ADC range, as (0.1 VIN / 10.0 VREF) * 100% = 1%. This essentially makes 8-bit with such reference range useless, as output code resolution is just 2.56 bits, providing next transfer function:
|8-bit ADC Input voltage (VREF = 10.000 V)||8-bit ADC Output code||Ideal error|
|0.010 V||0×00||100%, cannot detect signal||
||0.020 V||0×00||100%, cannot detect signal|
|0.030 V||0×00||100%, cannot detect signal|
|0.040 V||0×01 (Threshold level = 0.0391 V)||-2.34%|
|0.050 V||0×01 (Threshold level = 0.0391 V)||-21.88%|
|0.060 V||0×01 (Threshold level = 0.0391 V)||-34.9%|
|0.070 V||0×01 (Threshold level = 0.0391 V)||-44.2%|
|0.080 V||0×02 (Threshold level = 0.0782 V)||-2.34%|
|0.090 V||0×02 (Threshold level = 0.0782 V)||-13.19%|
|0.100 V||0×02 (Threshold level = 0.0782 V)||-21.88%|
Table 2. Low-level signal measurement with 8-bit ADC and high VREF
Obviously, such as system as is not suitable for such low signal measurement and need either higher resolution ADC or signal amplification circuit to bring input close to full-scale of ADC range (which is 10.000 V, due to used voltage reference VREF).
However, smarter solution is often possible. The output resolution and accuracy can be increased by reducing the reference voltage to match input signal voltage closer. ADC may allow external voltage reference use, and allow low voltage reference levels. Reducing the reference voltage is functionally equivalent to amplifying the input signal, without amplifier or additional components on hardware level requirement. Thus reducing the reference voltage often used to increase the resolution at the inputs, keeping in mind LSB voltage larger than errors from design and own ADC implementation.
With such approach, care need to be exercised, as voltage reference cannot be decreased too much, as other effects such as thermal noise of the inputs, gain and offset errors, non-linearity and thermoelectric voltages becoming an issue, and these contributors are independent of reference voltage.
Now same example with reduced VREF to 0.1500 V with allow to use most of this reduced input range and obtain much better sensitivity over test 0.000V – 0.100 V signal. Interactive sensitivity calculator presented in the form and table below, with VREF as known reference voltage.
|VREF, reference voltage||V|
|ADC resolution, 2N||N = bits|
|LSB size, calculated|
Same test values in table below, but this time with low reference voltage.
|8-bit ADC Input voltage (VREF = 0.150 V)||8-bit ADC Output code||Ideal error|
|0.010 V||0×11 (0.00996 V)||-0.3906%|
|0.020 V||0×22 (0.01992 V)|
|0.030 V||0×33 (0.02988 V)|
|0.040 V||0×44 (0.03984 V)|
|0.050 V||0×55 (0.04980 V)|
|0.060 V||0×66 (0.05977 V)|
|0.070 V||0×77 (0.06972 V)|
|0.080 V||0×88 (0.07969 V)|
|0.090 V||0×99 (0.08965 V)|
|0.100 V||0xAA (0.09961 V)|
Table 3. Low-level signal measurement with 8-bit ADC and reduced VREF
How with 0.15V input reference voltage, design can use even 8-bit ADC with better than 1% accuracy in ideal case. So choosing correct reference level and range is very important for optimal performance of the analog to digital conversion system.
If reference level cannot be reduced to match input signal range, it is necessary to amplify low level signals so similar increase of the voltage resolution can be achieved. Alternative is to use more expensive higher resolution ADC. In same example system with VREF = 10.000 V as above, at least 16-bit ADC would be required to achieve same theoretical accuracy.
|16-bit ADC Input voltage (VREF = 10.000 V)||16-bit ADC Output code||Ideal error|
|0.010 V||0×0041 (0.00992 V)||-0.8179%|
|0.020 V||0×0083 (0.01999 V)||-0.0549%|
|0.030 V||0×00C4 (0.02991 V)||-0.3092%|
|0.040 V||0×0106 (0.03998 V)||-0.05%|
|0.050 V||0×0147 (0.04990 V)||-0.21%|
|0.060 V||0×0189 (0.05997 V)||-0.05%|
|0.070 V||0×01CA (0.06989 V)||-0.16%|
|0.080 V||0×020C (0.07996 V)||-0.05%|
|0.090 V||0×024D (0.08987 V)||-0.14%|
|0.100 V||0×028F (0.09995 V)||-0.05%|
Table 4. Low-level signal measurement with more expensive 16-bit ADC and high VREF
These resolution-depending errors are quantization limits of ideal linear ADC. Any gain, nonlinearity and offset errors are to be added in case of real hardware. This is exact reason why all common multimeters have multiple ranges, instead of one combined 0V – 1000V range. Multimeters with autorange still have same design, but perform automatic selection of best range depending on input signal.
These application challenges are well recognized by leading ADC manufacturers, such as Linear, Analog Devices, Texas Instruments, Maxim, and these manufacturers spend lot of R&D resources to reduce impact of all these error contributors on overall output accuracy, trying to use better packaging, isolation, and better stability parts in the design. As result, knowledge and design features also improved performance, so added digital resolution is useful in many applications. Resolution is relatively cheap to add, but it’s important to understand that it’s not the resolution alone makes better accuracy ADC.
Most of modern ADCs today have low voltage power supply requirements, matching typical +3.3V or +5V digital systems supply rails. As result reference voltage also have typical levels at 2.500, 2.048, 3.000, 4.096 VDC. To measure signal levels higher than these values, attenuation and front end scaling is required. Lower voltage levels helpful for compact battery-powered devices and allow simple interfacing with typical CMOS microcontroller or digital bus. Many ΔΣ-ADC and feature-rich SAR ADC have integrated on-chip voltage reference sources, front-end amplifiers, switching, even temperature sensors as well, essentially making nearly complete measurement system on compact single chip package. One of such devices, Texas Instruments ADS1262 32-bit ADC was reviewed and tested here while ago.
There are different types of ADC designs depends on target application requirements and operation principle. Table below presents some most common types, their basic performance parameters and their strong/weak sides.
|ADC Type||Flash||Delta-Sigma ΔΣ||Integrating (slope)||Successive approximation (SAR)|
|Operation principle||Parallel comparator array||Oversampling with digital filtering||Integration vs known reference charges||Binary search comparison|
|Speed||Very fast (up to few GHz)||Slow (Hz) to Fast (few MHz)||Very slow (mHz) to Medium (kHz)||Medium (kHz) – Fast (few MHz)|
|Resolution||Low, <14bit||Medium to very high, 12-32 bit||Can be very high, 32 bits||8 – 20 bit|
|Implementation cost||High||Low||Medium to very high for precision||Low|
Table 5. Types of ADC designs and performance limitations
Correct ADC type choice is key importance for best results in specific applications. Commonly pressure sensor in practical application operates with low bandwidth due to relatively large volumes of measured flow/mass, typical choice are ADC types like SAR, Delta-Sigma and less often Integrating type. Other designs, for example high-speed oscilloscope need to use flash or pipeline ADCs with high bandwidth.
ADC of same type also may have very different packages, and different levels of integration. Larger packages often can have integrated reference blocks, temperature sensors, input channel multiplexers, programmable current sources for sensor excitation. Often ADC block is also integrated part of bigger SOC system to further save space, however accuracy and resolution of such converters often inferior to discrete ADC designs. Resolution of ADC inside SOCs is usually 12-16 bit with just few exceptions on specialized instrumentation solutions.
Easy to see from the Image 3, how complex high-resolution high-accuracy discrete ADC can be. High accuracy and stability require use of custom-made matched components in hermetic ceramic packages, expensive operational amplifiers, take lot of space and have number of control signals and power requirements to function. Today use of such precise integrating ADC in electronics are limited to narrow niche applications, where cost and design footprint are less important that performance. One of such examples are 6½-digit+ multimeter, paired with discrete high-stability references or instrumentation applications. SAR and high-resolution ΣΔ ADC solutions got closer in performance to state of the art multi-slope integrating ADC, replacing them in many designs due to much smaller package options, ease of use and affordable cost.
Now we know how to convert voltage from sensor into digital code, and as result know how to convert analog pressure into digital code. Practical demonstration of using such design covered in next section using integrated sensor hybrid, which have both analog sensor and ADC components inside same compact package.