The ULN2003 Stepper Motor Driver Module is small size & ease to use electronic module, it used ULN2003 Chip to amplify the signal from the micro controller, Input voltage max 15v
Logic Control Voltage: 3 to 5.5v
Motor Supply Voltage: 5 to 15v
Can Sink 500mA from 50v supply,(beter used voltage driver under 15 volts)
Operating Temperature: -25 degrees Celsius to +90 Degree Celsius
Stepper motor has convert pulse to angle displacement. So if you give stepper driver a certain PWM signal, it will drive step motor to a certain angle. you can control the angle the stepper moved by the number of the pulse.
And you can also control the speed of the stepper rotate by the frequency of the pulse.
Controlling the signal to drive a 28BYJ48 stepper to rotate 1/4096 circle.
line | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
---|---|---|---|---|---|---|---|---|
red | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
orange | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
yellow | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
pink | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
blue | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
Defined the time series in a array
1 2 3 4 5 |
// Byte = CCW < COUNTER CLOCK WISE // BYTE = CW < CLOCK WISE <br>byte CCW[8] = {0x09,0x01,0x03,0x02,0x06,0x04,0x0c,0x08}; //Counter Clock-Wise <br>byte CW[8]= {0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09}; //Clock-Wise |
& in the following usage it will run, and then you must know how to drive a stepper.
The stepper motor stopped when pushed the stop_button. It also can be changed to control the stepper motor to counterclockwise or clockwise rotation.
Source Code
Arduino Programming Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
/*************************** 14CORE | ULN2003 STEPPER MOTOR TEST CODE *************************/ /* The time Series to control the stepper --make your making more easy! */ byte CCW[8] = {0x09,0x01,0x03,0x02,0x06,0x04,0x0c,0x08}; byte CW[8] = {0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09}; const int stop_key = 14; //stop_button connect to Arduino-A0 byte change_angle=64; //change the parameter to change the angle of the stepper void Motor_CCW() //the stepper move 360/64 angle at Counter Clock wise { for(int i = 0; i < 8; i++) for(int j = 0; j < 8; j++) { if(digitalRead(stop_key)==0) { PORTB =0xf0; break; } PORTB = CCW[j]; delay Microseconds(1150); } } void Motor_CW() //the steper move 360/64 angle at Clockwise { for(int i = 0; i < 8; i++) for(int j = 0; j < 8; j++) { if(digitalRead(stop_key)==0) { PORTB =0xf0; break; } PORTB = CW[j]; delay Microseconds(1150); } } void setup() { pinMode(stop_key,INPUT); digitalWrite(stop_key,HIGH); Serial.begin(57600); DDRB=0xff; PORTB = 0xf0; for(int k=0;k<change_angle;k++) { Motor_CCW(); } } void loop() { Motor_CCW(); //make the stepper to anticlockwise rotate // Motor_LR(); //make the stepper to clockwise rotate } |
Download the ULN2003_Data_Sheet Here!
I finally found it, and works well. Thanks
Saved as a favorite, I really like your blog!