Advertisement

Circuit description

Fig. 1 shows the circuit of the microcontroller based tachometer. The tachometer comprises AT89C2051 microcontroller, ULN2003 high-current Darlington transistor array, CA3140 operational amplifier, common-anode 7-segment (4-digit multiplexed) display and its four anode-driving transistors.

The AT89C2051 is a 20-pin, 8-bit microcontroller of Intel’s 8051 family made by Atmel Corporation. Port-1 pins P1.7 through P1.2, and port-3 pin P3.7 are connected to input pins 1 through 7 of ULN2003. Port-1 pins are pulled up with 10-kilo-ohm resistor network RNW1. They drive all the seven segments of the display with the help of internal inverters.

Fig. 4: A single-side PCB layout for microcontroller based tachometer
Fig. 4: A single side PCB layout for microcontroller based tachometer

 

Fig. 5: Component layout for the PCB
Fig. 5: Component layout for the PCB

Download PCB and component layout PDFs: click here
Port-3 pins P3.0 through P3.3 of the microcontroller are connected to the base of transistors T1 through T4, respectively, to select one digit out of the four at a time and to supply anode-drive currents to the common anode pin of respective digit. Pin configuration of transistor BC557 is shown in Fig. 3.

When pin P3.0 of microcontroller IC1 goes low, it drives transistor T1 into saturation, which provides the drive current to anode pin 6 of 4-digit, 7-segment, common-anode display DIS1. Similarly, transistors T2 through T4, respectively, provide supply to common-anode pins 8, 9 and 12 of DIS1. Thus microcontroller IC1 drives the segment in multiplexed manner using its port pins. This is time-division multiplexing process.

Segment data and display-enable pulse for display are refreshed every 5 ms. Thus, the display appears to be continuous even though it lights up one by one.

Switch S1 is used to manually reset the microcontroller, while the power-on-reset signal for the microcontroller is given by C1 and R6. A 12MHz crystal is connected to pins 4 and 5 of IC1 to generate the basic clock frequency for the microcontroller. The circuit uses a 6V battery for power supply or alternatively a mains derived low voltage supply. An actual-size, single-side PCB layout for the tachometer (Fig. 1) is shown in Fig. 4 and its component layout in Fig. 5.

Construction & testing

The source code of this article can be downloaded below at code file ‘tacho.hex.’ Using a programmer, load the code into the new chip AT89C2051. (Refer the May 2005 issue of EFY for article on programmer for 89C51 and 2051.) Then, fit it into the circuit board and after powering up the circuit, test it.

For testing, point the probe using torchlight for illumination of the rotating object. For fans, use the light from behind. Hold the probe firmly so as to provide a steady, bright illumination on the object. Even an LED pen torch could be used here. Avoid the fluctuating background light from sources such as tubelight.

Software

The software is written in Assembly language and assembled using 8051 cross-assembler. It is well commented and easy to understand. It uses AT89C2051’s internal timer for measuring the period of one cycle of the rotation in units of 100 microseconds. Thus if the speed is 1500 rpm, it is 25 rps, and the time taken for one cycle is 40 ms.

The timer uses an interrupt to count overflows every 100 microseconds and so the number counted by the timer program in this case will be ‘400.’ This is divided by ‘600,000’ (so many 100/µs present in a minute), giving a result of ‘1500.’ This gives the rpm. These digits are displayed on the 4-digit, 7-segment display. To perform the division, subroutine UDIV32 is employed, which is a standard subroutine available for 8051 family for 32-bit number by 16-bit number division. It has an accuracy of 5 rpm in a 6000rpm count.


Download source code: click here

The article was originally published in July 2013 and has recently been updated.

Advertisement


5 COMMENTS

  1. I am happy to read these projects and please need or mentioned why u used value of register,capacitor and other component ?another values r used or this values are enough ?how to understand this is enough values?

  2. Sir,
    I am third year electronics engineering poly student. I am doing this digital tachometer as my 3rd year project. I completed everything. I even loaded hex file into the micro controller. But its not working. Please help. Is there any modification in program or hardware? Plz help.

SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here