Keyboard data-acquisition system is cheap and simple

The most important criteria of a data-acquisition system for college science laboratories are simplicity and price rather than precision or speed. The data-acquisition system in Figure 1 offers adequate precision of less than 0.5% and speed of 1 Hz to replace the outdated laboratory chart recorder in student laboratories. You can install the system in 5 sec, operate it with a single toggle switch, and construct it for approximately $40. The only additional equipment necessary is a computer running Excel and an ATbus (not Universal serial bus), keyboard.

The system is simple to operate. After you install it between the keyboard and the PC, the keyboard functions normally until you close the toggle switch, which puts the circuit into "acquire" mode. The system then bypasses the keyboard and "types" data into an Excel spreadsheet column at the rate of 1 point/sec. When you switch off the system, the circuit finishes sending the current data before returning control to the keyboard. The slow sampling rate gives Excel time to replot an entire column of data and thus appear to be charting in real time.

The central IC in the circuit is the PIC12C671-04 µC, IC2 , which has an onboard 8-bit ADC. The circuit configures this µC to receive an analog voltage through the A/D pin. Because laboratory instruments output 1V full-scale and the ADC's internal reference is set for 5V full-scale, a rail-to-rail single-supply op amp, IC1 , provides a gain of 5. The op amp's feedback circuit also acts as a lowpass filter. The system has acceptable offset of –1.2 bits and displays excellent linearity; the coefficient of determination, R2 , equals 0.99998.

Because no pins are available for external clocking, the circuit allows the PIC µC to run at approximately 4 MHz using its internal RC oscillator. However, this oscillator is not a sufficiently accurate timebase for even 8-bit precision, so an external 16.384-MHz oscillator-divider, IC4 , produces a 64-kHz waveform that feeds into the Tmr0 pin of the PIC. The combination of a divide-by-256 prescaler and the appropriate period loaded into Timer 0 provide an accurate 1-sec interrupt.

The PIC µC "types" to the computer by outputting signals that emulate the keyboard via the Clk and Dat lines of IC2 . These pins duplicate the wired-OR electrical characteristics of the keyboard interface. When the data-acquisition system is active, the keyboard must not connect to the computer. The circuit fulfills this requirement using analog switches inside IC3 in the keyboard clock and data lines. The µC controls these switches using the Sw signal.

The keyboard line powers the entire circuit, and the circuit shields the handle of the spst switch as a protection from static electricity. By downloading the source program for the PIC, you can then compile under MPLAB 4.12 or use the .hex file. (DI #2478)