| Sensor Voltage Interface Basics |
Last Modified: 2007-03-23
The interface of various sensors to a controller like the BrainStem GP 1.0 module typically involves either conditioning or converting voltage levels into the range the controller requires. Many systems use A/D converters to make the sensor value relevant in a program or data logging configuration. These converters have a fixed range of voltages they can convert from with 0-5V being by far the most common.
Sensors often create voltages in different ranges than those required by the controllers they are being interfaced to which requires the conversion of one voltage to another. This conversion often breaks down into a combination one or more of three types, amplification, dividing, and shifting.
Voltage dividing is probably the easiest transformation you can perform on sensor outputs to alter the value being connected to a microcontroller or other circuit.
The mathematical equivalent of what you are trying to achieve when dividing voltages is a simple division. For instance, say you have a sensor that outputs 0-100V and you want to convert this to 0-5V for interface to the A/D input on your BrainStem. The goal would be to create a 20:1 ratio of voltage which means dividing the original sensor output voltage by a factor of 20. So we need a small circuit that will accomplish the following pictorially:
The easiest way to accomplish this division is using a few resistors to form a voltage divider. The resistors are wired up in series to create intermediate voltages based with the desired division. The above example could be accomplished as follows:
This voltage divider uses the input as the top of the resistor ladder and ground as the bottom. The actual division is defined by the proportion of resistance between the two resistors.
Notice the above circuit does not work out to an exact division by 20. This is because the resistors used are commonly found resistor values. Precision resistors with exact tolerances can be used but are often not needed since the original output of sensors typically varies. Here the resulting output voltage is slightly below the maximum of 5V but with a reasonable A/D converter like the 10-bit converters used in the BrainStem GP 1.0 module would still offer plenty of dynamic range in the sensor readings.
Voltage amplification is required for a class of sensors that create small voltages. Often sensors of this type are converting some sort of physical energy such as acceleration, temperature, or other minimal physical force into a voltage. This conversion is often an inefficient conversion and the measured energy is minimal which results in very small voltages generated by the sensor. To make these small voltages meaningful, they must be amplified to a usable level.
The equation for amplification is the exact opposite of dividing. You want to multiply the output voltage from a sensor to gain the full range of your A/D input or other interfaced circuit. Lets say you have an accelerometer which measures accelerations in g (gravity) units. A sensor like this may have a response of 312mV/g which means the sensor will generate 0.312V for each gravity unit of force it encounters. Now, say you would like to measure up to 2 gravity units (2g) with your detector with the full range of your 0-5V A/D converter. This means you need to multiply the output voltage of your accelerometer by a factor of about 16 to get the desired range and sensitivity in your measurements. So we want to accomplish the following pictorially:
Probably the most common way to multiply a voltage is using an amplifier. Here, we will use a common Operational Amplifier (Op Amp) to multiply the voltage. These Op Amp circuits are extremely common in electronics and there are volumes of literature devoted specifically to the various characteristics and performance of each. We use one of the original versions which is widely available and easy to interface called the 741. Here is one circuit that will amplify the voltage by a factor of about 16:
There are some things to note about this circuit. Again, changing resistance values gives a different voltage amplification (multiplication). The small numbers indicate the pins of the 741 package that you would connect to for this circuit (it is an 8 pin chip). Also, notice the additional power supply which is both positive and negative. This is very common for Op Amp circuits. Since the Op Amp is powered by a plus/minus voltage of 9V, the absolute output can at best be 9V. In practice, the output voltage will probably be slightly less.
The gain for this amplifier may not be exactly linear, depending on the input and output voltages. This can often be hidden in the noise of the sensor and accuracy of the A/D conversion on the other end but it should be considered. The higher the gain of an amplifier, the larger the margin of error and noise.
Shifting voltages can be a requirement for sensor data that are generated symmetrically about a common (often ground) voltage. A simple example of this would be a motor acting as a generator where spinning in one direction creates a positive voltage and spinning in the other direction creates a negative voltage. Since most common A/D converters in microcontrollers deal with a 0-VCC range for conversions, sensors that are symmetric about the ground voltage reference need to be shifted into the 0-VCC range.
The equation for shifting is then then the addition or subtraction of an offset from the original sensor's voltage. For example, if your sensor produces -2 to 2V, you would want to add 2V to the output for reading with a common 0-5V A/D converter. This addition would result in a final output of 0-4V which the A/D converter could then use. This conversion looks like this pictorially:
This circuit is a two-stage summing amplifier using an Op-Amp chip (the 1458) that houses two op-amps on a single chip. Notice there are some fixed values of resistors that essentially create a voltage summing circuit. The input on one side is a resistor network that creates a fixed voltage to sum with the input voltage. The variable resistor values change this resistor network's set voltage. You could substitute a potentiometer for R1 and R2 to make the addition variable, by twisting the potentiometer.
The addition circuit also requires a plus/minus 9V power supply for the op-amps. In addition, a tap from the 5V supply used for the logic is used although this could be done with the positive 9V side as well, provided the voltages are computed correctly.
So the above conversions define addition, subtraction, multiplication, and division of a voltage. Each of these conversions can be thought of in isolation as shown above or they can be combined to create composite conversions. We essentially have an algebra of blocks we can use to achieve a wide variety of overall conversions.
Say you have a sensor that creates -100 to 100V and you want to read the value with a 0-5V A/D converter. You would need to scale down the original voltage to -2.5 to 2.5V first and then offset the result by adding 2.5V to get the result into the desired range of 0-5V for your A/D converter. You can chain together the conversions for such an effect which would look like this pictorially:
The above conversions all introduce impurities in the resulting signal in the form of noise, non-linearity, and other corruptions of the original input voltage. Care must be taken to minimize the number of stages and also to order them for reduced error. Testing and careful thought can typically reduce these impurities to a minimum but they cannot be disregarded.
There is a general rule of thumb with regard to these introduced impurities. The more you are changing the original voltage, the more impurities you will introduce. For instance, an amplification of 100x would be generally more noisy than one of 2x.
Power Supply Issues
Several of these circuits require a plus/minus 9V supply for the Op Amps. This can readily be accomplished using two standard 9V batteries. More sophisticated options include standard power supplies, charge pumps and inverters and several other options. The 9V battery is cheap, simple and it works well. Op Amp circuits tend to be pretty efficient so the batteries should last quite some time.
The subject of sensor interfaces is vast. This article attempts to give some basics that are easy, practical, and quick to implement. Here are two great references to consider:
A short workshop converting this material was held at the Colorado School of Mines (CSM). The handout used for the class is available for download.
| voice: 720-564-0373, email: firstname.lastname@example.org, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy |
© Copyright 1994-2012 Acroname, Inc., Boulder, Colorado. All rights reserved.