The BEEB BODY BUILDING COURSE No. 37 Mike Cook comes UNDER PRESSURE This month I want to look at a neglected area of computer interfacing that of sensing pressure. No not the "get it by yesterday" type of pressure but the type studied by Boyle and others. I want to explore the techniques of measuring pressure in a gas or liquid and some of the applications to which we can put this. Rather than presenting a cut and dried project I want to show how you can begin experimenting with pressure sensing. The measurement of pressure is very useful. For example you could monitor atmospheric pressure for a weather station. You can investigate the pressure in and around an internal combustion engine or even measure vibrations. With suitable hardware you can even weigh objects quite accurately, and there are applications in monitoring and control. The only snag with all this is that pressure transducers tend to be a little on the pricey side. Nevertheless let's have a brief look at what's available and how they work. While there are a few different types of pressure transducers, the family we are going to look at here are the type based on the monolithic piezoresistive crystal. A piezoresistive crystal is one which changes its resistance in response to mechanical stress. In a pressure transducer the piezoresistive crystal is formed into a bridge circuit. The Wheatstone bridge was invented by Charles Bridge for the measurement of relative resistances. Look at figure I (a), this shows a simple potential divider. The voltage at point "V" depends upon the supply voltage and the ratio of the two resistors. This voltage will increase and decrease with resistor B increasing and decreasing, whereas if resistor A changes the change in voltage will be reversed. That is as A increases the voltage decreases. Now suppose we have a physical phenomena that alters resistance; if we make two such potential dividers and make the top resistor variable in one and the bottom resistor the variable in the other, we have doubled the size of the effect. By measuring the difference in the mid-point voltages we can get a more accurate measurement than would otherwise be possible. This is shown in figure I (b). However, just to confuse us, the resistors are normally drawn in a diamond configuration as shown in figure I (c). By altering the resistors that are not effected by the physical phenomena we can get both voltages to be the same or as we say balance the bridge. This can be done with great accuracy because you only need to detect whether there is a voltage, not measure how large it is. Then, with some simple calculations, the values of the unknown resistors can be worked out (from the values needed to balance the bridge). Pressure transducers however make all resistors in the bridge active. One set of resistors respond to pressure in one way and the second set respond in the opposite sense. It is quite easy to understand how this happens if you look at figure II. This shows a crystal being deformed under pressure. The top surface is stretched and offers a longer path to the current; so the more pressure the crystal is under, the greater is the surface resistance. Similarly, the bottom surface is compressed, presenting a lower resistance with increasing pressure. This is just the phenomena that we need to construct a bridge. The pressure transducer is made by etching a diaphragm into a crystal and connecting it up like a bridge. As pressure can be applied to both sides of the diaphragm we can construct basically three different types of pressure transducer. These are illustrated in figure III by reference to National Semiconductors LX06XXX series of pressure transducers. The three X's on the end of the number indicate that any number may be used and still be in the same family. The first type measures pressure differences by applying pressure to both sides of the diaphragm. One side increases the bridge output and the other side decreases it. Hence they are labled positive and negative ports. The second type measures absolute pressure by sealing one side of the diaphragm in a vacuum. Finaly the third type has one side of the diaphragm open to atmospheric pressure so that any pressure measured is relative to atmospheric pressure. This is known as a Gage pressure transducer. These three types of transducer are available in a number of different physical configurations and working over different pressure ranges. Some types can withstand liquids as well as gases. The transducers are calibrated to give anywhere between 1.4 to 20 mV each pound per square inch. So in all cases the transducers output will need amplifying before it can measured. Unfortunately there is a further fly in the ointment. As well as being sensitive to pressure all transducers are sensitive to temperature. What happens is that as the temperature increases the sensitivity decreases almost as if the diaphragm were getting stiffer. Of course it's not really but that is the effect. So we have to compensate for this by making the bridge supply voltage change with temperature to keep the output independent of temperature. The solution used in the LX06XXX series of transducers is to mount two thermistors in the bridge. This is shown in figure IV along with the physical pin out of the device. The idea is that the resistance of the thermistor decreases with increasing temperature. Then as the voltage across the device is constant the voltage across the bridge will increase with an increase of temperature. Therefore the sensor is compensated for decreased sensitivity and the overall sensor output is independent of temperature. The trick is to get the thermistors to accurately track the transducers change. To do this they are made using "thick film" technology. This not punk movie making but involves screen printing resistors onto a ceramic substrate using conductive inks. Then areas of the printed regions are etched away using a laser until exactly the right value is found. This individual laser trimming of each component adds greatly to the accurcy and to the cost. As the thick film substrate is the same one as used to mount the pressure transducer, good thermal tracking is assured. Armed with a temperature compensated transducer we can see what is needed to make a pressure gauge. Figure V shows a typical circuit which can be used to connect a transducer to the analogue input port on the BBC computer. Using an LM324 you can get about 2% accuracy over a tempsrature range of 5 to 40 oC. The circuit consists of three operational amplifiers connected as a differential amplifier. Basically it is the same as the one I used for the Heart Rate Monitor in the April 84 Body Building article. Each arm of the bridge is first buffered and amplified before being combined so that the difference is taken. The overall gain of the amplifier is the product of the two stages. With the components shown, the gain is simply the value of R2. As R2 is 20K, the gain will be 20. You can work out the gain you need by multipling the transducer's sensitivity by the maximum pressure and dividing this by the maximum voltage of your detector. Try to keep R2 below 470K. If you want any more gain then you will have to alter the other resistor values. As the operational amplifier can't get very close to its power rails, 0.7 of a volt is removed by passing the output through an emitter follower. In order to compensate for this voltage drop R7 is taken to earth through a diode. If you have a differential or Gage transducer this point should be taken to a mid voltage point by using VR2. This is to bias the signal as the output could swing in either direction. However with an absolute type of transducer the signal can only go in one direction as you can't get a lower pressure than a vacuum. This circuit uses an LM324 which contains four operational amplifiers, the fourth is used to further amplify the transducer outupt to give a more accurate reading over a restricted range of pressures. The variable resistor VR1 adds an offset voltage to allow the range of pressures to be set, to get a really fine control you can use a multi-turn pot. As this output has undergone a lot of amplification it is inevitable that some noise will have been picked up, C1 will help to filter this out. Note that this is an inverting amplifier so that if the pressure increases the output voltage will drop. You can take care of this in your calibration procedure. The circuit shows the connection to be made to the analogue input port. This has a rather unstable reference of about 1.8V and for this application is best being read with an ADVAL(1) AND 255 statement to restrict the values returned to 8 bits. Normally the built in converter is just about good for 10 bits and is ANDed with a value of 1023. However the last two bits are a bit noisy and unless you take the average of about 10 measurements you are better sticking to 8 bits. If you want a more stable reference and accurate measure of the pressure, you could use the four and a half digit DVM described in the April 85 Body Building article. This allows measurement of voltages to be made to an accuracy of greater than 1mV. By knowing the actual voltage out of the system and the gain of the amplifiers you can calculate the output from the transducer. From the sensitivity of the transducer you can then work out the pressure. Note that the DVM will only give about three readings per second and so this method is not suitable where you want to measure rapidly changing pressures. There is an alternative way of temperature compensation and this allows us to use much cheaper transducers. These transducers are the SPX range. These have only a simple hole in one side for the absolute range and both sides for differential or gauge measurements. They have a widish range of sensitivities and so would probably need to be calibrated in most situations. As they are un-compensated we have to make some form of temperature compensation. To do this we need an LM334 programmable current source. This device acts as a constant source of current. The size of the current can be programmed by the value of an external resistor. Now the current output of the LM334 rises linearly with temperature. In fact it rises at a greater rate than the sensor's sensitivity drops. Therefore we can't use the LM334 on its own as we would over-compensate. So what we have to do is to supply some of the bridge current from the LM334 and some from a shunt resistor. If we get the proportions of currents right we will have a current supply that changes to match the change in bridge sensitivity. Well, going by the values on the data sheets for the sensitivity of the cheaper SPX transducer, we get a compensation circuit as shown in figure VI. The resistors should be of the metal film type as they are the most stable with changes in temperature and having just compensated for the bridge change, we don't want to bother with changing resistors. This can then be used in the same circuit as the other transducer. This circuit should be accurate to about +- 2%. For rearly accurate compensation, the two resistor values have to be adjusted on the individual transducers. It should be noted that both the transducer and the LM334 should be in close thermal contact so that they are both at the same temperature. This month's project is more experimental and so does not lend itself to a printed circuit board. However, as pressure transducers are not the easiest things to get hold of I can supply them as the kits. Therefore on offer this month is a kit of parts to build the circuit in figure V consisting of a piece of veroboard the op-amps and resistors and a selection of pressure transducers. The order form is on page XXX. A review of the vital statistics of each transducer is given in table I. There are other types of pressure transducer available, write to me with an SAE if you would like a list of the full range. Having got our measurement of pressure what can we do with it? Well it can be a useful addition to the anemometer (June 85) in a computerised weather station. Although the more expensive sensors will give better results you could get some useful results using the low cost SPX sensors. The SPX100D would give normal atmospheric pressure of 14.7 psi in the middle of its range. Now atmoshperic pressure is normally measured in millibars (mb) but as you will have to calibrate the sensor it does not matter. The SI unit of pressure is the Pascal and 1 psi is equal to 6.894757 X 103 Pascal (Pa). The Pascal is in the units of Newtons per square Meter (NM-2). Finally there are 100NM-2 in 1 mb. Normally atmospheric pressure ranges between 990 to 1030 mb. However on a barometer I saw the range was 880 to 1090 mb, nevertheless there is adequite range using the analogue input port or even more accurasy using the Body Build DVM. As I said you will have to calibrate the system and the calibration will take care of those messy conversions of units. All you need is a measure of pressure in what ever system you like. Basically there are two ways you can calibrate it, one using a barometer and the other by using the local weather forcasts. If you make the gain of the amplifier about 220 and use the times 10 input I have calculated that you will be able to get accuracy of about 1 mb. That is if you read the analogue input port with the ADVAL(2) AND 255 statement. In order to calibrate it you will need to take two readings at known pressures. the conversion will be in the form of:- Pressure= C+Reading*F where C and F are constants of conversion. The task of calibration is to find these constants. Suppose you have taken two readings labled R1 and R2, associated with each reading is a pressure P1 and P2. Now the value of F can be found by using:- F= (P1-P2)/(R1-R2) As there is an inverting amplifier the value for F will be negative. Once you have found F you can find C by:- C=P1-R1*F You now have the constants to build into your monitering program. Remember after calibration do not alter the offset control VR1 otherwise the value of the constant C will be changed. The constant F is governed by the gain of the amplifier. When the atmospheric pressure is used for weather forecasting it is normalised so that the value used was as if it were measured at sea level. You see, as you increase in hieght atmospheric pressure drops by about one milli bar (mb) for every 10 metres. If you are using a barometer you can adjust the pressure reading according to your hight above sea level. You can easily find this by looking at an ordnance survey map. If you use the local weather office to get your readings these will already have been normalised so you don't have to bother. Once you have set up the system make sure you do not handle the pressure sensor as you will increase its temperature and not the temperature of the compensating current source. I have not tried the SPX sensor and amplifier circuit for long term stability but the data sheets suggest that it should be alright. An other application of pressure measurement could be to weigh object by connecting it up to an old innertube. By placing an object on a partially inflated innertube or bag the pressure is increased proportional to the weight of an object. What about a gague that measures your lung capacity by measuring how hard you can suck or blow? A pressure gauge inserted in place of a spark plug in an engine can indicate compression ratios and point to a damaged cylinder head gasket or worn piston rings. Placed around the carburetto or exhaust a pressure gauge can givean indication of a car's performance. In fact the SPX series of transducers were especially made for the motor industry. Many school physics experiments can be computerised such as Boyle's law and the Karnot engine. Like all Body Build articles, the fun begins when you let loose your creativity on it. See you next month when, I hope, the pressure is off. Table I pressure transducers Type Range Sensitivity Type LX06015A 0 to 15 psi 6.67 mV/psi Absolute LX06030A 0 to 30 psi 2.63 mV/psi Absolute LX06001G -1 to +1 psi 27.7 mV/psi Gage LX06005G -5 to + 5 psi 10.0 mV/psi Gage LX06015G -15 to +15 psi 6.65 mV/psi Gage LX06100G 0 to 100 psi 1.4 mV/psi Gage LX06001D -1 to +1 psi 27.7 mV/psi Differential LX06005D -5 to +5 psi 10.0 mV/psi Differential LX06015D -15 to +15 psi 6.67 mV/psi Differential LX06030D -30 to +30 psi 2.63 mV/psi Differential SPX200A 0 to 30 psi .033 to .065 mV/psi Absolute SPX100D 0 to 15 psi .065 to .13 mV/psi Differential/Gage SPX200D 0 to 30 psi .033 to .065 mV/psi Differential/Gage