Rotary encoder detection circuit and detection method

By designing a rotary encoder detection circuit and filtering the burr signal using a monostable circuit, the problem of instability of the output pulse of the mechanical rotary encoder is solved, extending the service life and improving signal stability.

CN120043565AActive Publication Date: 2025-05-27ITECH ELECTRONICS NANJING
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202510519445.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-05-27
Estimated Expiration
2045-04-24

AI Technical Summary

Technical Problem

After a long time of use, the mechanical rotary encoder will be unstable due to wear and environmental factors of the mechanical contacts, resulting in unstable output pulses, which will cause interference jitter, affect counting and judgment, and have a short service life.

Method used

A rotary encoder detection circuit is designed, including a rotary encoder circuit, a monostable circuit and a subsequent circuit. By detecting the signal of the contacts in the non-contact area, the monostable circuit is used to filter the glitch signal to improve signal stability.

Benefits of technology

It extends the service life of the rotary encoder, eliminates burr signals, improves the efficiency of software judgment, and is low in cost and simple, stable and reliable in the circuit.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120043565A_ABST
    Figure CN120043565A_ABST
Patent Text Reader

Abstract

The invention discloses a rotary encoder detection circuit and a detection method, the circuit comprises a rotary encoder circuit, a monostable circuit and a post-stage circuit, the rotary encoder circuit has two groups of signal outputs, each group of signals comprises a signal with a contact in a contact area and a signal with a contact in a non-contact area, each group of signals is used for shaping the output signal of the rotary encoder circuit through one monostable circuit, and the post-stage circuit is used for processing the output signal of the monostable circuit of which the contact is located in a non-contact area and detecting the rotation direction and the rotation amount of the rotary encoder. According to the rotary encoder detection circuit and the detection method provided by the invention, a traditional method for detecting an electric signal generated during contact of a mechanical contact is changed into a method for detecting a signal generated during non-contact of the mechanical contact, so that the service life of the rotary encoder is greatly prolonged, the compatibility is good, the cost is low, and the circuit is simple and stable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of rotary encoder detection, and particularly relates to a rotary encoder detection circuit and a detection method. Background Art

[0002] Rotary encoders are currently widely used due to their convenient operation and sensitive response. Commonly used rotary encoders are divided into mechanical and photoelectric types. The photoelectric type has a high cost and is used in high-speed and high-precision applications. The mechanical type has a low cost and is generally used in consumer products, panel inputs, etc. Inside the mechanical type, there are two sets of contacts. One set is the static contacts fixed on the base, and the other set is the moving contacts that rotate with the central axis. When the rotary encoder rotates, it drives the moving contacts to slide across the static contacts, generating a pulse signal output. Relying on these two sets of mechanical contacts, mechanical quantities such as rotational angular displacement and angular velocity are converted into electrical signals and output as digital quantities in pulse form. Common mechanical rotary encoders have single-channel and dual-channel outputs. The single-channel output only outputs a string of pulses. The dual-channel outputs are respectively called A and B, and the two outputs are orthogonal with a phase difference of 90 degrees. When rotating in different directions, the phase sequence will also be different. The receiving device processes these two signals to obtain the rotation direction and rotation amount. The technical parameter is the number of pulses per revolution. Mechanical rotary encoders are convenient to use, but after long-term use, mechanical contacts will wear during frequent contact processes, resulting in poor contact, unstable output pulses, and many interference jitters, affecting normal counting judgment, so they have to be replaced in advance. In addition, the reasons for the poor contact of the rotary encoder are divided into mechanical reasons, environmental reasons, and usage reasons. The mechanical reason is that mechanical wear occurs during use, resulting in wear of the contact contacts. The environmental reason is that the use environment has temperature and humidity changes, dust, etc., resulting in accelerated oxidation and wear of the contacts. The usage reason is improper usage method, resulting in arcing between the contacts and further accelerating the wear of the contacts. Summary of the Invention

[0003] The purpose of the present invention is to provide a rotary encoder detection circuit and a detection method in view of the deficiencies of the prior art.

[0004] A rotary encoder detection circuit disclosed by the present invention includes a rotary encoder circuit, a monostable circuit, and a post-stage circuit. The rotary encoder circuit has two sets of signal outputs. Each set of signals includes a signal when the contact is in the contact area and a signal when the contact is in the non-contact area. Each set of signals is respectively shaped by one of the monostable circuits. The post-stage circuit processes the signal output by the monostable circuit when the contact is in the non-contact area to detect the rotation direction and rotation amount of the rotary encoder.

[0005] Further, when the contacts in the rotary encoder circuit are in the contact area, a trigger signal is generated to trigger the monostable circuit. The monostable circuit enters the non-steady state. During the process of the monostable circuit transitioning from the non-steady state to the steady state, unstable glitch signals generated due to poor contact of the contacts are filtered, and the monostable circuit outputs an inverted trigger signal. When the contacts in the rotary encoder circuit are in the non-contact area, the monostable circuit does not receive the trigger signal. After the monostable circuit completely exits the non-steady state, it flips the output signal to indicate that the contacts in the rotary encoder are in the non-contact state. The subsequent circuit processes the output signals of the two groups of monostable circuits in the non-contact state to detect the rotation direction and rotation amount of the rotary encoder.

[0006] Further, the monostable circuit is a re-triggerable monostable circuit. When the contacts in the rotary encoder circuit are in an unstable contact state, the monostable circuit can be triggered again during the non-steady state to reset the time of the non-steady state.

[0007] Further, the monostable circuit includes a circuit composed of a transistor and a buffer, a 555 circuit, a gate circuit, or a circuit using a monostable multivibrator chip.

[0008] Further, the subsequent circuit includes a single-chip microcomputer or a logic device.

[0009] A detection method based on a rotary encoder detection circuit disclosed by the present invention includes: Rotating the rotary encoder so that the rotary encoder circuit outputs two groups of signals, where each group of signals includes a contact area signal and a non-contact area signal; If the output signal is a contact area signal, trigger the monostable circuit to work, and the monostable circuit shapes and inverts the output signal of the rotary encoder circuit; if the output signal is a non-contact area signal, the monostable circuit flips the output signal; The subsequent circuit processes the output signals of the two groups of monostable circuits in the non-contact area to determine the rotation direction and rotation amount of the rotary encoder.

[0010] Further, the subsequent circuit processes the output signals of the two groups of monostable circuits in the non-contact area. The output signal of one group of monostable circuits is used as a reference signal to determine the rotation direction and rotation amount of the rotary encoder, including: When the output signals of both groups of monostable circuits are contact area signals, enter the preparation detection state; When the reference signal becomes a non-contact area signal, enter the start detection state. After waiting for the output signals of the two groups of monostable circuits to stabilize, detect the state of the output signal of the other group of monostable circuits; If the output signal of another group of monostable circuits is a non-contact area signal, it is detected that the rotation in the first direction is once; if the output signal of another group of monostable circuits changes from a contact area signal to a non-contact area signal, it is detected that the reverse rotation in the first direction is once; After completing one cycle of detection, when the output signals of both groups of monostable circuits are non-contact area signals, return to the initial state and start the next detection cycle.

[0011] The beneficial effects brought by the technical solution of the present invention are as follows: The rotation encoder detection circuit and detection method proposed in this application abandon the traditional detection of the electrical signals generated when mechanical contacts are in contact, and instead detect the signals when mechanical contacts are non-contact. In the non-contact area, since there are no electrodes, it is impossible to generate pulses, the signal is more stable, and debouncing is easier. In the contact area, the generated glitches are usually more frequent and irregular, so they are abandoned and not used, which greatly extends the service life of the rotation encoder; it has good compatibility and can almost directly replace the original rotation encoder circuit; it filters the glitches generated by the rotation encoder and improves the efficiency of software judgment; it has low cost, and the circuit is simple, stable and reliable. Description of the Drawings

[0012] Figure 1 It is the structural block diagram of the rotation encoder detection circuit proposed in this application.

[0013] Figure 2 It is the circuit diagram of the first specific embodiment of the rotation encoder detection circuit proposed in this application.

[0014] Figure 3 It is the effect diagram of the improvement of the output waveform of the first specific embodiment of the rotation encoder detection circuit proposed in this application.

[0015] Figure 4 It is the actual output waveform diagram of the first specific embodiment of the rotation encoder detection circuit proposed in this application.

[0016] Figure 5 It is the schematic diagram of the right-handed output waveform of the first specific embodiment of the rotation encoder detection circuit proposed in this application.

[0017] Figure 6 It is the schematic diagram of the left-handed output waveform of the first specific embodiment of the rotation encoder detection circuit proposed in this application.

[0018] Figure 7 It is the circuit diagram of the second specific embodiment of the rotation encoder detection circuit proposed in this application.

[0019] Figure 8 It is the flowchart of the method for judging the rotation direction and rotation amount of the rotation encoder in an embodiment of this application. Detailed Embodiments

[0020] To make the objectives and technical solutions of the embodiments of this application clearer, the following will clearly and completely describe the technical solutions of the embodiments of this application with reference to the accompanying drawings of the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, rather than all of them. Based on the described embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.

[0021] In one embodiment of this application, please refer to Figure 1 , which is a structural block diagram of a rotary encoder detection circuit proposed in this application. The present invention discloses a rotary encoder detection circuit, including a rotary encoder circuit 11, a monostable circuit 12, and a subsequent stage circuit 13. The signal output by the rotary encoder circuit 11 is shaped by the monostable circuit 12 for the signal output by the rotary encoder circuit 11, where the signals include the signal when the contact is in the contact area and the non-contact area signal. The subsequent stage circuit 13 processes the signal output by the monostable circuit when the contact is in the non-contact area, detects the rotation direction and rotation amount of the rotary encoder. The subsequent stage circuit includes a single-chip microcomputer, logic devices, etc.

[0022] Please refer to Figure 2 , which is a circuit diagram of the first specific embodiment of the rotary encoder detection circuit proposed in this application.

[0023] In this embodiment, the rotary encoder circuit includes a rotary encoder (Encoder), a first resistor R1, a third resistor R3, and a sixth resistor R6. The rotary encoder has two groups of signal outputs, namely A and B. The a pin of the rotary encoder is the output of the A group signal. The output of the A group signal is connected to the monostable circuit after being connected in series with the third resistor R3. The b pin of the rotary encoder is the output of the B group signal. The output of the B group signal is connected to the monostable circuit after being connected in series with the sixth resistor R6. The c pin (the common pin for pulse output) of the rotary encoder is connected to the power supply after being connected in series with the first resistor R1.

[0024] The monostable circuit is a retriggerable monostable circuit. A retriggerable monostable can be triggered again during the astable state to reset the duration of the astable state. The monostable circuit is composed of a transistor and a buffer. The monostable circuit connected to the output of Group A signals includes: a first capacitor C1, a second capacitor C2, a second resistor R2, a fourth resistor R4, a first transistor Q1, and a first buffer U1A. The first terminal of the first capacitor C1 is connected to the first terminal of the fourth resistor R4. The second terminal of the fourth resistor R4 is connected to the second terminal of the first capacitor C1 and the source electrode of the first transistor Q1. The source electrode of the first transistor Q1 is connected to the first terminal of the second capacitor C2. The gate electrode of the first transistor Q1 is connected to the first terminal of the fourth resistor R4. The drain electrode of the first transistor Q1 is connected to the first terminal of the second resistor R2, the second terminal of the second capacitor C2, and the input terminal of the first buffer U1A. The negative pin of the first buffer U1A is connected to the first terminal of the second capacitor C2. The positive pin of the buffer U1A is connected to the power supply. The output terminal of the first buffer U1A is connected to the subsequent circuit. The second terminal of the second resistor R2 is connected to the power supply. The second terminal of the fourth resistor R4 is grounded. The first terminal of the first capacitor C1 is connected to the third resistor R3.

[0025] The monostable circuit connected to the output of Group B signals is the same as the monostable circuit connected to the output of Group A signals, and includes: a third capacitor C3, a fourth capacitor C4, a fifth resistor R5, a seventh resistor R7, a second transistor Q2, and a second buffer U1B. The first terminal of the third capacitor C3 is connected to the first terminal of the seventh resistor R7. The second terminal of the seventh resistor R7 is connected to the second terminal of the third capacitor C3 and the source electrode of the second transistor Q2. The source electrode of the second transistor Q2 is connected to the first terminal of the fourth capacitor C4. The gate electrode of the second transistor Q2 is connected to the first terminal of the seventh resistor R7. The drain electrode of the second transistor Q2 is connected to the first terminal of the fifth resistor R5, the second terminal of the fourth capacitor C4, and the input terminal of the second buffer U1B. The negative pin of the second buffer U1B is connected to the first terminal of the fourth capacitor C4. The positive pin of the second buffer U1B is connected to the power supply. The output terminal of the second buffer U1B is connected to the subsequent circuit. The second terminal of the fifth resistor R5 is connected to the power supply. The second terminal of the seventh resistor R7 is grounded. The first terminal of the third capacitor C3 is connected to the sixth resistor R6.

[0026] As an example, the first buffer U1A and the second buffer U1B are Schmitt trigger buffers. The power supply is a +3.3V power supply.

[0027] When the contact in the rotary encoder is in the on state, the monostable circuit is triggered, and the monostable circuit enters the astable state. Since it takes a certain amount of time for the astable circuit to enter the stable state, during this time, frequent triggering will only reset the duration of the astable state and will not affect the output of the monostable circuit, thus filtering out the unstable spikes caused by poor contact during the angular displacement of the contact.

[0028] When the contact in the rotary encoder is in the off state, the monostable circuit will flip after a period of time because it does not receive a trigger signal or glitch, indicating that the contact in the rotary encoder is in the non-contact area.

[0029] Taking the output of Group A signals as an example, in the output of Group A signals, the first resistor R1, the third resistor R3, the first transistor Q1, and the stationary contact and moving contact of the rotary encoder together form the contact detection circuit of the rotary encoder, and the first buffer U1A outputs signal A. Due to the amplification effect of the first transistor Q1, the current of the signal output by Group A of the rotary encoder is amplified, so the requirement for the current of the signal output by the rotary encoder is low, and the resistance values of the first resistor R1 and the third resistor R3 can be relatively large.

[0030] When the contact of the rotary encoder is in the contact area, a trigger pulse is generated to trigger the monostable circuit. The trigger pulse makes the first transistor Q1 saturated through the second resistor R2, quickly discharges the second capacitor C2, and the first buffer U1A outputs a low-level signal, and the circuit enters the non-steady state.

[0031] When the contact of the rotary encoder is in a poor contact state in the contact area, a level will be generated. The difference is that the level signals usually generated in the contact area are relatively stable, while the level signals generated in the poor contact state are less stable and will generate continuous, short-duration and many glitch signals. Since it takes a certain amount of time for the second capacitor C2 to charge through the second resistor R2, the short-term on and off of the first transistor Q1 will not affect the output of signal A of the monostable circuit, thus filtering out the unstable glitches caused by poor contact during the angular displacement of the contact.

[0032] It takes a period of time for the monostable circuit in the non-steady state to enter the steady state, and the monostable circuit is a retriggerable monostable circuit. During this time, that is, the glitches generated by the contact of the rotary encoder circuit are irregular and the time of the next glitch generation cannot be predicted. Frequent triggering of the sub-monostable circuit by the contact in the rotary encoder circuit will only reset the duration of the non-steady state and will not affect the output of signal A of the monostable circuit. Therefore, using a retriggerable monostable circuit can simplify the design and does not require estimating the timing of the next trigger generation, thus filtering out the unstable glitches caused by poor contact during the angular displacement of the contact.

[0033] When the contact is in the non-contact area state, the trigger pulse disappears, and the charge on the second capacitor C2 is filled by the current passing through the second resistor R2. When the voltage on the second capacitor C2 accumulates to a certain level, the first buffer U1A is driven to output a high-level signal. At this time, the high-level signal is the processed non-contact area signal. Since there is no pulse, the generated signal is more stable and easier to debounce, and the data that needs to be processed is less than the processed contact area signal.

[0034] See also Figure 3 , is a diagram showing the output waveform improvement effect of the first specific embodiment of the rotary encoder detection circuit proposed in this application. Figure 3 The yellow waveform in the middle is a signal after the rotary encoder outputs a set of signals and before the monostable circuit processes it. When it is at a high level, it means that the rotary encoder contacts are connected, that is, in the contact area. When it is at a low level, it means that the rotary encoder contacts are disconnected, that is, in the non-contact area. It can be seen from the figure that the waveform of the contact area signal output when the rotary encoder contacts are in the contact area contains many burrs. Figure 3 The green waveform in the middle is the signal output after the monostable circuit processes the output of the group of signals. Since the monostable circuit inverts the signal, when the contact is in the contact area, the processed contact area signal output is low level, and when the contact is in the non-contact area, the processed non-contact area signal output is high level. When the contact switches between the non-contact area and the contact area, there is an unstable contact state, see Figure 3 When the yellow waveform is at a high level and the green waveform is at a low level, the green waveform has one more section than the yellow waveform. The unstable contact signal is processed by a monostable circuit to filter out the unstable burrs caused by poor contact during the angular displacement of the contact point, and the processed low-level signal is output, which is beneficial for the subsequent circuit to avoid false detection when detecting the processed non-contact area signal. Figure 3 After the middle contact moves from the contact area to the non-contact area until it is completely out of the contact unstable state, the processed non-contact area signal jumps to a high level.

[0035] The principle of obtaining the signal by processing the output signal of group B through a monostable circuit is the same as that of group A output, and will not be repeated here.

[0036] As an example, see Figure 4 , is an actual output waveform diagram of the first specific embodiment of the rotary encoder detection circuit proposed in the present application, including the monostable circuit connected in group A and the monostable circuit connected in group B jointly completing the output after processing the two-way signal of the rotary encoder, wherein the yellow waveform represents the waveform of the signal output by group A, and the green waveform represents the waveform of the signal output by group B. The phase difference between the two-way signals output by the rotary encoder detection circuit is used to determine whether the rotary encoder is turning left or right; Figure 4The signal waveform processed by the rotation encoder detection circuit proposed in this embodiment can be obtained to be stable without burrs. After the rotation encoder is used for a period of time, the improved output waveform effect is almost the same as that of a brand-new rotation encoder output waveform.

[0037] As an example, please refer to Figure 5 and Figure 6 , Figure 5 which is a schematic diagram of the right-handed output waveform of the first specific embodiment of the rotation encoder detection circuit proposed in this application, Figure 6 which is a schematic diagram of the left-handed output waveform of the first specific embodiment of the rotation encoder detection circuit proposed in this application. Since there is a phase difference between the A-group output and the B-group output, the signals A of the A-group output and B of the B-group output will have different times when they reach the high level. Further, the phase is different for different rotation directions. Among them, Figure 5 and Figure 6 the state 1 represents the state where the contacts are in full contact, and at this time both signal A and signal B are low levels; the state 2 represents the transition state from the contact area to the non-contact area. When signal B is high level and signal A is low level, it indicates that the rotation encoder rotates to the right. When signal B is high level and signal A is high level, it indicates that the rotation encoder rotates to the left; the state 0 represents the initial state, and at this time both signal A and signal B are high levels. Since the states of state 2 and state 0 are the same when rotating to the left, there is no state 2 in Figure 6 , and directly enters the state 0 after the detection is completed.

[0038] Please refer to Figure 7 , Figure 7 which is the circuit diagram of the second specific embodiment of the rotation encoder detection circuit proposed in this application. In this specific embodiment, different from the circuit in Figure 2 , a monostable circuit is constructed using a monostable multivibrator chip.

[0039] The rotation encoder circuit includes: a rotation encoder, a twelfth resistor R12, and a thirteenth resistor R13. The A-group output of the rotation encoder is connected to the first terminal of the thirteenth resistor R13, the B-group output is connected to the first terminal of the twelfth resistor R12, and the second terminal of the thirteenth resistor R13 and the second terminal of the twelfth resistor R12 are connected and grounded. The c-foot of the rotation encoder is connected to the power supply VCC.

[0040] The monostable circuit connected to the output of Group A includes: the eleventh resistor R11, the eleventh capacitor C11, and the first monostable multivibrator chip U2A. The first terminal of the eleventh resistor R11 is connected to the node between the power supply VCC and the c pin of the rotary encoder. The second terminal of the eleventh resistor R11 is connected to the pin 1CX / RX of the first monostable multivibrator chip U2A and the first terminal of the eleventh capacitor C11. The pin 1CX of the first monostable multivibrator chip U2A is connected to the second terminal of the eleventh capacitor C11. The pin 1A of the first monostable multivibrator chip U2A is grounded. The pin 1B of the first monostable multivibrator chip U2A is connected to the output of Group A. The pin is connected to the power supply VCC. The pin VCC of the first monostable multivibrator chip U2A is connected to the power supply VCC. The pin is connected to the subsequent circuit. The pin GND of the first monostable multivibrator chip U2A is grounded.

[0041] The monostable circuit connected to the output of Group B includes: the fourteenth resistor R14, the twelfth capacitor C12, and the second monostable multivibrator chip U2B. The first terminal of the fourteenth resistor R14 is connected to the power supply VCC. The second terminal of the fourteenth resistor R14 is connected to the pin 2CX / RX of the second monostable multivibrator chip U2B and the first terminal of the twelfth capacitor C12. The second terminal of the twelfth capacitor C12 is connected to the pin 2CX of the second monostable multivibrator chip U2B. The pin 2A of the second monostable multivibrator chip U2B is grounded. The pin 2B of the second monostable multivibrator chip U2B is connected to the output of Group B. The pin is connected to the power supply VCC. The pin VCC of the second monostable multivibrator chip U2B is connected to the power supply VCC. The pin is connected to the subsequent circuit. The pin GND of the second monostable multivibrator chip U2B is grounded.

[0042] Taking the output of Group A as an example, when the contact of the rotary encoder is in a non-contact state, the input of 1B of the first monostable multivibrator chip U2A is at a low level, and the monostable chip is in a steady state. When the contact of the rotary encoder is in the contact area, a high-level signal is generated. According to the working principle of the first monostable multivibrator chip U2A, when the input is high, the charge on the eleventh capacitor C11 is quickly discharged, and the first monostable multivibrator chip U2A enters a transient state to shape the pulse signal. At this time, the pin Output a low-level signal, and the circuit enters an unstable state. When the contact is in the non-contact area state, the 1B input of the first monostable multivibrator chip U2A turns into a low-level signal, and the power supply continuously charges the eleventh capacitor C11 through the eleventh resistor R11. When the voltage on the eleventh capacitor C11 reaches the threshold value, the circuit flips, and the first monostable multivibrator chip U2A enters a stable state. At this time, at the pin of the first monostable multivibrator chip U2A Output a high-level signal.

[0043] The principle of processing the signal output by the B group through the monostable circuit is the same as that of the A group output, which will not be elaborated here.

[0044] As an example, the monostable circuit also includes a retriggerable monostable circuit composed of a 555 circuit or a gate circuit, which can also achieve the same effect. Using the monostable circuit to shape the signal generated by the rotary encoder requires a lower output current for the driving signal of the rotary encoder, and further reduces the possibility of "sparking" caused by current passing during the use of the rotary encoder, avoiding further shortening of the service life of the rotary encoder due to usage reasons.

[0045] This application also provides a detection method for a rotary encoder detection circuit, including the following steps: Rotate the rotary encoder so that the rotary encoder circuit outputs two groups of output signals, where each group of signals includes a contact area signal and a non-contact area signal; If the output signal is a contact area signal, trigger the monostable circuit to work, and the monostable circuit shapes and inverts the output signal of the rotary encoder circuit; if the output signal is a non-contact area signal, the monostable circuit flips the output signal; The subsequent circuit processes the output signals of the monostable circuits in the two non-contact areas. The output signal of one group of monostable circuits is used as a reference signal to judge the rotation direction and rotation amount of the rotary encoder. Specifically: When the output signals of the two groups of monostable circuits are both non-contact area signals, it is the initial state; When the output signals of the two groups of monostable circuits are both contact area signals, enter the ready-to-detect state; When the reference signal becomes a non-contact area signal, enter the start-detection state. After waiting for the output signals of the two groups of monostable circuits to stabilize, detect the state of the output signal of the other group of monostable circuits; If the output signal of the other group of monostable circuits is a non-contact area signal, it is detected that the first direction rotates once; if the output signal of the other group of monostable circuits changes from a contact area signal to a contact area signal, it is detected that the first direction rotates in the reverse direction once; After completing a periodic detection, when the output signals of both sets of monostable circuits are non-contact area signals, return to the initial state and start the next detection cycle.

[0046] Please refer to Figure 8 , which is a flowchart of a method for determining the rotation direction and rotation amount of a rotary encoder in an embodiment of the present application. Different rotary encoders will have different waveforms. In this embodiment, the encoder PEC16-4115F is used, and the output signals of the two sets of monostable circuits are signal A and signal B, and the reference signal is signal B. Taking the example that when the contact is in the non-contact area, signals A and B are high-level, and when the contact is in the contact area, signals A and B are low-level. State 0 is the state where both contacts are in the non-contact state (initial state), state 1 is the state where both contacts are in the contact state, and state 2 is the transition state from contact to non-contact. After the contact corresponding to signal B enters the non-contact area from the contact area, the detection starts. The method for determining the rotation direction and rotation amount of the rotary encoder includes steps S1 to S8: Step S1: In the initial state 0, both signal A and signal B are high-level; Step S2: Enter state 1, both signal A and signal B are low-level; Step S3: Wait for signal B to change from low to high-level; Step S4: Wait for signals B and A to stabilize; Step S5: Detect the state of signal A and determine whether signal A is high-level. If so, enter step S6; if not, enter step S7; Step S6: The level of signal A does not change, and it is detected that the rotary encoder rotates counterclockwise once, and return to step S1; Step S7: The level of signal A has a process of changing from low to high, and it is detected that the rotary encoder rotates clockwise once, and enter state 2; Step S8: Wait for signal A to become high-level again and return to step S1.

[0047] When the rotary encoder is rotated, the levels of signals A and B will change, and the sequences of the potential combinations of signals A and B are different when rotating counterclockwise and clockwise. The rotation direction of the rotary encoder is detected according to the potential difference. The rotary encoder will return to the initial state whether it rotates counterclockwise or clockwise. When the counterclockwise rotation judgment ends, both A and B are high-level, which is the same as the initial state. When the clockwise rotation judgment ends, signal A is low-level and signal B is high-level. It can be understood that signal A has an action of changing from low-level to high-level. At this time, it is still necessary to wait for signal A to become high-level to return to the initial state, while there is no such action when rotating counterclockwise.

[0048] The rotation encoder detection circuit and detection method proposed in this application use a rotation encoder circuit, a monostable circuit, and a subsequent stage circuit to detect the trigger signal of the rotation encoder. Instead of detecting the electrical signal generated when the mechanical contact is in contact, it detects the signal when the mechanical contact is non-contact. In the non-contact area, since there is no electrode, no pulse can be generated, the signal is more stable, and debouncing is easier. In the contact area, the generated glitches are usually frequent and irregular, so they are abandoned and not used. By using the rotation encoder detection circuit and detection method proposed in this application, the service life of the rotation encoder is greatly extended; it has good compatibility and can almost directly replace the original rotation encoder circuit; it filters the glitches generated by the rotation encoder and improves the efficiency of software judgment; it has low cost, and the circuit is simple, stable and reliable.

[0049] As described above, although the present invention has been shown and described with reference to specific preferred embodiments, it should not be construed as a limitation of the present invention itself. Various changes can be made to it in form and detail without departing from the spirit and scope of the present invention defined by the appended claims.

Claims

1. A rotary encoder detection circuit, characterized in that: It includes a rotary encoder circuit, a monostable circuit and a post-stage circuit. The rotary encoder circuit has two groups of signal outputs, each group of signals includes a signal when the contact is in the contact area and a signal when the contact is in the non-contact area. Each group of signals is shaped by one of the monostable circuits respectively. The post-stage circuit processes the output signals of the monostable circuits when the two groups of contacts are in the non-contact area to detect the rotation direction and rotation amount of the rotary encoder.

2. The rotary encoder detection circuit according to claim 1, characterized in that: When the contact in the rotary encoder circuit is in the contact area, a trigger signal is generated to trigger the monostable circuit, and the monostable circuit enters a non-stable state. During the process of the monostable circuit entering a stable state from the non-stable state, the unstable burr signal generated by the poor contact of the contact is filtered out, and the monostable circuit outputs an inverted trigger signal; when the contact in the rotary encoder circuit is in the non-contact area, the monostable circuit does not receive the trigger signal, and when the monostable circuit is completely out of the non-stable state, the output signal is flipped, indicating that the contact in the rotary encoder is in a non-contact state, and the post-stage circuit processes the output signals of the two groups of monostable circuits in the non-contact state to detect the rotation direction and rotation amount of the rotary encoder.

3. The rotary encoder detection circuit according to claim 2, characterized in that: The monostable circuit is a re-triggerable monostable circuit. When the contact in the rotary encoder circuit is in an unstable contact state, the monostable circuit can be triggered again during the unstable state to reset the unstable time.

4. The rotary encoder detection circuit according to claim 3, characterized in that: The monostable circuit includes a circuit composed of a transistor and a buffer, a 555 circuit, a gate circuit or a circuit using a monostable multivibrator chip.

5. The rotary encoder detection circuit according to claim 1, characterized in that: The subsequent circuit includes a single chip microcomputer or a logic device.

6. A detection method based on the rotary encoder detection circuit according to any one of claims 1 to 5, characterized in that: Rotating the rotary encoder so that the rotary encoder circuit outputs two sets of signals, each set of signals including a signal that the contact is in a contact area and a signal that the contact is in a non-contact area; If the output signal is a contact area signal, the monostable circuit is triggered to work, and the monostable circuit shapes and inverts the output signal of the rotary encoder circuit; if the output signal is a non-contact area signal, the monostable circuit flips the output signal; The subsequent circuit processes the output signals of the monostable circuits in the two non-contact areas to determine the rotation direction and amount of the rotary encoder.

7. The detection method of the rotary encoder detection circuit according to claim 6, characterized in that: The subsequent circuit processes the output signals of the two sets of monostable circuits in the non-contact area, one of which is a reference signal to determine the rotation direction and amount of the rotary encoder, including: When the output signals of the two sets of monostable circuits are both non-contact area signals, it is the initial state; When the output signals of the two sets of monostable circuits are both contact area signals, the detection preparation state is entered; When the reference signal becomes a non-contact area signal, the detection state is entered, and after the output signals of the two sets of monostable circuits are stable, the state of the output signal of the other set of monostable circuits is detected; If the output signal of the other monostable circuit is a non-contact area signal, a rotation in the first direction is detected once; if the output signal of the other monostable circuit changes from a contact area signal to a non-contact area signal, a reverse rotation in the first direction is detected once; After completing one cycle detection, when the output signals of the two sets of monostable circuits are both non-contact area signals, they return to the initial state and start the next detection cycle.

Citation Information

Patent Citations

  • Two-phase signal processing circuit of rotary encoder and signal processing method thereof

    CN103994781A

  • Rotary encoder detection method, device and system

    CN112504316A

  • Keyboard, detection method and detection circuit of rotary encoder, and display device

    CN114544153A

  • Magnetic detection based multi-loop absolute value encoder

    CN203479313U

  • Portable touch handheld encoder tester

    CN208238822U