• No results found

LM339 PIN DIAGRAM

In document Digital Tachometer Project Report (Page 33-41)

Pin 1 is grounded Trigger input is applied to pin 2 In quiescent condition of output this input is kept at + VCC To obtain transition of output from stable state to

8.1 LM339 PIN DIAGRAM

Fig 8.1: LM339 Pin Diagram

8.2 LM339 DESCRIPTION

These devices consist of four independent voltage comparators that are designed to operate from a single power supply over a wide range of voltages. Operation from dual supplies also is possible, as long as the difference between the two supplies is 2 V to 36 V, and VCC is at least 1.5 V more positive than the input common-mode voltage. Current drain is independent of the supply voltage. The outputs can be connected to other open-collector outputs to achieve wired-AND relationships.

34

8.3 LM339 PIN DESCRIPTION

Fig 8.3: LM339 Pin Description

8.4 WORKING

A dedicated voltage comparator will generally be faster than a general-purpose comparator pressed into service as a comparator. A dedicated voltage comparator may also contain additional features such as an accurate, internal voltage reference, an adjustable hysteresis and a clock gated input.

A dedicated voltage comparator chip such as LM339 is designed to interface with a digital logic interface (to a TTL or a CMOS). The output is a binary state often used to interface real world signals to digital circuitry (see analog to digital converter). If there is a fixed voltage source from, for example, a DC adjustable device in the signal path, a comparator is just the equivalent of a cascade of amplifiers. When the voltages are nearly equal, the output voltage will not fall into one of the logic levels, thus analog signals will enter the digital domain with unpredictable results. To make this range as small as possible, the amplifier cascade is high gain. The circuit consists of mainly Bipolar transistors. For very high frequencies, the input impedance of the stages is low. This reduces the saturation of the slow, large P-N junction bipolar transistors that would otherwise lead to long recovery times. Fast small Schottky diodes, like those found in binary logic designs, improve the performance significantly though the performance still lags that of circuits with amplifiers using analog signals. Slew rate has no meaning for these devices. For applications in flash ADCs the distributed signal across eight ports matches the voltage and current gain after each amplifier, and resistors then behave as level-shifters.

35

9.0 OVERALL CIRCUIT IN ACTION

36 The circuit diagram, though shown divided the into 3 individual units namely 1. Power unit

2. Signal conditioning

3. Microcontroller and Display,

they are, in actuality , part of an integral unit.

They share the same supply voltage +vcc = 5v and ground as shown by appropriate symbols and labels. We will see the entire system in depth now, but step by step.

As the portability of tachometer is not to be sacrificed at any cost, one portable power unit must be provided. This is accomplished using a fixed 9v dc battery and a voltage regulator. But this doesn't mean that use of ac mains is of no use. Actually, one rectifier circuit followed by the same regulator (as used with the battery powered supply) and some filtering components (also used in battery powered supply). But the main aim of a designer is not to sacrifice compactness, but usage of ac mains powered supply, requires a connecting cable to be carried all the time. This is not acceptable at all, if the circuit is meant to be compact as well as portable. One big disadvantage of using battery powered supply is the frequent drainage of battery. But we have overcome this issue using proper program code to save battery and perfect switch positioning which ensure the most efficient power handling. If battery is kept properly in a dry environment, may never get drained, still continuous use of the tachometer for say 2-3 hours may need the battery to be changed. This point is again explained in Test Points (chap 15 )

Now comes the signal conditioner. It can be visualized of consisting of an input, an output and a primary signal synthesizer. The principle operation of the project is simple, detection of light reflected from a rotating body. A bright white LED emits light continuously, but how do we sense it ? It is sensed by a photodiode. The sensitivity of photodiode should high. But in some cases, we may need to reduce it. Whenever light ray reflects, it is sensed by the photo diode, which was till now turned off with collector voltage Vc = +5v approx., is turned on giving a low signal (Vc = 0v ). These low signals which are analog in nature, are used to gate the the counter of the microcontroller. However, these pulses cannot be applied directly, as microcontroller only deals with digital data, that is either 1 or 0 . This job of digitizing the analog pulses is done by a op amp comparator, texas instruments lm339.When there is no reflection of light, photo diode is off, its collector voltage is Vc = +5v or greater than the logic high threshold of the microcontroller.

37 Thus when diode is off, it sends a +5v signal to the comparator, which compares this signal at the inverting terminal with a preset signal at the non-inverting terminal, which is deliberately set such that its less than the OFF state diode voltage (around +5v) and greater than the ON state diode voltage (a few milli volts). As the comparator detects a +5v which greater than the non-inverting threshold it gives an output voltage equal to +vsat = +5v (as stated before all components share the same vcc and ground). This is nothing but the logic1 of the microcontroller. Whenever light gets reflected from the rotating body, diode conducts and the inverting terminal voltage of the comparator is less that the non-inverting terminal threshold, giving output voltage = either -vsat or 0 (depends on whether -vee is grounded or not). As we need a digital signal, -vee is set to ground. Whenever pulse is obtained, comparator gives a logic 0.

This is how the comparator, which is the signal conditioner, does the job of smoothening, digitizing and amplifying (in odd sense).

The output of the comparator is connected to the pin number 15 of the microcontroller. As we have used the Timer register for external event counting (i.e. pulse counting in this case), these external events must occur at the external timer 1 interrupt pin which the pin number 15 in this case. This is set automatically when we set a timer x register as a counter in the TMOD register.

Note :- If timer x is set as a timer, then the event to be counted is not external, but the clock cycles which synchronize the microcontroller AT89S51.

In the TMOD register only, setting the last 2 bits of each nibble with proper combination we can use different modes. Out of 4 modes, we have used the MODE 2,8- bit auto reload mode. If the counter exceeds the value of 255 (FF)

, we increment a

register count so that after one roll over of the

TF1, if the counted pulse is 55, it means 155H pulses are counted. But this is an error as this 8 bit controller cannot be used to display a number which exceeds 255 (in fact we can display the number above 255, but it increases the complexity almost a 1000 times, and any rotating body is very less likely to be running at a speed greater than, say even a 200 RPS.

One 16 bit timer is used as a counter to count the number of pulses coming out of the comparator. A comparator to work properly, must have a pull up resistor at the output pin. If you look at our circuit diagram, you will not find any. This is because port 3 of the AT89S51 (at one pin of which comparator output is given) already has internal pull up resistors.

To calculate speed in RPS, the simplest way is to count the number pulses reflecting back from the rotating body for duration of 1 sec. To serve this purpose, the other timer is used as an internal delay timer. As stated before, in the TMOD register, if we reset the TMOD.7 or TMOD.2 bits (timer/counter control bits for timer 1 and 0

38 respectively), we set the respective timer in the timer delay mode. In this mode, the counter register (so called) is incremented by every clock pulse coming from the crystal which synchronizes the entire operations of the microcontroller. Out of the 4 modes, we have used the MODE1, the 16 bit counter. The delay scheme used is identical to the one used in chap 6 under the software delay scheme, except that here, instead of using a 8 bit register, we use a 16 bit timer to produce larger delay. As we need to have a 1 sec delay, using only 16 bit counter is not enough because maximum delay that can be produced with a 16 bit register with a clock of 11.0592 MHz (what we used), max delay is 1.085*10^6*65535 = 71msec. So we use another register with initial count 14H and decrement it every time TF0 rolls over, thus we get a delay of 1 sec. This is same as giving a 71 msec delay 14 times (0.071*14 = 1).

Now the final and the most important task to be done is the displaying of the counted pulses. The conventional persistence strategy for 7 seg LED is used. Here we first convert the number to decimal. As this is a 8 bit controller, maximum number is 3 digit only (255 or FFH). We first divide the number by 100, and we display the quotient. We first enable the MSB digit by enabling its transistor and disable all others. Then we find out the corresponding code for a given number depending upon whether the display is Common Anode type or Common Cathode type. These codes are usually pre stored in the program memory as look up tables and accessed using base + index addressing mode. Remember we do not display the number (or character) say 1 directly, but send its 7 seg code which nothing but a bit pattern depending on which of the a-g segments need logic 1 for CK display and logic 0 for CA display.

Once MSD is sent, we again set off the MSD transistor by giving a 0 base drive, we then divide remainder of the first result by 10 and again find the 7 seg code for the quotient. We now turn the middle digit transistor driver on, keeping all others off. We display the 7 seg code, wait for some time and again turn of the driver. And lastly, the remainder of the previous result is nothing but the LSD, whose 7 seg code is searched for and then sent out to corresponding digit by making that transistor driver on. Now the important question, If only one digit is getting ON at a given time, how does the display look continuous to our eyes? The answer is “Persistence of Vision”. Once the display subroutine is done, we repeat the process a number of times until a parameter in a register becomes zero. Microcontroller performs instructions almost within a microsecond, but our eyes can at max catch only 120 frames per second. However a, the display routine time is much smaller than the time for which 120 frames may last. Thus out eyes can virtually sense no change in the very fast turn ON and OFF of the display. Thus if the display routine is repeated for a finite duration, our eyes see the display as if it was a continuous one, due persistence of vision.

After completion of display, controller restarts the 1 sec time delay and counter and again displays the result. This process keeps on continuing as long as power is running. Thus very fast varying speeds, which are termed as dynamic speeds can be easily measured. This is a huge bonus.

39 In this way, our project, the Wide Range Digital Tachometer (WRDT) first converts the analog pulses into digital ones, then counts them for a perfectly set 1 sec duration, and immediately displays the result, ready to count for 1 sec again. The efficiency is in the higher 95’s as will be shown in the performance graphs (chap 10).

40

10. TACHOMETER CALIBRATION UNIT

In this chapter we will see the tachometer calibration unit. To calibrate he tachometer a rated DC shunt motor is used which is powered with a voltage supply of maximum 12v. The figure shows the physical appearance of the motor.

Fig 10.0.1: 12v DC motor (1000Rpm)

The armature and field are shunted and connected in parallel to supply voltage. The voltage supply is variable 0-12V DC power supply. Here by varying the armature voltage the speed variation in proportion is observed.

Fig 10.0.2: Circuit Diagram Va=Armature voltage

For Va=0V: Speed of motor = 0RPM = 0RPS

For Va=3V: Speed of motor = 250RPM = 4 OR 5 RPS For Va=6V: Speed of motor = 500RPM = 8 OR 9 RPS For Va=9V: Speed of motor = 750RPM = 12 OR 13 RPS Speed of motor = 1000RPM = 16 OR 17 RPS

41

In document Digital Tachometer Project Report (Page 33-41)

Related documents