Stepper motors are widely used in production and life because of their high positioning accuracy, low cost, and simple control.
Compared with open-loop stepper motors, closed-loop stepper motors have a certain overload capability and will not lose steps. They can adjust the current according to the load to reduce motor heating.
Due to the skyrocketing chip prices, the cost of closed-loop stepper motor controllers has skyrocketed. This design proposes a closed-loop stepper motor controller solution using the domestic chip ESP32 as the main control.
This design is based on Yang Gong's closed-loop stepper motor driver. The hardware has been modified and redesigned. The software has transplanted and reconstructed the code, and extracted part of the code of Grbl_ESP32 as the running framework of the core algorithm.
characteristic:
1. EN/DIR/STEP interface control, compatible with 3D printer motherboard
2. Serial port/Bluetooth/Telnet online parameter adjustment
3. 3.3A peak current
4. Position closed loop/position open loop mode can be switched
5. Overheating protection
6. Voltage monitoring
7. Real-time data feedback
typical application:
1. 3D printer, laser engraving machine, flat plotter
2. Robot
3. Electric slide
4. Smart curtains
5. Electric turntable
Figure 1 Arduino style pin diagram
The project is made public for the first time;
The project is original;
The project has not won awards in other competitions;
The project has not participated in a defense defense at school;
Open source license: CC-BY-NC-SA 3.0
Quote: #四 session的立chuangcompetition#HyperStepper Integrated low-cost, high-speed, high-precision fully closed-loop stepper motor (open source protocol: BSD)
Citation: Grbl_Esp32 (Open Source License: GPL-3.0)
Self-citation: [Hangshun Training Camp] Closed-loop stepper motor controller
Self reference: ESP32 Closed Loop Stepper Motor Controller
(1) Drive circuit:
This design uses two A4950 chips as driver chips. This chip is a full-bridge DMOS PWM motor driver and has a current limiting function. Constant current control can be achieved based on this function.
Figure 2 A4950 structural block diagram
The constant output current can be changed by adjusting the Verf pin voltage, Imax = Verf/(10*Rsense). In this design, the Verf pins of the two A4950s are connected to the DAC output pins of the ESP32 respectively, using 0.1Ω current sampling resistor, so the maximum output current is 3.3A
Figure 3 A4950 circuit diagram
(2)BUCK step-down circuit & LDO step-down circuit:
In this design, the control system power supply is obtained by stepping down the motor power supply to 5V through the BUCK circuit and then stepping down the voltage twice through the LDO buck circuit.
The BUCK chip model used in this design is JW5026, which has a withstand voltage of up to 40V and a maximum output current of 1A. It requires a small number of peripheral components and low filtering inductance requirements, so it saves PCB space.
Figure 4 BUCK step-down circuit
The LDO model used in this design has a maximum output current of up to 900mA, which is very suitable for powering ESP32
Figure 5 LDO buck circuit
(3)External signal input circuit:
In this design, the external input signal is isolated with an optocoupler. EN is a low-speed signal, so a low-speed optocoupler is used. The DIR/CLK signal is a high-speed signal, so a high-speed optocoupler is used.
Figure 6 External input signal circuit
(4) MCU minimum system:
This design uses ESP32-PICO-D4 as the main control, which integrates crystal oscillator/SPI FLASH/RF filter circuit/decoupling capacitor, etc., and requires very few peripheral components.
This design reserves a GH1.25 6pin interface as the program burning interface and serial communication interface
Figure 7 MCU minimum system
(5) Encoder circuit:
This design uses the domestic 14-bit high-precision absolute magnetic encoder MT6816. You can choose to use its SPI interface or ABI interface (not supported yet). It is installed on the back of the PCB and obtains the motor rotor angle through the radial magnetizing magnet installed at the tail of the motor.
Figure 8 Encoder circuit
(6) Motor power supply voltage sampling circuit & driver IC temperature sampling circuit:
Figure 9 Motor power supply voltage sampling circuit & driver IC temperature sampling circuit
(7) Motor power supply filter circuit:
This design uses an SS54 on the motor power supply to prevent the electric energy generated when the stepper motor is in the power generation state from causing the system to start incorrectly, and uses an SMBJ30CA to prevent the stepper motor from being in the feedback braking state or the power generation state. Voltage burnout A4950 also uses a large-capacity MLCC for line energy storage to reduce the voltage ripple of the motor power supply when it is running.
Figure 10 Motor power supply filter circuit
Code: https://gitee.com/STM32G474RET6/xbdrive (not yet complete)
Figure 11 Code screenshot
Figure 12 System framework
Figure 13 Screenshot of BOM table (including transfer module and serial port module components)
Figure 14 Back picture
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet