Design Idea

Indicator has "electronic lens"

Edited by Bill Travis

Abel Raynus, Armatron International Inc, Melrose, MA -- EDN, 9/4/2003

The method for implementing an extended-scale meter described in an earlier Design Idea had a conceptual error: The meter impedance must change continuously, not discretely as expressed (Reference 1). You could achieve the desired result by using a digital potentiometer controlled by an input voltage via an appropriate interface. But this approach is probably too sophisticated. Figure 1 shows an alternative approach that needs only a small and inexpensive microcontroller. The method exploits the fact that a dc meter measures the average value of a PWM signal: IAVG=IPEAK(TPULSEWIDTH)/(TPERIOD).

Therefore, you can control the current through the meter by changing the pulse width of the PWM signal. The PWM-generating software determines the law that governs the change in current in the meter. In the process of creating this software, you can choose expansion of any part of the scale (Figure 2).
Figure 2 correspond to expanded scales. You can create the scale patterns by choosing the threshold voltages (breakpoints) and slopes. The circuit resembles an "electronic lens" attached to the meter, which magnifies any chosen part of the scale. The ADC in the microcontroller of Figure 1 transforms the measured input voltage into its 8-bit hex equivalent. The microcontroller program (Listing 1) reads the hex value and finds a corresponding pulse width from a table in its memory. Finally, the routine generates the PWM signal with the given pulse width. Figure 3 shows the software flow chart for the process.

As an example of the method, calculate the scale expansion of a 100-µA dc meter with a measured-voltage range of 0 to 5V. You need to magnify the portion of the input from 2 to 3V, from 20 to 70%, leaving 10% at the beginning and 20% at the end of the scale (Figure 2, characteristic c). Table 1 shows the steps of the calculations, which you execute as follows:

  1. Choose a number (N) and the values of the measured input voltages, VIN These parameters depend on the desired accuracy of the meter scale. As an example, assume voltages with increments of 0.5V for the low slope (Figure 2) and 0.1V for the high slope (Table 1, column 2). Therefore, N=19.
  2. Calculate the 8-bit ADC's digital output, NIN, for the selected input voltages (column 3): NIN=(256/5)VIN=51.2VIN.
  3. Transform NIN from decimal to hexadecimal format (column 4). The errors arising from the 8-bit quantization are insignificant for an analog indicator.
  4. Choose the PWM period, T. This value depends on the rapidity of the input-voltage change and should be relatively short to prevent needle chatter. Assume T=10 msec for easy Table 1 calculations.
  5. Calculate the number of timer cycles for the PWM period. The accuracy of any microcontroller's time intervals is a function of the accuracy of its oscillator frequency, which for the MC68HRC908K1 depends on the external RC circuit. The data sheet for the IC recommends a tolerance of 1% or less for these components to obtain a clock tolerance of 10% or better. But it is difficult to find a 10-pF±1% capacitor, so this design uses a less expensive 5% capacitor and measures the oscillation frequency. According to the microcontroller manual, the timing components R=20 kΩ and C=10 pF should yield a frequency of approximately 4.5 MHz. The measured frequency is 5.75 MHz. With the timer/counter prescaler set at 64, the timer-clock period is 44.5 µsec. Hence, you can calculate the number of timer cycles for any time interval as Nt=(t in milliseconds)/(44.5×10–3)=22.5×(t in milliseconds). Thus, for T=10 msec, N10=225 or NHEX=$E1.
  6. Determine the duty cycle (α) of the PWM signal for each chosen input voltage, VIN, as well as the scale-expansion pattern (column 5); α=(IV/IMAX)×100%. You could either read the current value directly from the diagram in Figure 2 (characteristic c) or calculate it for three linear parts of the scale with the following equation: IV=ITi+Si(VIN–VTi), where IV is the current for the given input voltage VIN, ITi is the current for the threshold voltage VTi (i={1,2,3}), and Si is the slope of each linear portion of the scale in Figure 2 (characteristic c). The expressions for the three piecewise-linear segments are as follows:

7. Determine the pulse width of the PWM signal: PW=αT (column 6).

8. Calculate the number of timer cycles, NOUT, for this pulse width by using the equation for Nt and transform the number into hexadecimal format (columns 7 and 8).

9. Enter NIN and NOUT (Listing 1).

You can use any microcontroller with a PWM function and built-in ADC. The one in Figure 1 has a 12-channel, 8-bit ADC and the capability to generate a PWM signal. This microcontroller has 15 I/O pins, which are necessary for executing other functions. If your application needs only to effect the meter-scale expansion, then the eight-pin 68HC908QT2 is probably a better choice. This microcontroller has a built-in oscillator and costs less than $1.


Reference
  1. Raynus, Abel, "Expanded-scale indicator revisited," EDN, Aug 8, 2002, pg 112.



ADVERTISEMENT

ADVERTISEMENT

Feedback Loop


Post a CommentPost a Comment

There are no comments posted for this article.

Related Content

 

By This Author


ADVERTISEMENT

Knowledge Center



Technology Quick Links

EDN Marketplace


©1997-2008 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other Reed Business sites

ADVERTISEMENT
You will be redirected to your destination in few seconds.