A stepper motor controller based on PIC24F single chip computer, Bluetooth wireless communication and APP control on mobile phone is introduced. The controller is driven by double H bridge and optocoupler isolation. It has the characteristics of motor parameter detection, no common conduction and compatibility with stepper motor under 24V. Stepping motors are widely used in various digital control systems. They have high accuracy and reliable operation. They are the key components of various automatic control systems.
This paper introduces a design of stepping motor controller based on PIC24F single chip computer, which adopts Bluetooth wireless communication and APP control on mobile phone. The hardware includes stepping motor drive circuit, motor voltage and current detection circuit, MCU control circuit, power supply circuit and shell temperature monitoring circuit. The wireless control and parameter detection of stepper motor are realized by combining the designed software with the mobile phone APP. This scheme takes 16-bit MCU PIC24FJ64GA004 as the control core, receives control instructions from APP on mobile phone through Bluetooth module, MCU drives stepper motor by optocoupler PC817 connected with double H bridge circuit of MOS transistor, and controls the positive and negative rotation, acceleration and deceleration of stepper motor. At the same time, DS18B20 temperature sensor monitors the shell temperature, motor parameter detection circuit detects the voltage and phase current of the stepper motor, which is uploaded to the mobile phone through Bluetooth module after A/D sampling and filtering by MCU, thus realizing the stepper motor control and online monitoring function. The schematic diagram of the system is shown in Figure 1. On the basis of H bridge circuit, the driving circuit of stepping motor is designed. It is a mature motor control scheme to build double H-bridge drive circuit with discrete element MOS transistors. The circuit is not complicated and the performance is reliable. According to the upper limit of different working currents of MOS transistors, it can even reach tens of amperes. It is an ideal stepping motor driver scheme. The driving circuit of H-bridge of MOS transistor has NMOS configuration and PMOS NMOS configuration. The on-resistance of H-bridge of all-NMOS transistor is smaller, but the on-voltage of the upper arm of the NMOS transistor is higher than that of the power supply, which requires additional boost circuit.
This increases the complexity and cost of the circuit. We use PMOS NMOS configuration to build the driving circuit of double H-bridge stepping motor, and the circuit is more important. Simple, low cost; and in such low current working conditions, PMOS increased conduction loss can be neglected. The driving circuit and MCU are optoelectronically isolated, and the widely used low cost optocoupler PC817 is selected. Double-input four-channel and gate (74HC08D) is added to add enabling function to drive circuit. That is, only when enabling, four-channel control signal is effective. IRF5305 and IRF1205 are selected to make stepping motor run safer and more stable. Their parameters are 55V, 110A and TO252 patch package. The driving circuit schematic diagram of stepping motor is shown in Fig. 2. In order to monitor the operation status of stepper motor in real time, the measurement function of motor parameters is designed for the driver. The operation parameters of the motor are obtained by real-time monitoring the working voltage, phase current and shell temperature of the motor to ensure the safe and stable operation of the motor.
The current sampling resistance of the motor is constantan resistance. One end is connected under H bridge and the other end is connected with GND. Its working temperature range is wide.
Its temperature coefficient is only – 40-40*10-6/. It is an ideal choice for high precision current sampling resistance. The voltage and current signal conditioning circuit is constructed by LM324 operational amplifier. The voltage is then fed into the MCU, and the A/D is sampled by the 10Bit A/D converter built in the MCU. The digital temperature chip DS18B20 is selected for the shell temperature monitoring, which is pasted on the surface of the motor shell, and the temperature parameters are monitored in real time and sent to the MCU.
The schematic diagram of motor parameter detection circuit is shown in Fig. 3. In the circuit design, 0 ohm resistance is used to connect analog (AGND) and digital (GND) single-point to reduce mutual interference and improve circuit performance. In the system, the driving circuit is powered by input voltage, MCU and Bluetooth module need additional 3.3V voltage. The traditional linear regulator has low efficiency, large size and severe heat. Therefore, DC-DC switching power supply is used to provide 3.3V voltage. The switching voltage regulator chip adopts MP2359 scheme of MPS Company. Its efficiency can be up to 92% and its working frequency can be as high as 1.4MHZ. The extremely high working frequency determines that it can work normally only with small input capacitance, output capacitance and power inductance. Bluetooth chooses HC-05 module and sends automatically through serial port. The main control chip is PIC24FJ64GA004. The power supply and the peripheral circuit of the main control chip are shown in Figure 4.
The main control chip receives the motor control instructions from the mobile APP through the Bluetooth module through the serial port to control the motor speed, step number, rotation direction and other parameters. At the same time, the collected motor parameters are transmitted to the mobile phone through the Bluetooth module after A/D conversion and software filtering. The flow chart of the system software is shown in Fig. 5. App on mobile phone is based on Chinese programming environment “easy Android” development, pure Chinese programming, easy to use, thermostatic element reducing the difficulty of development.
The software can configure parameters such as step number, speed and rotation direction of motor, and send them to the controller through Bluetooth. At the same time, it receives the motor parameters sent by the controller, and decodes, displays and saves the parameters. App on the mobile terminal is shown in Figure 6. This design realizes a wireless stepper motor controller based on PIC24FJ64GA004 MCU, double H bridge drive of MOS transistor, motor voltage, current and temperature acquisition, Bluetooth transmission. The controller program is developed by C language, and the APP design of mobile terminal is completed by Chinese language “easy Android”, which realizes the low cost wireless control of stepper motor.