|
|
|
Creating a PWM Output
Sensor FPAAs are powerful and flexible ICs useful for quickly, efficiently, and accurately designing a wide variety of circuits, including one that converts a pressure sensor's analog output into a digital pulse width modulated signal. Eric Jacobsen, Motorola
An alternative to manually calibrating and breadboarding a PWM output circuit is to use a field-programmable analog array to quickly and accurately achieve the desired PWM sensor output characteristics. With this technique the sensor's analog voltage output characteristics may be quickly accommodated to obtain the desired transfer function without modifying hardware components. Where multiple circuit topologies are possible, each may be quickly and efficiently implemented within the analog array. This article demonstrates, by means of a pressure sensor example, how to design a PWM output for an analog voltage output sensor. The
Pressure Sensor's Characteristics
and calibrated (i.e., offset and span are precision trimmed). The sensors are available in full-scale pressure ranges from 6 kPa (~1 psi) to 700 kPa (~100 psi). With the recommended 5 V supply, the MPX5000 Series produces an output of 0.25 V at zero pressure to 4.75 V at full-scale pressure. This corresponds to a dynamic range (commonly referred to as the span) of 4.5 V. The electrical characteristics of the MPX5100D are given in Table 1.
An
Overview of the FPAA Motorola's MPAA020 FPAA is based on switched-capacitor technology and contains an uncommitted array architecture of 20 op amps, a multitude of 8-bit capacitor banks, routing structures, and other supporting circuitry to configure any of the op amps as a variety of analog functions, including amplifiers, summing amplifiers, comparators, biquad filters, integrators, differentiators, and S/H circuits. With the FPAA's EasyAnalog, a front-end software circuit design tool, analog circuits may be designed, redesigned, and manipulated, and their performance confirmed quickly and efficiently. Once a circuit is designed, the software converts the circuit topology into a serial data stream that programs the MPAA020's onchip SRAM by either downloading the data directly from an RS-232 port or via a serial EPROM that is programmed with the circuit configuration data. Using an
FPAA to Design a PWM Output Pressure Sensor Creating
the PWM Circuit
to the sensor's analog DC voltage output. As shown in Figure 2, the comparator's output is high whenever the sensor's voltage is greater than a given ramp voltage and low whenever the sensor's voltage is less than the ramp voltage. By visualizing the sensor's voltage increasing and decreasing (corresponding to increasing and decreasing pressures), the duty cycle of the PWM output can be seen to change accordingly. Thus, the linear ramp waveform provides a linear translation of the sensor's analog voltage output to a pulse train with a duty cycle that varies linearly with the sensor's analog output voltage. If the sensor's analog voltage changes linearly with pressure, then the PWM output's duty cycle will also vary linearly with pressure. Stage 1. Stage 1 is the ramp generator and consists of four analog macro blocks whose characteristics can be modified to customize/calibrate the ramp for a specific application. To see how this is done, it is first necessary to understand how they work to create the repeating ramp waveform. Beginning at the output of the comparator macro (in Stage 1), let's assume the comparator's output is negative, or in other words, is low. (To allow inverting and noninverting signal gains, i.e., noninverting and inverting macro gain stages, all input signals to the MPAA020 are referenced to a signal ground, created by an internal bandgap reference, which is typically 2.5 V.) The output of the comparator connects to two macro inputs, the rectifier and an inverting gain stage. The rectifier simply rectifies the negative signal and creates a positive reference at the negative terminal of the comparator; the comparator's negative input terminal will therefore always be a positive voltage determined by the rectifier. This positive voltage can be conveniently adjusted by changing the gain parameter of the rectifier. The comparator output is also input to an inverting gain stage. Therefore, the comparator's negative output is inverted to a positive voltage. This positive voltage is then input to the ramp generator. The inverting gain stage, like the rectifier, has a gain parameter that can be adjusted to modify the ramp waveform's characteristics. The ramp macro has a few important parameters that can be adjusted to modify the ramp waveform, but in general it functions as follows: when its input voltage is positive (referenced to signal ground), the ramp voltage increases linearly; when its input voltage is negative, the ramp voltage is discharged to signal ground. The repeating ramp waveform therefore can be generated by continuously applying a positive voltage to the ramp macro's input to increase the ramp voltage and then applying a negative voltage to discharge the ramp's voltage back to signal ground. The ramp macro's output is then input to Stage 2, and is also fed back to the positive terminal of the comparator. As the ramp charges, its voltage is compared to the rectifier's output. When the ramp voltage is lower than the rectifier's output, the comparator's output is low, as is the current state of the comparator. Thus, while the ramp's voltage is lower than that of the rectifier, the Stage 1 system remains in this "steady state." Once the ramp voltage exceeds the rectifier's output voltage, the comparator's output becomes positive (high). By following the signal path around the loop once again, the comparator's high output is input to the rectifier and the inverting gain stage. The rectifier simply rectifies the positive voltage, but now the output of the inverting gain stage becomes negative. The inverting gain stage's negative output is input to the ramp, discharging (turning off) the ramp to signal ground. But now the ramp voltage upon discharging is lower than the rectifier's voltage output at the comparator's negative terminal. Thus the comparator's output switches low, resulting in a positive output from the inverting gain stage. This positive output, input to the ramp, now starts the ramp charging all over again. The circuit uses feedback to reset the ramp every time its voltage exceeds the reference voltage created by the rectifier. The
individual Stage 1 macros and their parameters are:
Rectifier. The rectifier generates the constant reference voltage that determines at what voltage the ramp discharges (turns off) and has a gain parameter that can be modified to adjust that voltage level (see Figure 3. The input to the rectifier is ±2.5 V (the comparator's output, referenced to signal ground). For example, by setting the rectifier's gain to 0.8 V/V, the rectifier's output will be ABS (±2.5 V 0.8) = 2.0 V. Thus, the ramp will charge from 0 V to 2.0 V (signal ground referencedremember that signal ground is 2.5 V referenced to earth ground). Inverting Gain Stage. The input voltage to the ramp is controlled by adjusting the inverting gain stage's gain parameter. Although from the
previous discussion this point might not seem significant, it should be noted that the slope of the ramp is a function of its input voltage. In other words, the speed at which the ramp charges is directly proportional to its input voltage. The frequency of the repeating ramp waveform can therefore be modified by adjusting its input voltage (see Figure 4). For example, the desired input voltage to the ramp is 1 V. The gain of the inverting gain stage is therefore designed to be 0.4 V/V (±2.5 V 0.4 = 1.0 V). Note that the positive 1 V is significant in controlling the speed of the ramp's charging but the negative voltage does not control the ramp's dischargingany negative voltage causes the ramp to discharge at the same rate. Ramp Generator. The ramp generator has up to three adjustable parameters:
Modifying the clock frequency from its fastest sampling rate of 1 MHz is not recommended since slower clock frequencies result in fewer samples per unit time. Thus, a very slow clock frequency can result in a ramp waveform with a stair-step output. The overall accuracy of the PWM output will then be limited by the ramp itself and not the noise floor or sensitivity (resolution) of the sensor. The ramp waveform is subject to: ramp waveform's period = (rectifier's gain 2.5) (number of clock cycles/volt) (inverting amplifer's gain 2.5)-1 (sampling clock frequency)-1 ramp's initial dynamic range = rectifier's gain 2.5
Stage 2. Stage 2 is an inverting summing amplifier used to level-shift the ramp such that it symmetrically straddles signal ground (see Figure 5). Remember that the ramp's dynamic range extends from signal ground to, for example, 2.0 V above signal ground. But the sensor's output voltage spans 0.25-4.75 V referenced to earth ground. Thus, the ramp's dynamic range must be signal conditioned to be greater than the sensor's dynamic range. Stage 2 uses Stage 4, a precision reference voltage generator, to accurately level-shift the ramp. The required level-shift voltage is governed by: level-shift voltage required = -0.5 ramp's initial dynamic range The gain for each input signal to the summing amplifier is set to 1 (unity gain) since only level-shifting of the ramp is required. For the example in which the ramp spans 0-2 V referenced to signal ground, a reference voltage of -1 V is generated in order to position the ramp from -1 V to +1 V referenced to signal ground (or from 1.5 to 3.5 V referenced to earth ground).
Stage 3. Stage 3 amplifies the level-shifted ramp waveform so that its dynamic range is larger than that of the sensor (see Figure 6). If the sensor's output extends from 0.25 V to 4.75 V, or, referenced to signal ground, from -2.25 V to +2.25 V, then the ramp waveform must be amplified to be greater than this sensor's range (e.g., -2.3 V to +2.3 V). To increase the ramp's dynamic range from 2 V [1 V - (-1 V)] to the desired dynamic range of 4.6 V [2.3 V - (-2.3 V)] requires a gain of 4.6 V / 2 V = 2.3 V/V: Stage 3 gain = ramp's desired dynamic range / ramp's initial dynamic range Stage 4. As previously noted, Stage 4 is the precision reference voltage added to the ramp waveform. For the above example, to position the ramp waveform symmetrically about the signal ground, a reference voltage of -1.0 V is required. Stage 5. Stage 5 is the comparator that compares the final ramp waveform to the sensor's analog output voltage. The output of Stage 5 is the PWM output. Important Note: Because the MPAA020 is a sampled system, an anti-aliasing filter for the sensor's analog output signal is recommended. A Design
Example for the PWM Output Pressure Sensor
Based on the second parameter, the ramp frequency is also 2 kHz; its period is therefore ˝ kHz = 0.5 ms. Plugging into the ramp design equations: Let the ramp's reference voltage = 2.0 V, thus: ramp's
initial dynamic range = 2.0 V And, let the ramp's input voltage = 1.0 V, thus: 1.0 V =
inverting amplifier's gain 2.5 0.5 ms =
2.0 (number of clock cycles/volt) 1.0-1 1 x 10-6 Now the ramp must be level-shifted and amplified to the appropriate level. It is first level-shifted to symmetrically straddle the signal ground. As before, this requires a reference voltage of: level-shift voltage required = -0.5 2.0 V = -1.0 V Finally, amplify the ramp by adjusting the gain of Stage 3, the ramp's desired dynamic range divided by its current dynamic range: Stage 3 gain = 4.6 V / 2.0 V = 2.3 Measuring
the Sensor's PWM Output
Calibrating,
via Software, the Sensor's PWM Output
PWM output after obtaining two known pulse widths at their two known corresponding pressures. Typically a two-point calibration technique uses the zero and full-scale pressure of the application as the known pressures (see Figure 7). Follow these steps to calibrate the PWM output:
Important Note: This calibration procedure will yield excellent system accuracy (neglecting any sensor output nonlinearity, ramp nonlinearity, and so forth, as explained above). Care must be taken, however, to ensure that the sensor's analog output is compensated for environmental conditions such as temperature, humidity, or mechanical stresses (other than the property the sensor is meant to detect) that may cause the sensor's output to drift. Calibration
Tips for the Analog Array
Summary References Eric Jacobsen is a System Design Engineer, Hardcopy Imaging, Motorola, Inc., 2100 E. Elliott Rd., M/D EL344, Tempe, AZ 85284; 602-413-4055, fax 602-413-5597, r18084@email.sps.mot.com For more information on field-program-mable analog arrays, contact Bill Altonen, Business Manager for FPAAs, Motorola, Inc., 2100 E. Elliot Rd., Tempe, AZ 85284; 602-413-4663, r12953@email.sps.mot.com For more information on sensors, contact Sensor Marketing, Motorola, Inc., 602-244-4556, fax 602-244-4201.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|