Sei sulla pagina 1di 11

Chapter 3

Voltage Measurement
station
3. Voltage measurement station

3.1. Introduction:
We have fabricated a voltage measurement station in our laboratory which is
basically a 16-channel dual-slope integrator interfaced with a microprocessor.
The control program is a daemon which uses Message Passing Interface (MPI)
and is written in C++. The data is acquired and returned as value-time pairs
through pointers by a library function. There is also a browser-based frontend
which enables one to manage the data through the World Wide Web (WWW)
from anywhere. The main advantage of this mechanism is that one can control
any experiment without being present in the laboratory. The control frontend
is computer architecture and OS (operating system) independent. Any stan-
dard browser is sufficient to control the instrument. Communication between the
computer and microprocessor [1] is via a serial (RS232C) interface. The HTTP
daemon runs on the computer and allows commands to be received via HTML
forms which activate CGI scripts. In the first version, these scripts would con-
nect via named pipes to the master controller program. The recent version uses
MPI calls executed by the CGI scripts. The analog-to-digital (A/D) conversion
code is dumped into the microprocessor (Z80A) which controls various switches
of a dual-slope integrator circuit through standard parallel (8255-based) ports. In
this way, a layered operation scheme ensures smooth functioning of the system.
Authentication may be implemented via an SQL-based database.

3.2. The instrument:


The instrument has two parts, the hardware and the software.

3.2.1. The hardware:


The hardware is shown in figure (3.2.1). It has two parts. One is for channel
selection and the other for A/D conversion. Channel selection is done with the
help of a 4-to-16 demultiplexer / decoder (LM 74154) followed by 16 op-amp
based comparators (4×LM 399 ) driving 16 CMOS switches (4×CD 4066). The

49
3. Voltage measurement station

Figure 3.2.1.: basic circuit diagram. The operational amplifiers used here are
LF351 and the comparators LM339

50
3. Voltage measurement station

four control lines of the demultiplexer are connected to a 8255 port of the
microprocessor trainer kit. Depending on the pattern output to the input of the
demultiplexer, one of the comparators that are connected to the output lines of
the demultiplexer will be high. The outputs of the comparators are connected
to the control pins of the 16 switches. The output of the switches are shorted
together and connect to the input of the A/D converter. The input lines of the
16 switches act as the 16 selectable inputs of the voltage measuring station.

The A/D converter uses the principle of dual-slope integration. The integrator
is a simple op-amp based one with a CMOS switch connected in parallel with
the capacitor. At the beginning this capacitor is shorted through this switch
which is controlled by the microprocessor. This resets the integrator to ground
potential. The voltage which is to be measured is level-shifted with the help of
an op-amp based adder to make it always positive. This allows the apparatus to
work in the positive as well as in the negative voltage domain. This shifted
voltage is now applied to the input of the integrator (through a CMOS switch)
for a fixed time. The output of the integrator ramps to a value that is
proportional to the shifted input voltage. Next a reference voltage of fixed
negative value is applied to the input of the integrator and the time required for
the integrator output to ramp back to zero is measured (number of timing loops
required). The reference voltage used here is obtained from a high quality
temperature stabilized reference zener ( LM 399) which has a reverse breakdown
voltage 6.97 V olts which we scale down to 2 V olts with the help of an op-amp.
The time for the ramp-back is now proportional to the original shifted input
voltage. The scheme of the conversion is shown in figure 3.2.2. The zero
crossing is sensed via a comparator followed by a transistor in the open-collector
configuration with a 5 V olt pull-up which can be read-in directly by an input
port of the microprocessor. If Vref erence and Vmeasured are reference voltage and
the voltage to be measured respectively and tref erence and tmeasured are the time
periods corresponding to the input and reference stages of the measurement
cycle respectively, then from the figure 3.2.2

Vref erence tref erence


=
Vmeasured tmeasured

The standard delay and the components of the integrator (R and C) are cho-
sen such that the maximum output of the integrator (final ramp voltage with
maximum permissible input voltage) is well below the saturation voltage of the
integrator. For the purpose of timing (with the input voltage) we have used a
delay loop which loads F F F F 16 into a register pair and decrements the pair till
the value goes to zero. R and C are 100 kΩ and 0.68 µF respectively. The loop

51
3. Voltage measurement station

Figure 3.2.2.: Wave form of the output of the integrator.

used to measure the ramp-back time with the reference voltage is more complex;
it incorporates instructions for sensing the comparator output.

3.2.2. The software


The schematic of the whole setup is shown in figure (3.2.3). The Linux OS has
been used throughout. We discuss the different parts below:

3.2.2.1. The microprocessor-computer interface

The microprocessor stores the ramp-down time in the form of a two-byte number
in its memory. This number is read-in by the computer through the RS-232C
serial interface and processed to get the actual voltage value. The sequence of
operations is thus:

1. Dump the conversion code (in machine language) into the microprocessor
via the serial interface.

2. Run the code on the microprocessor through commands sent through the
serial interface.

3. Read back the conversion value stored by the microprocessor in its memory
via the serial interface.

52
3. Voltage measurement station

Figure 3.2.3.: Schematic of the whole arrangement

4. Compute the actual voltage value from the retrieved number, i.e. subtract
the shift and do the necessary scalings.

3.2.2.2. The meter controller daemon in the older version

The whole sequence of control functions is managed by a daemon programme run-


ning on the computer. This programme, once started in the background, does all
the initializations like dumping the conversion code into the microprocessor and
initialization of the ports. Then it opens two named pipes, one for input and other
for output and waits for some meaningful input. When a client programme sends
some request via the input pipe, the daemon authenticates the request through
the SQL database by checking the username and password, sends commands to
the microprocessor as necessary and writes its output into the output pipe and
goes back to the ‘listen’ state. It is the responsibility of the client programme to
read-in the values from the output pipe. Thus proper sequencing of commands,
authentication, microprocessor control, value computation and all management
is handled by the daemon which alone has the power to communicate directly
(via the serial port) with the microprocessor. It is written in C++.

3.2.2.3. The ‘client’ CGI programmes

At the user end, all that is required is a browser, running on any operating system.
The ‘Apache HTTP’ daemon has been enabled on the server. A welcome screen
written in HTML greets the user with a form where the username and password
has to be typed. CGI programs [3] written in C++ accept and interpret input

53
3. Voltage measurement station

Figure 3.2.4.: Block diagram of intra-connection of voltmeter

from this form and connect to the main daemon programme via the named pipes.
The results returned by the daemon are read-in from the output (for the daemon)
pipe and a dynamic HTML page is generated which is displayed in the browser
through an in-lined frame (<iframe>). Functions available to the user include:

1. Single conversion and read-out.

2. Multiple conversions with presettable counter.

3. Plotting of the conversion data (using gnuplot with GIF output).

In the current version, we have replaced the named pipes with the MPI (Mes-
sage Passing Interface) library for inter-process communication. Multiple asyn-
chronous requests from independently running programmes (may be from dif-
ferent experiments running at the same time) can now be handled without any
conflicting claims on the named pipes. The detailed discussions on daemon pro-
grammes are in Chapter 6. figure 3.2.4 shows intra-connections of the voltmeter.

3.3. Zero compensation and ongoing development


Integrating instrument of this kind are slow, but offer the significant advantage
of averaging, and have data smoothing with reduction in contribution from high-
frequency noise. However, polarization of the integrator capacitor forms the
largest source of error, effectively reducing the achievable resolution and accu-
racy of the instrument. Unlike errors due to offsets of the active component
inputs and outputs, which are relatively constant and hence can be calibrated

54
3. Voltage measurement station

Figure 3.2.5.: Solder side the printed circuit board of the voltmeter

55
3. Voltage measurement station

out, polarization errors are history-dependent. The values and times of previous
readings effect current readings in ways that also depend on the humidity and
temperature of the surroundings.
At present, we use a step-gap arrangement by shorting channel 16 to ground
permanently. Each conversion occurs in two steps - one conversion on channel 16
followed by the actual reading. The reading from channel 16 is used to set the
zero of the instrument, effectively converting it into a four-slope device.
We are currently developing a genetic-algorithm-based correction module for
the meter controller daemon. The daemon internally stores a few previous value-
time pairs. The idea is to use these values to estimate polarization residues
and hence correct the current readings. Since evolutionary algorithms are self-
training, temperature and humidity effects (which is very important in our lo-
cal climate) will be incorporated automatically as the daemon executes random
sanity-checking runs against zero and reference voltages from time to time and
uses the variable voltage-time data to auto-calibrate itself in a self- manner. The
genetic algorithm libraries have been developed, but the correction module is not
yet ready. Once operational, the auto-zero run at each conversion will be nearly
doubled along with significant improvement in resolution and accuracy.

3.4. General performance and cost


The values of the components are so chosen that a count of F F F F16 corresponds
to +2 V and 000016 to −2 V . The resolution of 1 − in − 65535 which is indi-
cated by the counter value of F F F F16 , however, is not obtained due to capacitor
polarization. Using a standard cell for calibration (∼ 1.01859 V at 20◦ C) we
could attain a resolution of better than 4 21 digits. The conversion rate with this
resolution is about one per second. One advantage of the system is the control
over the actual conversion code running on the microprocessor. By changing
the algorithm, various speeds and resolutions can be achieved. Screenshots of
the welcome screen and main interface are shown in figures (3.4.1) and (3.4.2).
The cost of the main conversion circuit including PCB (figure 3.2.5) is around
$10 (US). The microprocessor training kit is costlier, about Rs. $100 (US). If
this is replaced by a microcontroller, this meter can be built very cheaply. As
the students from different Universities often have a course on microprocessors,
the fabrication of this particular instrument can be included as a project. The
photograph of the meter circuit board is shown in figure 3.4.3.

56
3. Voltage measurement station

Figure 3.4.1.: Welcome screen as displayed in the browser

Figure 3.4.2.: Meter screen as displayed in the browser

Figure 3.4.3.: Photograph of the component side of the meter circuit board. The
black co-axial cables are the 16 inputs and grey ribbon is connected
in series with 16 LEDs which indicate the selected channel.

57
3. Voltage measurement station

References
1. Elizabeth Agnew Nichols, Joseph C Nichols, Peter R Rony, Z-80 Micropro-
cessor: Programming & Interfacing, H. W. Sams, 1979.

2. David L Terrell, OP Amps: Design, Application and Troubleshooting, Newnes,


1996 Second Edition, pp 353-356.

3. Mark Felton, CGI Internet Programming with C++ and C, Prentice Hall,
1997.

4. PCB homepage http://pcb.sf.net.

5. How to make PCBs at home http://www.riccibitti.com/pcb/pcb.htm.

58

Potrebbero piacerti anche