Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

WTA Stepper Motor control with ULN 2003

Status
Not open for further replies.

alpha91

Full Member level 3
Full Member level 3
Joined
Sep 23, 2011
Messages
168
Helped
1
Reputation
2
Reaction score
2
Trophy points
1,298
Activity points
2,625
Hi all,

Recently I am learning on how to control a stepper motor.
The circuit working condition is as below:

PIC 16F628a --> ULN 2003 --> 28BYJ-48 stepper

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);
}


but i can feel that my motor is vibrating when i am holding it, but the shaft just dont rotate.
May i know what is the problem?
 

You are sending two nibbles and the high nibble is zero. You need to send a sequence of bits 0011 0110 1100 1001 0011...

Are you sure that you are doing that?
 
Are you sure that the bit pattern is wired to the correct wires?
Frank


You are sending two nibbles and the high nibble is zero. You need to send a sequence of bits 0011 0110 1100 1001 0011...

Are you sure that you are doing that?

2720_p_1320673805227.jpg


I am using this module to connect to my PIC
RB0 --> 1N1
RB1 --> 1N2
RB2 --> 1N3
RB3 --> 1N4
 

I see that the bit 0 is missing. You need to adjust for that.
 
I see that the bit 0 is missing. You need to adjust for that.

Hi, sorry, i dont get what you mean.
which bit 0 is missing?

I can feel the vibration of the motor,it is same as the duration that i set.
but just the shaft is not rotating. I am wondering what is happening.
 

If you see the PCB silkscreen, the MCU IO starts with IN1..IN7- that makes 7 bit input. Either the bit0 is missing or bit 8 is ignored. If bit 8 is ignored, it would not make any difference because bits 5-7 are not used by the controller. Normally bits are labelled from 0-7 (well, that is the most common; RB0...RB7) but you also must consider the endian-ness. The fact that the motor is vibrating clearly suggests that the sequence received is not correct. You also need to see the motor connections (try to reverse one of the A1-A2 OR B1-B2 connections).

Also reduce the delay- 500ms is very long and just try 50ms or so.

- - - Updated - - -

I guess that ABCD are LEDs that are showing the pulses. In that case, INCREASE the delay to 1-2 sec and see whether the correct sequence is being output. If the correct sequences are coming, then decrease the delay and check the motor connections. I guess the centre pin is the ground- check with a multimeter. Also see that the pulses are being referred to the 'correct' ground. One wire from the PIC must connect to the ground in the board...
 
Hi,

I think the motor connection is wrong (it doesn't meet yout digital pattern)

Now:
IN1 and IN3 are for the same coil.
And IN2 and IN4 for the other coil.

You could change motor connection or digital pattern to solve the problem.

Klaus
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top