New product v3 engraving machine expansion board 3D printer A4988 driver board
1. Product introduction
The expansion board can be used as a drive expansion board for engraving machines, 3D printers, etc. There are a total of 4 slots for stepper motor drive modules ( note that this board does not contain A4988 stepper motor drive modules, which can be purchased separately from our store ) capable of driving 4 -way not into the motor, stepper motor and each way takes only 2 Ge IO ports, that is, 6 Ge IO ports can be well managed 3 stepper motors, very convenient, farewell The operation of traditional stepping motors is cumbersome.
2. Introduction to the correspondence between UNO and module IO port
The pins needed for the basic control of stepper motors, other pins are only used when engraving machines, or 3D printers, we will not explain them in detail here, IO corresponds to the figure above.
Arduino UNO———————- Expansion board
8 ———————— EN (Stepper motor drive enable terminal, active low)
7 ———————– Z.DIR (direction control of Z axis)
6 ———————– Y.DIR (direction control of Y axis)
5 ———————– X.DIR (direction control of X axis)
4 ———————- Z.STEP (step control of Z axis)
3 ———————- Y.STEP (step control of Y axis)
2 ———————- X.STEP (Step control of X axis)
//The following is a simple stepper motor control program,
#define EN 8 //Stepper motor enable terminal, active low
#define X_DIR 5 //X-axis stepper motor direction control
#define Y_DIR 6 //Y-axis stepper motor direction control
#define Z_DIR 7 //z-axis stepper motor direction control
#define X_STP 2 //x-axis stepping control
#define Y_STP 3 //y-axis stepping control
#define Z_STP 4 //z-axis stepping control
/*
//Function: step Function: Control the direction and number of steps of the stepper motor.
//Parameter: dir direction control, dirPin corresponds to the DIR pin of the stepper motor, stepperPin corresponds to the step pin of the stepper motor, steps The number of steps
//No return value
*/
void step(boolean dir, byte dirPin, byte stepperPin, int steps)
{
digitalWrite(dirPin, dir);
delay(50);
for (int i = 0; i <steps; i++) {
digitalWrite(stepperPin, HIGH);
delayMicroseconds(800);
digitalWrite(stepperPin, LOW);
delayMicroseconds(800);
}
}
void setup(){//Set the IO pin used by the stepper motor to output
pinMode(X_DIR, OUTPUT); pinMode(X_STP, OUTPUT);
pinMode(Y_DIR, OUTPUT); pinMode(Y_STP, OUTPUT);
pinMode(Z_DIR, OUTPUT); pinMode(Z_STP, OUTPUT);
pinMode(EN, OUTPUT);
digitalWrite(EN, LOW);
}
void loop(){
step(false, X_DIR, X_STP, 200); //X-axis motor reverses 1 circle, 200 steps are one circle
step(false, Y_DIR, Y_STP, 200); //Y-axis motor reverses 1 circle, 200 steps are one circle
step(false, Z_DIR, Z_STP, 200); //The z-axis motor reverses 1 circle, 200 steps are a circle
delay(1000);
step(true, X_DIR, X_STP, 200); //X-axis motor rotates forward 1 circle, 200 steps are one circle
step(true, Y_DIR, Y_STP, 200); //The y-axis motor rotates forward 1 circle, 200 steps are a circle
step(true, Z_DIR, Z_STP, 200); //The z-axis motor rotates forward 1 circle, 200 steps are a circle
delay(1000);
}
Experimental phenomenon: the stepper motor reverses one revolution, pauses for 1 second, and then forwards one revolution, and so on.
It is worth noting that: When connecting the A4988 module, be careful not to insert it backwards. The stepper motor wiring method is:
2A, 2B are a group (red, green), 1A, 1B are a group (blue, yellow). If you want to change the direction, just change the position of one group, such as 2A, swap with 2B.
Reviews
There are no reviews yet.