Stepping motor control circuit

By using multiple coil control units to connect to a small number of GPIO ports in the stepper motor control circuit, combined with the single four-beat control method and the MOS tube push-pull structure, the problem of high GPIO quantity and cost in the existing technology is solved, and the control system is realized. Efficient control of stepper motors.

CN118763929APending Publication Date: 2024-10-11CETHIK GRP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410879533.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

Existing stepper motor control circuits require a large number of GPIOs and expensive motor driver chips, making it difficult to effectively control stepper motors in scenarios with weak GPIO capabilities and stringent costs.

Method used

Design a stepper motor control circuit that connects to a small number of GPIO ports through multiple coil control units. It uses the high level, low level and high resistance state of the GPIO port to control the stepper motor, using single four-beat control. Method and MOS tube push-pull structure, reducing the number and cost of GPIO.

Benefits of technology

It significantly reduces the number of GPIO ports, reduces driving costs, and achieves efficient control of stepper motors. It is suitable for scenarios with weak GPIO capabilities and stringent costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118763929A_ABST
    Figure CN118763929A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of motor control, and discloses a stepping motor control circuit, which comprises a controller, a power supply module and a coil control module, the coil control module comprises a plurality of coil control units, one group of coils is connected with two coil control units, and at least one coil control unit is simultaneously connected with the end parts of the plurality of groups of coils; the controller provides GPIO ports and is connected with the coil control units through the GPIO ports, one GPIO port is connected with one or two coil control units, the GPIO port has three states of high level, low level and high resistance, one coil control unit controlled by the same GPIO port has two states of opening and closing or has three states of opening, opening and closing, and the coil control units are connected with the coil control units through the GPIO ports. And the two coil control units controlled by the same GPIO port have three states of on-off, off-on and off-off. According to the invention, the control of the stepping motor can be realized only by using a small number of GPIOs and switching devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of motor control, and in particular relates to a stepper motor control circuit, which is suitable for various scenarios in which a stepper motor is controlled by an embedded system. Background Art

[0002] Stepper motors are widely used in various electronic devices. They can be used to control pan / tilts, electric lenses, etc. on cameras. Stepper motors can be roughly divided into bipolar stepper motors and unipolar stepper motors. The difference between the two is whether the direction of the coil's power supply can be changed.

[0003] A bipolar stepper motor commonly used in cameras has two sets of coils. It uses an H-bridge circuit for bidirectional power control and combines the control timing of the stepper motor to achieve forward and reverse rotation. Bipolar stepper motor control circuits mostly use integrated motor driver chips. The motor driver chip integrates an H-bridge circuit. The motor driver chip is controlled by the GPIO or bus protocol of the main chip to achieve forward and reverse rotation of the bipolar stepper motor. A unipolar stepper motor commonly used in cameras has two sets of coils, and the center taps of the two sets of coils are connected to the power supply or ground, so the two ends of the coil can only be controlled in one direction with low or high levels, and the direction of the coil current is fixed, so it is called a unipolar stepper motor.

[0004] At present, the forward and reverse rotation of the motor is realized through timing control. Darlington tubes and multi-channel motor driver chips are mostly used in circuit control. The Darlington tube solution is particularly widely used in civilian scenarios. The software methods for motor driver chips to control motors mainly include single four-beat method (1-1), double four-beat method (2-2), eight-beat method (1-2), and micro-step method. Traditional control methods require the use of a large number of GPIOs. One motor requires 4 GPIOs to control. Usually, a device has two motors, which requires at least 8 GPIOs. Using a simplified design, at least 6 GPIOs are required. At the same time, the price of motor driver chips is also relatively expensive. Summary of the invention

[0005] The purpose of the present invention is to provide a stepper motor control circuit, which only requires a small number of GPIOs and switch devices to realize the control of the stepper motor, and is suitable for scenarios where the main control GPIO capability is weak and cost control is strict.

[0006] To achieve the above object, the technical solution adopted by the present invention is:

[0007] A stepper motor control circuit is used to control the operation of a stepper motor. A stepper motor has two sets of coils. The stepper motor control circuit includes a controller, a power module and a coil control module.

[0008] The coil control module includes a plurality of coil control units, one group of coils is connected to two coil control units, and at least one coil control unit is simultaneously connected to ends of the plurality of groups of coils;

[0009] The power supply module is connected to each coil control unit and is used to supply power to each coil control unit;

[0010] The controller provides a GPIO port and is connected to the coil control unit through the GPIO port. One GPIO port is connected to one or two coil control units. The GPIO port has three states: high level, low level and high impedance. A coil control unit controlled by the same GPIO port has two states of on and off or three states of off-on, on-off and off-off. Two coil control units controlled by the same GPIO port have three states of on-off, off-on and off-off.

[0011] Several optional methods are also provided below, but they are not intended to be additional limitations on the above-mentioned overall solution, but are merely further supplements or preferences. Under the premise that there are no technical or logical contradictions, each optional method can be combined with the above-mentioned overall solution separately, and multiple optional methods can also be combined.

[0012] Preferably, each coil control unit has a control interface, a power interface and a motor interface, the control interface is connected to the GPIO port of the controller, the power interface is connected to the power module, and the motor interface is connected to the coil.

[0013] Preferably, there is the following relationship between the number of coil control units and the number of coil groups:

[0014] n(n-1) / 2≥mq

[0015] Wherein, n is the number of coil control units, m is the number of coil groups, q is the number of coil groups in parallel, and the number of GPIO ports is less than or equal to n.

[0016] Preferably, the controller controls the operation of the stepper motor using a single four-beat control method based on the three states of the GPIO port.

[0017] Preferably, the stepper motor is a unipolar stepper motor, and two unipolar stepper motors are controlled as a group, wherein the two groups of coils of one unipolar stepper motor in a group are respectively a first coil and a second coil, and the two groups of coils of the other unipolar stepper motor are respectively a third coil and a fourth coil, and the center taps of the first coil, the second coil, the third coil and the fourth coil are connected to a power module;

[0018] The forward part of the first coil is connected in parallel with the forward part of the third coil, one end of the parallel connection is a center tap end, and the other end is a first parallel end, the first parallel end is connected to a first coil control unit, and the first coil control unit is connected to a first GPIO port;

[0019] The negative part of the first coil is connected in parallel with the positive part of the fourth coil, one end of the parallel connection is a center tap end, and the other end is a second parallel end, the second parallel end is connected to the second coil control unit, and the second coil control unit is connected to the second GPIO port;

[0020] The positive part of the second coil is connected in parallel with the negative part of the third coil, one end of the parallel connection is a center tap end, and the other end is a third parallel end, the third parallel end is connected to a third coil control unit, and the third coil control unit is connected to a third GPIO port;

[0021] The negative part of the second coil is connected in parallel with the negative part of the fourth coil, one end of the parallel connection is a center tap end, and the other end is used as a fourth parallel end, the fourth parallel end is connected to a fourth coil control unit, and the fourth coil control unit is connected to a fourth GPIO port;

[0022] The first GPIO port, the second GPIO port, the third GPIO port and the fourth GPIO port are partially identical or completely different GPIO ports.

[0023] Preferably, when the first GPIO port, the second GPIO port, the third GPIO port and the fourth GPIO port are completely different GPIO ports, the first coil control unit, the second coil control unit, the third coil control unit and the fourth coil control unit are respectively a power NMOS tube;

[0024] Among the four parallel ends, namely the first parallel end, the second parallel end, the third parallel end and the fourth parallel end, each parallel end is connected to the drain of a power NMOS tube, and the source of the power NMOS tube is grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel end.

[0025] Preferably, when the first GPIO port, the second GPIO port, the third GPIO port and the fourth GPIO port are partially identical GPIO ports, and the first GPIO port and the third GPIO port are the same GPIO port, or the second GPIO port and the fourth GPIO port are the same GPIO port;

[0026] The two coil control units that are not connected to the same GPIO port are respectively a power NMOS tube, each parallel end is connected to the drain of a power NMOS tube, and the source of the power NMOS tube is grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel end;

[0027] Among the two coil control units connected to the same GPIO port, one of the coil control units is a power NMOS tube, the corresponding parallel end is connected to the drain of the power NMOS tube, the source of the power NMOS tube is grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel end; the other coil control unit includes a power NMOS tube, a signal NMOS tube and two resistors, the corresponding parallel end is connected to the drain of the power NMOS tube, the source of the power NMOS tube is grounded, the gate of the power NMOS tube is connected to the drain of the signal NMOS tube, the drain of the signal NMOS tube is connected to the power module through a resistor, the source of the signal NMOS tube is grounded, the gate of the signal NMOS tube is connected to the GPIO port corresponding to the parallel end, and the gate of the signal NMOS tube is connected to the power module through another resistor.

[0028] Preferably, when the first GPIO port, the second GPIO port, the third GPIO port and the fourth GPIO port are partially identical GPIO ports, the first GPIO port and the third GPIO port are the same GPIO port, and the second GPIO port and the fourth GPIO port are the same GPIO port;

[0029] Among the two coil control units connected to the same GPIO port, one of the coil control units is a power NMOS tube, the corresponding parallel end is connected to the drain of the power NMOS tube, the source of the power NMOS tube is grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel end; the other coil control unit includes a power NMOS tube, a signal NMOS tube and two resistors, the corresponding parallel end is connected to the drain of the power NMOS tube, the source of the power NMOS tube is grounded, the gate of the power NMOS tube is connected to the drain of the signal NMOS tube, the drain of the signal NMOS tube is connected to the power module through a resistor, the source of the signal NMOS tube is grounded, the gate of the signal NMOS tube is connected to the GPIO port corresponding to the parallel end, and the gate of the signal NMOS tube is connected to the power module through another resistor.

[0030] Preferably, the stepper motor is a bipolar stepper motor, and two bipolar stepper motors are controlled as a group, wherein the two groups of coils of one bipolar stepper motor in a group are respectively the first coil and the second coil, and the two groups of coils of the other bipolar stepper motor are respectively the third coil and the fourth coil;

[0031] The first coil is connected in series with the second coil, the connecting end of the first coil and the second coil in the series circuit is used as the first end, the other end of the first coil is used as the second end, and the other end of the second coil is used as the third end;

[0032] One end of the third coil is connected to the second end, the other end of the third coil is connected to the third end, one end of the fourth coil is connected to the second end, the other end of the fourth coil is connected to the first end or serves as an independent fourth end;

[0033] Any end is connected to a GPIO port via a coil control unit, and the coil control unit is a MOS tube push-pull structure.

[0034] Preferably, the MOS tube push-pull structure includes an NMOS tube and a PMOS tube;

[0035] The gate of the NMOS tube and the gate of the PMOS tube are connected to the same GPIO port, the drain of the NMOS tube and the drain of the PMOS tube are connected to the same end, the source of the PMOS tube is connected to the power module, and the source of the NMOS tube is grounded.

[0036] A stepper motor control circuit provided by the present invention realizes controlling two stepper motors through four or less GPIO ports by connecting one coil control unit to the ends of multiple groups of coils at the same time, and connecting one GPIO port to one or two coil control units, thereby greatly reducing the GPIO quantity requirement and also reducing the driving cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A structural diagram of a stepping motor control circuit of the present invention;

[0038] Figure 2 A coil structure diagram of one of the unipolar stepping motors in a group of unipolar stepping motors of the present invention;

[0039] Figure 3 A coil structure diagram of another unipolar stepping motor in a group of unipolar stepping motors of the present invention;

[0040] Figure 4 A schematic diagram of the circuit structure when the present invention controls a group of unipolar stepper motors and the four GPIO ports are completely different GPIO ports;

[0041] Figure 5 A schematic diagram of a circuit structure when the present invention controls a group of unipolar stepper motors, and the four GPIO ports are the first GPIO port and the third GPIO port are the same GPIO port;

[0042] Figure 6A schematic diagram of the circuit structure when the present invention controls a group of unipolar stepper motors, and the four GPIO ports are the second GPIO port and the fourth GPIO port are the same GPIO port;

[0043] Figure 7 A schematic diagram of the circuit structure when the present invention controls a group of unipolar stepper motors, the four GPIO ports are the first GPIO port and the third GPIO port are the same GPIO port, and the second GPIO port and the fourth GPIO port are the same GPIO port;

[0044] Figure 8 A schematic diagram of the circuit structure when the present invention controls a group of bipolar stepping motors with four ends;

[0045] Fig. 9 The present invention is a schematic diagram of a circuit structure when controlling a group of bipolar stepping motors with three ends. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] It should be noted that when a component is referred to as being “connected” to another component, it may be directly connected to the other component or there may be a central component; when a component is referred to as being “fixed” to another component, it may be directly fixed to the other component or there may be a central component.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0049] like Figure 1 As shown, this embodiment discloses a stepper motor control circuit, including a controller, a power module and a coil control module, for controlling the operation of the stepper motor. For the stepper motor controlled by this embodiment, a stepper motor has two sets of coils, and includes two categories: unipolar stepper motors and bipolar stepper motors. The function of each module, the connection mode between modules and the working principle are described in detail below.

[0050] (1) Coil control module: It is composed of multiple coil control units. Each coil control unit has three interfaces, namely, control interface, power interface and motor interface, which are connected to the controller, power module and motor coils respectively. The coil control units can have the same circuit structure or different circuit structures, depending on the number of control GPIO ports and the number of motor coils.

[0051] It should be noted that the number n of coil control units and the number m of coil groups can be the same or different. Each group of coils of the stepper motor needs to be connected between two coil control units, that is, each two coil control units control a group of coils, and at least one coil control unit is connected to the ends of multiple groups of coils at the same time.

[0052] Therefore, in this embodiment, the number of coil control units is related to the number of coils, because each group of coils is connected to two coil control units, so in principle it is necessary to satisfy n(n-1) / 2≥m. When the control logic can be further simplified (multiple groups of coils are connected in parallel, and the number of parallel groups q is defined), the number n can be reduced, that is, n(n-1) / 2≥mq is satisfied. Based on this relationship, the simplified result of the control circuit is derived.

[0053] (2) Power module: responsible for supplying power to the coil control module and connected to the power interface of each coil control unit in the coil control module.

[0054] (3) Controller: Mainly refers to the main control chip, which controls the coil control module through the GPIO port. The control interface of each coil control unit in the coil control module is connected to the GPIO port of the controller. One GPIO port is connected to one or two coil control units. The GPIO port has three states: high level (H), low level (L) and high impedance (Z).

[0055] In the design of the coil control unit, based on the basic switch circuit, it is ensured that under the control of the GPIO port, the H / L / Z of a GPIO port can make all the coil control units controlled by it present three states (off-on, on-off, and off-off) when combined together. For example, if a GPIO port controls a coil control unit, the H / L / Z three-state input will make the switch of this coil control unit present three states. If a GPIO port controls two coil control units, the H / L / Z three-state input will make the two coil control units present three states when combined together, and so on. That is, in this embodiment, a coil control unit controlled by the same GPIO port has two states of on and off or three states of off-on, on-off, and off-off, and the two coil control units controlled by the same GPIO port have three states of on-off, off-on, and off-off.

[0056] Based on the connection relationship between the GPIO port and the coil control unit, it can be obtained that the maximum number of GPIO ports is equal to n. When the control circuit is further streamlined, the number of GPIO ports can be further reduced. Combined with the relationship between the number of coil control units and the number of coil groups, it can be proved that the number of GPIO ports required in this embodiment is greatly reduced compared with the traditional control mode.

[0057] In addition, the controller of this embodiment uses a single four-beat control method. At any time, only one set of coils of the stepper motor in operation remains energized. Combined with the three-state logic of the coil control unit, the control timing diagram is determined to complete the stepper motor operation control.

[0058] The present invention achieves the effect of simplified control of the controller by rationally combining multiple coil control units and multiple coils of the motor; and further simplifies the coil control unit and the control scheme by connecting coils in parallel using mathematical methods.

[0059] The present embodiment is described below in detail using a unipolar stepping motor and a bipolar stepping motor.

[0060] Example 1

[0061] This embodiment is described by taking a unipolar stepping motor as an example.

[0062] Two unipolar stepper motors are controlled as a group, such as Figure 2-Figure 3 As shown, the two groups of coils of a unipolar stepper motor in one group are the first coil L1 and the second coil L2, and the two groups of coils of another unipolar stepper motor are the third coil L3 and the fourth coil L4. The coils are divided into positive and negative parts by the center tap, i.e., the positive part L1+ of the first coil, the negative part L1- of the first coil, the positive part L2+ of the second coil, the negative part L2- of the second coil, the positive part L3+ of the third coil, the negative part L3- of the third coil, the positive part L4+ of the fourth coil and the negative part L4- of the fourth coil. The center taps of the first coil L1, the second coil L2, the third coil L3 and the fourth coil L4 are connected to the power supply VCC (VCC is the power supply for driving the motor, i.e., the output power supply of the power module). + / - divides the coil L into two parts, and after specifying a certain positive direction, it represents different current directions of the coils. Because of the existence of the center tap, the number of coils in this embodiment is doubled, so m=4×2=8.

[0063] It should be noted that the control circuit of this embodiment controls two unipolar stepper motors as a group, but is not limited to controlling only two unipolar stepper motors. Based on the control circuit of one group of unipolar stepper motors, the control circuit can be replicated to control multiple groups of unipolar stepper motors.

[0064] The positive part L1+ of the first coil is connected in parallel with the positive part L3+ of the third coil, one end of the parallel connection is the center tap end, and the other end serves as the first parallel end A, the first parallel end A is connected to the first coil control unit, and the first coil control unit is connected to the first GPIO port P1.

[0065] The negative part L1- of the first coil is connected in parallel with the positive part L4+ of the fourth coil, one end of the parallel connection is the center tap end, and the other end is used as the second parallel end B, the second parallel end B is connected to the second coil control unit, and the second coil control unit is connected to the second GPIO port P2.

[0066] The positive part L2+ of the second coil is connected in parallel with the negative part L3- of the third coil, one end of the parallel connection is the center tap end, and the other end serves as the third parallel end C, the third parallel end C is connected to the third coil control unit, and the third coil control unit is connected to the third GPIO port P3.

[0067] The negative part L2- of the second coil is connected in parallel with the negative part L4- of the fourth coil, one end of the parallel connection is the center tap end, and the other end is the fourth parallel end D, the fourth parallel end D is connected to the fourth coil control unit, and the fourth coil control unit is connected to the fourth GPIO port P4. That is, this embodiment has four coil control units (n=4).

[0068] The first GPIO port P1, the second GPIO port P2, the third GPIO port P3 and the fourth GPIO port P4 are partially the same or completely different GPIO ports. The first GPIO port P1, the second GPIO port P2, the third GPIO port P3 and the fourth GPIO port P4 are GPIO ports of a main control chip (a chip for controlling a motor, which has a GPIO port, and this embodiment does not limit the chip model or structure), and have three states H / L / Z, where H / L / Z are high level, low level and high impedance respectively.

[0069] Based on the above circuit connection, it can be seen that the present application can realize the control of two unipolar stepper motors by using up to 4 GPIO ports, which significantly reduces the number of GPIO ports occupied compared to the traditional method of 6 or 8 GPIO ports.

[0070] Example 1-1

[0071] Based on the coil connection method of embodiment 1, this embodiment designs the first GPIO port P1, the second GPIO port P2, the third GPIO port P3 and the fourth GPIO port P4 to be completely different GPIO ports. Figure 4As shown (the power module and the controller are omitted in the figure, and the power supply VCC provided by the power module and the GPIO port provided by the controller are shown), the first coil control unit, the second coil control unit, the third coil control unit and the fourth coil control unit are respectively a power NMOS tube, and the coil control unit has two states of on and off.

[0072] For the four parallel terminals, namely the first parallel terminal A, the second parallel terminal B, the third parallel terminal C and the fourth parallel terminal D, each parallel terminal is connected to the drain of a power NMOS tube, and the source of the power NMOS tube is grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel terminal.

[0073] Specifically, the first parallel terminal A is connected to the drain of the first power NMOS tube Q1 (ie, the first coil control unit, controlled by the first GPIO port P1), the source of the first power NMOS tube Q1 is grounded, and the gate of the first power NMOS tube Q1 is connected to the first GPIO port P1.

[0074] The second parallel terminal B is connected to the drain of the second power NMOS tube Q2 (ie, the second coil control unit, controlled by the second GPIO port P2), the source of the second power NMOS tube Q2 is grounded, and the gate of the second power NMOS tube Q2 is connected to the second GPIO port P2.

[0075] The third parallel terminal C is connected to the drain of the third power NMOS tube Q3 (ie, the third coil control unit, controlled by the third GPIO port P3), the source of the third power NMOS tube Q3 is grounded, and the gate of the third power NMOS tube Q3 is connected to the third GPIO port P3.

[0076] The fourth parallel terminal D is connected to the drain of the fourth power NMOS tube Q4 (ie, the fourth coil control unit, controlled by the fourth GPIO port P4), the source of the fourth power NMOS tube Q4 is grounded, and the gate of the fourth power NMOS tube Q4 is connected to the fourth GPIO port P4.

[0077] This embodiment adopts the form of shuffling the coils, that is, L3+ and L1+ are connected in parallel, L4+ and L1- are connected in parallel, etc. Therefore, in this embodiment, there are a total of 4 groups of coils connected in parallel, so q=4, combined with m=8, n=4, satisfying n(n-1) / 2≥mq, the number of GPIO ports in this example is 4, equal to n, compared with the traditional control circuit, the number of GPIO ports is significantly reduced.

[0078] The controller of this embodiment is based on single four-beat control. Only one set of coils of a motor is energized at any time, and the two motors do not rotate at the same time. According to this control idea, the timing diagram and truth table are formulated as shown in Table 1. (The left side is the timing diagram, and the right side is the corresponding truth table.)

[0079] Table 1 First timing truth table

[0080]

[0081] Note: 1 / 2 / 3 / 4 represents the order of four beats. When the coils are crossed, the motor cannot rotate normally. Because the motor rotation requires different coils to be energized alternately, after the coils are crossed, the two consecutive beats are the same group of coils with opposite currents, so the motor will not rotate, but will only vibrate slightly, which does not affect the actual use (suitable for scenes with low precision requirements).

[0082] In this embodiment, four GPIO ports and four power NMOS tubes are used to control two unipolar stepper motors. Compared with the traditional method of using six or eight GPIO ports in conjunction with a motor driver chip, the number of GPIO ports occupied and the control cost are significantly reduced.

[0083] Example 1-2

[0084] Based on the coil connection method of Example 1, this embodiment designs the first GPIO port, the second GPIO port, the third GPIO port and the fourth GPIO port as partially identical GPIO ports, and the first GPIO port and the third GPIO port may be the same GPIO port, or the second GPIO port and the fourth GPIO port may be the same GPIO port.

[0085] The two coil control units that are not connected to the same GPIO port are respectively a power NMOS tube, each parallel end is connected to the drain of a power NMOS tube, and the source of the power NMOS tube is grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel end.

[0086] Among the two coil control units connected to the same GPIO port, one of the coil control units is a power NMOS tube, the corresponding parallel end and the source of the power NMOS tube are grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel end; the other coil control unit includes a power NMOS tube, a signal NMOS tube and two resistors, the corresponding parallel end is connected to the drain of a power NMOS tube, and the source of the power NMOS tube is grounded, the gate of the power NMOS tube is connected to the drain of the signal NMOS tube, the drain of the signal NMOS tube is connected to the power module through a resistor, the source of the signal NMOS tube is grounded, the gate of the signal NMOS tube is connected to the GPIO port corresponding to the parallel end, and the gate of the signal NMOS tube is connected to the power module through another resistor.

[0087] Specifically, Figure 5As shown (the power module and the controller are omitted in the figure, and the power supply VCC provided by the power module and the GPIO port provided by the controller are shown), when the first GPIO port P1 and the third GPIO port P3 are the same GPIO port (at this time the third GPIO port P3 is connected to the first GPIO port P1), the first coil control unit is the first power NMOS tube Q1, the second coil control unit is the second power NMOS tube Q2, the third coil control unit includes the third power NMOS tube Q3, the fifth signal NMOS tube Q5, the resistor R1 and the resistor R3, and the fourth coil control unit is the fourth power NMOS tube Q4.

[0088] The first parallel terminal A is connected to the drain of the first power NMOS transistor Q1 , the source of the first power NMOS transistor Q1 is grounded, and the gate of the first power NMOS transistor Q1 is connected to the first GPIO port P1 .

[0089] The second parallel terminal B is connected to the drain of the second power NMOS transistor Q2 , the source of the second power NMOS transistor Q2 is grounded, and the gate of the second power NMOS transistor Q2 is connected to the second GPIO port P2 .

[0090] The third parallel terminal C is connected to the drain of the third power NMOS tube Q3, the source of the third power NMOS tube Q3 is grounded, the gate of the third power NMOS tube Q3 is connected to the drain of the fifth signal NMOS tube Q5, the drain of the fifth signal NMOS tube Q5 is connected to the power supply VCC through the resistor R1, the source of the fifth signal NMOS tube Q5 is grounded, the gate of the fifth signal NMOS tube Q5 is connected to the third GPIO port P3 (that is, the first GPIO port P1), and the gate of the fifth signal NMOS tube Q5 is connected to the power supply VCC through the resistor R3.

[0091] The fourth parallel terminal D is connected to the drain of the fourth power NMOS transistor Q4 , the source of the fourth power NMOS transistor Q4 is grounded, and the gate of the fourth power NMOS transistor Q4 is connected to the fourth GPIO port P4 .

[0092] This embodiment adopts the form of shuffling the coils, that is, L3+ and L1+ are connected in parallel, L4+ and L1- are connected in parallel, etc. Therefore, in this embodiment, there are a total of 4 groups of coils connected in parallel, so q=4, combined with m=8, n=4, satisfying n(n-1) / 2≥mq, the number of GPIO ports in this example is 3, which is less than n. Compared with the traditional control circuit, the number of GPIO ports is significantly reduced.

[0093] The controller of this embodiment is based on single four-beat control. Only one set of coils of a motor is energized at any time, and the two motors do not rotate at the same time. According to this control idea, a timing diagram and truth table 2 are formulated. (The left side is the timing diagram, and the right side is the corresponding truth table.) Table 2 Second timing truth diagram

[0094]

[0095] Note: 1 / 2 / 3 / 4 represents the order of four beats. When the coils are crossed, the motor cannot rotate normally. Because the motor rotation requires different coils to be energized alternately, after the coils are crossed, the two consecutive beats are the same group of coils with opposite currents, so the motor will not rotate, but will only vibrate slightly, which does not affect the actual use (suitable for scenes with low precision requirements).

[0096] It should be noted that Figure 5 In the example of connecting the third GPIO port to the first GPIO port, in other embodiments, when the first GPIO port is connected to the third GPIO port, the switching Figure 5 The coil control unit corresponding to the first GPIO port and the third GPIO port can be used, and will not be described in detail here.

[0097] In this embodiment, three GPIO ports and five power NMOS tubes are used to control two unipolar stepper motors. Compared with the traditional method of using six or eight GPIO ports in conjunction with a motor driver chip, the number of GPIO ports occupied and the control cost are significantly reduced.

[0098] In addition, if Figure 6 As shown in the figure (the power module and the controller are omitted, and the power supply VCC provided by the power module and the GPIO port provided by the controller are shown), when the second GPIO port and the fourth GPIO port are the same GPIO port (at this time, the fourth GPIO port P4 is connected to the second GPIO port P2), the first coil control unit is the first power NMOS tube Q1, the second coil control unit is the second power NMOS tube Q2, the third coil control unit is the third power NMOS tube Q3, and the fourth coil control unit includes a fourth power NMOS tube Q4, a sixth signal NMOS tube Q6, a resistor R2 and a resistor R4

[0099] The first parallel terminal A is connected to the drain of the first power NMOS transistor Q1 , the source of the first power NMOS transistor Q1 is grounded, and the gate of the first power NMOS transistor Q1 is connected to the first GPIO port P1 .

[0100] The second parallel terminal B is connected to the drain of the second power NMOS transistor Q2 , the source of the second power NMOS transistor Q2 is grounded, and the gate of the second power NMOS transistor Q2 is connected to the second GPIO port P2 .

[0101] The third parallel terminal C is connected to the drain of the third power NMOS transistor Q3 , the source of the third power NMOS transistor Q3 is grounded, and the gate of the third power NMOS transistor Q3 is connected to the third GPIO port P3 .

[0102] The fourth parallel terminal D is connected to the drain of the fourth power NMOS tube Q4, the source of the fourth power NMOS tube Q4 is grounded, the gate of the fourth power NMOS tube Q4 is connected to the drain of the sixth signal NMOS tube Q6, the drain of the sixth signal NMOS tube Q6 is connected to the power supply VCC through the resistor R2, the source of the sixth signal NMOS tube Q6 is grounded, the gate of the sixth signal NMOS tube Q6 is connected to the fourth GPIO port P4 (that is, the second GPIO port P2), and the gate of the sixth signal NMOS tube Q6 is connected to the power supply VCC through the resistor R4.

[0103] This embodiment adopts the form of shuffling the coils, that is, L3+ and L1+ are connected in parallel, L4+ and L1- are connected in parallel, etc. Therefore, in this embodiment, there are a total of 4 groups of coils connected in parallel, so q=4, combined with m=8, n=4, satisfying n(n-1) / 2≥mq, the number of GPIO ports in this example is 3, which is less than n. Compared with the traditional control circuit, the number of GPIO ports is significantly reduced.

[0104] The controller of this embodiment is based on single four-beat control. Only one set of coils of a motor is energized at any time, and the two motors do not rotate at the same time. According to this control idea, a timing diagram and truth table 3 are formulated. (The left side is the timing diagram, and the right side is the corresponding truth table.) Table 3 Third timing truth diagram

[0105]

[0106] Note: 1 / 2 / 3 / 4 represents the order of four beats. When the coils are crossed, the motor cannot rotate normally. Because the motor rotation requires different coils to be energized alternately, after the coils are crossed, the two consecutive beats are the same group of coils with opposite currents, so the motor will not rotate, but will only vibrate slightly, which does not affect the actual use (suitable for scenes with low precision requirements).

[0107] It should be noted that Figure 6 In the example of connecting the fourth GPIO port to the second GPIO port, in other embodiments, when the second GPIO port is connected to the fourth GPIO port, the switching Figure 5 The coil control unit corresponding to the second GPIO port and the fourth GPIO port can be used, and no further details will be given here.

[0108] In this embodiment, three GPIO ports and five power NMOS tubes are used to control two unipolar stepper motors. Compared with the traditional method of using six or eight GPIO ports in conjunction with a motor driver chip, the number of GPIO ports occupied and the control cost are significantly reduced.

[0109] Examples 1-3

[0110] Based on the coil connection method of Example 1, this embodiment designs the first GPIO port, the second GPIO port, the third GPIO port and the fourth GPIO port as partially identical GPIO ports, wherein the first GPIO port and the third GPIO port are the same GPIO port, and the second GPIO port and the fourth GPIO port are the same GPIO port.

[0111] Among the two coil control units connected to the same GPIO port, one of the coil control units is a power NMOS tube, the corresponding parallel end is connected to the drain of the power NMOS tube, the source of the power NMOS tube is grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel end; the other coil control unit includes a power NMOS tube, a signal NMOS tube and two resistors, the corresponding parallel end is connected to the drain of the power NMOS tube, the source of the power NMOS tube is grounded, the gate of the power NMOS tube is connected to the drain of the signal NMOS tube, the drain of the signal NMOS tube is connected to the power module through a resistor, the source of the signal NMOS tube is grounded, the gate of the signal NMOS tube is connected to the GPIO port corresponding to the parallel end, and the gate of the signal NMOS tube is connected to the power module through another resistor.

[0112] Specifically, Figure 7 As shown (the power module and the controller are omitted in the figure, and the power supply VCC provided by the power module and the GPIO port provided by the controller are shown), when the first GPIO port P1 and the third GPIO port P3 are the same GPIO port (at this time, the third GPIO port P3 is connected to the first GPIO port P1), and the second GPIO port and the fourth GPIO port are the same GPIO port (at this time, the fourth GPIO port P4 is connected to the second GPIO port P2), the first coil control unit is the first power NMOS tube Q1, the second coil control unit is the second power NMOS tube Q2, the third coil control unit includes the third power NMOS tube Q3, the fifth signal NMOS tube Q5, the resistor R1 and the resistor R3, and the fourth coil control unit includes the fourth power NMOS tube Q4, the sixth signal NMOS tube Q6, the resistor R2 and the resistor R4.

[0113] The first parallel terminal A is connected to the drain of the first power NMOS transistor Q1 , the source of the first power NMOS transistor Q1 is grounded, and the gate of the first power NMOS transistor Q1 is connected to the first GPIO port P1 .

[0114] The second parallel terminal B is connected to the drain of the second power NMOS transistor Q2 , the source of the second power NMOS transistor Q2 is grounded, and the gate of the second power NMOS transistor Q2 is connected to the second GPIO port P2 .

[0115] The third parallel terminal C is connected to the drain of the third power NMOS tube Q3, the source of the third power NMOS tube Q3 is grounded, the gate of the third power NMOS tube Q3 is connected to the drain of the fifth NMOS tube, the drain of the fifth NMOS tube is connected to the power supply VCC through the resistor R1, the source of the fifth signal NMOS tube Q5 is grounded, the gate of the fifth signal NMOS tube Q5 is connected to the third GPIO port P3 (that is, the first GPIO port P1), and the gate of the fifth signal NMOS tube Q5 is connected to the power supply VCC through the resistor R3.

[0116] The fourth parallel terminal D is connected to the drain of the fourth power NMOS tube Q4, the source of the fourth power NMOS tube Q4 is grounded, the gate of the fourth power NMOS tube Q4 is connected to the drain of the sixth signal NMOS tube Q6, the drain of the sixth signal NMOS tube Q6 is connected to the power supply VCC through the resistor R2, the source of the sixth signal NMOS tube Q6 is grounded, the gate of the sixth signal NMOS tube Q6 is connected to the fourth GPIO port P4 (that is, the second GPIO port P2), and the gate of the sixth signal NMOS tube Q6 is connected to the power supply VCC through the resistor R4.

[0117] This embodiment adopts the form of shuffling the coils, that is, L3+ and L1+ are connected in parallel, L4+ and L1- are connected in parallel, etc. Therefore, in this embodiment, there are a total of 4 groups of coils connected in parallel, so q=4, combined with m=8, n=4, satisfying n(n-1) / 2≥mq, this embodiment cannot take the equal sign, and it is the most simplified design in the integer set. In this embodiment, the number of GPIO ports is 2, which is less than n. Compared with the traditional control circuit, the number of GPIO ports is significantly reduced.

[0118] In this embodiment, only two GPIO ports and six MOS tubes are needed. Combined with the algorithm idea of ​​Charlie multiplexing, a single four-beat control method is adopted to realize the control of two unipolar stepper motors. For example, when the first GPIO port P1 is H, the first power NMOS tube Q1 is turned on, the fifth signal NMOS tube Q5 is turned on, and the third power NMOS tube Q3 is turned off; when the first GPIO port P1 is L, the first power NMOS tube Q1 is turned off, the fifth signal NMOS tube Q5 is turned off, and the third power NMOS tube Q3 is turned on; when the first GPIO port P1 is Z, the first power NMOS tube Q1 is turned off, the fifth signal NMOS tube Q5 is turned on, and the third power NMOS tube Q3 is turned off; the second GPIO port P2 is the same. (The core idea of ​​Charlie multiplexing is to use high impedance state to turn off both switch tubes.)

[0119] The controller of this embodiment is based on single four-beat control. Only one set of coils of a motor is energized at any time, and the two motors do not rotate at the same time. According to this control idea, a timing diagram and truth table 4 are formulated. (The left side is the timing diagram, and the right side is the corresponding truth table.) Table 4 Third timing truth diagram

[0120]

[0121] Note: 1 / 2 / 3 / 4 represents the order of four beats. When the coils are crossed, the motor cannot rotate normally. Because the motor rotation requires different coils to be energized alternately, after the coils are crossed, the two consecutive beats are the same group of coils with opposite currents, so the motor will not rotate, but will only vibrate slightly, which does not affect the actual use (suitable for scenes with low precision requirements).

[0122] This embodiment uses Charlie multiplexing to control the three states of the GPIO port to achieve three switch states for the two groups of coils, namely, switch, close and close. The two groups of coils are not energized at the same time by connecting the coils end to end and using the GPIO high impedance state. The two motors are not working at the same time by combining the crossover between coils and the use of the GPIO high impedance state and the control timing. The time-sharing rotation control of two unipolar stepping motors is achieved through the control circuit of 2 GPIOs and 6 MOS tubes.

[0123] It should be noted that the MOS tube in this application can be replaced with other switching devices that achieve the same function, so that this application only requires a small number of GPIOs and switching devices to achieve the control of a unipolar stepper motor, which is suitable for scenarios where the master GPIO capability is weak and cost control is strict.

[0124] Example 2-1

[0125] This embodiment is described by taking a bipolar stepping motor as an example.

[0126] Two bipolar stepper motors are controlled as a group. The two coils of one bipolar stepper motor in a group are the first coil L1 and the second coil L2, and the two coils of the other bipolar stepper motor are the third coil L3 and the fourth coil L4, that is, the number of coils m=4.

[0127] It should be noted that the control circuit of this embodiment controls two bipolar stepper motors as a group, but is not limited to controlling only two bipolar stepper motors. Based on the control circuit of one group of bipolar stepper motors, the control circuit can be replicated to control multiple groups of bipolar stepper motors.

[0128] like Figure 8As shown in the figure (the power module and the controller are omitted, and the power supply VCC provided by the power module and the GPIO port provided by the controller are shown), in the control circuit for a group of bipolar stepper motors, the first coil L1 is connected in series with the second coil L2, and the connecting end of the first coil L1 and the second coil L2 in the series circuit is used as the first end A, the other end of the first coil L1 is used as the second end B, and the other end of the second coil L2 is used as the third end C; one end of the third coil L3 is connected to the second end B, and the other end of the third coil L3 is connected to the third end C, one end of the fourth coil L4 is connected to the second end B, and the other end of the fourth coil L4 is used as an independent fourth end D. Any end is connected to a GPIO port through a coil control unit, and the coil control unit in this embodiment is a MOS tube push-pull structure. The GPIO port is a GPIO port of the main control chip (a chip used to control the motor, and the chip has a GPIO port, and this embodiment does not limit the chip model or structure), and has three states of H / L / Z, and H / L / Z are high level, low level and high impedance respectively.

[0129] The MOS tube push-pull structure includes an NMOS tube and a PMOS tube; the gate of the NMOS tube and the gate of the PMOS tube are connected to the same GPIO port, the drain of the NMOS tube and the drain of the PMOS tube are connected to the same end, the source of the PMOS tube is connected to the power supply VCC (the power supply for driving the motor, that is, the output power supply of the power module), and the source of the NMOS tube is grounded.

[0130] In this embodiment, there are a first end, a second end, a third end and a fourth end, so there are four coil control units (n=4) in this embodiment, that is, four MOS tube push-pull structures, which are respectively a first PMOS tube Q1 and a first NMOS tube Q4 connected to the second end B (constituting a first coil control unit, controlled by the first GPIO port P1), a second PMOS tube Q2 and a second NMOS tube Q5 connected to the first end A (constituting a second coil control unit, controlled by the second GPIO port P2), a third PMOS tube Q3 and a third NMOS tube Q6 connected to the third end C (constituting a third coil control unit, controlled by the third GPIO port P3), and a fourth PMOS tube Q7 and a fourth NMOS tube Q8 connected to the fourth end D (constituting a fourth coil control unit, controlled by the fourth GPIO port P4).

[0131] The gates of the first PMOS tube Q1 and the first NMOS tube Q4 are connected to the first GPIO port P1, the drains of the first PMOS tube Q1 and the first NMOS tube Q4 are connected to the second end B, the source of the first PMOS tube Q1 is connected to the power supply VCC, and the source of the first NMOS tube Q4 is grounded; the gates of the second PMOS tube Q2 and the second NMOS tube Q5 are connected to the second GPIO port P2, the drains of the second PMOS tube Q2 and the second NMOS tube Q5 are connected to the first end A, the source of the second PMOS tube Q2 is connected to the power supply VCC, and the source of the second NMOS tube Q5 is grounded The gates of the third PMOS tube Q3 and the third NMOS tube Q6 are connected to the third GPIO port P3, the drains of the third PMOS tube Q3 and the third NMOS tube Q6 are connected to the third end C, the source of the third PMOS tube Q3 is connected to the power supply VCC, and the source of the third NMOS tube Q6 is grounded; the gates of the fourth PMOS tube Q7 and the fourth NMOS tube Q8 are connected to the fourth GPIO port P4, the drains of the fourth PMOS tube Q7 and the fourth NMOS tube Q8 are connected to the second end B, the source of the fourth PMOS tube Q7 is connected to the power supply VCC, and the source of the fourth NMOS tube Q8 is grounded.

[0132] Among them, Q1 / Q2 / Q3 / Q7 selects a PMOS tube whose turn-on voltage is greater than the difference between the power supply VCC and the high level of the GPIO port and less than the power supply VCC, ensuring that when P1 / P2 / P3 / P4 is high or high impedance, Q1 / Q2 / Q3 / Q7 is turned off, and when P1 / P2 / P3 / P4 is low, Q1 / Q2 / Q3 / Q7 is turned on. In addition, Q4 / Q5 / Q6 / Q8 selects an NMOS with a turn-on voltage less than the GPIO high level, ensuring that when P1 / P2 / P3 / P4 is high, Q4 / Q5 / Q6 / Q8 is turned on, and when P1 / P2 / P3 / P4 is low or high impedance, Q4 / Q5 / Q6 / Q8 is turned off.

[0133] Based on the above structure, this embodiment combines the core idea of ​​Charlie multiplexing and uses high configuration to realize that both switch tubes are turned off. For example, when the first GPIO port P1 is in the H state, the first PMOS tube Q1 is turned off and the first NMOS tube Q4 is turned on; when the first GPIO port P1 is in the L state, the first PMOS tube Q1 is turned on and the first NMOS tube Q4 is turned off; when the first GPIO port P1 is in the Z state, the first PMOS tube Q1 is turned off and the first NMOS tube Q4 is turned off; that is, the first GPIO port P1 can be satisfied to allow the first coil control unit to have three states. The same is true for P2 / P3 / P4. Therefore, this embodiment only requires 4 GPIOs and 8 MOS tubes. Combined with the algorithm idea of ​​Charlie multiplexing, the conventional single four-beat control method is adopted to realize the control of two bipolar stepper motors.

[0134] In this embodiment, since there are no coils in parallel, the number of coil groups in parallel is q=0, combined with m=4, n=4, so this embodiment satisfies n(n-1) / 2≥mq. The control circuit of this embodiment is not a simplified design, and the number of GPIO ports is 4, which is equal to n. The control of two stepper motors is achieved based on 4 GPIO ports, which still has advantages over traditional solutions.

[0135] This embodiment provides a method based on single four-beat control. Only one set of the two sets of coils of a motor is energized at any time, and the two motors do not rotate at the same time. Therefore, a timing diagram and a truth table are provided as shown in Table 5 (the left side is the timing diagram, and the right side is the corresponding truth table).

[0136] Table 5 The first timing diagram and truth table

[0137]

[0138] Note: 1 / 2 / 3 / 4 represents the order of four beats.

[0139] In this embodiment, 4 GPIO ports and 8 MOS tubes are used to control two bipolar stepper motors. Compared with the traditional method of using 6 or 8 GPIO ports in conjunction with a motor driver chip, the number of GPIO ports occupied and the control cost are significantly reduced.

[0140] Example 2-2

[0141] This embodiment is described by taking a bipolar stepping motor as an example.

[0142] Two bipolar stepper motors are controlled as a group. The two coils of one bipolar stepper motor in a group are the first coil L1 and the second coil L2, and the two coils of the other bipolar stepper motor are the third coil L3 and the fourth coil L4, that is, the number of coils m=4.

[0143] It should be noted that the control circuit of this embodiment controls two bipolar stepper motors as a group, but is not limited to controlling only two bipolar stepper motors. Based on the control circuit of one group of bipolar stepper motors, the control circuit can be replicated to control multiple groups of bipolar stepper motors.

[0144] like Fig. 9As shown in the figure (the power module and the controller are omitted, and the power supply VCC provided by the power module and the GPIO port provided by the controller are shown), in the control circuit for a group of bipolar stepper motors, the first coil L1 is connected in series with the second coil L2, and the connecting end of the first coil L1 and the second coil L2 in the series circuit is used as the first end A, the other end of the first coil L1 is used as the second end B, and the other end of the second coil L2 is used as the third end C; one end of the third coil L3 is connected to the second end B, and the other end of the third coil L3 is connected to the third end C, one end of the fourth coil L4 is connected to the second end B, and the other end of the fourth coil L4 is connected to the first end A. Any end is connected to a GPIO port through a coil control unit, and the coil control unit is a MOS tube push-pull structure. The GPIO port is a GPIO port of the main control chip (a chip used to control the motor, and the chip has a GPIO port, and this embodiment does not limit the chip model or structure), and has three states of H / L / Z, and H / L / Z are high level, low level and high impedance respectively.

[0145] The MOS tube push-pull structure includes an NMOS tube and a PMOS tube; the gate of the NMOS tube and the gate of the PMOS tube are connected to the same GPIO port, the drain of the NMOS tube and the drain of the PMOS tube are connected to the same end, the source of the PMOS tube is connected to the power supply VCC (the power supply for driving the motor, that is, the output power supply of the power module), and the source of the NMOS tube is grounded.

[0146] In this embodiment, there are a first end, a second end and a third end, so there are three coil control units (n=3), that is, three MOS tube push-pull structures, which are respectively a first PMOS tube Q1 and a first NMOS tube Q4 connected to the second end B (constituting a first coil control unit, controlled by the first GPIO port P1), a second PMOS tube Q2 and a second NMOS tube Q5 connected to the first end A (constituting a second coil control unit, controlled by the second GPIO port P2), and a third PMOS tube Q3 and a third NMOS tube Q6 connected to the third end C (constituting a third coil control unit, controlled by the third GPIO port P3).

[0147] And the gates of the first PMOS tube Q1 and the first NMOS tube Q4 are connected to the first GPIO port P1, the drains of the first PMOS tube Q1 and the first NMOS tube Q4 are connected to the second end B, the source of the first PMOS tube Q1 is connected to the power supply VCC, and the source of the first NMOS tube Q4 is grounded; the gates of the second PMOS tube Q2 and the second NMOS tube Q5 are connected to the second GPIO port P2, the drains of the second PMOS tube Q2 and the second NMOS tube Q5 are connected to the first end A, the source of the second PMOS tube Q2 is connected to the power supply VCC, and the source of the second NMOS tube Q5 is grounded; the gates of the third PMOS tube Q3 and the third NMOS tube Q6 are connected to the third GPIO port P3, the drains of the third PMOS tube Q3 and the third NMOS tube Q6 are connected to the third end C, the source of the third PMOS tube Q3 is connected to the power supply VCC, and the source of the third NMOS tube Q6 is grounded.

[0148] Q1 / Q2 / Q3 selects a PMOS tube whose turn-on voltage is greater than the difference between the power supply VCC and the high level of the GPIO port and less than the power supply VCC, ensuring that when P1 / P2 / P3 is high or high impedance, Q1 / Q2 / Q3 is turned off, and when P1 / P2 / P3 is low, Q1 / Q2 / Q3 is turned on. In addition, Q4 / Q5 / Q6 selects an NMOS tube whose turn-on voltage is less than the GPIO high level, ensuring that when P1 / P2 / P3 is high, Q4 / Q5 / Q6 is turned on, and when P1 / P2 / P3 is low or high impedance, Q4 / Q5 / Q6 is turned off. Because L1 and L4 are in parallel, the current of Q1 / Q2 / Q4 / Q5 is twice that of Q3 / Q6.

[0149] Based on the above structure, this embodiment combines the core idea of ​​Charlie multiplexing and uses high configuration to realize that both switch tubes are turned off. For example, when the first GPIO port P1 is in the H state, the first PMOS tube Q1 is turned off and the first NMOS tube Q4 is turned on; when the first GPIO port P1 is in the L state, the first PMOS tube Q1 is turned on and the first NMOS tube Q4 is turned off; when the first GPIO port P1 is in the Z state, the first PMOS tube Q1 is turned off and the first NMOS tube Q4 is turned off; that is, the first GPIO port P1 can be satisfied to allow the first coil control unit to have three states. The same is true for P2 / P3. Therefore, this embodiment only requires 3 GPIOs and 6 MOS tubes. Combined with the algorithm idea of ​​Charlie multiplexing, the conventional single four-beat control method is adopted to realize the control of two bipolar stepper motors.

[0150] In this embodiment, since the first coil L1 and the fourth coil L4 are connected in parallel, the number of coil groups in parallel is q=1, combined with m=4, n=3, so this embodiment satisfies n(n-1) / 2≥mq, and the equal sign is the simplest design, that is, the control circuit of this embodiment is the simplest design, and the number of GPIO ports in this example is 3, which is equal to n, and the number of GPIO ports cannot be further reduced.

[0151] This embodiment provides a method based on single four-beat control. Only one set of the two sets of coils of a motor is energized at any time, and the two motors do not rotate at the same time. Therefore, a timing diagram and a truth table are provided as shown in Table 6 (the left side is the timing diagram, and the right side is the corresponding truth table).

[0152] Table 6 Second timing diagram and truth table

[0153]

[0154]

[0155] Note: 1 / 2 / 3 / 4 represents the order of four beats.

[0156] In this embodiment, extremely simplified 3 GPIO ports and 6 MOS tubes are used to control two bipolar stepper motors. Compared with the traditional 6 or 8 GPIO ports combined with motor driver chips, the number of GPIO ports occupied and the control cost are significantly reduced.

[0157] This embodiment uses Charlie multiplexing to control the three states of the GPIO port to realize that the MOS tube push-pull structure has three switch states, namely, switch, close-on and close-off. The effect of not energizing the two sets of coils at the same time is achieved by connecting the coils end to end and using the high-impedance state of the GPIO port. The effect of not working at the same time is achieved by combining the use of the GPIO high-impedance state and the conventional control timing. The time-sharing rotation control of two bipolar stepper motors is achieved by combining the control circuit of 3 GPIOs, 6 MOS tubes and the conventional single four-beat control method. This embodiment only takes the single four-beat control method as an example for explanation, and is not limited to this embodiment that can only work in combination with the single four-beat control method. For example, it can also be based on conventional control methods such as the double four-beat method, the eight-beat method or the micro-step method. Under the premise of ensuring the normal operation of the two bipolar stepper motors, this embodiment does not limit the control method.

[0158] It should be noted that the MOS tube in this application can be replaced with other switching devices that achieve the same function, so that this application only requires a small number of GPIOs and switching devices to achieve the control of bipolar stepper motors, which is suitable for scenarios with weak master GPIO capabilities and strict cost control.

[0159] In the present invention, the terms "first", "second", etc. are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number or order of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0160] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0161] The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.

Claims

1. A stepper motor control circuit, used to control the operation of a stepper motor, wherein a stepper motor has two sets of coils, characterized in that: The stepper motor control circuit includes a controller, a power module and a coil control module; The coil control module includes a plurality of coil control units, one group of coils is connected to two coil control units, and at least one coil control unit is simultaneously connected to ends of the plurality of groups of coils; The power supply module is connected to each coil control unit and is used to supply power to each coil control unit; The controller provides a GPIO port and is connected to the coil control unit through the GPIO port. One GPIO port is connected to one or two coil control units. The GPIO port has three states: high level, low level and high impedance. A coil control unit controlled by the same GPIO port has two states of on and off or three states of off-on, on-off and off-off. Two coil control units controlled by the same GPIO port have three states of on-off, off-on and off-off.

2. The stepper motor control circuit according to claim 1, characterized in that: Each coil control unit has a control interface, a power interface and a motor interface. The control interface is connected to the GPIO port of the controller, the power interface is connected to the power module, and the motor interface is connected to the coil.

3. The stepper motor control circuit according to claim 1, characterized in that: There is the following relationship between the number of coil control units and the number of coil groups: n(n-1) / 2≥mq Wherein, n is the number of coil control units, m is the number of coil groups, q is the number of coil groups in parallel, and the number of GPIO ports is less than or equal to n.

4. The stepper motor control circuit according to claim 1, characterized in that: The controller uses a single four-beat control method to control the operation of the stepper motor based on the three states of the GPIO port.

5. The stepper motor control circuit according to claim 1, characterized in that: The stepper motor is a unipolar stepper motor, and two unipolar stepper motors are controlled as a group. The two groups of coils of one unipolar stepper motor in the group are respectively a first coil and a second coil, and the two groups of coils of the other unipolar stepper motor are respectively a third coil and a fourth coil, and the center taps of the first coil, the second coil, the third coil and the fourth coil are connected to a power module; The forward part of the first coil is connected in parallel with the forward part of the third coil, one end of the parallel connection is a center tap end, and the other end is a first parallel end, the first parallel end is connected to a first coil control unit, and the first coil control unit is connected to a first GPIO port; The negative part of the first coil is connected in parallel with the positive part of the fourth coil, one end of the parallel connection is a center tap end, and the other end is a second parallel end, the second parallel end is connected to the second coil control unit, and the second coil control unit is connected to the second GPIO port; The positive part of the second coil is connected in parallel with the negative part of the third coil, one end of the parallel connection is a center tap end, and the other end is a third parallel end, the third parallel end is connected to a third coil control unit, and the third coil control unit is connected to a third GPIO port; The negative part of the second coil is connected in parallel with the negative part of the fourth coil, one end of the parallel connection is a center tap end, and the other end is used as a fourth parallel end, the fourth parallel end is connected to a fourth coil control unit, and the fourth coil control unit is connected to a fourth GPIO port; The first GPIO port, the second GPIO port, the third GPIO port and the fourth GPIO port are partially identical or completely different GPIO ports.

6. The stepper motor control circuit according to claim 5, characterized in that: When the first GPIO port, the second GPIO port, the third GPIO port and the fourth GPIO port are completely different GPIO ports, the first coil control unit, the second coil control unit, the third coil control unit and the fourth coil control unit are respectively a power NMOS tube; Among the four parallel ends, namely the first parallel end, the second parallel end, the third parallel end and the fourth parallel end, each parallel end is connected to the drain of a power NMOS tube, and the source of the power NMOS tube is grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel end.

7. The stepper motor control circuit according to claim 5, characterized in that: When the first GPIO port, the second GPIO port, the third GPIO port and the fourth GPIO port are partially identical GPIO ports, and the first GPIO port and the third GPIO port are the same GPIO port, or the second GPIO port and the fourth GPIO port are the same GPIO port; The two coil control units that are not connected to the same GPIO port are respectively a power NMOS tube, each parallel end is connected to the drain of a power NMOS tube, and the source of the power NMOS tube is grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel end; Among the two coil control units connected to the same GPIO port, one of the coil control units is a power NMOS tube, the corresponding parallel end is connected to the drain of the power NMOS tube, the source of the power NMOS tube is grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel end; the other coil control unit includes a power NMOS tube, a signal NMOS tube and two resistors, the corresponding parallel end is connected to the drain of the power NMOS tube, the source of the power NMOS tube is grounded, the gate of the power NMOS tube is connected to the drain of the signal NMOS tube, the drain of the signal NMOS tube is connected to the power module through a resistor, the source of the signal NMOS tube is grounded, the gate of the signal NMOS tube is connected to the GPIO port corresponding to the parallel end, and the gate of the signal NMOS tube is connected to the power module through another resistor.

8. The stepper motor control circuit according to claim 5, characterized in that: When the first GPIO port, the second GPIO port, the third GPIO port and the fourth GPIO port are partially identical GPIO ports, and the first GPIO port and the third GPIO port are the same GPIO port, and the second GPIO port and the fourth GPIO port are the same GPIO port; Among the two coil control units connected to the same GPIO port, one of the coil control units is a power NMOS tube, the corresponding parallel end is connected to the drain of the power NMOS tube, the source of the power NMOS tube is grounded, and the gate of the power NMOS tube is connected to the GPIO port corresponding to the parallel end; the other coil control unit includes a power NMOS tube, a signal NMOS tube and two resistors, the corresponding parallel end is connected to the drain of the power NMOS tube, the source of the power NMOS tube is grounded, the gate of the power NMOS tube is connected to the drain of the signal NMOS tube, the drain of the signal NMOS tube is connected to the power module through a resistor, the source of the signal NMOS tube is grounded, the gate of the signal NMOS tube is connected to the GPIO port corresponding to the parallel end, and the gate of the signal NMOS tube is connected to the power module through another resistor.

9. The stepper motor control circuit according to claim 1, characterized in that: The stepper motor is a bipolar stepper motor, and two bipolar stepper motors are controlled as a group, wherein the two groups of coils of one bipolar stepper motor in a group are respectively the first coil and the second coil, and the two groups of coils of the other bipolar stepper motor are respectively the third coil and the fourth coil; The first coil is connected in series with the second coil, the connecting end of the first coil and the second coil in the series circuit is used as the first end, the other end of the first coil is used as the second end, and the other end of the second coil is used as the third end; One end of the third coil is connected to the second end, the other end of the third coil is connected to the third end, one end of the fourth coil is connected to the second end, the other end of the fourth coil is connected to the first end or serves as an independent fourth end; Any end is connected to a GPIO port via a coil control unit, and the coil control unit is a MOS tube push-pull structure.

10. The stepper motor control circuit according to claim 9, characterized in that: The MOS tube push-pull structure includes an NMOS tube and a PMOS tube; The gate of the NMOS tube and the gate of the PMOS tube are connected to the same GPIO port, the drain of the NMOS tube and the drain of the PMOS tube are connected to the same end, the source of the PMOS tube is connected to the power module, and the source of the NMOS tube is grounded.