[Need help] Stepper motor control

alpha91

Feb 7, 2016
1
Joined
Feb 7, 2016
Messages
1
Hi all, i am learning to control stepper motor by using ULN2003a chip together with PIC 16f628a with a stepper motor.
But unfortunately it is not working. I am able to feel the motor is vibrating but the shaft is not rotating.

My code is as below:

void main()
{
CMCON = 0x07; // To turn off comparators
TRISB = 0; // PORT B as output port
PORTB = 0x0F;
do
{
PORTB = 0b00000011;
Delay_ms(500);
PORTB = 0b00000110;
Delay_ms(500);
PORTB = 0b00001100;
Delay_ms(500);
PORTB = 0b00001001;
Delay_ms(500);
}while(1);
}


The motor i that i am using
Mini-Stepper-Motor-5v-4-phase-5-wire-stepper-motor-gear-motor.jpg


The ULN2003a module
2720_p_1320673805227.jpg


Does anyone here can let me know what is wrong? Thanks
 

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
Hello there,

Can you describe how the PIC is interfaced with the controller?

Which portb pins are connected to 1N1:4??
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
It is likely you are not sequencing the phases correctly. Swap the leads of one of the two coils and it should work.

Bob
 
Top