DATE: May 6, 1999

TO: Mr. Julien Pechmezac and Professor Dean Neikirk

FROM: Gustavo Espinosa and Donnie Garcia

SUBJECT: Completion report on our project to create a computer interfacing circuit to control LEDs for use with a chemical sensor

ABSTRACT:

Our project, the development of a computer interfacing circuit to control LEDs for use with a chemical sensor, has been produced over the course of the semester. The required specifications include adding no additional hardware, using as many LED colors as possible, making the circuit as universal as possible, making the outputs latch, developing a sequence to enable the operation of the LED controller, and making the circuit battery operated. All of these goals were met in the development of our design. To accomplish our goals, we used information gathered from several sources such as Craig Peacock’s web site on interfacing computers, Anthony Bishop’s relay handbook, and several conversations with Dr. Neikirk. With the knowledge we gained, we developed a product that is compatible with all of the systems used in conjunction with the chemical sensor. One of the only limitations with our current design is the amount of current we are drawing from the voltage source. The current scheme draws a significant amount of current from the batteries, which would cause them to drain too quickly. In response to this problem, we wrote code using VHDL that would condense our circuit into a simple programmable gate array (PGA). The PGA would not draw as much current as the components it would replace. The implementation of this more efficient system is left for future work.

INTRODUCTION

Our project facilitates the data acquisition of the chemical sensor by developing a computer-to-hardware interface to control LEDs. The chemical sensor or electronic tongue is a small device built on a silicon wafer. The wafer has a grid of micromachined pits in which polymer beads are placed. These beads change color when they come in contact with different chemicals. LEDs illuminate the grid on the silicon wafer to facilitate optical capture by a video camera. Software then analyzes the change in color from the gathered images to distinguish what chemicals the sensor came in contact with. The result of our project is a device that receives an input signal from the computer and produces an output that controls LEDs. The device will be used in conjunction with other devices such as a video camera to acquire data from the chemical detector. We made it universal so it can be used with many different computer types. Our final device also includes decoding and latching features that allow the user to run other devices such as a printer from the parallel port without affecting the outputs of the control circuit. We also incorporated relays that will allow the user to control any type of load with the same control circuit. These additions increase the usefulness and effectiveness of our device.

RESEARCH

The theory we incorporated in our project can be separated into three main parts. These include our research on the parallel port and relays, the TTL (transistor-transistor logic) components, and CP-Clare’s relays.

Parallel Port and Relays

Through our research, we decided to use the computer’s parallel port to provide an interface between the computer and the control circuit for the LEDs. This decision led us to our main source, "Interfacing the Standard Parallel Port" by Craig Peacock. This web page contains several sections that we have found useful in the realization of our project. The introduction outlines a clear algorithm for outputting a byte to a printer. In the hardware properties section, we learned the pin assignments for the 25 pin parallel port connector as shown in Table 1.

We used these assignments to successfully connect our control circuit to the parallel port. This article also outlines how much current the parallel port can sink or source. Parallel ports output at TTL logic levels (5V for a "high" signal and 0.1V for a "low" signal) and can sink or source 4-16mA of current. Since drawing too much current can damage the computer’s hardware, the designer should not rely on the parallel port’s current to power a device. We used this information to ensure that our device does not draw too much current from the computer’s parallel port. From this article, we also learned about port addresses and software registers. The article provided a program that can write to the parallel port’s data pins. The program was helpful in implementing a control scheme for the LEDs. The information from this source helped us understand how the parallel port works and has contributed to the completion of our project.

Another important source was Solid-State Relay Handbook with Applications by Anthony Bishop. This book allowed us to understand some of the basic principles behind the operation of solid state relays. It also helped us choose which relay would be more applicable towards our project. We had a choice between a solid state and electromechanical relay. We chose to use the solid state relay because of the reliability of solid state technology. We also considered the fact that we needed to drive the relay through logic that is controlled by a computer. This logic would not be able to supply enough current to operate an electromechanical relay. We also had to choose between an opto-coupled and a transformer-coupled solid state relay. This choice was facilitated by the information we found in the book. Since we are using a DC source to drive our circuit, we would have to implement an oscillator that would allow us to properly use the transformer. The added oscillator would unnecessarily complicate our design, so we chose to use the opto-coupled relay since it would perform better under our circuit conditions. With the information we found, we were able to make educated decisions about the relay we used.

TTL Components

In the realization of our project, we referred to the TTL logic book to choose our components and learn their behavior. The TI 74138 is a 3 to 8 line decoder. This decoder has two active low and one active high enable inputs. To place the decoder in the decoding mode you must place G1 high and G2A or G2B low. Once in this mode the decoder takes the inputs A, B, and C and outputs a low signal to one of the corresponding outputs Y(0) - Y(7). To output to pin Y(3), you would need the sequence shown in Table 2. With this sequence, outputs Y(0) - Y(2) and Y(4) - Y(7) will remain high while Y(3) becomes low.

 G1 G2A + G2B C B A Y (3)
 L L L H H L

Table 2: Y(3) Sequence

Other specifications of the 74138 decoder are that the inputs are fully buffered, the decoder can take up to 7 volts as the supply voltage, and the minimum voltage it takes to switch the input on is 0.8 volts. It also typically drains about 40mA, but this value is dependent on Vcc (supply voltage).

The TI 7474 is another component we used in the realization of our device. The 7474 is a dual D flip-flop with individual clocks for each input. Once the preset and clear for the individual flip-flops have been set high the output Q will change state at the falling edge of a clock. This is ideal for latching. The 7474 has a maximum Vcc of 7 volts. It sinks about 10mA depending on Vcc. The information we gathered from the TTL data book was very valuable in the final design of our circuit.

CP-Clare's Solid State Relays

The last component we used in the implementation of our circuit is a solid state relay. We had some difficulty locating the relays we wanted because most of the ones available at local electronics stores were too bulky for our application. We managed to find some small IC (integrated circuit) relays on the web. They are 8 pin, dual, opto-isolated, normally-open relays (LAA 110) manufactured by CP-Clare. The advantage of these relays is that they are smaller than our other components, yet they have the same performance as some of the bulkier relays sold at electronics stores. They are opto-isolated, so that the circuitry at the control inputs is not connected to the circuitry at the output through a hard-wire connection. Instead, a light emitting diode that is activated at the input triggers the output. This allows the user to control any kind of device such as a motor or LEDs without having to worry about damaging the control side of the relay because of voltage or current spikes at the output. The relays we chose can handle a maximum of 350V at the output. They are also designed to handle up to 100mA at the input. The LAA110 is a dual chip in that it has two sets of control inputs and outputs. This feature allowed us to minimize the area being used in our design by using only two relays instead of four to control the LEDs. Another specification of the chip is that the output switch is normally open. The only time the voltage connected at one of the output pins is going to be transferred to the LED is when the input is high. In normal operation, the LEDs will be off unless the user turns them on.

SOLUTION

Using our research and the data we collected about various components, we completed the design of our circuit. Our first goal was to build a circuit that enables our device when a specific input from the parallel port is received. The enable signal must then be latched so a change in the state of the parallel port pins will not affect the rest of our design. The first stage consists of a 74138 decoder. This component is used to decode an enable signal from the parallel port. After researching ASCII (American Standard Code for Information Interchange) codes, we found that the printable characters begin at 32 (decimal). Using this information, we placed parallel port pins 7 — 4 on the first decoder. When pins 7-0 have the code 00011000, the parallel port is at 24 (which is below 32) and the Y(1) output of the "enable" decoder becomes low. This is accomplished by placing pins A, B, and C of the decoder to parallel port pins 4, 5, and 6. G2A and G2B are placed on pin 7 and G1 is connected to Vcc. Pin 3 of the parallel port is connected to the clock of a 7474 (D flip-flop). The Y(1) output of the decoder is connected to a D1 input to a 7474. After pins 7-0 are placed at 00011000 the next code 00010000 strobes the clock of the flip-flop, and the output of the 7474 is latched. At this point, pins 4, 5, and 6 can be changed without affecting the rest of our circuit.

The second stage of our circuit must take signals from the parallel port to turn on and latch the outputs. The enable signal from the first part of our circuit is placed on the G2 pin of two 74138 decoders. The first decoder, or the clock decoder, uses pins 4, 5, and 6 as its A, B, and C inputs as shown in figure 1. The outputs of this decoder Y(1)—Y(7) are connected to the clocks of the

Figure 1: General layout of final control circuit design

7474s. This decoder is used to tell the flip-flops when to latch. The inputs to the 7474s come from the LED decoder. The LED decoder has parallel port pins 0 — 2 connected to the inputs A, B, and C. To turn on and latch the LEDs, a proper signal must be sent to the LED decoder and then, the proper clock signal must be sent to the clock decoder to latch the output. Once the user is done placing the LEDs in the proper state a disable code can be sent to relinquish control of the parallel port to another device. The code used to accomplish the disable is 00001000 then 00000000. This strobes the clock of the enable flip-flop changing the enable signal of the clock and LED decoders. The parallel port can then be changed to any state except the enable-state without affecting the output of our device. A sample input sequence is shown in Table 3.

Table 3: Sample Parallel Port Sequence

The outputs of our flip-flops are connected to relays. The relays allow loads of up to 350 volts to be attached to our control device. Currently we have 4 'AA' batteries connected as the power supply to our circuit and LEDs. To solve the problem of having as many LED colors and configurations we came up with the idea of an LED board that is separate from the rest of our device. This board is attached to the control circuit and is interchangeable.

RESULTS

One of the problems we encountered was the use of batteries to run the circuit. Our circuit, as stated previously, incorporated three 74138 decoders, three 7474 D flip-flops, two LAA110 relays, and four different color LEDs. All of these components added a significant current drain on our power supply. When the chips and LEDs were biased at 6V and all of the LEDs were on, the total current drawn from the power supply was 380mA. This value decreased by 60mA when the circuit was biased at 5V which is half a volt higher than the minimum needed to run the chips and LEDs effectively. The amount of current drawn from the power supply was higher than expected. We were concerned with the high current demand from the batteries.

Four 'AA' batteries connected in series can provide the needed voltage of 6V, but only 2,850 MAH (milliamp-hours). The MAH rating system means that we can run the batteries at 2.85 amps for one hour before they would not be able to provide the expected performance or we could also run them at 1.4 amps for two hours. For our project, this implies that we could run all four batteries a maximum of seven hours before they would no longer be a reliable source. The only problem with the specification is that we need at least 4.5V to run the circuit effectively, and we are not sure how long the battery can be used before this threshold is reached. Some alternatives include using other forms of batteries that can withstand the current demand. "C" size batteries for example can run for 7,500 MAH while "D" size batteries can run for 15,000 MAH. The type of batteries described above are alkaline, but there are other forms that allow the user to run the circuit for longer periods of time before the performance of the battery decreases. Another possibility is the use of a lead acid battery that provides 6V and 12,000 MAH. By using a lead acid battery, we can run our circuit effectively for 30 hours. The advantage of the lead acid battery is the relatively small size compared to the four "D" size battery configuration discussed earlier [3].

Another measurement of concerned is the amount of current being drawn from the parallel port. This is an important parameter because the parallel port can at most source 16mA to the circuit. If we exceed this amount, we might cause damage to the computer's hardware. In our final design, the parallel port's signals are being used to drive the three decoders. We made measurements on the amount of current we were drawing from the parallel port in this configuration and found that we were drawing 13mA from the parallel port. Even though this number is high, it is the absolute maximum that will be drawn from the port, so we are not concerned with damaging any of the computer's parts.

Due to the extensive testing of our design, it is currently realized on a protoboard. We will strive to implement our circuit on a more permanent dip pin board if time allows.

 

 

CONCLUSION

Our project specifications included adding no additional hardware to the computer, making the circuit battery operated, making the design as universal as possible, and having as many different LED colors as possible. In addition to these specifications, we included other provisions to make our implementation more effective. These included forcing the LEDs to latch and developing a sequence of inputs that would enable our circuit. The parallel port can then be used for other applications such as printing without affecting the output of our device. The use of relays has also allowed our device to control a wide variety of loads aside from LEDs.

By the end of the semester, we had met all of the specifications that were given to us. Our device can be run from a 6V battery supply whether it be from 4 "AA" batteries in series or one 6V lead acid battery. Our design can also be run from any PC because the commands to the parallel port can be realized using DOS. We also added no additional hardware to the computer. With our LED board design, the LED colors can be easily changed or grouped. With the use of 74138 decoders and 7474 D flip-flops, we were able to latch the outputs and implement an enable signal that would allow the user to use the parallel port for other applications without affecting the outputs to the LEDs. The relays allow us to attach individual power supplies up to 350V to separate loads.

From our results, we realize that our circuit does have limitations. Though it is battery operated, there is a limitation on how long our device will last. The decoders and flip-flops we use draw too much current. Realizing all of the chips on a microprocessor or PGA can lower our current draw and further condense our design. If the user were to develop all of the logic on one microprocessor, then the whole circuit could be built on a very small area. By reducing the area the components take up, the overall electronic tongue can feasibly be made into a portable device that can be taken by the user to any location where a chemical reading is necessary. We have written VHDL code that can be synthesized by Xilinx software. The software can in turn be realized on a PGA. This code has been simulated, but the implementation of a PGA is beyond the scope and time of our project.

 

 

REFERENCES

[1] "Interfacing the Standard Parallel Port," http://www.senet.com.au/~cpeacock, March 1, 1999.

[2] Bishop, Anthony, Solid-State Relay Handbook with Applications. Indianapolis, IN: Howard W. Sams & Co, 1986.

[3] "Digital Logic," http://www.ti.com/sc/docs/products/logic/index.htm, April 21, 1999.

[4] "Popular Alkaline Batteries," http://www.duracell.com/Our_Products/index.html, May 1, 1999.