Transistors Q1, Q2 toggle control between the first two 7 segment displays and Q3, Q4 between last two 7 segment displays on each half cycle of the internally generated clock in the GreenPAK.

Figure 1. Top Level Schematic
The IR sensor consists of an infrared transmitter LED and infrared receiver LED. The two are shielded from each other as shown in the figure 2.

Figure 2. Infrared sensor
Good sensor design ensures predictable and reliable operation. Here are some important notes:
For infrared receiver to receive the light, a reflecting tape is attached on the Fan. When fan made one revolution the light is reflected from the tape and is received by the receiver LED. The number of times it is received in half minute will be equivalent to the RPM of fan (since both rising and falling edges triggers the counters). In order to speed up the process, 8 pieces of tape may be attached on fan. This helps calculate the RPM with 8x faster timing (i.e. 3.75 sec). The piece of tape must be attached so that the light is properly reflected during each revolution of the fan.
The GreenPAK design code is done in three GreenPAK chips.
There are two circuits that can be used for the clock: internal oscillator, or crystal oscillator (both files are attached and either can be used). Each circuit consists of a 4.25 sec timer. It generates a 3.75sec “high” time, and a 0.5sec “low” time for the “Enable sensor input for counters” signal.
This means the sensor counters remain enabled for 3.75sec, and for 0.5sec the 7 segment display remain frozen at the final output.
When an internal oscillator is used, the connections of pin 16 and pin 17 in schematic are not required. However, for better accuracy over varying ambient temperatures, the crystal oscillator option should be used.
The design can be configured for counting revolutions during a particular time, but the revolution number cannot exceed beyond 9999.
Normally a high is present at Pin 2, and whenever the infrared is reflected back from the tape (8 times every cycle), a momentarily low is observed. The rising and falling edges are both detected and if the 3.75 sec timer is enabled, it is passed on to the first counter block.

Figure 3. Reflecting tape for infrared beam interruption
In order to tradeoff between sample time and accuracy we can vary the measurement interval of the tachometer (from 3.75 sec). It is due to the fact that some application requires higher accuracy like industrial motors whose rpm needs to be maintained at fix speed, based on the present speed inputs.
For these type of applications a more accurate reading is required which can be obtained by increasing the sample time.
However, some applications are OK with less accuracy but a faster update rate is better, like measuring rpm of car engine.
This can be done by varying the time interval of the reading from 3.75 sec time to some higher/lower value. This can be achieved by changing the counter CNT0 and CNT1 values. The display time can be varied by changing the CNT5 and CNT6 values. It must be noted that CNT5 and CNT6 must have the same values.
There are two BCD counters implemented in each of the other two GreenPAK SLG46533V, each of them is a countdown counter. The incoming clock signal is from the sensor data (passed during the 3.75 sec time). The counter decrements during every sensor interrupt received. The 2nd counter starts the third counter in the other chip.

Figure 4. BCD counters in SLG46533V

Figure 5. BCD to seven segment converter
This part of the code converts the four bit BCD code to seven segment display. The selection between two 7 segment displays is also made during each cycle of the clock.
All the counters reset at 0101 (equivalent to decimal 10 using negative logic). All the counters also reset when 3.75sec has elapsed. Counter 1 represents least significant digit and counter 4 represents most significant digit.
The relation between the first three counters is tabulated below. The first two of them is implemented in one chip and the third one is implemented in other chip.

Figure 6. Display of Optical Tachometer
.png)
Figure 7. BCD to seven segment converter
Table 1 shows how first two counters starts counter 3. The counter 4 increments whenever counter 3 reaches its limit as tabulated below.
| Counter 3 | Counter 4 |
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> | 1111 |
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> | 1110 |
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> | 1101 |
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> | 1100 |
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> | 1011 |
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> | 1010 |
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> | 1001 |
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> | 1000 |
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> | 0111 |
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> | 0110 |
Table 1. Relation between counter 3 and counter 4
| Counter 1 | Counter 2 | Counter 3 |
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> |
1111 | 1111 |
| 1110 | ||
| 1101 | ||
| 1100 | ||
| 1011 | ||
| 1010 | ||
| 1001 | ||
| 1000 | ||
| 0111 | ||
| 0110 | ||
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> |
1111 | 1110 |
| 1110 | ||
| 1101 | ||
| 1100 | ||
| 1011 | ||
| 1010 | ||
| 1001 | ||
| 1000 | ||
| 0111 | ||
| 0110 | ||
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> |
1111 | 1101 |
| 1110 | ||
| 1101 | ||
| 1100 | ||
| 1011 | ||
| 1010 | ||
| 1001 | ||
| 1000 | ||
| 0111 | ||
| 0110 | ||
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> |
1111 | 1100 |
| 1110 | ||
| 1101 | ||
| 1100 | ||
| 1011 | ||
| 1010 | ||
| 1001 | ||
| 1000 | ||
| 0111 | ||
| 0110 | ||
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> |
1111 | 1011 |
| 1110 | ||
| 1101 | ||
| 1100 | ||
| 1011 | ||
| 1010 | ||
| 1001 | ||
| 1000 | ||
| 0111 | ||
| 0110 | ||
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> |
1111 | 1010 |
| 1110 | ||
| 1101 | ||
| 1100 | ||
| 1011 | ||
| 1010 | ||
| 1001 | ||
| 1000 | ||
| 0111 | ||
| 0110 | ||
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> |
1111 | 1001 |
| 1110 | ||
| 1101 | ||
| 1100 | ||
| 1011 | ||
| 1010 | ||
| 1001 | ||
| 1000 | ||
| 0111 | ||
| 0110 | ||
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> |
1111 | 1000 |
| 1110 | ||
| 1101 | ||
| 1100 | ||
| 1011 | ||
| 1010 | ||
| 1001 | ||
| 1000 | ||
| 0111 | ||
| 0110 | ||
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> |
1111 | 0111 |
| 1110 | ||
| 1101 | ||
| 1100 | ||
| 1011 | ||
| 1010 | ||
| 1001 | ||
| 1000 | ||
| 0111 | ||
| 0110 | ||
| 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> 1111 -> 1110 -> 1101 -> 1100 -> 1011-> 1010 -> 1001 -> 1000 -> 0111 -> 0110 -> |
1111 | 0110 |
| 1110 | ||
| 1101 | ||
| 1100 | ||
| 1011 | ||
| 1010 | ||
| 1001 | ||
| 1000 | ||
| 0111 | ||
| 0110 |
Table 2. First relation three BCD Counters
This tachometer was tuned by first matching its RPM against a Hall Effect based tachometer, and the results are well matched up to the tenth digit. Because the Hall Effect based tachometer gave false readings at slow fan speeds, this is where this GreenPAK design is superior. The design can also be used to build an RPM measuring instrument based on a rotary encoder.
Name: Bilal Ahmed
Background: Bilal Ahmed received an MS in Electronics Engineering from NED University, Karachi. He has more than 10 years of experience in PLC, SCADA, Data acquisition, Industrial automation, Robotics and Embedded systems. Currently he works as Head of Embedded systems and Robotics in HF Electronics.
Contact: appnotes@silego.com