Why do we need to do signal conditioning? Well consider a sensor called a thermocouple. A thermocouple is simply two dissimilar wires joined together at a point called a junction. At the junction, a voltage potential will form that is a function of the temperature of the junction. As a result, these sensors are frequently used in making digital thermometers.
The typical voltage level for the junction is on the order of less than 10 millivolts. Clearly, that’s not much! But think back to the lab where you hooked a wire to an oscilloscope and observed noise from the florescent fixtures in lab. You may not have noticed the amplitude of this noise, but it can easily be on the order of 100 or more millivolts. That means that signal noise, in this example, is actually ten times greater than the signal itself!
How could we possibly measure the signal we want (from the thermocouple) when we have ten-times more signal noise??
ANSWER: WE CAN’T!
So the key is to perform signal conditioning. We’ve actually already seen this concept back when we studied Wheatstone Bridges. Here, in order to make the very weak signal from the bridge strong, we considered using amplifiers.
For today, we’ll study three types
of signal conditioning:
Filter:
a circuit that allows signals of a certain frequency to "pass" while greatly
attenuating (diminishing) signals of unwanted frequencies.
To see how this works in principle, let’s once again return to our voltage divider circuit:
As always, we know that the output voltage will be given by the voltage divider formula:
But let’s look at that formula in greater detail. Some observations:
Capacitors are circuit components that are capable of storing a tiny amount of electric charge.
The unit of a capacitor is the Farad (F). However, one Farad of charge is a tremendous amount! Therefore, sizes of typical capacitors are usually on the order of microfarads (m F = 10-6 F) or picofarads (pF = 10-12 F).
The impedance of a capacitor is called
the "capacitive reactance" (Xc) and is given
by the formula:

From this formula we see a characteristic of capacitors: signals of very high frequency cause the impedance of a capacitor to be very low, and signals of very low frequency cause the capacitor’s impedance to be very high. As a matter of fact, if we take this to an extreme and let the signal’s frequency be zero (a DC signal) then the impedance of the capacitor is infinite.
Therefore, a capacitor will completely block current flow from a DC signal because its impedance is infinitely high.
Now, let’s use a capacitor in series with a resistor to form a voltage divider circuit. This is a common circuit called an RC circuit. Let’s measure the voltage drop of our voltage divider (Eout) across the capacitor:
According to what
we’ve learned about any voltage divider in general, the attenuation ratio
will have the impedance of the capacitor in the numerator and the total
impedance (the resistor plus the capacitor) in the denominator. Thus,

Now, let’s look at the types of outputs from this circuit. First, let’s assume that Ein is a signal of very low frequency. As a matter of fact, let’s allow it to be a DC signal. If that is the case then we let the value of frequency f be zero. Doing this causes the attenuation ratio to become one, and thus Eout = Ein. In a sense, the value of Ein simply passes out of the circuit as Eout.
Ok, take it to the other extreme. Let the frequency f be a very high number, say, approaching infinity. When this is the case, we immediately see that the attenuation ratio becomes zero. Thus, regardless of what Ein is, Eout will be equal to zero. In this sense, the higher frequency signal of Ein does not pass through the circuit. As a matter of fact, it is completely attenuated.
So in essence, this circuit passes low frequency signals and blocks high frequency signals. This is one circuit embodiment of a low pass filter. As we’ll see a little later, it’s just one of many possible ways to accomplish this.
What do you suppose will happen if we take Eout across the resistor instead??
Exercise: use the voltage divider formula to prove that this makes a high pass filter, that is, a circuit that passes high frequency signals and attenuates low frequency signals.
Now, although the RC circuit can be used to make a filter it is not the most efficient way to do it. One of the problems is that the "cutoff frequency" is poorly defined. In filters, the ideal is to have a very well defined cutoff frequency. For a low pass filter, we would then ideally like to have no attenuation of signals below the cutoff frequency and complete attenuation of signals above the cutoff frequency. The output would look something like this:
In reality, the output of an RC circuit low pass filter would look something like this:
In looking at this, note that high frequencies are not really "cut off" just above the cutoff frequency, they’re just slightly attenuated. Now one of the ways to get around this is to keep adding RC circuits in parallel:
When this is done, the slope of the cutoff curve (just above the cutoff frequency) is much, much steeper. But there’s one slight problem: each one of the resistors and each one of the capacitors remove energy from the input voltage, thus weakening it. For some input signals that are weak to start with (remember the thermocouple?) this is energy you can’t afford to lose.
This is what’s called a passive filter. It’s passive because it’s made of components (resistors and capacitors) that are not capable of adding energy to a circuit. They can only take it away.
But now, let’s return to a concept we hit once before … amplification. What if we could first amplify the weak signal to make a much stronger copy of it, and then filter it? Doing this would make our filter become what is called an active filter, because the addition of an amplifer now allows energy to be added to the circuit, thus making it active.
We now have an intuitive feel for amplifiers.
It’s time to introduce real ones. Although there are many types of amplifiers
in electrical circuits, one of the most common and useful types is called
the operational amplifier, or op-amp
for short. The symbol for an op-amp looks like this:
Here, there are two inputs, the inverting input (V1) and the non-inverting input (V2). The V+ and the V- are the external supply connections. It’s important to understand that an amplifier doesn’t magically make more energy. It uses the energy supplied to it from an external supply to make the stronger copy of the input signal. Thus, regardless of the gain of the amplifier the output will never exceed the value of the supply voltage. Remember, the gain is the ratio of output to input, or better yet, the multiplier that will be applied to the input.
The gain of the amplifier will always be applied to the difference between V1 and V2. For many applications, V2 is just tied to ground forcing its value to be zero. Thus, the gain will only be applied to V1. Since V1 is the inverting input, the output will be the negative of the input. This is called an inverting amplifier. It is but one of many possible amplifier circuits, some of which invert the signal, some of which do not. For now, we’ll just focus on the inverting amp.
The question is: how do we get this gain?
Well, the answer is surprisingly simple. To design the op-amp for a certain gain, we add two impedance devices as shown:
Notice that one of these impedances, Zf, is used to create a feedback loop between the input and output of the amplifier. This is therefore called a feedback impedance. Similarly, the other impedance is found between the input to the op-amp and the input signal, thus it is called an input impedance.
It turns out, no matter what the impedance
devices are, that the gain for the op-amp in this configuration will always
be:

So, to create a general purpose amplifier with a gain of 5, we could use resistors for Zf and Zi, and all we have to do is assure that the ratio of the resistance values (Rf / Ri) is equal to 5. NOTE: high resistance values should typically be used.
Exercise: what is the gain of this circuit?
Exercise: if the output voltage of this circuit is measured to be 12 volts, then what must the value of Rf be?
Notice here that the feedback loop features a parallel circuit. Current in feedback could travel either through the resistor (R2) or the capacitor (C) or partially through both. Regardless, keep in mind that current will always take the path of least resistance (the old adage is true!) Now, given this, let’s say that a very low frequency signal is input to the op-amp. Because the impedance of the capacitor will be very high, the current will not flow through it and will instead flow through the resistor R2. Thus, the gain of the circuit will essentially be R2/R1 and a measurable output will occur. As a matter of fact, depending on the values of R2 and R1, the output will not only be measurable, but it can be amplified.
Ok, but what if Ein suddenly becomes a very high frequency signal? Well, the impedance of the capacitor becomes very low and since current will take the path of least resistance (or impedance) the current will pass through the capacitor unimpeded and will not go through the resistor R2. But remember, the gain of an op-amp is always the feedback impedance divided by the input impedance. Here, the feedback impedance of the capacitor is nearly zero, which means that no matter what the input impedance is, the gain will be near zero and thus the output voltage will also be near zero.
Sounds like another low-pass filter …
That’s exactly what it is!
Exercise: use the gain formula to prove that this circuit is a high-pass filter
Op amps are incredibly versatile and useful circuits. We’ve only begun to explore their capabilities. As you saw when we studied Wheatstone Bridges, the use of an op-amp is critical to be able to increase the voltage difference across the bridge to a measurable level. That’s a very clear case of the need for signal conditioning.
Or is it?
There’s another kind of signal conditioning that finds great favor when working with microcontrollers. Just like amplifiers and filters, where you actually used these before really studying them in depth, you’ve also used this form of signal conditioning.
It’s called analog-to-digital conversion (ADC). It’s useful to microcontrollers because all computers must work on digital signals.
Now recall from earlier that digital signals can only have two possible values. This lends itself well to the base-two, "binary" system of numbering. So in terms of voltages, let’s say a zero-volt level is a binary "0" and a +5 volt level is a binary "1". ADC allows us to deal with all the voltage levels in between …
First, an analog-to-digital converter
is specified in terms of the number of "bits"
it creates to form a "word". For example,
a "10-bit analog-to-digital converter" creates a binary word that is comprised
of ten "1"s and/or "0"s. Such a word might look something like this:
1001110101
But what does this mean??
Well, in terms of decimal numbers we can convert this realizing that each bit, moving from right to left, represents an increasing power of the number two. For our example, this is:
29 28 27 26 25 24 23 22 21 20
1 0 0 1 1 1 0 1 0 1
Now, wherever the bits are set to 1, we simply add those powers of two together. In our example, we would add up:
29 = 512
26 = 64
25 = 32
24 = 16
22 = 4
20 = 1
______
629 = total
For this 10-bit ADC, the binary number 1001110101 represents 629 analog-to-digital counts. On your microcontrollers, when we use the "read_analog_input" command we retrieve the analog-to-digital counts from the ADC and assign that number to a variable. You now know what that number means!
But that still doesn’t answer the question of how this relates to analog voltage levels.
What an ADC does is it makes a comparison
of an input voltage (Vin) to a set voltage level called a reference
voltage (Vref). The ratio of analog-to-digital "counts" to the maximum
possible
counts is then set equal to the ratio of Vin to Vref. NOTE:
the maximum possible counts is given by 2N, where N
is the number of bits in the ADC. In equation form, this is:

or, put another way …

which is the ADC equation you have used in lab. In lab, the microcontrollers use 10-bit ADCs, which means that the maximum possible number of counts is 1024. The reference voltage Vref is set equal to 5 volts. Any Vin you hook to the analog input channels is converted to a number of counts according to these parameters. Obviously, a 5 volt input will give us the highest count (which is actually 1023) and an input of 0 volts will give us a count of 0. Every voltage in between will appear as a number of counts between 0 and 1023.
Now it’s important to realize that although we view the number of analog-to-digital counts and use this in our programming, the micro sees that number of counts as its binary equivalent. So, as was the example above, if an input voltage causes a count of 629, the binary number 1001110101 is used by the microcontroller for its operation.
Exercise: a 3.6 volt input will give what analog-to-digital count on the microcontrollers in lab? What is the 10-bit binary equivalent to that number of counts?
So what does this have to do with signal conditioning?
Remember that the 0’s and 1’s are actually voltages that are either 0 volts or +5 volts. When the micro is given the 10-bit number 1001110101, it means that there are 10 lines (wires literally) in the micro that are either set to 0 or +5 volts.
Now think back to signal noise. We saw in lab how hooking a wire to the oscilloscope allowed us to see signal noise on the screen when we held the wire up in the air. That’s because the wire literally acts like an antenna to absorb transient electrical signals (noise).
So in a mechatronic system, the wires between our sensor and the microcontroller are literally doing the same, they are susceptible to noise. The tiny signal changes taking place at the sensor are going to be blasted with signal noise in the wires leading to the micro.
But what if the signal at the sensor could be converted to its digital equivalent right at the sensor, so that the signal being transmitted to the micro is a series of binary signals (0 and +5 volts)? Yes, these signals will see noise too. But as long as the noise is reasonable (like the 100 millivolt noise we’ve seen before) then this is not going to affect the 1’s and 0’s much at all. As a matter of fact, it’s likely that the micro is going to be set up so that any voltage over a certain threshold, say 2.5 volts, is interpreted as a "1" and any voltage below that threshold is interpreted as a "0". If that’s the case, you can add quite a bit of signal noise to a digital signal and the micro will still be able to tell the difference between the 0’s and 1’s and make a perfect reproduction of the intended signal.
In that sense, analog-to-digital conversion is a very, very effective method of signal conditioning.
One last thing. The resolution (R)
of an analog-to-digital converter is given by the formula:

This provides us with a measure of what a difference in one analog-to-digital count means in terms of differences in analog voltage amplitude. For example, in our 10-bit ADCs with Vref = 5 volts, the resolution would be about 4.88 millivolts. To think of this another way, each count represents a change of analog voltage level of about 4.88 millivolts. Any change smaller than that will not result in a change in ADC count. Thus, 3.072 volts would give us an ADC count of 629. If that voltage changed to 3.070 volts (a 2 millivolt change) the ADC count would still register 629 because the change is less than the resolution of the ADC.
So let’s say that we had a much higher bit ADC, and used a smaller Vref. For example, 24-bit ADCs are commercially available. According to the resolution formula, with Vref = 1 volt, the resolution for this would be about 59.6 nanovolts … that’s less than 60 billionths of a single volt!
Now, just food for thought, if we could
digitize a small signal using this kind of ADC, where the resolution of
the signal is so infinitesimally small, how important is an amplifier?
In some applications, it turns out that they’re no longer very important
at all. One case of this is a device called the Digital Bridge Analyzer,
which was invented by Kettering’s Mechanical Engineering Professors Stokes
and Kowalski. In this device, an amplifier is no longer needed with the
signal differences of a Wheatstone Bridge used for strain gage measurements.
They’ve successfully used a 24-bit ADC to read the signal and send it’s
digital equivalent to a microcontroller for analysis!