Advertisement
Advertisement

Use your printer port as a high-current ammeter

-July 06, 2000

With a few inexpensive components and INT1Ch, you can turn the printer port of your PC into a high-current ammeter. This design's goal is to make remote high-current measurements, but you can use this technique to remotely measure any other similar analog electrical quantity, such as voltage and charge, at moderate speeds without going for expensive, PC-based general-purpose or tailor-made data-logging add-on cards.

In Figure 1a, a low temperature-coefficient manganin element senses the high current of the remote module. The manganin element gives an output of 0 to 500 mV, which is VIN to the circuit, for an output-current range of 0 to 100A. Instrumentation amplifier IC1 amplifies this output voltage by 2. Voltage-to-frequency converter IC2 digitizes this amplified voltage to a resolution of 13 bits. The values of R1, R2, and C1 give a serial output- pulse train at a rate of 10 kHz/V according to FOUT=VIN/10(R1+R2)C.

Figure 1 A low-temperature-coefficient manganin element senses the high current of the remote module, and IC2's voltage-to-frequency converter digitizes the resulting amplified voltage (a). This result, in turn, attaches to the PC's LPT printer port through an optocoupler, counters, and buffers (b).

The converter's output linearity of less than 0.01% ensures a linear conversion of the sensed voltage/current to frequency throughout the current range.

Figure 1b shows the other part of the circuit that attaches to the PC's LPT printer port. This circuit couples the converter's output pulses through an optocoupler. It also conditions and counts the pulses using a 16-bit counter, IC4 and IC5, whose output bits IC7 and IC8 buffer. The circuit hooks the buffer outputs to the input port, STATUS port at 0x379h, of the printer adapter. The circuit inhibits or allows the pulses to the counter by controlling the output bit D2 (DATA port at 0x378h) of the printer port to enable or disable AND gate IC4. The PC reads the counter output a nibble at a time by controlling the address inputs of a two-to-four decoder (IC9) using D0 and D1 bits of the DATA port. The decoder outputs in turn control the buffer outputs.

A simple Turbo C program controls the remote current measurement. (Click here to download the program). The timer-tick interrupt, 0x1Ch, which occurs 18.2 times/sec and whose only task is to keep track of the time of day, generates the timebase. The timer-tick interrupt executes the TIMEBASE() routine to update the TIMER variable. To make a measurement, the printer port first disables the pulses to the counter by setting D2 of the data port to logic 0 and clearing the counter contents by setting D3 to logic 1 and resetting it to logic 0. To enable the pulses to the counter, D2 bit of data port is a logic 1. For each 0x1C interrupt, the TIMER increments. When the TIMER reaches 18 (in approximately 0.989 sec), disabling the D2 bit to logic 0 inhibits the pulses. Also at this time, the program corrects the timebase to 1 sec by applying correction factor CF=18.2/18. The ISENSE() routine sequentially reads the counter-output nibbles starting from LSNIBBLE through the status port by applying addresses 0x00 to 0x03 to the decoder. The program applies the correction factor to the values and displays the value of the sensed current CURRENT. The program sets the TIMER variable to zero and clears the counters. The unit is now ready for another measurement cycle. (DI #2550)

Loading comments...

Write a Comment

To comment please Log In

FEATURED RESOURCES