## MikroElektronika

The CD4011 will be our “show-and-tell” IC to cover the main characteristics of digital circuits. It is a 14 pin DIL package. The pin-out is shown in figure 7.4a. Note the small half-round slit on one end of the IC. It identifies pin 1. Pins 7 and 14 connect to a supply (battery or DC power supply). Negative is connected to pin 7. Positive is connected to pin 14.

There are four logic NAND gates in a CD4011 IC. Each has two inputs and one output. For gate N1 the inputs are pins 1 and 2, and output is pin 3. The symbol for a NAND gate is displayed in figure 7.4b. The inputs are marked A and B and output is F. The supply voltage can be up to 16v and as low as 5V. The output will deliver up to 10mA at 12v but this is reduced as the supply voltage is reduced.

Figure 7.4b shows the truth table for a NAND gate. It shows the output voltage (voltage between F and ground) with different input states. Because there are only two voltages for every pin, we call them states, with logic zero when the voltage is zero, and logic one when the voltage on the pin is the same as the supply voltage.
From this we can read the second row of the truth table: if logic zero is on both input pins, output is logic one, third row is similar: if the first input is one, and the second one is zero, output is logic one, fourth row: if the first input is zero, and the second one is one, output is logic one. Fifth row is different, since both of its inputs are one, the definition of NAND gate states that the output is zero.

Fig. 7.4: a – 4011 pin placements, b – symbol and the truth table for NAND gates,

Logic circuits have many applications, but their main use is in computer circuits.
The following circuit is a simple example to show how the gates can be connected to produce a project that turns on a globe when a finger is placed on a “touch pad.”
The globe turns off after a period of time, determined by the value of the 470u and 2M2 resistor.

The operation of a NAND gate

Lets look at the functionalities of the following circuit. Both inputs of NI1 are connected to each other, so when input P is HIGH, output is zero. This logic zero is passed on to NI2, so no matter what is on the input 6, output 4 is logic one. This means that, between the ground and pin 4, the voltage is equal to 12V.

Fig. 7.5: Sensor switch using a 4011

Current flows through capacitor C and resistor R, so capacitor begins to charge. Every uncharged capacitor behaves like a short circuit. Because of that, when 12V appears on pin 4, it is also present on resistor R and also on pins 8 and 9. Pin 10 shows logic zero because of this which is connected to pin 6. From now on, logic zero on pin 5 is no longer needed because only one input needs to be zero for the output to be logic one. So input P is no longer needed. Gates NI2 and NI3 maintain logic zero on pin 4. How long will this last? It depends on the value of the capacitor and resistor. As the capacitor charges, the voltage on the resistor drops and when it falls to 1/2 of the supply voltage (6V in our case), NI3 detects a low on its inputs so logic one appears on pin 10. Since logic one is now on input 5 (no logic one present on P), and on input 6, output 4 is zero, capacitor dumps its charge via diodes on the inputs on pins 8 and 9 and the circuit starts operating again.

As we saw, for a certain period of time, which is equal to T=0.7*RC output of pin 10 was logic zero. During that time output E (pin 11) is logic one. For example, if R = 2M2 and C=47µF, for time T = 2.2*10^6*47*10^-6 = 94 sec from the moment impulse on input P subsided, voltage on output E is 12V.
The end result of our experiment is on diagram 7.5a. Short positive pulses appearing on P in the time t1 caused a  longer variable ulse on output E.
Schematic 7.5b displays this circuit which allows us to light a bulb using four NAND gates interconnected in the way shown on picture 7.5a.
The sensor is two copper (or some other conducting material) plates glued to some non-conducting material (plastics, wood, etc.) in close proximity to each other. So, when we touch the sensor with the tip of our finger, we close the circuit. 12V appears on input P, which in turn conducts the voltage to the output E, resistor R = 22k conducts base current and the bulb lights. When we remove our finger, output E will last for 94 seconds, after which it goes to logic zero and the light goes out.
Transistor T is selected so that its maximum allowed collector current is higher than the current of the globe.
(The globes current flow value is found by dividing its power by its voltage. For example, if its power is P = 6W and voltage is U = 12V, current through the globe is I = P/U = 6W/12V = 0.5A or higher. One thing you must remember with a globe is the starting or “turn-on” current. It is about six times the operating current and the transistor must be able to pass this current for the globe to illuminate.