深圳市宏维微电子有限公司
Shenzhen Hongweiwei electronics Co., Ltd.
Service Hotline: 18098972264

News center

Driving Stepper Motor

Date: 2019-09-23
Views: 1027

       I will describe the process of stepper motor drive with a 2-phase 4-wire stepper motor as an example. Everyone knows that an energized conductor produces a force in a magnetic field; an energized coil produces a magnetic field. The first one is the principle of DC motor drive, which is not introduced here. The latter principle is the basis of the motion of the stepper motor. Let's take a look at the 2-phase 4-wire stepper motor construction diagram, as follows:

Driving Stepper Motor


As can be seen from the above diagram, the stepper motor has a rotor and a stator. The so-called rotor, that is, the device is active and can be rotated. The so-called stator is that the device is fixed and does not move. The rotor, the middle magnet, we can see that its N and S poles have been marked. The stator, the outer ring, which has four coils of A (A+), B (B+),A(_)  (A-),B(_) (B-), each of which has a lead The externally connected line, where A, A (-) is a phase, is connected, and temporarily calls it A phase, B, B (-) is a phase, is connected, and temporarily calls it phase B. When phase A or phase B is energized, it is turned into a magnet that exerts a strong gravitational force on the magnets on the rotor, thereby pulling the rotor. Of course, the polarity of the magnet must have a certain regularity, and the torque can act in one direction according to its own needs, otherwise the force may be offset, causing the motor to not rotate or tremble after being energized. The energization law of A phase or B phase energization is the timing problem of the familiar stepping motor. Regarding the timing of the motor, we will introduce it with the program below. First explain three important parameters, as follows:

 Pitch angle: It means the angle between the two tooth pitches. The 42 stepping motor I used 

                      has 50 teeth, and the pitch angle α=360/50=7.2°.

Number of beats: The number of pulses required to turn a pitch angle, or the number of pulses 

                              required to complete a periodic change in the magnetic field, denoted by 

                              n,The following program is a 4-shot operation mode, that is, AB→BA_A_B_→AB_

                                   

Step angle: indicates the angle θ at which the motor rotates every time the control system sends 

                     a pulse signal. θ = pitch angle / number of beats = 7.2 / 4 = 1.8 °.   

The  key information we need to use about the stepper motor has been   introduced above. The next step is to explain the wiring diagram of the 2-phase 4-wire stepper motor used here, as shown below:

Driving Stepper Motor


Finally, I used Pieces of codes to illustrate the driving process of the stepper motor. The products have been used: 42 stepper motor; arduino nano development board (HW-284); driver board, L298N driver board (HW-095). The wiring diagram is as follows:

Driving Stepper Motor

Driving Stepper Motor

Codes

#include

 

#define D2 2 //A+  Black wire----OUT1

#define D3 3 //A-  Green wire----OUT2

#define D4 4 //B+  Red wire----OUT3

#define D5 5 //B-  Blue wire----OUT4

 

void setup() {

  pinMode(D2,OUTPUT);

  pinMode(D3,OUTPUT);

  pinMode(D4,OUTPUT);

  pinMode(D5,OUTPUT);

}

 

void loop() {

 //  The stepping motor used by me is 50 teeth, the pitch angle α=7.2°.if motor is drived in full steps,the step angle β=α/4. the motor turns 1.8° when send a pulse.

    /******if the motor Rotated speed is  2rev / s, then you can calculate the width of each pulse , pulse width = (1000 / 2) / (360 ° / 1.8 °) = 2.5ms******/

 

 digitalWrite(D2,HIGH);

  digitalWrite(D3,LOW);// A phase forward conduction

  digitalWrite(D4,HIGH);

  digitalWrite(D5,LOW);// B phase forward conduction

  delay(2.5);/*** Set the pulse length to 2.5ms and the motor speed to 2 revolutions per second.***/


  digitalWrite(D2,LOW);

  digitalWrite(D3,HIGH);// A phase opposite conduction

  digitalWrite(D4,HIGH);

  digitalWrite(D5,LOW);// B phase forward conduction

  delay(2.5);

 

  digitalWrite(D2,LOW);

  digitalWrite(D3,HIGH);// A phase opposite conduction

  digitalWrite(D4,LOW);

  digitalWrite(D5,HIGH);// B phase opposite conduction

  delay(2.5);

 

  digitalWrite(D2,HIGH);

  digitalWrite(D3,LOW);// A phase forward conduction

  digitalWrite(D4,LOW);

  digitalWrite(D5,HIGH);// B phase opposite conduction

  delay(2.5);

}




News / news More
2019 - 08 - 06
1.IntroductionArduino Due is an open source development board with 32-bit ARM core. Its pins are fully compatible with Arduino Mega2560. Atmel's ATSAM3X8E is used in the chip. Atmel preburns bootloader into ROM when it manufactures the chip. Arduino Due has 54 digital IO ports (12 can be used for PWM output), 12 analog input ports, 4 UART hardware serial ports, 84 MHz clock frequency, one USB ...
2019 - 08 - 06
At present, it is found that Arduino version 1.8.5 or more needs to be set up when downloading programs.Next, take Arduino 1.8.5/Arduino 1.8.8/arduino 1.8.9 and Arduino 1.8.9 as examples.The development board connects the computer through the USB cable and checks the port number in the device manager. As shown in the figure.I. Take Arduino 1.8.5 as an exampleOpen the Arduino software and set up th...
2019 - 08 - 06
Prepare software:ST Visual Programmer1. Read Protection Settings:Click on Option byteClick on the ROP option and select Read Out Protection ONAfter the above changes, the chip can no longer be read!When burning HEX files, there will be read protection prompts.The tips are as follows: Read Out Protection ON in read protection stateThis operation is equivalent to the first level protection, and can ...
2019 - 08 - 06
LED照明灯具的驱动电源对变压器、电感器参数的要求十分高,为求精准需花费大量的人力和财力才能实现,工业化生产成本很难进一步下降。对LED驱动恒流源芯片设计技术的创新和突破,新的解决方案可以在LED灯具驱动电源实际应用时,输出电流对变压器和电感的电感量和LED的VF等参数不太敏感。创新技术的关键是优化芯片算法语言。芯片控制输出电流峰值,并通过辅助绕组反馈,使得退磁时间和芯片开关周期的比例固定,这样就可以使得输出电流与外围的电感量偏差和输出电压的偏差无关,而LED的VF值的偏差和电感偏差正是批量生产面临的最大的问题。来说,批量生产的变压器电感量和LED的VF都会有5~10%左右的偏差。而LED照明恒流驱动电源,批量精度可达3%以内,可以容许变压器和电感参数有较大的允差,这就降低了规模工业化生产的成本并促进流水线的持续快速生产
Copyright ©2019 - 2021 
Shenzhen Hongweiwei electronics Co., Ltd.
Rhino Cloud provides cloud computing services
Address:No. 4 Futian Zhonghang Road, Futian District, Shenzhen City 100 Building, Jindu A Block 31F
Tel:+86 0755-2955 6666
Fax:+86 0755-2788 8009
Zip-code:330520
Hotline 18098972264 E-mail 3004130168@qq.com
5
电话
  • 18098972264
1
QQ
6
二维码
BackTop