Maker Pro

Incremental Encoder from HDD Motor


This project shows how to create an incremental encoder from an HDD motor using GreenPAK™ IC.

Below we described steps needed to understand how the solution has been programmed to create an incremental encoder. However, if you just want to get the result of programming, download GreenPAK™ software to view the already completed GreenPAK Design File. Plug the GreenPAK Development Kit to your computer and hit the program to design the solution.


Encoders are widely used to translate rotary or linear motion into a digital signal. They are useful for monitoring or controlling motion parameters such as speed, rate, direction, distance or position. These parameters are necessary for countless applications that translate motion parameters into information like motor feedback, linear measurement, and X-Y positioning. Encoders can be found everywhere from complex computer numerical control (CNC) machines to computer mice. There are several types of rotary encoders. Absolute and relative (incremental) encoders are the two main types. An absolute encoder outputs a value proportional to the current state, whereas an incremental encoder outputs a change in state and its direction.

To create a reliable, almost unbreakable incremental encoder, an HDD motor designed to operate over thousands of turns can be a good solution. All you need is to connect it to a GreenPAK IC.

Brushless DC Motor Theory

Any BLDC motor has two primary parts: the rotor, the rotating part; and the stator, the stationary part. Important components of the two parts are the stator windings and the rotor magnets.

In an outer rotor design, the windings are located in the core of the motor. The rotor magnets surround the stator windings (see Figure 1).


Standard 3-phase circuits take on two major forms with names that represent the way in which the single-phase networks are connected: a Star-connected network, also known as Y-connected, symbolized by the letter Υ; and a Delta connected network, symbolized by Δ (delta). In our case, we will be looking only at the Star type connection.


GreenPAK Circuit Design Analysis

Let’s start from the left side of the design shown in Figure 3. We have two analog comparators (ACMPs) connected to the appropriate inputs to monitor voltage on the motor coils. Next, we have two delays (DLYs) configured for both edges to filter any possible noise from the inputs. Two DFFs take on the role of signal sequence-dependent switches. To understand this better, note that all design operation is based on a signal race between input Pins 6 (IN#2) and 3 (IN#1). For example, if the signal on the input of ACMP1 reaches the threshold before ACMP0, only DFF2 will be ready to switch to a HIGH state. All we need then is to wait for the HIGH signal from ACMP0’s output, and vice versa. Thus, we will have pulses on Pin10 (Increment) or Pin12 (Decrement). From that point, we have an operational rotation encoder.

As you can see in Figure 3, PIN9 is named Buzzer. Each time a pulse appears on DFF2 or DFF3, cells PDLY and CNT3 / DLY3 generate a 1 ms pulse for a BPT-14 model piezo sound transducer. This creates a soft clicking sound while the encoder is rotating and helps the user to understand how much the encoder was rotated.


Circuit Operation

In Figure 4 you can see the way the coils are connected. We use two Schottky diodes, D1 and D2, to limit negative (relative to GND) voltage phase. To define the Pinout of the HDD motor you can simply measure coil resistance with a multimeter. To properly connect the motor to the GreenPAK CMIC as shown in Figure 4, we measured the resistance between coils until we found 3 separate coils (1.9 Ω in our case) and the common point “Q”.

The functionality waveform of a real HDD motor encoder circuit created in GreenPAK Designer is shown in Figure 5 and Figure 6, in which Channel1 (yellow / top line) ─ PIN3 (IN#1), Channel2 (light blue / 2nd line) ─ Pin6 (IN#2), Channel3 (magenta / 3rd line) ─ Pin10 (Increment), Channel4 (blue / bottom line) ─ Pin12 (Decrement). As can be seen in Figure 5 and Figure 6, we can easily define which output channel to toggle by the sequence of input Pins 3 (IN#1) and 6 (IN#2).



GreenPAK IC’s are readily suitable for this project because of their low current consumption, small package size, and flexibility in operation. The benefit of such an encoder is its reliability because of the absence of direct electrical contact. Its operation is very similar to an optical encoder except that the motor will give some threshold in the speed of rotation to start detecting a useful signal.

Note: for proper circuit operation, do not forget to configure the input and output Pins correctly. As shown in the schematic, Pins 3 and 6 inputs are to be configured as Analog input and all outputs as 2x Push Pull with the largest possible current drive mode.

Related Content


You May Also Like